## 5 Simulation Setup
### Performance Metrics  
Controller performance was evaluated using the following KPIs:  
Final Biomass (\(B_{f}\), g/m\({}^{2}\))  
Total shoot dry mass of lettuce at harvest (end of simulation):  
\[B_{f}=y_{1}(N_{s}) \tag{13}\] \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Model** & **Disturbance Handling** & **Solver Initialization** \\ \hline NMPC-C & Frozen current disturbance \(d(t)\) & Cold-start \\ NMPC-CW & Frozen current disturbance \(d(t)\) & Warm-start \\ NMPC-P & LSTM-based disturbance & Cold-start \\ NMPC-PW & prediction \(d(t+k|t)\) & Warm-start \\ NMPC-I & Ideal disturbance \(d(t+k)\) & Cold-start \\ NMPC-IW & Ideal disturbance \(d(t+k)\) & Warm-start \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Summary of the NMPC controller variants evaluated. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Variable** & \begin{tabular}{c} **MAE** \\ **(Train)** \\ \end{tabular} & \begin{tabular}{c} **RMSE** \\ **(Train)** \\ \end{tabular} & \begin{tabular}{c} **MAE** \\ **(Valid)** \\ \end{tabular} & \begin{tabular}{c} **RMSE** \\ **(Valid)** \\ \end{tabular} & \
\begin{tabular}{c} **MAE** \\ **(Test)** \\ \end{tabular} &
\begin{tabular}{c} **RMSE** \\ **(Test)** \\ \end{tabular} \\ \hline Solar Radiation (W/m\({}^{2}\)) & 13.75 & 28.50 & 17.77 & 35.57 & 16.10 & 34.41 \\ CO\({}_{2}\) (ppm) & 4.85 & 7.76 & 6.09 & 9.81 & 4.97 & 7.30 \\ Temperature (\({}^{\circ}\)C) & 0.58 & 0.93 & 0.62 & 1.01 & 0.70 & 1.17 \\ Humidity (\% RH) & 2.23 & 3.54 & 2.45 & 3.99 & 2.92 & 4.61 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Predictive performance of the LSTM model on train, validation, and test sets. where \(y_{1}(k)\) is the shoot dry mass (g/m\({}^{2}\)) at simulation step \(k\), and \(N_{s}\) is the total number of simulation steps. Net Profit (\(P_{net}\), HfI/m\({}^{2}\))  
Net profit is calculated as the revenue from harvested lettuce minus the total operating costs for CO\({}_{2}\) and heating:  
\[P_{net}=R_{bio}-(C_{\text{CO2}}+C_{heat}) \tag{14}\]  
where  
Revenue from biomass (\(R_{bio}\), HfI/m\({}^{2}\)):  
\[R_{bio}=c_{p}\cdot B_{f}\cdot 10^{-3} \tag{15}\]  
CO\({}_{2}\) cost (\(C_{\text{CO}_{2}}\), HfI/m\({}^{2}\)):  
\[C_{\text{CO}_{2}}=c_{\text{CO}_{2}}\sum_{k=0}^{N_{s}-1}u_{1}(k)\Delta t\cdot 1 0^{-6} \tag{16}\]  
Heating cost (\(C_{heat}\), HfI/m\({}^{2}\)):  
\[C_{heat}=c_{h}\sum_{k=0}^{N_{s}-1}u_{3}(k)\Delta t \tag{17}\]  
where \(c_{p}\) is the lettuce price (HfI/kg), \(c_{\text{CO}_{2}}\) the CO\({}_{2}\) cost (HfI/kg), and \(c_{h}\) the heating cost (HfI/J). The term \(B_{f}\cdot 10^{-3}\) converts biomass from g/m\({}^{2}\) to kg/m\({}^{2}\); \(\sum u_{1}(k)\Delta t\cdot 10^{-6}\) is total CO\({}_{2}\) supplied (kg/m\({}^{2}\)); and \(\sum u_{3}(k)\Delta t\) is total heating energy used (J/m\({}^{2}\)). All other variables are as defined in Section 2. Biomass Cost (\(C_{bio}\), HfI/kg)  
Operating cost per kilogram of harvested biomass:  
\[C_{bio}=\frac{C_{\text{CO}_{2}}+C_{heat}}{B_{f}\cdot 10^{-3}} \tag{18}\]  
Constraint Violation Index (\(V_{i}\), %)  
The average normalized violation of each output constraint \(y_{i}\), \(i\in[1,4]\), is calculated as:  
\[V_{i}=\frac{100}{N_{s}}\sum_{k=0}^{N_{s}-1}v_{i}(k) \tag{19}\]  
where the normalized violation at each time step \(v_{i}(k)\) is defined as:  
\[v_{i}(k)= \begin{cases}0,&\text{if }y_{i,\text{min}}(k)\leq y_{i}(k)\leq y_{i, \text{max}}(k)\\ \frac{y_{i}(k)-y_{i,\text{max}}(k)}{y_{i,\text{max}}(k)-y_{i,\text{min}}(k)},& \text{if }y_{i}(k)>y_{i,\text{max}}(k)\\ \frac{y_{i,\text{min}}(k)-y_{i}(k)}{y_{i,\text{max}}(k)-y_{i,\text{min}}(k)},& \text{if }y_{i}(k)<y_{i,\text{min}}(k)\end{cases}  \tag{20}\]  
where \(y_{i}(k)\) is the value of output \(i\) at time step \(k\), and \(y_{i,\text{max}}(k)\), \(y_{i,\text{min}}(k)\) are its time-varying upper and lower bounds, respectively. The primary indices reported are: \(V_{B}=V_{1}\), \(V_{C}=V_{2}\), \(V_{T}=V_{3}\), \(V_{H}=V_{4}\).