# An Algorithm for Nutrient Mixing Optimization in Aquaponics
## 1 Introduction  
In the field of recirculating hydroponics and aquaponics, analyses of hydroponic drainage water and fish waste water are essential to correctly mix plant nutrient solutions. Historically, colorimetric, spectrophotometric, and chromatographic laboratory methods are used and commercial producers still mostly rely on these robust and accurate measurements of weekly samples. Recently, the development of sensors or systems capable of measuring concentrations of individual ions in the nutrient solution on-site and inreal time (e.g., ion-selective electrodes (ISEs), ion-sensitive field-effect transistors (ISFETs), or capillary electrophoresis (CE)) has represented a significant advancement in nutrient solution monitoring. CE systems [1] have recently been implemented in Dutch greenhouses, allow for several measurements a day, and are reported to have a comparable accuracy to standard laboratory methods. ISE and ISFET systems [2] are more cost-effective and measure on-line, but are only available for certain macronutrients and can be less accurate and robust than traditional analytical methods. In the wake of these technological innovations, automated nutrient solution mixing strategies and systems have been developed for hydroponic plant production [3; 4; 5; 6; 7]. These aforementioned studies integrated ion-selective electrodes into control systems to maintain ideal nutrient concentrations and pH levels, which are crucial for maximizing plant growth and health [8]. In coupled aquaponic systems, these requirements have to be considered together with the requirements of the fish culture, and optimization is thus very limited. In this study, the focus is on a decoupled aquaponic system, i.e., the double recirculating aquaponic system (DRAPS) [9; 10]. The integration of Internet of Things (IoT) technology has further enhanced the efficiency of automated systems, allowing for remote monitoring and management of nutrient solutions. This capability is particularly beneficial for large-scale operations where constant manual monitoring would be impractical. IoT connectivity also facilitates data accumulation across multiple systems and locations, enabling predictive analytics to forecast nutrient deficiencies before they affect plant health. Recent research has focused on the algorithms needed to process the data and decision-making processes regarding the recycling of excess nutrients in drainage water [11; 12]. [PERSON] et al. [12] present an extensive work combining mass balance models with databases of nutrient solution recipes. [PERSON] et al. [11], on the other hand, developed a decision-tree model, which also accounts for nutrients that can not be analyzed. As the mentioned studies focus on hydroponic systems, they only consider the nutrient sources, plant drain water and fertilizer stock solutions. As a consequence, these algorithms have been restricted to iterative calculations without the possibility of weighting the options. In aquaponic systems, this aspect is more critical because fluctuations in fish drain water, plant drain water, rain water and tap water must be considered, and the option for different constraints and varying importance (i.e., weight) of optimization targets should be possible. For example, rapid fluctuations in plant drainage water can be caused by weather-induced changes in photosynthesis and transpiration rates or fluctuations in nitrogen concentration in fish waste water can be expected. To the authors' knowledge, no algorithm that takes these important aspects into account has been developed so far. Control engineering and optimization theory provide tools, methods, and solutions for such decision-making problems. In this work, the system, i.e., its inputs, outputs, states, and process constraints, are described mathematically using modeling methods. A goal for the mixing is then formulated and translated into a mathematical objective function, e.g., with a focus on the precision of target solution concentration or economic factors.