# ORC Optimal Design through Clusterization for Waste Heat Recovery in Anaerobic Digestion Plants
## 3 Methodology
### Preliminary Design
#### 3.1.2 Design Optimization Problem  
The preliminary ORC design was formulated as a constrained optimization problem, which was solved through MATLAB v. 2019b. CoolProp v. 6.3.0 [38] was used to determine the thermodynamic properties of the ORC fluid. In the mathematical model, each component is assumed to be an open system operating in steady-state conditions, and the pressure drops in ORC heat exchangers and pipes are neglected. The part of the digestion plant modeled in the code includes the ORC and the thermal fluid loop (Figure 5). The design is performed by considering that all the available thermal energy is exploited under design conditions. Therefore, in this preliminary stage, the presence of the air cooler located upstream of the thermal oil circulation pump is overlooked. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Cluster** & \(\hat{Q}_{dig}\) [**kW**] & \(\hat{m}_{f}\) [**kg/s**] & \(T_{f}\) [\({}^{\circ}\)C**] & **Population [\%]** \\ \hline
1 & 166 & 3.30 & 239 & 24.5 \\
2 & 176 & 2.82 & 245 & 20.6 \\
3 & 135 & 3.35 & 250 & 32.1 \\
4 & 151 & 2.80 & 256 & 22.8 \\ \hline Average & 155 & 3.09 & 248 & - \\ Summer & 119 & 3.21 & 256 & - \\ Winter & 190 & 2.86 & 238 & - \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Centroids and population scores for the four-cluster partition. This heat exchanger is used to reject the excess heat to prevent sewage overheating, and its operation is considered only in off-design conditions. The ORC design problem can be formulated as in Equation (2):  
\[\max_{x\in\Phi\subseteq\mathbb{R}^{R^{\prime}}}f(\mathbf{x}) \tag{2}\]  
where \(\Phi\) is the so-called feasible region; \(f(\mathbf{x})\) is the problem objective function; and \(\mathbf{x}\) is the variable vector. The optimization problem must satisfy the following set of constraints (Equation (3)):  
\[\Phi=\ \left\{ \begin{array}{ll}\mathbf{x}\in R^{6}\ |&\mathbf{\begin{array}{l}lb\leq x \leq ub\\ A\cdot x\leq b\\ c(x)\leq 0\end{array}\end{array} \right\} \tag{3}\]  
where \(lb\) and \(ub\) represent the lower and upper variable bounds, respectively; \(A\) and \(b\) define the linear inequality set that must be observed by \(x\) components; finally, \(c(x)\) is a vector function so that \(c\): \(R^{6}\to R^{n}\), where \(n\) is the number of the problem's non-linear constraints. \(c(x)\leq 0\) represents a set of non-linear inequalities that the problem must satisfy. The \(x\) components (i.e., optimization variables) are:  
* ORC evaporation temperature \(T_{c,or}\) in \({}^{\circ}\)C.
* ORC condensation temperature \(T_{cd,or}\) in \({}^{\circ}\)C.
* ORC superheating degree \(\Delta T_{sh,or}\) in \({}^{\circ}\)C.
* Thermal oil temperature entering the ORC evaporator \(T_{loop,1}\) in \({}^{\circ}\)C.
* Thermal oil temperature exiting the ORC evaporator \(T_{loop,2}\) in \({}^{\circ}\)C.
* Thermal oil mass flow rate \(\dot{m}_{loop}\) in kg/s. For thermal oil loop variable subscripts, please refer to Figure 5.  
The ORC cycle was modeled to evaluate \(f(\mathbf{x})\) in Equation (2). The following equations define the calculation procedure for each ORC point. This equation set must be interpreted by considering that the optimization algorithm tries a set of optimization variables (\(\mathbf{x}\) components) in each solver iteration. Given that during each ORC cycle evaluation, \(T_{cv,or}\), \(T_{cd,or}\), and \(\Delta T_{sh,or}\) are known, among the other variables, since the solver provides them. Since the ORC evaporation temperature is known, it is possible to determine ORC evaporation pressure \(p_{cv,or}\) by using CoolProp. The ORC turbine inlet conditions are then univocally determined (\(p=p_{cv,or}\); \(T=T_{cv,or}+\Delta T_{sh,or}\)). Since \(T_{cd,or}\) is known, condensation pressure \(p_{cd,or}\) may be readily determined. At this point, isent  
Figure 5: The subset of the biogas production plant that was modeled and optimized.