ABACO: A New Model of Microalgae ‐ Bacteria Consortia for Biological Treatment of Wastewaters

: Microalgae ‐ bacteria consortia have been proposed as alternatives to conventional biolog ‐ ical processes to treat different types of wastewaters, including animal slurry. In this work, a micro ‐ algae ‐ bacteria consortia (ABACO) model for wastewater treatment is proposed, it being calibrated and validated using pig slurry. The model includes the most relevant features of microalgae, such as light dependence, endogenous respiration, and growth and nutrient consumption as a function of nutrient availability (especially inorganic carbon), in addition to the already reported features of heterotrophic and nitrifying bacteria. The interrelation between the different populations is also in ‐ cluded in the model, in addition to the simultaneous release and consumption of the most relevant compounds, such as oxygen and carbon dioxide. The implementation of the model has been per ‐ formed in MATLAB software; the calibration of model parameters was carried out using genetic algorithms. The ABACO model allows one to simulate the dynamics of different components in the system, and the relative proportions of microalgae, heterotrophic bacteria, and nitrifying bacteria. The percentage of each microbial population obtained with the model was confirmed by respiro ‐ metric techniques. The proposed model is a powerful tool for the development of microalgae ‐ re ‐ lated wastewater treatment processes, both to maximize the production of microalgal biomass and to optimize the wastewater treatment capacity.


Introduction
One of the most critical environmental challenges of the 21st century envisaged by humanity is the expansion of the population, which will result in increased urban wastewater production [1] and large amounts of animal slurry caused by the rise in meat production [2,3]. The world's growing population, along with (i) a rapid industrialization, (ii) intensive agriculture, (iii) the effluent discharged below an environmentally safe level, and (iv) the lack of technologies to reclaim used water could lead to a scarcity of clean water in many countries [4]. The current conventional wastewater treatment methods have become quickly outdated because they need a lot of land, intensive energy input, and a lot of money [5]. As an alternative strategy to beat these disadvantages, microalgaebased wastewater treatment is gaining an increased importance in the context of European bioeconomy, because of its potential to treat wastewater, recover nutrients of wastewater, and produce a large variety of valuable compounds with applications in agriculture, aquaculture, and food production, among others [6][7][8]. The use of microalgae for wastewater treatment involves the emergence of complex microalgae-bacteria consortia which vary as functions of environmental and operational conditions [9].
Microalgae are photosynthetic microorganisms that grow using inorganic carbon (CO2) as a carbon source, and light as an energy source. During this growth, microalgae release oxygen which can use by heterotrophic bacteria to oxidate the organic matter present in influent wastewater. At the same time, heterotrophic bacteria supply CO2 for photosynthetic activity, completing the cycle. Besides, the oxygen produced by microalgae can be used by nitrifying bacteria to oxidize the ammonium to nitrate (nitrification process), consuming CO2 as a carbon source too [10][11][12]. Since microalgae-bacteria consortia in wastewater treatment was described in 1953 by [13], multiple microalgae-bacteria models have been described and validated [14][15][16][17]. These mathematical models offer great appeal to studying microalgae-bacteria interactions because they can provide useful tools for design and control purposes, in addition to model simulators, which can all lead to an increase the process efficiency [18].
In most of the proposed mathematical models, the part related to the activity of the bacteria is widely obtained and validated through the Activated sludge models (ASM) [19]. However, information on microalgae parameters in wastewater treatment systems is scarce. Therefore, in this work, a new microalgae-bacteria mathematical model named ABACO is proposed; the characteristic parameters of microalgae in it were obtained experimentally in previous works [20,21]. Thus, the main purpose of this study was to develop, calibrate, and validate the whole microalgae and bacteria model with experimental data from duplicate laboratory-scale photobioreactors using pig slurry as a nutrient source. The implementation of the microalgae-bacteria model has been performed in MATLAB software, and it allows one to simulate the dynamics of different components in the system and the relative proportions of microalgae and bacteria. Moreover, the model has a series of parameters whose exact values are unknown, being within a range. The calibration of these parameters has been carried out using genetic algorithms, which allow determining their values from minimizations of given cost functions. This calibration procedure provides a simple and fast adjustment method for the characterization of the model parameters, even allowing recalibration with different scenarios in a very easy way, such as for different strains and culture mediums. Moreover, notice that thanks to the proposed calibration process, it is possible to estimate the percentage of each species in the reactor, which is also a relevant contribution of the methodology proposed in this work.

Microorganisms and Culture Conditions
The microalgal strain used to inoculate the photobioreactors was Scenedesmus almeriensis. The stock culture of Scenedesmus almeriensis was maintained photo-autotrophically in spherical flasks (1 L capacity) using the Arnon medium [22]. The microalgal culture was continuously bubbled with CO2-enriched air (1%), which allowed us to control the pH at 8.0. The air temperature in the chamber was controlled in order to obtain a desire temperature (22 °C). The culture temperature was set at 25 °C, controlled by regulating the air temperature in the chamber. The culture was artificially illuminated in a 12:12 h L/D cycle using four Philips PL-32W/840/4p white-light lamps, providing an irradiance of 750 μE/m 2 s on the spherical 1.0 L flask surface. Two laboratory-scale photobioreactors were inoculated using the culture stock. The average composition of the Arnon medium used is reported in Table 1.

Laboratory Photobioreactors
Two hand-made photobioreactors made with polymethylmethacrylate (0.08 m in diameter, 0.2 m in height and with a 1 L capacity) were used to perform the experiments ( Figure 1). The reactors were inoculated with 20% of Scenedesmus almeriensis and diluted pig slurry (20%). The photobioreactors were operated in the laboratory but simulating outdoor conditions prevailing in outdoor raceway reactors. Firstly, the photobioreactors were operated in batch mode for 5 days to obtain a high biomass concentration. Afterwards, they were operated in continuous mode by removing 20% of the culture every day and replacing it with fresh piggery wastewater. The dissolved oxygen in the culture was controlled below 200 % Sat to avoid negative effects because of excessive dissolved oxygen accumulation. For that, air was supplied on demand. Additionally, the pH was controlled at 8.0 using CO2 injections. To simulate the outdoor solar cycle, the reactors were artificially illuminated using eight 28 W fluorescent tubes (Philips Daylight T5). The maximum irradiance (PAR) inside the reactors without cells was 1000 μEm −2 s −1 , measured using an SQS-100 spherical quantum sensor (Walz GmbH, Effeltrich, Germany). The culture temperature was kept at 25 °C by controlling the temperature of the culture chamber in which the photobioreactors were located. The average composition of the piggery wastewater used is reported in Table 1.

Biomass Concentration and Analytical Methods
The biomass concentration (Cb) was measured by dry weight. For that, aliquots (100 mL) of each photobioreactors the culture were filtered through the Macherey-Nagel MN 85/90 glass fiber filters. Then, the filters were dried in an oven at 80 °C for 24 h. Standard official methods were used to analyze the composition of the piggery wastewater and the supernatants from microalgae-bacteria cultures. The phosphate was measured by visible spectrophotometry through the phospho-vanado-molybdate complex (phosphate standard for IC: 38364). The nitrate was quantified by measuring optical density at 220 nm and 275 nm (nitrate Standard for IC: 74246). The ammonium was measured according to the Nessler method (ammonium standard for IC: 59755). The chemical oxygen demand (COD) was determined by spectrophotometric measurement using Hach-Lange kits (LCl-400).

Model Calibration and Validation
MATLAB Software was used to carry out the model calibration process using genetic algorithms through the Genetic Algorithm Optimization Toolbox (GAOT), based on [23]. Additionally, the model validation with experimental data was performed using MATLAB Software.

Respirometry: Measurements of the Photosynthesis and Respiration Rates
In order to validate experimentally the percentage of each microbial population proposed in the biological model, respirometric measurements were performed when at steady state. The percentages of microalgae and bacteria in the culture were estimated as functions of the microalgae net photosynthesis rate, the heterotrophic respiration rate, and the nitrifying respiration rate, respectively. These measurements were performed with handmade photo-respirometer equipment. This equipment is described in detail in [11]. The method allows one to determine the photosynthesis and respiration rates through the variations in dissolved oxygen concentrations in microalgae-bacteria cultures, as described in detail in [11].
For evaluating the microalgae net photosynthesis rate of each microalgae-bacteria culture, a sample of the culture was exposed to four light-dark cycles of four minutes each to measure and register the variation in dissolved oxygen. During the light phases, the photosynthetic microalgae generated dissolved oxygen, and this dissolved oxygen was consumed by the endogenous respiration during the dark periods. Thus, the microalgae net photosynthesis rate was calculated as the difference between the slope of the oxygen production during the light period and the slope of the oxygen consumption during the dark period. Subsequently, another sample of the culture was used to determine the heterotrophic respiration rate. For this purpose, 0.8 mL of sodium acetate (30 g/L) was added to the sample and it was exposed to four light-dark cycles of 4 min each. The respiration rate of the heterotrophic bacteria was calculated as the slope of the oxygen consumption with sodium acetate minus the slope of the oxygen consumption during the dark period in the endogenous culture. By following the same method, another sample was used to measure the nitrifying respiration rate of the culture. However, the nitrifying activity was determined using 0.8 mL of ammonium chloride (3 g/L) instead of sodium acetate. The respiration rate of the nitrifying bacteria was calculated as the slope of the oxygen consumption with ammonium chloride minus the slope of the oxygen consumption during the dark period in the endogenous culture [11].
Finally, in order to correct the influence of oxygen desorption on the photo-respirometric measurements, the oxygen mass transfer coefficient (KLa) was calculated. This coefficient was measured in the system according to Equation (1).
where is the oxygen accumulation expressed as the derivate of XO2 (mg/L) concentration over time, KLa is the global oxygen mass transfer coefficient (h −1 ), and X * is the oxygen saturation concentration in the liquid. Further detailed descriptions of the equipment, the standard protocol, and the metabolic rate calculations are in [11].

Results
This section, divided into four parts, presents the results obtained for the joint model of microalgae biomass production combined with pig slurry treatment. The first part provides a description of the mass balances of the model related to the process. The second part shows the mathematical background relative to the growth rate of the species involved. The third part shows the calibration process and the results. Finally, in the fourth part, the validation results obtained for the model are presented.

Model Concept
In microalgae-based wastewater treatment, different types of microbial consortia appear as a function of environmental and operational conditions. Figure 2 shows the biological process taking place in the reactor when using wastewater (i.e., diluted pig slurry) as the culture medium. Under illumination, microalgae (XALG) fix carbon dioxide (CO2) and release oxygen (O2) while assimilating nutrients, such as ammonium (NH4), nitrate (NO3), and phosphate (PO4). The O2 produced by the photosynthesis is essential for the degradation of the biodegradable soluble organic matter (BSOM) by heterotrophic bacteria (XHET), BSOM being a fraction of total organic matter (COD) contained in wastewater. In turn, during bacterial oxidation of soluble organic matter, CO2 is produced, it being available for photosynthesis and the nitrification process. During nitrification, nitrifying bacteria (XNIT) transform NH4 already contained at the inlet culture medium into NO3, while also consuming O2 produced through photosynthesis. The developed model includes the mass balances of major compounds involved into the biological process, in addition to the growth rate of the different species involved (microalgae and bacteria) as a function of culture conditions and nutrients availability. Starting from known initial conditions and variables already measured in the reactor it is possible to simulate the evolution of the system over time, thus the variation of both compounds and microorganisms. Figure 3 shows the most relevant inputs and outputs of the model, and the initial conditions required. The inputs for the model are the variables commonly measured in photobioreactors such as irradiance, dissolved oxygen, pH and temperature. The model outputs are the concentrations of major microorganisms already considered such as microalgae, heterotrophic bacteria and nitrifying bacteria; in addition to the concentration of major components and nutrients involved into the biological process such as oxygen, carbon dioxide, total inorganic carbon, ammonium, nitrate, phosphate, and BSOM. For the right estimation of the evolution of the system it is necessary to establish values for the initial conditions, which correspond to the initial concentrations of the nutrients and the total biomass, the initial percentages of species in the photobioreactor and the calibration parameters.

ABACO Model
The biological model has been applied to the treatment of diluted pig slurry as a relevant type of wastewater. The model has been developed considering the main microalgal and bacterial processes that simultaneously occur in the microalgae-based wastewater treatment. An initial dynamic model considering the influence of main environmental variables (irradiance, temperature, pH and dissolved oxygen) on microalgae and bacteria growth was developed by [20]. The model equations were inspired in the BIOALGAE model [17], and it was already validated, the model allowing one to simulate the effect of environmental conditions on the photosynthesis and respiration rate of microalgae-bacteria consortia. Distinctions were performed among activity of microalgae, heterotrophic and nitrifying bacteria [11]. The BIOALGAE model has been improved in this work by considering the influence of nutrients concentration (CO2, N-NH4 + , N-NO3 − , P-PO4 2− and BSOM) in the microalgae and bacteria growth and coefficient yields, resulting in the new ABACO model. The parameters of the model related with the microalgae activity were determined experimentally [21], while the bacterial parameters were obtained from the Activated Sludge Models (ASM) [19,24].

Microalgae Biomass
The microalgal cells are present in the photobioreactors, it not being feed to the system with the influent wastewater. Part of the microalgae biomass is removed every day with the effluent as a function of imposed dilution rate (inverse of hydraulic retention time). Microalgae biomass concentration increases due to autotrophic growth of microalgae, using light as energy source and of CO2 as carbon source, whereas it reduces by endogenous respiration and decay of microalgae. These last phenomena represent the autoxidation of microalgae, where they metabolize their own cellular material. The global balance to estimate the microalgae biomass concentration is given by Equation (2). 3 ] is the volume in the reactor, X [g m −3 ] is the microalgae biomass concentration, μ [day −1 ] is the microalgae specific growth rate and Q [m 3 s −1 ] represents the harvesting flow rate.
The specific growth rate μ is mainly a function of light availability inside the reactor, summarized by the average irradiance inside the culture I [25], and modified by the influence of different variables such as temperature μ T , pH μ pH , dissolved oxygen μ DO and CO2 μ CO . In addition the influence of nutrients availability such as ammonium nitrogen μ N NH , phosphate phosphorus μ P PO and nitrate nitrogen μ N NO , and the microalgae maintenance m , is considered as shown in Equation (3).
Microalgae can growth using both ammonium and nitrate as a nitrogen source. Then, there is a process rate for the growth of microalgae using ammonium and another one when using nitrate, thus Equation (3) becomes as Equations (4) and (5) for considering this phenomenon. Notice that Equation (5) considering the consumption of nitrate is only used when there is not ammonium in the system.
As observed from Equation (3), during the microalgae growth, it is assumed that two main process occur: the microalgal growth and the microalgal maintenance. The microalgae growth rate is modeled as the product of a maximum growth rate (μ , ) as expressed in Equation (6), algae biomass concentration (X ) as shown in Equation (7), and switching functions for environmental parameters (irradiance, temperature, pH and dissolved oxygen), carbon dioxide, nitrogen and phosphorous (Equation (9)-(15)). The rate of the microalgae maintenance (m ) considers the endogenous respiration of the microalgae and the microalgae decay (Equation (8)).
Taking the model described by Molina et al. in [25], the light limitation growth model can be expressed as follows: is the average irradiance inside de culture it summarizing the light availability inside the reactor, I [μE m −2 s −1 ] is the irradiance constant (equivalent to irradiance required to achieve half of the maximal growth rate) and n is a form parameter. The average irradiance is expressed as follows: where where m , and m , [day −1 ] represent the minimum and maximum respiration rates, I , [μE m −2 s −1 ] is the irradiance required to stop photosynthesis and start respiration process, and n is the form parameter for respiration.
The influence of temperature, pH, dissolved oxygen and nutrients concentration into the microalgae growth rate are included as normalized values, then it varying between 0 and 1. Therefore, when the culture conditions are optimal these terms are equal to 1 and the specific growth rate is only a function of light availability, achieving the maximal value at irradiances upper than saturation irradiance. However, if culture conditions are not optimal the respective normalized values are lower than 1, directly reducing the microalgae growth rate whatever the irradiance. The temperature index μ T , expressed by Bernard et al. in [26], represents the influence of temperature on microalgae growth. The temperature index can be expressed as follows: where where pH is the culture pH, whereas pH , pH and pH the respective maximal, minimal and optimal pH for the microalgae strain.
The dissolved oxygen term μ DO depends on a maximum value, determined by the strain, which represents the dissolved oxygen concentration that can be accumulated in the culture without being detrimental to microalgae growth. It can be expressed as the following equation: where DO [%] is the culture dissolved oxygen, DO , [%] is the maximum amount of dissolved oxygen for the microalgae strain, m is a form parameter.
The concentration of nutrients in the culture medium (wastewater) can be also a limiting factor for microalgae growth. The influence of carbon dioxide μ CO is described as follows: where ] is the microalgae inhibition constant for carbon, and n , is the microalgae form parameter for carbon. The influence of ammonium nitrogen μ N NH is represented by the following equation: where X [g m −3 ] is the ammonium nitrogen concentration, K , , [g m −3 ] is the microalgae half-saturation constant for ammonium, K , , [g m -3 ] is the microalgae inhibition constant for ammonium, and n , is the microalgae form parameter for ammonium. The influence of nitrate nitrogen μ N NO is represented by the following equation: where X [g m −3 ] is the nitrate nitrogen concentration, K , , [g m −3 ] is the microalgae half-saturation constant for nitrate, K , , [g m −3 ] is the microalgae inhibition constant for nitrate, and n , is the microalgae form parameter for nitrate. The influence of phosphate phosphorus μ P PO is represented by the following equation: where X [g m −3 ] is the phosphate phosphorus concentration and K , , [g m −3 ] is the microalgae half-saturation constant for phosphate.

Heterotrophic Bacteria
Heterotrophic bacteria are already present in the influent wastewater, then they are supplied to the system with the inlet wastewater also it being removed with the harvested flow rate as a function of imposed dilution rate. Heterotrophic bacteria grow using the organic matter as source of energy and carbon. These bacteria are aerobic then consuming O2 produced during the photosynthesis process. The endogenous respiration and the decay are responsible for the heterotrophic biomass lost. The global balance to estimate the heterotrophic bacteria concentration is given by Equation (16).
where Q [m 3 s −1 ] is the dilution flow rate, X , [g m −3 ] is the heterotrophic bacteria inlet concentration, μ [day −1 ] is the specific growth rate of heterotrophic bacteria and X , [g m −3 ] is the heterotrophic bacteria concentration in the reactor. As with microalgal processes, heterotrophic processes include both the heterotrophic growth and the heterotrophic maintenance. The heterotrophic specific growth rate μ is modeled as the product of maximum growth rate μ , ) and switching functions for environmental parameters such as temperature μ T , pH μ pH and dissolved oxygen μ DO ; in addition to biodegradable soluble organic matter μ BSOM , ammonium nitrogen μ N NH and phosphate phosphorous μ P PO (Equation (17)). The rate of the heterotrophic maintenance m considers the endogenous respiration of the heterotrophic bacteria and the heterotrophic decay. The specific growth rate for heterotrophic bacteria is expressed from the following equation: where μ , [day −1 ] is the maximum specific growth rate for heterotrophic bacteria, whereas m [day −1 ] represent the endogenous respiration of the heterotrophic bacteria and the heterotrophic decay.
The temperature and pH terms (μ T and μ pH ) are also based on the cardinal model, so they are identical to those previously expressed for microalgae. These terms depend on the maximum (T , and pH , ), minimum (T , and pH , ) and optimal (T , and pH , ) values of temperature and pH for heterotrophic bacteria, such as expressed in Equations (18) The influence of dissolved oxygen μ DO is expressed as follows: where K , , [g m -3 ] is the heterotrophic bacteria half-saturation constant for dissolved oxygen. The influence of ammonium nitrogen μ N NH is represented by the following equation: where K , , [g m −3 ] is the heterotrophic bacteria half-saturation constant for ammonium. The influence of phosphate phosphorus μ P PO is represented by the following equation: where K , , [g m −3 ] is the heterotrophic bacteria half-saturation constant for phosphate. The influence of biodegradable soluble organic matter μ BSOM is represented by the following equation: where X [g m −3 ] is the concentration of biodegradable soluble organic matter (BSOM) in the reactor and K , , [g m −3 ] is the heterotrophic bacteria half-saturation constant for BSOM.

Nitrifying Bacteria
Nitrifiying bacteria can be also supplied to the reactor with the wastewater supplied to the reactor, it being also removed during harvesting. Nitrifying bacteria perform the nitrification process, thus oxidizing ammonium to nitrate. These microorganisms are aerobic, then requiring oxygen, also using CO2 as a carbon source. The concentration of nitrifying bacteria increases due to growth but also decrease by endogenous respiration and decay. The global balance to estimate the concentration of nitrifying bacteria is given by Equation (24).
where X , [g m −3 ] is the nitrifying bacteria inlet concentration, μ [day −1 ] is the nitrifying bacteria specific growth rate and X , [g m −3 ] is the nitrifying bacteria concentration in the reactor.
The processes related with nitrifying bacteria include both autotrophic growth and maintenance. The rate of the autotrophic growth is modeled as the product of maximum growth rate μ , ) and switching functions for environmental parameters, such as temperature μ T , pH μ pH and dissolved oxygen μ DO ; in addition to ammonium nitrogen μ N NH and phosphate phosphorous μ P PO (Equation (25)). The rate of maintenance m considers the endogenous respiration of the nitrifying bacteria and nitrifying decay. The following equation represents the nitrifying bacteria specific growth rate: where μ , [day −1 ] is the maximum specific growth rate for nitrifying bacteria and m [day −1 ] is the endogenous respiration of the nitrifying bacteria and the nitrifying maintenance.
As for the heterotrophic bacteria, the temperature and pH terms ( μ T and μ pH ) are expressed the same form. These terms depend on the maximum (T , and pH , ), minimum (T , and pH , ) and optimal (T , and pH , ) values of temperature and pH for nitrifying bacteria, such as expressed in Equations (26) and (27) The influence of dissolved oxygen μ DO is represented by the following equation: where K , , [g m −3 ] is the nitrifying bacteria half-saturation constant for dissolved oxygen and K , , [g m −3 ] is the nitrifying bacteria inhibition constant for dissolved oxygen.
The influence of carbon dioxide μ CO is described as follows: where K , , [g m -3 ] is the nitrifying bacteria half-saturation constant for carbon. The influence of ammonium nitrogen μ N NH is represented by the following equation: where K , , [g m -3 ] is the nitrifying bacteria half-saturation constant for ammonium. The influence of phosphate phosphorus μ P PO is represented by the following equation: where K , , [g m −3 ] is the nitrifying bacteria half-saturation constant for phosphate.

Dissolved Oxygen
During the photosynthesis, microalgae release O2 and its consumed by aerobic bacteria respiration and microalgae respiration. The dissolved oxygen is measured and represents a model input.

Dissolved Carbon Dioxide
Carbon dioxide is generated during the aerobic respiration (bacteria and microalgae), and is consumed by nitrifying bacteria as carbon source and by microalgae for the photosynthetic process. The concentration of CO2 is determined by the total inorganic carbon concentration and the presence of bicarbonate buffer. Thus, it is assumed that CO2 is always in chemical equilibrium with bicarbonate (HCO3) and carbonate (CO3). The following equilibrium constant between carbon dioxide, carbonate and bicarbonate is defined: where X is the bicarbonate concentration, X is the carbon dioxide concentration, X is the carbonate concentration, and H is the concentration of hydrogen ions, which can be obtained from the pH by means of the following equation: Assuming a total inorganic carbon concentration of 0.1 [g L −1 ], the concentration of bicarbonate and carbon dioxide can be obtained from the following equations:

Chemical Oxygen Demand
Chemical oxygen demand (COD) of the inlet wastewater is mainly related with the organic matter already present on it. The COD includes the total organic matter, both the biodegradable and the no biodegradable organic matter. Additionally, it is produced during the microbial decay, and the biodegradable fraction is consumed by heterotrophic bacteria.

Biodegradable Organic Soluble Matter.
The biodegradable organic matter dissolved is the fraction of the organic matter which is available for biodegradation by heterotrophic bacteria XHET. It is introduced in the influent wastewater and is produced by microbial decay. XBSOM is removed by heterotrophic consumption and during the dilution process, such as expressed in the following equations:

Ammonium Nitrogen
Different forms of nitrogen can be found in wastewater. Ammonium nitrogen is introduced in the system though the influent wastewater, it being consumed by microalgae, heterotrophic bacteria, and nitrifying bacteria. Besides, ammonium nitrogen is generated by microbial decay. The ammonium nitrogen concentration is modelled by the following equation:

Nitrate Nitrogen
Nitrogen in form of nitrate enters in the system through the influent wastewater and it is produced during nitrification by nitrifying bacteria. It is consumed by microalgae cells when ammonium is not presented or have been consumed. The nitrate nitrogen concentration is modelled by the following equation:

Phosphate Phosphorous
Phosphorous is contained into the wastewater both as organic and inorganic. Organic phosphorous is transformed into inorganic during degradation of biodegradable organic matter then the phosphate phosphorous concentration corresponding to total phosphorous available. Phosphate phosphorous is introduced in the system with influent wastewater, it being produced during decay of all microbial populations. It is consumed during the growth of microalgae, heterotrophic bacteria and nitrifying bacteria. The phosphate phosphorus concentration is modelled by the following equation: Although growth rate models for the different microorganisms are well defined, the consumption and generation parameters of nutrients associated with each species present some uncertainty. The production of microalgae using wastewater as culture medium presents diverse variability in the model parameters. Depending on the type of wastewater and its components, the generation and consumption parameters associated with microalgae and bacteria may vary. This fact raises the need for a model that allows adapting its parameters for each situation. Therefore, a calibration method is presented using genetic algorithms that is capable of estimating the characteristic parameters of the model from experimental data measured in the reactor.

Experimental Datasets
Experimental data for model calibration and validation were collected from two laboratory-scale photobioreactors, which were fed with pig slurry diluted at 20%. The concentrations of biomass and the major nutrients (N-NH4 + , N-NO3 − , P-PO4 2− , COD) both at the inlet wastewater and inside the reactor were measured. The descriptions of the reactors and the probes used to collect the data (temperature, pH, DO, and light), along with the methods used to measure biomass and nutrients, are shown in Section 2.

Calibration Process
The already shown equations of the model include of a series of characteristic parameters whose exact values are unknown, or the values are known in a defined range. The uncertainty in the values of these parameters imposes the need for a calibration process, which has been carried out through genetic algorithms. Calibration using genetic algorithms results in a useful and reliable method for the estimation of uncertain parameters, since it allows optimizing a cost function that measures the deviation of the output of the model from that of the real system by modifying the parameter values between the established limits. The ranges of the estimated parameters have been obtained from the cited literature, and from experience in the design of the installation.
The calibration process using genetic algorithms was implemented in MATLAB using the Genetic Algorithm Optimization Toolbox (GAOT), based on [1], with an initial population of 50 phenotypes (solutions) and a termination condition of 50 generations. This method starts with an initial set of calibration parameters and runs the model to obtain the error. The cost function is computed as the sum of the individual root mean square error (RMSE) functions for the simulated organism and nutrients (total biomass, ammonium, nitrate, phosphate, and BSOM) and the real measured values, expressed as the following equation: where Cb g m is the estimated total biomass concentration (microalgae + heterotrophic bacteria + nitrifying bacteria); Cb g m is the experimental total biomass concentration measured. The rests of the parameters also describe the differences between the estimated concentrations and the experimentally measured ones for all elements. N represents the size of the data vector.
The calibration parameters are related to the maximum growth rates for the microorganisms, and the coefficients of generation and nutrient consumption. Table 2 lists the descriptions of all the calibration parameters, and the values obtained as a result of the calibration process.
In addition to the parameters described in the table, through this calibration process, it is possible to estimate the percentage of each species in the reactor. The experimental measurement of the concentration of the species of bacteria is something complex to carry out and highlights the need for a simple way of being able to estimate the percentage of each species within the reactor. Therefore, for both the calibration and validation data, the genetic algorithm method was used to determine the initial percentage of each species. In this way, the calibration process acts as a tool to estimate the percentages of microalgae and bacteria involved in the reactor from the measurements of total biomass and nutrients in it.
Data used during the calibration process correspond to the experimental measurements from during for 14 consecutive days. The imposed culture conditions were equivalent to that found in a raceway reactor, with light and dark cycles representing day and night. In addition, pH and dissolved oxygen were controlled by injecting CO2 and air. Figure 4 represents the experimental data measured, which correspond to measurements of irradiance, pH, dissolved oxygen, and temperature, in addition to measurements of total biomass dry weight (microalgae, heterotrophic bacteria, and nitrifying bacteria) and measurements of nutrients (ammonium, nitrate, phosphate, and BSOM).   Figure 5 represents the calibration results obtained in the estimation of the model variables. This figure is made up of six independent graphs that represent different variables estimated in the model. Figure 5a represents the percentage of each species of microorganisms within the reactor. Figure 5b represents the biomass concentration for each organism in the reactor (microalgae, heterotrophic bacteria, and nitrifying bacteria), in addition to the total biomass concentration, expressed as the sum of the individual concentrations, and the experimental measurements. Figure 5c represents the estimated phosphate concentration and the experimental data. Figure 5d shows the estimated ammonium concentration and the experimental values. Figure 5e represents the estimated nitrate concentration and the experimental measurements. Finally, Figure 5f represents the estimated biodegradable soluble organic matter concentration, compared with the experimental measurement. As a result of the calibration, initial percentages of 82.1% for microalgae, 13.2% for heterotrophic bacteria, and 4.7% for nitrifying bacteria have been established. Looking at Figure 5a,b, it is observed how the concentration of microalgae decreases until reaching a steady state. On the other hand, the concentration of heterotrophic bacteria grows slightly, consuming ammonium and organic matter, while the concentration of nitrifying bacteria remains constant. The sum of the concentration of each species represents the total biomass concentration (dashed line), which properly fit to the experimental data.
Although the experimental concentrations of nutrients (phosphate, ammonium, nitrate, and BSOM) are very scattered, a trend is observed for each. The estimated values for the elements presented in Figure 5c-f fit correctly within the experimental data. The total RMSE value obtained through the cost function during calibration was 25.93, which is an acceptable value, since, with the exception of ammonia, the range of variation of the variables analyzed is small. An error of 0.076 was obtained for total biomass concentration, an error of 0.9 for phosphate, an error of 20.76 for ammonium, an error of 1.27 for nitrate, and an error of 2.94 for BSOM.

Validation
The validation data used to verify the values of the characteristic parameters obtained during the calibration process were obtained in a separate vessel reactor, operated in parallel with the one used for calibration. These data collect the experimental measurements from 14 days, represented in Figure 6. For the validation process, calibration using genetic algorithms has been used to determine the initial percentages of microorganisms in the reactor. In this way, it is possible to estimate the starting points for the concentration of microalgae and bacteria. In this case, the initial percentages obtained were 85% for microalgae, 12.6% for heterotrophic bacteria, and 2.4% for nitrifying bacteria, very similar to the percentages obtained during the calibration test. After this initial point, the concentrations of all the elements in the reactor were estimated and compared with the points measured experimentally, represented in Figure 7.  The estimation of the phosphate concentration ( Figure 7c) shows an increasing trend, slightly away from the center of the measurement points. However, the estimation is within the range of the experimental values. The concentration of ammonium ( Figure 7d) maintains a good trend within the established range, as does the estimated nitrate concentration ( Figure 7e). Finally, the BSOM estimation ( Figure 7f) shows a trend similar to the calibration results, within the experimental points. In this case, the total RMSE error was 30.25, slightly higher for calibration.
Regarding errors, for the total biomass concentration, an error of 0.077 was obtained, a value almost identical to the result obtained in calibration. The error obtained for phosphate was 1.33, higher than the result obtained in the calibration. The error obtained for ammonia was 25.89, also higher than the result obtained in calibration. The error for nitrate was 1.7, slightly higher than the calibration result. Finally, the error obtained for the BSOM was 1.25, lower than the result obtained in calibration.
These results, at a preliminary level, show a good trend in the estimation of the elements of the model. Certain discrepancies in the results, as in the case of phosphate, may have been due to approximations and considerations in the input parameters of the model, such as the concentrations of the nutrients in the dilution medium, which change over time and have been considered constant.
More details about the parameters used in ABACO model can be found in Appendix A.

Discussion
The combination of microalgae biomass production processes and wastewater (diluted pig slurry) treatment is a cost-effective goal that poses several challenges. On the one hand, the already used wastewater contains high amounts of nutrients that allow microalgae and bacteria growth [27]. On the other hand, the lower energy demand for the microalgae-bacteria wastewater treatment, along with the ability of microalgae for CO2 fixation, significantly increases the environmental sustainability of this eco-friendly technology [28]. Apart from multiple biological models proposed for microalgae-bacteria wastewater treatment using different types of effluents, scarce information is available about the use of animal manure as a nutrient source [29]. In this work, an integral microalgae and bacteria model named ABACO was developed, calibrated, and validated with experimental data from duplicate laboratory-scale photobioreactors using pig slurry as a nutrient source. The implementation of the model allowed us to simulate the dynamics of different components in the system and the relative proportions of microalgae and bacteria. The values of several model parameters were calibrated using genetic algorithms. Additionally, the percentage of each microbial population present in the microalgae-bacteria culture was estimated.
The results obtained from the comparison between the estimated values with respect to the measured experimental data have been satisfactory. The concentrations of the elements were adjusted within the range formed by the measurement points, despite being scattered data. The percentages of microalgae and bacteria within the reactor over time showed values close to those obtained in the literature [17,29]. Additionally, these percentages were estimated by a respirometric method, in which the microalgae, heterotrophic bacteria, and nitrifying bacteria showed estimated values that were close to those determined by calibration and validation processes. When analyzing the errors obtained for both cases, it becomes clear that faithfully estimating the evolution in the concentration of the different elements in the reactor is a complex process. The experimental values are very scattered, and that hinders their continuous evolution estimation. Even so, the results obtained are within the ranges of variation of the measurements taken.
The complexity in measuring individual concentrations of each species highlights the need for a reliable estimation method. Due to the calibration using genetic algorithms, it is possible to estimate the percentage of each microorganism in the reactor. From experimental data, the model allows one to determine the initial percentage of each element and 0% 20% 40% 60% 80% 100%

Microalgae
Heterotrophic bacteria Nitrifying bacteria estimate its evolution over time. In this way, the model can act as a simulator to predict the behavior of organisms based on the concentrations of nutrients present in the reactor medium. This model and the calibration parameters obtained will serve as the basis for the development of simulation models where the production of microalgae biomass is combined with wastewater treatment.

Conclusions
The microalgae-bacteria model proposed has demonstrated itself to be a useful tool for understanding the microalgal-bacterial interaction in wastewater treatment. The calibration carried out by means of genetic algorithms opens the door to a simple method of adjusting the various parameters that make up the model, so that it can be recalibrated from experimental measurements of different medium and culture scenarios, since the concentrations of nutrients vary from one type of medium to another. Therefore, the model could be applied to different strains, both microalgae and bacteria, by recalibrating the parameters based on a set of experimental data. The next step is focusing on the validation of the biological model in large-scale photobioreactors in order to find the optimal conditions for wastewater treatment, nutrient recovery, and biomass production, thereby enabling the sustainability of the process.

Data Availability Statement:
The data presented in this study are available on request from the corresponding author. The data are not publicly available due to privacy.
Acknowledgments: This work has been partially funded by the following projects: DPI2017 84259-C2-1-R (financed by the Spanish Ministry of Science and Innovation and EU-ERDF funds), the European Union's Horizon 2020 Research and Innovation Program under Grant Agreement No. 727874 SABANA and the PURASOL project CTQ2017-84006-C3-3-R (financed by the Spanish Ministry of Economy and Competitiveness). As well as being supported by the Spanish Ministry of Education through the National FPU Program (grant number FPU16/05996).

Conflicts of Interest:
There are no potential financial interests or others that could be perceived as influencing the outcome of the research. No conflicts, informed consent, or human or animal rights issues are applicable. All the authors confirmed authorship of the manuscript and agreed to submit it for peer review.