A fast linear predictive adaptive model of packed bed coupled with UASB reactor treating onion waste to produce biofuel

Background Agro-industrial wastes are an energy source for different industries. However, its application has not reached small industries. Previous and current research activities performed on the acidogenic phase of two-phase anaerobic digestion processes deal particularly with process optimization of the acid-phase reactors operating with a wide variety of substrates, both soluble and complex in nature. Mathematical models for anaerobic digestion have been developed to understand and improve the efficient operation of the process. At present, lineal models with the advantages of requiring less data, predicting future behavior and updating when a new set of data becomes available have been developed. The aim of this research was to contribute to the reduction of organic solid waste, generate biogas and develop a simple but accurate mathematical model to predict the behavior of the UASB reactor. Results The system was maintained separate for 14 days during which hydrolytic and acetogenic bacteria broke down onion waste, produced and accumulated volatile fatty acids. On this day, two reactors were coupled and the system continued for 16 days more. The biogas and methane yields and volatile solid reduction were 0.6 ± 0.05 m3 (kg VSremoved)−1, 0.43 ± 0.06 m3 (kg VSremoved)−1 and 83.5 ± 9.8 %, respectively. The model application showed a good prediction of all process parameters defined; maximum error between experimental and predicted value was 1.84 % for alkalinity profile. Conclusions A linear predictive adaptive model for anaerobic digestion of onion waste in a two-stage process was determined under batch-fed condition. Organic load rate (OLR) was maintained constant for the entire operation, modifying effluent hydrolysis reactor feed to UASB reactor. This condition avoids intoxication of UASB reactor and also limits external buffer addition.

Alternative energy has become important for world energy stability, environmental protection and developing countries [18]. Agro-industrial solid wastes are still a potential energy resource if they can be properly and biologically converted to methane [18,19]. Actually, large quantities of agro-industrial wastes are destined for landfills, thereby reducing their usefulness [20,21].
Anaerobic digestion consists of three steps: hydrolysis, acidogenic and methanogenic [22]. In the two first phases complex organic components are hydrolyzed and fermented into intermediate volatile fatty acids (VFA). In the final phase those VFA are reduced to methane and carbon dioxide [23]. A major limitation of anaerobic digestion in a single-phase is a large production of VFA and decreased pH of the solution, causing inhibition of the methanogenic bacterial community [24]. The formation of organic acids, H 2 and methane production can be separated into separate bioreactors in series in which the first produces organic acids, H 2 and CO 2 , while the second produces CH 4 and CO 2 [25].
The total retention time in the two-phase system is shorter than in the single phase. Furthermore, the gas conversion efficiency and methane concentration in the biogas are higher [26]. And finally, this process can be suitable for better process control. To increase the conversion of organic waste, both cellulose and hemicellulose need to be broken down to monosaccharides. This pretreatment is an important step for lignocellulosic biomass, including chemical, physical and biological processes [27][28][29].
Some authors have used rumen microorganisms for the degradation of onion waste, but the maximum loading rate was lower than for lignocellulosic substrates. Those authors suggested that high amounts of easily degradable sugars result in a relatively low acetate concentration which benefits butyric acid and high FA [30]. Other authors evaluated the performance of a mixed biofilm anaerobic digester (AMBR) for treating the mixture of onion juice and aerobic sludge under different mixing ratios and organic load rates. They found that under batch conditions the total biogas yield was 0.62 L gVS −1 with a concentration of methane over 60 % [16]. Likewise, they determined the digestibility of onion residuals using a two-phase anaerobic phased solid digester: one anaerobic mixed biofilm reactor for hydrolysis and a packed bed reactor for methanogenic phase. The study showed that the process is possible with the application of external chemicals for maintaining the alkalinity and pH. Biogas yield of the entire system was 0.69 L gVS −1 with a concentration of methane between 60 and 70 % [17].
On the other hand, there are advanced models which are based on complex knowledge in waste character and kinetics. These models require extensive analytical solving of sequential reactions and intermediate products where environmental factors are an effect; therefore, fast response producing models are needed for ideal control strategies. In fact, one of the most commonly used empirical models has been the anaerobic digestion model number 1 (ADM1) [31]. However, these approaches may involve many constant parameters with values that are specific and need to be sought from experiments or through assumptions. In addition, these constants are assumed to be the same forever; this may not be true in the presence of ever changing internal and external conditions [32]. The main difference of the proposed model and conventional statistical or empirical base model is that the coefficients are updated at every time step, providing adaptive ability in the presence of changing conditions over real time.
The objectives of this study were to determine a linear predictive adaptive model (LPAM) for anaerobic digestion in two stages of onion waste and analyses performance in terms of volatile fatty acids (VFA), alkalinity, ammonia and total nitrogen, biogas yield and methane concentration.

Characterization of onion waste
Onion waste was collected from wholesale distributors located in Mérida, Yucatán, México, and delivered to the renewable energy unit at Yucatan center for scientific research (CICY). The onion residues were analyzed for moisture content (MC), total solids (TS) and volatile solids (VS) using standard methods [33] before and after treatment. The sample was analyzed for carbon (C) and nitrogen (N) in the Fish Nutrition Lab of CINVESTAV-Mérida, Yucatán, and fibers (lignine, cellulose and hemicellulose), in the department of Wood, Cellulose and Paper in Guadalajara, Jalisco, according to the TAPPI standard test.

Chemical analyses
The biogas phase was monitored daily for CH 4 and volume; likewise, liquid phase was monitored daily for pH, VFA, and ammonia nitrogen and COD (Chemical Oxygen Demand). Biogas composition was measured using a gas chromatography Clarus 500-Perkin Elmer with the thermal conductivity detector (TCD), a Molesieve column (30 m long, 0.53 mm internal diameter and 0.25 μm film thicknesses), nitrogen as the carrier gas and temperatures of 75, 30 and 200 °C for the injector, oven and detector, respectively [34]. The pH was determined by a HQ-40d multi pH-meter. The VFA was determined by titration with H 2 SO 4 [35]. COD, total nitrogen (N T ), and ammonia nitrogen (N-NH 3 ) were determined via colorimetric methods (HACH Company DR-890).

Reactor characteristics
The hydrolysis reactor (HPR) was made with acrylic (diameter: 14.5 cm, height: 26.4 cm, total volume: 4.35 L, useful volume: 2.2 L); one screen was fitted at the bottom side of the reactor to collect the leachate. The reactor was filled with a mix of onion waste and PVC plastic rings (1 inch diameter and 1 cm wide) to increase the porosity of the packed bed and facilitate the percolation of the leachate. At the top side of the reactor a sample port for the biogas determination was placed and its volume was registered daily through a gasometer. An Iwaky EZBD1 peristaltic pump was used for maintaining the re-circulation. This reactor was maintained at laboratory temperature (25 °C ± 5).
The methanogenic reactor (UASB) was made with PVC (diameter: 10.2 cm, height: 68 cm, total volume: 5.5 L, useful volume: 5 L) and was inoculated with a mixture of non-anaerobic anaerobic seeds: 300 gL −1 cattle manure, 150 gL −1 of pig manure, 1.5 gL −1 of sodium carbonate and 1 L tap water, according to Blanco-Cocom [36], and was maintained at 35 °C by a regular water bath (Lauda Alpha RA 8). Biogas produced passed to a Ritter MGC-10 milligas counter for volume determination. A peristaltic pump (Iwaky EZBD1) was used for maintaining liquid up flow velocity of 1 ms −1 .

Hydrolysis reactor operation
The first hydrolysis reactor was a single-phase reactor (HPR1) and was run in batch mode. This reactor was filled with PVC rings, 460 g of onion waste, diced pieces about 1 cm 2 and 0.6 L of inoculum. The second hydrolysis reactor (HPR2) was filled with PVC rings, 460 g onion waste, diced pieces about 1 cm 2 , and 0.4 L solution of 1 M H 2 SO 4 which was recycled for 1 day. Then, the leach was neutralized by adding Na 2 CO 3 and 0.6 L inoculum. Both reactors were performed in duplicate.

Coupled system
OLR was the connection parameter between two reactors, according to Lehtomäki [40] and Yu [26]. The HPR2 was chosen to be coupled to the UASB because its performance obtained the shortest time. OLR was kept constant through measuring COD effluent daily of HPR2, which together with hydraulic retention time of UASB allowed for daily calculation of the volume fed to UASB.

Model development
A linear predictive adaptive model (LPAM) was used to model the relationship between two variables for fitting a linear equation to observed and predicted data the next set of state. It considers the experimental input values U in time t, the output variable y, the state variables X in time t + 1 and ε due to experimental and numerical errors. The relation between them is given by the following equations: The model was built for the coupled HPR2 + UASB reactors. Operating conditions for UASB were input variables from HPR2 (U), output methane volume (y) and effluent UASB condition state variable (X); determination of matrix coefficient A and vector b are explained in the next lines. The process flow diagram of the twophase anaerobic system with process variables are shown in Fig. 1.

Estimation of coefficients via multiple linear regression
Consider Eqs. (1) and (2) where X is the matrix defined by the x i,t states (3); U is the matrix defined by the u i,t input variables (4) where i is the variable (COD, pH, alkalinity, VFA, nitrogen); t is time; y is the methane volume output vector (5) and ε the error.
The output vector is defined as The i-th row ai for matrix A and vector b in (1) and (2) are obtained by solving the following equations where superscript T means vector transpose: In order to adjust the Linear Predictive Adaptive Model, each day the procedure is repeated when new data is available. Every day, the first column of X and U matrix is removed and the new data added to the last column to generated a new set of coefficients.

Characterization of onion waste
All analyses were made in triplicate. Carbon to nitrogen ratio is 15. According to Dioha [41] and Romano [16], this ratio is at the appropriate minimum for anaerobic bacteria because the increase in carbon content will increase carbon dioxide formation and high value of nitrogen will enhance the production of ammonia gas that could increase pH [41]. The onion waste had average moisture of 83.7 %. This result is lower than presented by Romano [17] (moisture content of 92.6 %) because in present study some pieces of peel of onion waste were used. However, moisture content was in accordance with Coventry [9], who found moisture content of 87 %. Therefore, lignin (16.1 % dry basis) and the sum of cellulose and hemicellulose (69.5 %) content in this study are higher than reported for Romano [17], 0.4 and 10 %, respectively.

Coupled system performance
The First HPR1 after 63 days did not show evidence of methanogenic phase. Therefore, in the second experiment (HPR2), pretreatment was necessary with H 2 SO 4 . It reached the methanogenic phase on day 14 and the effluent was fed to the UASB reactor at constant OLR; this was achieved by varying feed volume. Figure 2a shows the behavior of pH in the HPR2 + UASB reactors; hydrolysis pH falls quickly to an average value of 5.15 ± 0.29 at day 7. According to Kim [42], hydrolysis should be at pH 5.5 and Kapdan [43] mentioned a range between 5 and 6. At day 14, pH rose to 5.92 ± 0.9 where it reached the methanogenic phase. With the coupled system, it reached a pH near 7 within optimal limits for methane production due to consumption of VFA in the UASB. Furthermore, its effluent was recirculated. In the following days the pH of UASB reactor did not present significant change; it ranged from 7.1 ± 0.01 to 7.6 ± 0.04 which is ideal for anaerobic digestion process according to Mao [44]. Figure 2b shows VFA performance. The first days had an average value of 2.9 ± 0.9 gL −1 ; at day 14 the value was 11.2 ± 0.5 gL −1 . After coupled, a rapid fall occurred and at the end of the experiment VFA concentration was 0.3 ± 0.1 gL −1 which is equivalent to a VFA reduction of 97 %. This behavior is in accordance with Lehtomäki [40], a reduction over 90 % indicating that this behavior was due to consumption by the bacterial consortium of the VFA entering the reactor. Figure 2c shows alkalinity profile for HPR2 and UASB reactors. Hydrolysis reactor presented a decrease in the first 7 days with minimum value of 0.2 ± 0.2 gL −1 . Chugh [45] mentioned that at low pH un-ionized species of VFAs are formed and consume the bicarbonate alkalinity. After coupled system, HPR2 reached a value of 1.7 ± 0.2 gL −1 at day 14. For UASB reactor before coupled system, alkalinity was maintained almost constant. After that an increase was presented, Chugh [45], which indicated the correct buffer capacity of the reactor.
The response for COD is shown in Fig. 2d. Hydrolysis reactor at day 14 reached a maximum of 31.2 ± 0.5 gL −1 . At this point two reactors were coupled because a maximum COD and VFA were reached. The experiment ended when steady-state value was reached; this was the average of three consecutive measurements for COD when the deviations between the observed values were less than 5 %, according to Borja [46].  Figure 2e shows the profile for total and ammonia nitrogen; it shows total nitrogen peaking at 14 days at 14.7 ± 0.8 gL −1 . On the same day maximum ammonia nitrogen concentration of 4.1 ± 0.2 gL −1 was reached. After connection, a fall in nitrogen profile was presented to finalize the experiment at 0.17 ± 0.07 gL −1 and 0.08 ± 0.07 gL −1 for total and ammonia nitrogen, respectively. This is equivalent to a removal efficiency of 98 % for both species. These results are similar to those reported by El-Kamah [47] where removal efficiencies of 72 ± 6 % and 99 ± 1.3 % for total and ammonium nitrogen, respectively, are shown. Yenigün [48] indicated that an ammonia nitrogen concentration over 1.7 gL −1 can inhibit anaerobic digestion for complex substrates without inoculum acclimation; however, the addition of small volumes in UASB reactor allows acclimation to the high concentration of ammonia nitrogen.
Methane volume profile for UASB reactor is presented in Fig. 2f. Before coupled reactor, it gets an average volume of 0.8 Ld −1 ; after coupled, it gets a maximum of 2.2 ± 0.5 L and decreased because the carbon source was exhausted. After, digestion hydrolysis reactors were emptied and measured for remaining VS and TS. The TS and VS reductions were determined and results were 55.7 ± 8 % and 83.5 ± 9.8 %, respectively. Romano [17] reported a reduction of VS of 62 ± 17 %, as shown in Table 1. This behavior indicates a better performance of the system with chemical pretreatment and coupling when COD and VFA reached a maximum value in the hydrolysis reactor.
Average cumulative methane yield for UASB reactor after coupled system was 0.43 ± 0.06 m 3 (kg VS rem ) −1 and 76 % of the methane content. As is presented in Table 1, this result is slightly higher than reported by Romano [17], 0.3 m 3 (kg VS rem ) −1 . The methane yield reported in the present study is comparable with other authors such as Zuo [49] vegetable wastes 0.31 ± 0.2 (kg VS rem ) −1 ; Ganesh [50] vegetable and fruit waste 0.301 m 3 (kg VS rem ) −1 and Arumugam [51] 0.31 m 3 (kg VS rem ) −1 .
With regard to studies where pretreatment of the residue was performed, the yield of methane is greater than reported by Wang [52] where for anaerobic digestion in two phases with pretreatment with HCl yield was 0.192 m 3 (kg VS rem ) −1 . However, yield reported by Takashima [53] was 0.45 m 3 (kg VS rem ) −1 . They indicated that the behavior is attributed to the release of cellulose and hemicellulose due to acid pretreatment.
The degradation of 90 % VS was achieved in 30 days; for the HPR2 + UASB system it was higher than reported by Romano [17], which reported 14 days. The main reason for this difference is that Romano defined a maximum process time of 14 days. In other studies, time reported is in accordance with this study. Zuo [49] reported between 44 and 48 days for more than 90 % VS removal; Ganesh [50] 25 days for 97.5 % VS removal; Arumugam [51] 10 days for 67 % removal.

Linear predictive adaptive model (LPAM)
The model was developed once the two reactors were coupled at day 14 in accordance with COD and VFA criterions defined before. As the model needs a reference set of variables, data from day 14 to 19 were used to build X and U matrix. The prediction of methane generation and other parameters started on day 20 of the experiment. The experimental value and its prediction of daily methane generation and all state parameters are shown by the dotted mark and solid lines in Fig. 3.
A good correlation between the daily data and the results of the model prediction was observed as shown in Fig. 3. This not only reflects the strength of LPAM, which although simple is quite useful, but also establishes a biological process which remained constant OLR as a union factor between the reactors. As shown in Fig. 3a, pH has excellent fit; this is due to the low variability in UASB reactor. On the other hand, the model estimation on VFA and Alkalinity occasionally showed significant increase and decrease which is similar behavior for experimental and model data, Fig. 3c, d. As mentioned by Ahn [54], an addition of VFA reduces the alkalinity, but methanogens consume VFA and generate alkalinity. LPAM applied to COD; total and ammonia nitrogen profiles had a good correlation as shown in Fig. 3e-g, respectively. As Sendjaja [32] mentioned, even though profiles show good prediction of various parameters, a quantitative measure is necessary. For this reason the accuracy of prediction values was evaluated by comparing the area bound by curves from predicted and experimental values and X-axis. The error value is defined as the ratio between the difference in total area and the area bound by curve from experimental value; results are summarized in Table 2. As shown in Table 2, maximum error was for alkalinity model with 1.84 %, followed by VFA (1.48 %), COD (0.74 %), ammonia nitrogen (0.69 %), methane volume (0.61 %), total nitrogen (0.27 %) and finally pH (0.26 %). These results are in agreement with the results presented by Sendjaja [32] where the error for UASB reactor for VFA was 7.09 %; COD was 2.33 %; pH was 0.59 % and methane volume was 7.26 %. Table 3 shows the summary of various studies using mathematical models applied to anaerobic digestion. A ANFIS model for prediction of anaerobic digestion effluent quality was applied to a UASB. The authors indicated that enlarging of the database and/or frequency of monitoring will serve to reduce the error level and improve the predicting capability of the model; however, it was used for the entire experiment (85 days) [31]. Cakmakci [55] used ANFIS models to predict effluent versus concentration and methane yield in the anaerobic digester of primary sedimentation sludge. Due to highly nonlinear structure of the ANFIS model, a complex system such as anaerobic digestion could be easily modeled was shown; however, a large quantity of data was necessary for training zone (135 days) and testing zone (35 days). For model ANFIS, one learning stage is required and another for verification model, whereby the number of required data is quite high. This is in agreement with Sendjaja [32] where it is mentioned that one of the weaknesses of the models based on historical data is the need to obtain a lot of data, as well as maintaining stability in the process.
Zhao [56] developed AMD1 model for anaerobic digestion of lignocellulose-rich aquatic plants. Experiments were carried out to identify the parameters and calibrate and validate this model. The values were calculated and estimated for 7 of the 15 stoichiometric parameters and 9 of the 17 kinetic parameters, respectively. The model validation required 20 days.
Mairet [57] proposed a modified version of AMD1 (based on Contois kinetics for hydrolysis steps) to represent microalgae anaerobic digestion. After 140 days of experimentation, a good representation of the data was obtained, including pH inhibition. Chen [58] implemented a mathematical model to simulate twophase anaerobic digestion process treating traditional Chinese medicine wastewater with AMD1. It was necessary to estimate stoichiometric coefficients, equilibrium coefficients, and kinetic parameters using an explicit Runge-Kutta pair of Bogacki and Shampine. However, it failed to simulate the CSTR performance after 120 days of experiment. For AMD1 models it is necessary to assume some constants which can vary according to the process conditions; others have to be calculated or estimated from experimental data. Similarly, a high number of data is needed in order to adjust some parameters not found in the literature. Sendjaja [32] indicates that these models require several parameters which must be assumed or determined from experimental data. Also, these constants are assumed to be the same throughout the experiment, which is not entirely true mainly due to the variation of internal or external conditions.

Conclusions
Anaerobic digestion of onion waste in two stages can be a good alternative for reducing the residues and generating methane. Pretreatment was necessary to accelerate the digestion, lead to faster production of biogas and obtain a major methane concentration. The system reached a yield of methane of 0.43 (kg VS rem ) −1 . VFA, COD, total and ammonia nitrogen reductions were 93.6, 98, 98.7 and 95 %, respectively.
It is necessary to keep OLR constant as coupling parameter between HPR2 and UASB, avoid poisoning the UASB reactor, allow acclimation of UASB reactor to HPR2 effluent, and not require the addition of external buffer for UASB reactor.
A predictive adaptive linear model for anaerobic digestion was developed for the coupled HPR2 + UASB reactors. The model was able to predict the performance of the anaerobic process, including methane volume, COD, pH, VFA, alkalinity, total and ammonia nitrogen. The behavior predicted by the model can be a tool to establish control procedures in order to ensure suitability for the production of methane conditions.
One of the strengths of the proposed LAPM is the application to a system without the need for a very broad range of experimental data besides daily adaptation to internal and external conditions that the reactor is experiencing. The use of constants found in the literature is not required so that the error that is committed is minimized; further experiments to adjust, for example AMD1 model, parameters are reduced.

Authors' contributions
HMS: performed the experiments presented herein, drafted the manuscript and developed the mathematical model. LBC supervised the mathematical model. LAG conceived the study, financed the project, supervised the work and the manuscript. All authors participated in the experimental design and evaluation of the data. All authors read and approved the final manuscript.