## 2 Materials and Methods
### Engines
Figure 2 shows a diagram of one of the six cylinders' lines of the engines. Each engine has two lines of this type accounting for 12 cylinders. The electrical power generated depends on the conditions of the inlet air, such as temperature, pressure, humidity and the backpressure of the exhaust gas circuit and biogas composition. The reference conditions for the engine parameters ISO 3046/1 are: 100 kPa ambient pressure, 25 \({}^{\circ}\)C ambient temperature and 30% relative humidity. The tolerances at 100% of degree of loading are: biogas consumption \(\pm\)5%, main, auxiliary and emergency cooling circuits and exhaust gases \(\pm\)15%, mechanical losses and radiation \(\pm\)25%, exhaust gas temperature \(\pm\)20 \({}^{\circ}\)C, and air and gas mass flow \(\pm\)10%. Table 2 shows the key parameters of the biogas engines analyzed. The biogas ramp for controlling the cylinder biogas supply has a pressure regulation between 112.8 and 116.3 kPa. The engines are equipped with an exhaust gas silencer with 30 dB sound attenuation and an exhaust gas distribution valve (three-ways). This valve sends the gas flow to the boiler heat recovery zone or directly to the atmosphere through the chimney. Table 3 shows the different values obtained for the operating parameters of the engines based on the loading degree. The engine rotation speed is constant for any degree of loading to maintain synchronism with the alternator speed. \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Value** \\ \hline V\({}_{\mathrm{t}}\), total volume displacement (cm\({}^{3}\)) & 35,900 \\ Unitary volume displacement (cm\({}^{3}\)) & 2993 \\ Number of cylinders (units) in V disposition & 12 \\ Number of cylinders lines (units) & 2 \\ Bore (cm) & 15.2 \\ S\({}_{\mathrm{t}}\), stroke (cm) & 16.5 \\ Stroke/bore ratio & 1.08 \\ Piston area (cm\({}^{2}\)) & 181 \\ Compression ratio (volumetric) & 11.6 \\ Combustion chamber volume (cm\({}^{3}\)) & 282 \\ Ignition advance angle (\({}^{\circ}\)) & 20 \\ Combustion chamber volume/displacement & 9.4 \\ per cylinder ratio (\%) & 7100 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Parameters of biogas engines in Burgos WWTP. Figure 2: Scheme of one of the six cylinders’ lines of the engine. The engine has two equivalent lines. The mechanical power is affected by the inlet air density, which varies with the altitude and ambient temperature. Equation (1) calculates the engine mechanical efficiency losses (_Losses\({}_{\eta\text{-a}}\)_) due to altitude. Equation (2) estimates losses (_Losses\({}_{\eta\text{-T}}\)_) due to the inlet air temperature [37] and finally, Equation (3) is used to calculate the air atmospheric pressure (p\({}_{\text{atm}}\)) as a function of altitude:  
\[\textit{Losses}_{\eta\text{-a}}=\
icefrac{{(z-500)}}{{150}} \tag{1}\]  
\[\textit{Losses}_{\eta\text{-T}}=\
icefrac{{(T_{\text{env}}-25)}}{{5}} \tag{2}\]  
\[\text{P}_{\text{atm}}=\text{P}_{\text{atm}-0}\times(1-a\times z)^{b} \tag{3}\]  
where \(z\) represents the altitude measured at sea level and expressed in m, T\({}_{\text{env}}\) is the temperature of the location, and P\({}_{\text{atm}-0}\) stands for the atmospheric pressure at sea level. \(a\) and \(b\) are constants (a = 2.2557 \(\times\) 10\({}^{-5}\) m\({}^{-1}\), b = 5.2559). The altitude of Burgos is 859 m above the sea level, but the engines of the WWTP are at 830 m above sea level, so the real atmospheric pressure considered in the present manuscript for evaluating engine performance was 91.7 kPa with an air density of 1.07 kg/m\({}^{3}\) at 25 \({}^{\circ}\)C.