# An Algorithm for Nutrient Mixing Optimization in Aquaponics
## 3 Results
### Simulation Studies
#### 3.1.1 Focus on Minimizing the Error to the Reference  
In the first simulation study, the objective function of the static optimization problem is reduced to the term \(\omega_{\text{bal,ref}}\cdot\epsilon_{\text{NaW,ref}}(u)+\omega_{\text{bal,min }}\cdot\epsilon_{\text{NaW,min}}(u)\), i.e., costs are neglected and only reaching the target concentration is considered. The concentrations of the post-mixing nutrient solution can be seen in Figure 3. Furthermore, the resources used are shown in Table 3.  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Nutrient** & **PW** & **FW [(20)]** & **RW [(21)]** & **TW [(22)]** & \(\epsilon_{\text{MW},\text{pre}}\) & \(\epsilon_{\text{MW},\text{ref}}\) \\ \hline NO3\(-\)N & 37 & 21 & 0.4 & 1.4 & 122.5 & 122.5 \\ NH4\(-\)N & 2 & 4 & 0.6 & 0.02 & 40.3 & 40.3 \\ K\({}^{+}\) & 231 & 12 & 0.1 & 1.6 & 207.2 & 207.2 \\ Ca2\({}^{+}\) & 149 & 144 & 0.2 & 19.2 & 124.2 & 124.2 \\ Na\({}^{+}\) & 244 & 88 & 0.11 & 10.6 & 276 & - \\ Cl\({}^{-}\) & 300 & 127 & 0.15 & 17.4 & 425 & - \\ PO4\(-\)P & 198 & 2 & 0.3 & 0.002 & 42.6 & 42.6 \\ SO4\(-\)S & 236 & 33 & 0.3 & 9 & 85.9 & 85.9 \\ Mg2\({}^{+}\) & 92 & 17 & 0.05 & 3.5 & 43.8 & 43.8 \\ Fe2\({}^{+}\) & 2 & 0.06 & 0 & 0.012 & 0.8 & 0.8 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Nutrient concentrations of water sources and starting and reference values of concentrations in mixing tank in \(10^{-3}\)g L\({}^{-1}\).  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Nutrient** & **Ca(NO3)2** & **KNO3** & **K2 SO4** & **NH4 NO3** & **MgSO4** & **Fe-Chelat** & **KH3 PO4** \\ \hline NO3\(-\)N & 15.5 & 13.7 & 0 & 17.5 & 0 & 0 & 0 \\ NH4\(-\)N & 0 & 0 & 0 & 17.5 & 0 & 0 & 0 \\ K\({}^{+}\) & 0 & 38.4 & 45 & 0 & 0 & 0 & 28.2 \\ Ca2\({}^{+}\) & 19.9 & 0 & 0 & 0 & 0 & 0 & 0 \\ PO4\(-\)P & 0 & 0 & 0 & 0 & 0 & 0 & 22.7 \\ SO4\(-\)S & 0 & 0 & 18 & 0 & 12.5 & 0 & 0 \\ Mg2\({}^{+}\) & 0 & 0 & 0 & 0 & 9.6 & 0 & 0 \\ Fe2\({}^{+}\) & 0 & 0 & 0 & 0 & 0 & 6 & 0 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Nutrient composition of fertilizers in%.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Water Source** & \
\begin{tabular}{c} **Used Amounts for** \\ **Mixing in L** \\ \end{tabular} & **Fertilizer** &
\begin{tabular}{c} **Used Amounts for** \\ **Mixing in g** \\ \end{tabular} \\ \hline FW & 424.812 & Ca(NO3)2 & 117.09 \\  & & KNO3 & 256.594 \\   PW & 73.125 & K2 SO4 & 50.164 \\  & & NH4 NO3 & 180.962 \\  & 146.616 & MgSO4 & 210.046 \\  & Fe-Chelat & 7.651 \\  & 146.145 & KH3 PO4 & 72.654 \\ \hline Total & 790.698 & Total & 822.507 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Nutrient sources used for mixing when only the reference error is minimized.  
If the solver has a free and unconstrained choice of resources, it is able to set the concentrations of the post-mixing solution very accurately. Both the average and the maximum relative error are less than 0.1%.  
To achieve this accurate solution, the solver chose to use large amounts of FW. TW and RW were consumed at an intermediate level and the use of PW was the lowest compared to the other sources. Furthermore, a high amount of fertilizers was added to the solution.  
In the following simulation scenario, aspects of sustainability and recycling are incorporated in the optimization problem by reinstating the error terms \(e_{\text{water}}(u_{\text{V}})\) and \(e_{\text{fertil}}(u_{\text{N}})\) and therefore reducing the consumption of RW, TW and fertilizers and increasing the use of PW.