## 2 Materials and Methods
### Engine Parameters and Efficiency  
Equation (4) is used to calculate the average linear piston speed (\(C_{\rm eng}\)), Equation (5) for the effective biogas consumption (\(g_{\rm eff}\)), and Equation (6) for the volumetric efficiency of the engine (\(\eta_{\rm V}\)):  
\[C_{\rm eng}=2\times S_{t}\times\frac{n}{60} \tag{4}\]  
\[g_{\rm eff}=\frac{3.6\times\rho_{\rm biogas}}{\eta_{\rm mec-eng}\times LHV} \tag{5}\]  
\[\eta_{\rm V}=\frac{M_{\rm mix}}{V_{t}\times\left(\frac{2\times n}{60\times n_ {\rm stroke}}\right)\times\rho_{\rm ref-mix}} \tag{6}\]  
where \(S_{t}\) is the stroke length (m), \(n\) represents the rotation speed in revolutions per minute (rpm) at which the engine is running. The density of biogas (\(\rho_{\rm biogas}\)) was assumed as 1.15 kg/m\({}^{3}\) at standard temperature and pressure conditions. The mechanical efficiency of the engine (\(\eta_{\rm mec-eng}\)) is a parameter considered as a function of the degree of loading. The mass of air-fuel mixture (\(M_{\rm mix}\)) is used for estimating \(\eta_{\rm V}\), using as density (\(\rho_{\rm ref-mix}\)) a variable value calculated based on the impulsion pressure, and outlet temperature of the mixture exiting the turbocharger. \(V_{\rm t}\) corresponds to the cylinder displacement volume and \(n_{\rm stroke}\) is the number of strokes per cycle. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Cooling Circuit** & **Temperature (\({}^{\circ}\)C)** & **Volumetric Flow (m\({}^{3}\)/h)** & \multicolumn{2}{c}{
\begin{tabular}{c} **Nominal Thermal Power of the Heat** \\ **Plate Exchangers (kW)** \\ \end{tabular} } \\ \hline \multirow{4}{*}{Main} & Primary & Primary & Secondary & \\  & 75–90 & 80 & 40 & 299 \\  & (engine outlet) & – & – & 99 \\ \cline{1-1} \cline{2-5} \multirow{2}{*}{Emergency} & – & 25 & 30 & 110 \\ \cline{1-1} \cline{2-5}  & (engine inlet) & & & \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Parameters of the three cooling circuits of the engine. The electrical efficiency (\(\eta_{\text{el-eng}}\)) is calculated using Equation (7). _EP_ and _TP_ in the formula stand for electrical and thermal power. Equation (8) calculates the thermal efficiency (\(\eta_{\text{thermal-eng}}\)) based on the ratio between the useful thermal power of the engine (\(TP_{\text{useful-eng}}\)) and the thermal power contained in biogas and consumed by the engine (\(TP_{\text{biogas-eng}}\)). Equation (9) estimates the energy efficiency (\(\eta_{\text{energy-eng}}\)), and Equation (10) estimates the usable thermal energy factor of the engine (\(UITEF\)) considering the thermal power that has application in the WWTP, that is, the power used (\(TP_{\text{usable-eng}}\)) against the value of the thermal power susceptible of application. Equation (11) estimates the work/heat ratio of engine (\(WQ\))\({}_{\text{eng}}\), as the ratio between the mechanical power of the engine (\(MP_{\text{eng}}\)) and \(TP_{\text{useful-eng}}\):  
\[\eta_{\text{el-eng}}\;=\;EP_{\text{eng}}\;\times\;100/\;TP_{\text{biogas-eng}} \tag{7}\]  
\[\eta_{\text{thermal-eng}}\;=\;TP_{\text{useful-eng}}\;\times\;100/\;TP_{\text{ biogas-eng}} \tag{8}\]  
\[\eta_{\text{energy-eng}}\;=\;(EP_{\text{eng}}\;+\;TP_{\text{useful-eng}})\; \times\;100/\;TP_{\text{biogas-eng}} \tag{9}\]  
\[UITEF\;=\;TP_{\text{usabel-eng}}\;\times\;100/\;TP_{\text{useful-eng}} \tag{10}\]  
\[(W/Q)_{\text{eng}}\;=\;MP_{\text{eng}}\;\times\;100/\;TP_{\text{useful-eng}} \tag{11}\]  
Equation (12) estimates the ratio of the stoichiometric mass of air (\(A_{\text{stoichi}}\)) for biogas combustion considering molar fraction of methane in biogas (\(X_{\text{CH4}}\)) and the molecular weight of biogas and air (MWbiogas, MWair).