## 2 Materials and Methods
### Simulation Process  
The computational implementation of the modeling described above was prepared using MATLAB and Simulink. This allowed us to combine textual and graphical programming in the same environment to perform a multitude of parallel simulations (Figure 2) [35]. Therefore, for a given meteorological season (spring, summer, autumn, or winter) in the Madrid region, batch production was simulated for all GMS generated during this period. In our case, as indicated previously, a GMS corresponds to a sequence of seven consecutive days formed by the \(PAR\) and \(T\) data. According to previous calculations [19], there were 1204 GMS for the spring season, 1204 GMS for the summer, 1190 GMS for the autumn and 1184 GMS for the winter. Therefore, the average daily concentration of microalgae was determined in each of them. The average daily \(PAR\) and \(T\) data of these GMSs were taken as input parameters for the microalgae production simulation. These are the external parameters involved in the growth of microalgae that characterize environmental conditions. The simulations were run in parallel with this 7-day package workflow, considering the other input data as initialization parameters of the process.  
Figure 2 shows the block diagram model of microalgae growth (single microalgae cells, initial process) in a wastewater container without the addition of another product: where X, N and P represent the concentrations of microalgae, nitrogen and phosphorus, respectively. \(\mu\) and \(\mu_{D}\) are the specific growth and mortality rates, respectively. The nitrogen and phosphorus removal coefficients are given by \(Y_{N}\) and \(Y_{P}\). T and PAR are the temperature and photosynthetically active radiation.  
The initialization of the simulation process was based on the concentration of microalgae inoculum and nutrients initially present in the wastewater sample used for the cultivation experiment (Figure 1). To achieve this, it is necessary to know the characteristics of the aqueous medium, a wastewater sample, and microalgae species. The type of wastewater selected for this study came from a wastewater treatment plant in a municipality in the Madrid region and was therefore domestic. Its overall nitrogen and phosphorus compositions are given in Table 1. _Chorella vulgaris_ is the microalgae strain inoculated in the culture medium, and its concentration is also shown in Table 1. Other specific parameters are also given in Table 1. In addition, \(Y_{S,\mu}\), which are constants for all seasons, were obtained after adjusting the proposed model. The results of this model were compared with those obtained in the study presented by [PERSON] et al. [27]. The minimum temperature corresponds to the apparent threshold for any microalgae growth, which is approximately 8 \({}^{\circ}\)C [36]. The optimum and maximum temperatures were taken from [12]. The mortality rate was arbitrarily chosen to be low compared to the growth rate. The same value proposed by [27] was adopted, although it worked with a different type of microalgae. Finally, inhibition and half-saturation coefficients were estimated to be constant throughout the simulation.