# An Algorithm for Nutrient Mixing Optimization in Aquaponics
## 3 Results
### Simulation Studies  
To verify that the implemented program for the optimization of nutrient mixing is working as intended, three simulation scenarios were investigated.  
In the first study, the weights \(\omega_{\text{bal,V}}\) and \(\omega_{\text{bal,N}}\) are set equal to zero such that only the error between \(N_{\text{MW},q,\text{post}}(u)\) and \(N_{\text{MW},q,\text{ref}}\) is minimized in the objective function. The purpose of this scenario is to show how close the concentrations of the post-mixing solution can be to the reference values, when the costs of resources are neglected.  
In the second study, the complete objective function is taken into account by setting \(\omega_{\text{bal,V}}\) and \(\omega_{\text{bal,N}}\) to the values given in Equation (9). The aim of this scenario is to show if the use of external nutrient and water sources, e.g., fertilizers and TW, can be significantly reduced by increasing their respective weights \(\omega_{\text{water},i}\) and \(\omega_{\text{fert},i}\) in the objective function, while the mixed nutrient solution is still sufficiently close to the reference.  
In practical applications, it is often more important that all nutrients \(q_{\text{mut}}\) are available at a minimum level, while overshooting below an upper bound causes little problems. To showcase how constraints can be utilized to ensure minimum concentration levels, a third simulation with such constraints is investigated. For that, the bound for \(c_{q_{\text{mut}},\text{min}}\) (see Equation (19)) of the post-mixing solution is set to  
\[c_{q_{\text{mut}},\text{min}}=0.95\cdot c_{q_{\text{mut}},\text{ref}}. \tag{25}\]  
In real-world systems, varying weather conditions demand the properties of the nutrient solution to (dynamically) adapt to these disturbances. In a hot and dry climate, the plants of a hydroponic system take up more water than those in a cold and humid environment, while the nutrient uptake remains nearly unaffected. Therefore, the nutrient concentrations that are achieved in a solution should be significantly lower at the former scenario. To account for this demand, the user of the presented program can set the reference concentrations accordingly in the respective xml file. To investigate this scenario, a fourth simulation study is taken into account, where new reference concentrations are set to  
\[c_{q_{\text{mut}},\text{ref},\text{new}}=0.5\cdot c_{q_{\text{mut}},\text{ ref}}. \tag{26}\]  
The intention of this last study is to prove that the proposed algorithm is able to operate in different environmental conditions.  
An overview of the nutrient composition of water sources and fertilizers is given in Tables 1 and 2, as well as starting and target concentrations [18]. Constraints for nutrient concentrations can be found in [19]. Starting and reference values of nutrient masses can be calculated by multiplying their concentrations with the pre- and post-mixing water volume in the mixing tank. In the example, it is assumed that in the beginning, the mixing tank is filled by 1%, i.e., \(V_{\text{MW,pre}}\) is 10 L to avoid numerical issues.  
Values for plant drain represent a mean of multiple measurements that were taken weekly between May and June 2024. Plant drain samples were analyzed via inductively coupled plasma-optical emission spectrometry (ICP-OES) regarding Ca2\({}^{+}\), Fe2\({}^{+}\), K\({}^{+}\), Mg2\({}^{+}\), Na\({}^{+}\), PO4\(-\)P, and SO4\(-\)S concentrations and via continuous flow analysis (CFA) regarding the NO3\(-\)N and NH4\(-\)N concentrations.  
Note that reference concentrations are not given for chloride and sodium since we do not consider them to be beneficial nutrients, and therefore, the goal of the optimization is to keep the concentration of these two beneath the maximum concentrations of 276 mg L\({}^{-1}\) and 425 mg L\({}^{-1}\) for Na\({}^{+}\) and Cl\({}^{-}\), respectively.