## 3 Numerical Model  
### Performance Analysis  
An operative profile is a set of 48 SP values in the range [0, 100] indicating the operating points of the system for each 30 min time step. The numerical model, implemented in the Python programming language for this analysis, generates \(n\) random operative profiles and evaluates if they fulfill the heat and electrical demand at every time step. If not, the solution is discarded and the next candidate is evaluated. If yes, the cost associated with this solution is computed by:  
\[cost=\sum_{i}^{48}\left(E_{f}\cdot p_{f}+E_{el,b}\cdot p_{el,b}-E_{el,s}\cdot p _{el,s}\right)_{i} \tag{8}\]  
Figure 3: Cold start maneuver up to full-load, steady state. \(T_{rec}=450\) K. \(P_{el}\) = electrical power, \(P_{f}\) = fuel power, and N = rotational speed.  
where \(E_{f}\) is the energy content of the fuel burned and \(p_{f}\) the fuel price; \(E_{el,b}\) and \(E_{el,s}\) are the amounts of electrical energy bought and sold, and \(p_{el,b}\), \(p_{el,s}\) their prices, respectively. The average electricity and methane prices between the years 2018 and 2019 in Germany were considered in this work [20]:  
\[p_{f}=0.07\in\text{$\mathsf{E}$}/\text{kWh},\quad p_{el,b}=0.29\in\text{$ \mathsf{E}$}/\text{kWh},\quad p_{el,s}=0.04\in\text{$\mathsf{E}$}/\text{kWh}.\]  
At the end of the analysis, the solution that minimizes the cost is selected and is considered to be the optimal operating profile of the MTT Enertwin.  
Within one time step, the system requires as much fuel energy as \(E_{f}\) kWh and produces the two forms of energies \(E_{th}\) and \(E_{el}\), also in kWh. In the steady state:  
\[E_{i}=f(\text{SP})=P_{i}(\text{SP})\cdot\Delta t\quad i=th,el,f \tag{9}\]  
where \(P_{i}\) are shown in Table 1. In turn, during a start transient state, the system produces an amount of energy that is the integral during the 30 min ramp-up and is a function of the target SP and initial recuperator temperature:  
\[E_{i}=f(T_{34},\text{ SP})\quad i=th,el,f \tag{10}\]  
These values are modeled via 2D maps extrapolated from experimental data and shown in Figure 4. Finally, the electricity produced will rarely match exactly the electricity consumed by the user, \(\overline{E}_{el}\). Two scenarios are possible:  
\[E_{el}=\begin{cases}\overline{E}_{el}-E_{el,b}&\text{if }E_{el}<\overline{E}_{el}\\ \overline{E}_{el}+E_{el,s}&\text{if }E_{el}>\overline{E}_{el}.\end{cases}\]  
meaning that if more energy is required than produced, the difference needs to be bought from the grid; if too much electricity is produced, the excess will be fed back into the grid. The energy demands from the user are real-life measured data according to norms and will be presented in Section 3.2.  
The next meaningful question is how to determine weather or not a generated operative profile fulfills the demand. The key observation here is to guarantee that the heat capacity of the water tank must be always higher than the minimum threshold at every time step, otherwise the thermal demand cannot be fulfilled. This is expressed by:  
\[E_{tank,min}<E_{tank,i}<E_{tank,max} \tag{11}\] \[c_{p}V_{min}T_{min}<E_{tank,i}<c_{p}V_{max}T_{max}\quad\forall\ i. \tag{12}\]  
More information concerning the water tank vessel volume and heat capacity are described in Section 3.3. When the system is off (hence, when SP = 0 at a certain time step), thermal capacity is drawn from the tank by the user, plus a small part is lost by convection. At a certain point, a minimum is reached: either a minimum threshold temperature is  
Figure 4: The 2D interpolating maps allowing obtaining the energy produced during transient maneuvers. Starting from a recuperator temperature (left horizontal axis) and given the final SP (right horizontal axis), the thermal, electrical, and fuel energy can be read on the vertical axis, respectively.  
reached or too little water is present in the tank. At this moment, the system must be on in order to fulfill the demand. Operative profiles that do not guarantee this are not valid, hence discarded.