## 5 Simulation Setup
### Disturbance Generation and Pre-Processing  
The NMPC controllers were evaluated using realistic environmental disturbances generated as follows:  
Outdoor air temperature, relative humidity, and global solar radiation data were retrieved from the NASA POWER (Prediction Of Worldwide Energy Resources) database [32] for the location of Thai Nguyen, Vietnam (21.5962\({}^{\circ}\) N, 105.8471\({}^{\circ}\) E). This database served as the source for two distinct datasets:  
Simulation Dataset: For the purpose of controller evaluation via simulation, data were collected for the period 1 November 2020 to 10 December 2020 (40 days). This period was selected as it represents typical conditions for an early winter cultivation cycle in this region.  
The original hourly data for this 40-day period were linearly interpolated to achieve a 15 min resolution, matching the NMPC control interval.  
LSTM Training and Validation Dataset: The LSTM model, responsible for generating weather previews (as described in Section 4.2), was trained and validated using historical data from the period 12 November 2016 to 31 October 2020 (i.e., all data prior to the simulation/test period). This extensive dataset was also processed to a 15 min resolution.  
Daily averaged atmospheric CO\({}_{2}\) concentrations were initially extracted from OCO-2 (Orbiting Carbon Observatory 2) Level 3 data products [33]. To introduce more realistic diurnal variations crucial for greenhouse control, a Gaussian-modulated model was applied to these daily averages:  
\[\text{CO}_{2}(t)=C_{base}+Ae^{-\frac{(T_{out}-T_{opt})^{2}}{2\alpha^{2}}}- \alpha R(t) \tag{12}\]  
where  
\(\text{CO}_{2}(t)\) is the synthesized outdoor CO\({}_{2}\) concentration (ppm) at time \(t\);  
\(C_{base}\): Base CO\({}_{2}\) concentration (daily averages) (ppm);  
\(A\): Scaling factor for temperature impact;  
\(T_{out}(t)\) is the outdoor temperature (\({}^{\circ}\)C);  
\(T_{opt}\): Optimal temperature for photosynthesis (\({}^{\circ}\)C);  
\(\sigma\): Standard deviation for temperature effect;  
\(\alpha\): Sensitivity factor for solar radiation impact;  
\(R(t)\): Incident solar radiation (W/m\({}^{2}\)).  
The parameters were set as: A = 100, Topt = 22 \({}^{\circ}\)C, \(\sigma\) = 5, \(\alpha\) = 0.04 ppm/(W/m\({}^{2}\)), chosen to reflect typical ambient variations and plant uptake influences, consistent with literature values for similar environments [29]. The resulting disturbance profiles used for the 40-day NMPC simulations are shown in Figure 2.  
Figure 2: Disturbance Profiles used in 40-day greenhouse NMPC simulations. Dashed gray lines indicate lower and upper operational limits for CO\({}_{2}\), temperature, and RH, enabling direct visual assessment of when and how much the external disturbances violate desired setpoints.  
LSTM-based Weather Preview (for NMPC-P/PW): The 5.75 h (23-step) weather preview for the four disturbance variables (\(d_{1},d_{2},d_{3},d_{4}\)) was generated using an LSTM model. The model architecture consisted of three LSTM layers with 128, 64, and 32 units, respectively. Dropout layers with a rate of 0.2 were included after the first two LSTM layers for regularization. These were followed by a separate dense output layer with a ReLU activation function for each predicted disturbance variable. The model used a lookback window of L = 20 steps (5 h) with 15 min interval data to predict the next W = 23 steps. The LSTM model was trained using an 80/10/10 train/validation/test split and optimized with the Adam algorithm, minimizing the mean squared error loss function. Training was conducted for up to 50 epochs, with a batch size of 32.  
Upon completion of training, the LSTM disturbance forecast model demonstrated robust predictive performance across all weather variables. Table 3 summarizes the MAE and RMSE metrics for the train, validation, and test sets. Low error values were achieved for temperature, humidity, and CO\({}_{2}\), whereas higher errors were observed for solar radiation due to its greater variability.