Introduction

Presently, there is a strong worldwide reliance on non-renewable resources such as fossil fuels. The current situation, in which these resources are becoming scarce, means that the necessary cessation of all production activities is becoming a significant risk. Increasing and stabilizing the supply of renewable energy, which will not be exhausted, are key in the achievement of sustainable-development goals. However, the production of renewable energy by wind and solar power, which currently represent the largest contribution to renewable energy worldwide, fluctuates according to environmental conditions. These resources are therefore termed variable renewable energy sources. Stable power sources such as thermal or nuclear power and energy carriers such as hydrogen must be produced by advanced technology to compensate for the output fluctuation of renewable energy, and enable its practical use. Biomass is a renewable resource that is robust to environmental changes. This has attracted a lot of interest because it represents a raw material from which an energy system can be developed that is completely independent of fossil fuels. Such a system, involving the combination of variable renewable energy and robust energy, can compensate for fluctuations in the output of variable renewable energy sources through the production of energy from biomass. The issue of biogas production should be managed so that the energy supply is stabilized.

Of the energy production technologies that utilize biomass, anaerobic digestion is an excellent method, which can simultaneously perform waste treatment and energy recovery [1, 2]. Furthermore; the digestate, which is a by-product of anaerobic digestion, can be used as a fertilizer [1, 2]. The numerical optimization of the anaerobic digestion process has been studied for various methods. Mendez-Acosta et al. regulated volatile fatty acid concentration and total alkalinity, inhibitors of anaerobic digestion, to improve process stability using a dynamic model [3]. Mauky et al. developed a feeding management strategy to compensate for the difference between energy supply and demand in the International Water Association (IWA) Anaerobic Digestion Model No. 1 (ADM1) [4, 5]. Therefore, there have been some attempts to exploit the advantages of anaerobic digestion for energy supply and demand adjustments, and the models enable accurate prediction of gas generation and offer flexibility and robustness in various operating conditions. However; in terms of feasibility, the construction of a model for control of biogas production is complex because the current biogas generation prediction model has many parameters which must be determined in the various different operating conditions (for example, the temperature of the digester and solid concentration of the sludge) [6]. It is cumbersome and undesirable to determine all of the parameters included in ADM1 for each operating condition experientially. A simplified model for the prediction of biogas generation may address some of these challenges. From the viewpoint of feasibility at the industrial scale of a biogas plant, Hend et al. developed a simple model of biogas generation and conducted a parametric study for optimization of the model constants [7].

It is not possible to compensate for fluctuations in the output of variable renewable energy because the process is currently used for treating daily waste (e.g., food waste), and the amount of raw material input is therefore limited. If the raw material input is changed rapidly, the fermentation state may shift excessively and inhibit fermentation [8]. An improved model for predicting biogas generation while presuming the fermentation state is needed. To this end, AMD1 is widely used, but the present study aimed to represent the state-space of the anaerobic digestion process due to the above-mentioned reasons. The state-space model can predict the unobserved fermentation state, including parameters such as bacterial and substrate concentrations, from the measured gas flow rate. Furthermore, it is preferable to be able to easily estimate the parameters contained in the model. The objective of this study was, therefore, to construct a state-space model that is suitable for controlling biogas production as well as a system that can automatically estimate the necessary parameters representing input and output characteristics of the anaerobic digestion process from actual operation data.

Materials and methods

Anaerobic digestion process flow

Figure 1 presents the flow diagram of the anaerobic digestion process used in this study. Food waste from the cafeteria and copy-paper waste from Hokkaido University were used as raw materials. Food waste was ground using a food processor and copy-paper waste was cut using a shredder. Food waste was bagged in small portions and stored frozen, and paper waste was stored at ambient temperature until use as feedstock. To make the feedstock, N-rich material—namely, food waste—was mixed with paper as an auxiliary material to adjust the C/N ratio to around 40 to reduce ammonia inhibition (which can be a result of anaerobic digestion of N-rich feedstock) [9, 10]. To this end, the ground food waste and shredded paper were mixed in a mass ratio of 2.5:1. The resulting feedstock was added to a horizontal cylindrical reactor (effective volume: 0.235 m3) which was heated to around 52 °C and regularly stirred to allow for degassing and ensure adequate mixing of the feedstock. Biogas was collected using a gas trap bag. A portion of the discharged digestate was collected at the time of feeding and the residual digestate (excluding the returned digestate) was taken as the surplus digestate.

Fig. 1
figure 1

Anaerobic digestion processing flow. Feedstock prepared in the pre-treatment unit from food and paper waste was added to the anaerobic digester in an anaerobic-digestion unit. Biogas was collected by gas trap bag in the energy unit and the digestate was disposed of via the disposal unit

The total and volatile solids contents of the feedstock were about 40% and 35%, respectively. The sludge in the reactor was maintained at thermophilic temperature (52 °C). The anaerobic digestion process flow that was used in this study was therefore classified as dry thermophilic processing, and was expected to minimize digestate emissions because additional water was not required [6].

State-space model of anaerobic digestion process

We made some assumptions about the anaerobic digestion process to simplify the construction of the model. The overall reaction from the input of organic compounds (substrate) to biogas generation is represented by the model. The reactor was a semi-batch type and its sludge flow was complete-mixing flow. The volume of sludge in the reactor remained constant at 0.200 m3. To describe the mathematical state of the process, the bacterial concentration “n(t)” and substrate concentration “s(t)” were considered as the state variables that represented the fermentation status of the reactor. The bacterial and substrate concentrations in the feedstock were considered the manipulated variables “un(t)” and “us(t)”, respectively, and biogas was a controlled variable “v(t)”. Using these factors, the reactor was simplified as shown in Fig. 2.

Fig. 2
figure 2

Graphical representation of the semi-batch-type reactor used for anaerobic digestion in the present study. un(t) bacterial input (kg/m3/h), us(t) substrate input (kg/m3/h), n(t) bacterial concentration (kg/m3), s(t) substrate concentration (kg/m3), v(t) biogas flow rate (m3/h)

The mathematical model of anaerobic digestion was based on the mass balance theory. The state equation comprises two differential equations; the first representing bacterial growth and the second representing substrate decomposition. In this study, we used the logistic difference equation to represent bacterial growth, as it is an effective equation in the field of population biology [7]. The substrate decomposition equation shows that degradation of the substrate occurs in line with bacterial growth. The output equation refers to biogas flow rate, which represents the generation of biogas as the substrate decomposes and the bacteria multiply [11]. The specific growth rate in these equations is given by the modified Monod equation [12]. The mathematical model of the anaerobic digestion process is given by concatenating two differential equations and one algebraic equation (Eq. 1):

$$ \begin{aligned} & \left\{ {\begin{array}{*{20}l} {\frac{{{\text{d}}n\left( t \right)}}{{{\text{d}}t}} = \left( {\mu \left( s \right) - b} \right)n\left( t \right)\left( {1 - \frac{n\left( t \right)}{{n_{{\max} } }}} \right) + u_{n} \left( t \right)} \hfill \\ {\frac{{{\text{d}}s\left( t \right)}}{{{\text{d}}t}} = - \frac{1}{Y}\mu \left( s \right)n\left( t \right) + u_{s} \left( t \right)} \hfill \\ {v\left( t \right) = \left( {k_{g1} b + k_{g2} \frac{1}{Y}\mu \left( s \right)} \right)mn\left( t \right)} \hfill \\ \end{array} } \right., \\ & \mu \left( s \right) = \mu_{{\max} } \frac{s\left( t \right)}{{k_{s} + s\left( t \right) + k_{i} s^{2} \left( t \right)}} \\ \end{aligned} $$
(1)

where \( n\left( t \right) \) is the bacterial concentration (kg/m3), \( \mu \left( {\text{s}} \right) \) is the specific growth rate (h−1), \( b \) is the autolysis rate (h−1), \( n_{max} \) is the maximum bacterial concentration (kg/m3), \( u_{n} \left( t \right) \) is the bacterial input (kg/m3/h), \( s\left( t \right) \) is the substrate concentration (kg/m3), \( Y \) is the bacterial cell yield, \( u_{s} \left( t \right) \) is the substrate input (kg/m3/h), \( v\left( t \right) \) is the biogas flow rate (m3/h), \( m \) is the sludge volume (m3), \( k_{g1} , k_{g2} \) is the biogas generation coefficients, \( \mu_{{\max} } \) is the maximum specific growth rate (h−1), \( k_{s} \) is the dissociation constant (kg/m3), and \( k_{i} \) is the inhibition coefficient.

The perturbation method near the equilibrium point was applied to this nonlinear model. By disregarding the second- and higher-order terms after Taylor expansion of a two-variable function, referring to the appendix for details (Eq. 811), the linear time invariant state-space model was obtained (Eq. 2):

$$ \begin{aligned} & \frac{{{\text{d}}{\varvec{X}}\left( t \right)}}{{{\text{d}}t}} = {\varvec{A}}_{\varvec{p}} \varvec{X}\left( t \right) + \varvec{B}_{\varvec{p}} \varvec{U}\left( t \right) \\ & y\left( t \right) = \varvec{C}_{\varvec{p}} \varvec{X}\left( t \right), \\ & {\text{where:}}\;\varvec{X}\left( t \right) = \left[ {\begin{array}{*{20}c} {n\left( t \right)} \\ {s\left( t \right)} \\ \end{array} } \right], \quad \varvec{U}\left( t \right) = \left[ {\begin{array}{*{20}c} {u_{n} \left( t \right)} \\ {u_{s} \left( t \right)} \\ \end{array} } \right],\varvec{ }\quad y\left( t \right) = v\left( t \right), \\ & \varvec{A}_{\varvec{p}} = \left. {\frac{{\partial \varvec{F}}}{{\partial \varvec{X}\left( t \right)}}} \right|_{{\left( {\varvec{X}_{{\varvec{eq}}} ,\varvec{U}_{{\varvec{eq}}} ,t} \right)}} = \left[ {\begin{array}{*{20}c} {a_{11} } & {a_{12} } \\ {a_{21} } & {a_{22} } \\ \end{array} } \right], \\ & \varvec{B}_{\varvec{p}} = \left. {\frac{{\partial \varvec{F}}}{{\partial \varvec{U}\left( t \right)}}} \right|_{{\left( {\varvec{X}_{{\varvec{eq}}} ,\varvec{U}_{{\varvec{eq}}} ,t} \right)}} = \left[ {\begin{array}{*{20}c} {b_{11} } & {b_{12} } \\ {b_{21} } & {b_{22} } \\ \end{array} } \right],\\& \varvec{C}_{\varvec{p}} = \left. {\frac{\partial g}{{\partial \varvec{X}\left( t \right)}}} \right|_{{\left( {\varvec{X}_{{\varvec{eq}}} ,t} \right)}} = \left[ {\begin{array}{*{20}c} {c_{11} } & {c_{12} } \\ \end{array} } \right], \\ & a_{11} ,a_{12} ,a_{21} ,a_{22} ,b_{11} ,b_{12} ,b_{21} ,b_{22} ,c_{11} ,c_{12} = {\text{Jacobian elements}}, \\ & \varvec{F}\left( {\varvec{X}\left( t \right),\varvec{U}\left( t \right),t} \right) = \left[ {\begin{array}{*{20}c} {f_{1} \left( {\varvec{X}\left( t \right),\varvec{U}\left( t \right),t} \right)} \\ {f_{2} \left( {\varvec{X}\left( t \right),\varvec{U}\left( t \right),t} \right)} \\ \end{array} } \right], \\ & f_{1} \left( {\varvec{X}\left( t \right),\varvec{U}\left( t \right),t} \right){\colon}\, \frac{{{\text{d}}n\left( t \right)}}{{{\text{d}}t}} = \left( {\mu \left( s \right) - b} \right)n\left( t \right)\left( {1 - \frac{n\left( t \right)}{{n_{max} }}} \right) + u_{n} \left( t \right), \\ & f_{2} \left( {\varvec{X}\left( t \right),\varvec{U}\left( t \right),t} \right){\colon}\, \frac{{{\text{d}}s\left( t \right)}}{{{\text{d}}t}} = - \frac{1}{Y}\mu \left( s \right)n\left( t \right) + u_{s} \left( t \right),\;{\text{and}} \\ & g\left( {\varvec{X}\left( t \right),t} \right){\colon}\, v\left( t \right) = \left( {k_{g1} \frac{1}{Y}\mu \left( s \right) + k_{g2} b} \right)mn\left( t \right). \\ \end{aligned} $$
(2)

Here, the matrices that are coefficients of the vector of the state variables “X(t)” and the vector of the manipulated variables “U(t)” are partial derivative matrices evaluated by the equilibrium point of the Jacobian matrix. They are parameters which provide information relating to the characteristics of the anaerobic digestion process according to operating conditions.

Parameter-estimation system

First, we performed a Z-transformation on the state-space model, referring to the appendix for details (Eqs. 1214), to obtain discrete input and output relational expressions (Eq. 3):

$$ \begin{aligned} & a_{f} \left( q \right)y\left( k \right) & = \user2{B}_{\user2{f}} \left( q \right)U\left( k \right), \\ & \quad {\text{where: }}\;a_{f} \left( q \right) = q^{{ - 2}} + \left( { - a_{{11}} - a_{{22}} } \right)q^{{ - 1}} + \left( {a_{{11}} a_{{22}} - a_{{12}} a_{{21}} } \right) = q^{{ - 2}} + a_{1} q^{{ - 1}} + a_{2} , \\ ~ & \quad {\text{and}}\;\user2{B}_{\user2{f}} \left( q \right) = \left[ {\begin{array}{*{20}c} {c_{{11}} \left( {q^{{ - 1}} - a_{{22}} } \right) + c_{{12}} a_{{21}} } & {c_{{11}} a_{{12}} + c_{{12}} \left( {q^{{ - 1}} - a_{{11}} } \right)} \\ \end{array} } \right] = \left[ {\begin{array}{*{20}c} {b_{1} q^{{ - 1}} + b_{2} } & {b_{3} q^{{ - 1}} + b_{4} } \\ \end{array} } \right]. \\ \end{aligned} $$
(3)

The parameters of the original model (Eq. 2) were converted to “a1,2” and “b1,2,3,4”. Once their values are estimated, biogas generation—“y(k)”—can be predicted by inputting the bacterial and substrate concentrations in the feedstock—“U(k)”—into Eq. 3. Next, we developed a control system using the adaptive identification theory to estimate these parameters from actual operation data of the process [13]. The control system shown in Fig. 3 was denoted as the adaptive identifier. Input and output data were multiplied by the filter to provide the control signals “ξ11,12,21,22,3,4” in the adaptive identifier. The control signals were multiplied by the operation parameters and integrated, and the linear relationship between the output and parameters with the proportionality constant as the control signal was derived using Eq. 4:

Fig. 3
figure 3

Adaptive identifier. U(k) feedstock input (kg/m3/h), un(t) bacteria input (kg/m3/h), us(t) substrate input (kg/m3/h), y(t) biogas flow rate (m3/h), ym(t) scaled biogas flow rate (L/h), ξ11,12,21,22,3,4 control signals, a1,2” and “b1,2,3,4 parameters, h(q−1) is the filter, mn scaling coefficient related to bacterial output, ms scaling coefficient related to substrate output, l control system design constant, \( {\hat{\text{y}}} \)m(t) predicted scaled biogas flow rate (m3/h), ε(k) error (m3/h), KAI coefficient for least squares method, \( {\hat{\mathbf{\varTheta }}} \) estimated parameters

$$ \begin{gathered} y\left( k \right) = h\left( q \right)\mathbf{\Theta }^{{\text{T}}} \mathbf{\Xi }\left( k \right), \hfill \\ {\text{where}}:\;\mathbf{\Theta } = \left[ {b_{1} \quad b_{3} \quad b_{2} \quad b_{4} \quad 2l - a_{1} \quad l^{2} - a_{2} } \right]^{{\text{T}}} ,\;{\text{and}} \hfill \\ \mathbf{\Xi }\left( k \right) = \left[ {\xi _{{11}} \left( k \right)\quad \xi _{{12}} \left( k \right)\quad \xi _{{21}} \left( k \right)\quad \xi _{{22}} \left( k \right)\quad \xi _{3} \left( k \right)\quad \xi _{4} \left( k \right)} \right]{\text{T}}. \hfill \\ \end{gathered} $$
(4)

The parameters converted in Eq. 3 were further integrated into “Θ” in Eq. 4. If the values of this matrix element are obtained as described above, biogas generation can be predicted using Eq. 3. The difference between the measured output value and the value that was calculated using the estimated value of the parameter was defined as the output error “ε(t)” using Eq. 5:

$$ \varepsilon \left( k \right) = y\left( k \right) - h\left( q \right)\hat{\varvec{\varTheta }}^{\text{T}}{\varvec{\varXi}}\left( k \right). $$
(5)

With the assumption that the estimated value of the parameter obtained with minimized error was a true value, the least squares method was applied to Eq. 5 with n data sets representing input and output. The least squares estimate of the parameter was obtained using the normal equation (Eq. 6):

$$ \begin{aligned} & \hat{\varvec{\varTheta }} = \left( {\varvec{\varXi}_{\varvec{n}}\varvec{\varXi}_{\varvec{n}}^{\text{T}} } \right)^{ - 1}\varvec{\varXi}_{\varvec{n}} \varvec{Y}_{\varvec{n}}^{\text{T}} , \\ & {\text{where:}}\,\;\varvec{\varXi}_{\varvec{n}} = \left[ {\begin{array}{*{20}c} {\begin{array}{*{20}c} {\varvec{\varXi}\left( 1 \right)} & {\varvec{\varXi}\left( 2 \right)} \\ \end{array} } & {\begin{array}{*{20}c} \cdots & {\varvec{\varXi}\left( n \right)} \\ \end{array} } \\ \end{array} } \right]^{\text{T}} ,\;{\text{and}} \\ & \varvec{Y}_{\varvec{n}} = \left[ {\begin{array}{*{20}c} {\begin{array}{*{20}c} {y\left( 1 \right)} & {y\left( 2 \right)} \\ \end{array} } & {\begin{array}{*{20}c} \cdots & {y\left( n \right)} \\ \end{array} } \\ \end{array} } \right]^{\text{T}} . \\ \end{aligned} $$
(6)

To quantitatively evaluate the prediction accuracy of the model with the estimated parameters, the goodness-of-fit index (GFI) was introduced (Eq. 7) [14]:

$$ {\text{GFI }}\left[ {\text{\% }} \right] = 100\left( {1 - \frac{{y\left( k \right) - \hat{y}\left( k \right)}}{{y\left( k \right) - {\text{mean}}\left( y \right)}}} \right). $$
(7)

The adaptive identifier includes a switch relating to substrate input because we consider anaerobic digestion process to be a 2-input and 1-output system. This enables the estimation of all parameters either with or without substrate input. The filter “h(q−1)”, scaling coefficient “mn and ms” and control system design constant “l” were tuned so as to obtain the desired estimation result.

Simulation data

Substrate concentration was defined as the mass reduction that occurred following heating at 105 °C for 24 h then 600 °C for 3 h in an oven. Biogas generation was measured hourly with a wet gas meter (W-NKDa-0.5B, SHINAGAWA) and recorded using a data logger (Data mini LR 5000, HIOKI).

The data used in the simulation were the actual operation data collected in our laboratory in 2017 (Fig. 4). Bacterial input at 0 h was taken as the amount of substrate contained in the digestate at the beginning of the process, and feedstock input was performed four times at 0, 24, 72, and 96 h. Data of 3 days from 04/07/2017 (72 h data) when no feedstock was loaded and 1 week from 04/17/2017 (168 h data) when feedstock was loaded were used for model construction to estimate parameters. Data obtained during two 1-week periods from 06/05/2017 (168 h data) and 06/12/2017 (168 h data) were used for model validation. The organic loading rates of the model-construction period and the model-validation periods were different; the former was 3.96 (kg-VS/m3-digester/day) and the latter were 2.17 and 3.25 (kg-VS/m3-digester/day).

Fig. 4
figure 4

Simulation data for (I) feedstock input and (II) gas generation rate

Results and discussion

The results of tuning the constants related to the control system are shown in Table 1. The control signals generated by the adaptive identifier are illustrated in Fig. 5. The bacterial and substrate inputs originally appear as several pulse signals because the anaerobic digestion processing flow used in this study was a semi-continuous system. As can be seen from Fig. 5, the pulse input is converted into a control signal that changes continuously according to the input. Figure 6 shows the results of parameter estimation using data from the days where feedstock was not added. Although the estimated value of the parameter fluctuated largely at first, it gradually stabilized as the data increased, converging after about 24 h. This indicates that at least 24 h of identification experiment is required to estimate parameters related to bacterial input.

Table 1 Tuned constants
Fig. 5
figure 5

Control signals related to (I) bacterial input and (II) substrate input. Definitions: ξi is the controls signal. Numbers in the figure legend refer the subscripts of the control signals “i

Fig. 6
figure 6

Estimated parameters related to bacterial input for (I) the output side in (Eq. 3) and (II) the input side in (Eq. 3). Numbers in the figure legend refer the subscripts of the parameter “i”. Definitions: ai parameter on the output side in Eq. 3, bi parameter on the output side in Eq. 3

The parameter estimation results from data of the days when feedstock was loaded; in other words, the result of executing adaptive identification by turning on the switch relating to substrate input are shown in Fig. 7. The estimated value of the parameter changed greatly at the beginning of the experiment, converging after 120 h. Therefore, at least 120 h of identification experiment are necessary for the estimation of parameters related to substrate input.

Fig. 7
figure 7

Estimated parameters relating to substrate input on (I) the output side in (Eq. 3) and (II) the input side in (Eq. 3). Numbers in the figure legend refer the subscripts of the parameter “i”. Definitions: ai parameter on the output side in Eq. 3, bi parameter on the output side in Eq. 3

Figure 8 shows the results of biogas generation prediction using a model constructed with the estimated parameters, which reveal the high accuracy of the model. Figure 9 represents the results of validation performed with different data sets to those used for model construction. This was carried out to confirm the prediction accuracy of the model. The initial bacterial concentration of the model-construction period from 04/07/2017 to 04/17/2017 and the model-validation periods from 06/05/2017 to 06/12/2017 were different; the former values were 41 and 38 (kg/m3) and the latter values were 33 and 34 (kg/m3). The predicted biogas generation for the validation data sets exhibited low GFI (38.1% and 9.84%) because degassing due to agitation and heating had a significant influence on the recorded value for each hour. Therefore, a graph of accumulated biogas generation was constructed (Fig. 10). The GFIs for the two datasets are 84.39% and 96.53%. Figure 11 shows the GFI of accumulated biogas generation per day, which is more than 80% even at the lowest value except for the values after the 4th day of the period from 06/05/2017, when biogas generation of the 3rd day could not be predicted. This indicates that the model and parameter-estimation system constructed in this study provide high prediction accuracy for periods of 1 day or more. By applying this model and parameter-estimation system, it is possible to predict the biogas generation of an anaerobic digestion process under various operating conditions. However, in an actual plant it is necessary to consider that operating conditions such as feedstock composition change continually. This issue could be overcome by introducing an oblivion factor that limits input data for the parameter-estimation system to, for example, only the last 72 h. Estimated parameters are thereby adaptively controlled in response to changes in operating conditions, enabling accurate prediction of biogas production.

Fig. 8
figure 8

Predicted gas generation for the data set that was used for model construction in relation to (I) bacterial input and (II) substrate input

Fig. 9
figure 9

Predicted gas generation for the data set that was used for model validation from the periods beginning (I) 06/05/2017 and (II) 06/12/2017

Fig. 10
figure 10

Accumulated gas generation of the data set that was used for model validation from the periods beginning: (I) 06/05/2017 and (II) 06/12/2017

Fig. 11
figure 11

Goodness-of-fit values per day of accumulated gas generation for the periods beginning: (I) 06/05/2017 and (II) 06/12/2017

Conclusions

In this study, which aimed to construct a biogas production management system that can be employed to stabilize renewable energy supplies, we established a model and parameter-estimation system which is applicable to anaerobic digestion processes with various operating conditions. The adaptive identifier control system can automatically estimate parameters from input and output data. Use of this adaptive identifier revealed that at least 24 and 120 h of identification experiments were required to converge the parameters with respect to bacterial and substrate inputs, respectively. The model and estimated parameters exhibit high prediction accuracy, and future developments should focus on constructing biogas production management systems that incorporate model predictive control of biogas generation. Such systems will enable the stabilization of renewable energy supplies.