## 4 NMPC Formulation
### Control Objectives and Constraints
The cost function \(J\) to be minimized is given by:  
\[J=\sum_{k=0}^{N_{p}-1}\left[-q_{y1}\cdot(y_{1}(t+k+1|t)-y_{1}(t+k|t))+\sum_{i=1 }^{3}q_{u_{i}}\cdot u_{i}(t+k|t)+\sum_{i=1}^{4}\rho_{i}\cdot\varepsilon_{i}^{2 }(t+k+1|t)\right] \tag{6}\]  
where  
\[\begin{split} y_{1}(t+k|t)\text{ is the predicted shoot dry biomass at stage }t+k\,(k=0,\ldots,N_{p}-1).\\ q_{y1}>0\text{ is the economic weight associated with incremental biomass production}.\\ q_{u_{i}}>0\text{ are economic weights reflecting the costs of CO}_{2}\text{ injection }(u_{1})\text{ and heating }(u_{3})\text{; ventilation }(u_{2})\text{ is omitted from penalization, as the employed model assumes natural ventilation with the ventilation rate determined by the window opening actuated by a motor; consequently, the energy cost associated with ventilation control is considered negligible [7; 8; 9]. \(\rho_{i}>0\) are penalty weights on the squared slack variables \(\varepsilon_{i}\) to regulate the extent and frequency of output constraint violations. Penalty weight selection: In this study, the slack penalty weights for output constraints were not set to a single large value for all outputs, as is common in some related works. Instead, we assigned penalty weights inversely proportional to the amplitude of each output's constraint bounds. This normalization ensures balanced treatment of constraint violations, regardless of output units or scales. For instance, outputs with large feasible ranges (e.g., biomass) are assigned smaller penalty weights, while those with narrow ranges (e.g., temperature, humidity) are assigned higher penalties. This strategy allows the optimizer to penalize relative violations consistently, improving interpretability and controlling fairness across heterogeneous outputs. Notably, the biomass constraint was always satisfied in all simulations, consistent with biological principles and the model structure; hence, its penalty was set arbitrarily high, with no effect on control outcomes. As a result, the penalties were set as follows: \(\rho_{1}=10^{5}\), \(\rho_{2}=10^{3}\), \(\rho_{3}=10^{5}\), \(\rho_{4}=10^{4}\). Output Constraints: Time-varying constraints on temperature, humidity, and CO\({}_{2}\)--adapted dynamically based on solar radiation--reflect horticultural best practices for energy-efficient regulation. The bounds for the full output vector are given by:  
\[ \begin{split} y_{\text{min}}(t+k)&=\left[0,\,f_{ \text{co2,min}}(t+k),\,f_{\text{temp,min}}(t+k),\,50\right]^{T}\\ y_{\text{max}}(t+k)&=\left[\infty,\,f_{\text{co2, max}}(t+k),\,f_{\text{temp,max}}(t+k),\,80\right]^{T}\end{split}  \tag{7}\]Temperature bounds are time-varying functions of solar radiation \(d_{1}(t+k|t)\):  
\[ \begin{split} f_{temp,min}\left(t+k\right)&=\begin{cases}1 0&\text{if }d_{1}(t+k|t)<10\text{ W}/\text{m}^{2}\\ 22&\text{otherwise}\\ 15&\text{if }d_{1}(t+k|t)<10\text{ W}/\text{m}^{2}\\ 27&\text{otherwise}\end{cases}\\ \text{CO}_{2}\text{ bounds are time-varying functions of solar radiation }d_{1}(t+k|t)\text{: }\\ f_{\text{co2,}min}\left(t+k\right)&=\begin{cases}0&\text{if }d_{1}(t+k|t)<10\text{ W}/\text{m}^{2}\\ 500&\text{otherwise}\end{cases}\\ f_{\text{co2,}max}\left(t+k\right)&=1600\end{split}  \tag{9}\]  
This radiation-dependent setpoint strategy aims to optimize crop growth conditions while promoting energy conservation, based on established horticultural principles. During periods of low incident solar radiation (\(d_{1}(t+k|t)<10\text{ W}/\text{m}^{2}\)), typically corresponding to night-time or heavily overcast conditions where photosynthetic activity is minimal, a cooler temperature range (10-15 \({}^{\circ}\)C for lettuce, as per Equation (8)) is maintained to reduce heating costs [29; 30; 31]. Conversely, under higher solar radiation levels, the permissible temperature range is elevated (22-27 \({}^{\circ}\)C, as per Equation (8)) to better support active photosynthesis, aligning with reported optimal daytime temperatures [29; 30; 31].