## 2 Hybrid Numerical Model
### Thermodynamic Model  
In the 0D modelling method, the first law of thermodynamics and mass conservation are the bases to find thermodynamic properties. Distributions of pressure and temperature in control volumes are ignored due to the elimination of momentum equation. This lump open system will undergo a quasi-state process and leakage is assumed to not take place. As shown in Figure 1, the instantaneous position of the piston displacement by considering the top dead center (TDC) as the original point is calculated by [3]:  
\[x=r_{cs}\left[1-\cos\theta+\frac{l}{r_{cs}}\left(1-\sqrt{1-\left(\frac{r_{cs} }{l}\right)^{2}\sin^{2}\theta}\right)\right] \tag{1}\]  
in which \(r_{cs}\) and \(l\) are the crank radius and the length of the connecting rod, respectively. The momentary volume inside cylinder is then obtained by:  
\[V_{c}=V_{cl}+\frac{\pi D_{c}}{4}x \tag{2}\]  
where \(V_{cl}\) is the clearance volume and \(D_{c}\) is the cylinder diameter; subscript \(c\) represents the compressor cylinder. The first thermodynamic law over a control volume is given by [36]:  
\[\frac{dE_{cv}}{dt}=\frac{dQ_{cv}}{dt}-\frac{dW_{cv}}{dt}+\sum\frac{dm_{in}}{dt }h_{in}-\sum\frac{dm_{out}}{dt}h_{out} \tag{3}\]  
where \(E\), \(t\), \(Q\), \(W\) and \(h\) are system energy, time, heat transfer, work and specific enthalpy, respectively; \(cv\), \(in\) and \(out\) subscripts represent the control volume, flow through inlet and outlet ports, respectively. The potential and kinetic energy in the control volume is negligible, and thus only the internal energy is considered as the energy of system:  
\[\frac{dE_{cv}}{dt}=\frac{d(me)_{cv}}{dt}=m_{cv}\frac{de_{cv}}{dt}+e_{cv}\frac{ dm_{cv}}{dt} \tag{4}\]  
Here, \(m\) and \(e\) are the gas mass and specific internal energy, respectively. The work rate can be written as:  
\[\frac{dW_{cv}}{dt}=p_{cv}\frac{dV_{cv}}{dt} \tag{5}\]  
where \(p\) and \(V\) are pressure and volume, respectively. Figure 1: Schematic representation of the compressor hybrid model. The mass conservation law for a control volume is written as [37]:  
\[\frac{dm_{cv}}{dt}=\frac{dm_{in}}{dt}-\frac{dm_{out}}{dt} \tag{6}\]  
After taking into account relations (4), (5) and (6) in Equation (3), the following formula is achieved:  
\[\frac{de_{cv}}{dt}=\frac{1}{m_{cv}}\left[\frac{dQ_{cv}}{dt}-p_{cv}\frac{dV_{cv} }{dt}+\frac{dm_{in}}{dt}h_{in}-\frac{dm_{out}}{dt}h_{out}-e_{cv}\bigg{(}\frac{ dm_{in}}{dt}-\frac{dm_{out}}{dt}\bigg{)}\right] \tag{7}\]  
Differentiating with respect to time results in the conversion of the crank angle \(\theta\):  
\[\frac{d}{dt}=\frac{d}{d\theta}\frac{d\theta}{dt}=\omega\frac{d}{d\theta} \tag{8}\]  
where \(\omega\) is the angular speed of the crank shaft. Finally, the continuity equation and the first law of thermodynamics could be separately rearranged as the following equations:  
\[\frac{dm_{cv}}{d\theta}=\frac{dm_{in}}{d\theta}-\frac{dm_{out}}{d\theta} \tag{9}\]  
\[V_{c}=V_{cl}+\frac{\pi D_{c}}{4}x \tag{2}\]0  
In the above two equations, expressions for the cylinder control volume are different from those for the chamber control volume. For the compressor cylinder volume, mass flow rate through the valves could be written as [3]:  
\[\frac{dm_{in}}{d\theta}=\frac{dm_{s}}{d\theta}=\left\{ \begin{array}{ll}\frac {1}{\omega}\varphi_{vs}A_{vs}\sqrt{2\big{(}p_{s_{chamber}}-p_{c}\big{)}\rho_{s _{chamber}}}&\text{for }p_{s_{chamber}}>p_{c},y_{s}>0\\ -\frac{1}{\omega}\varphi_{vs}A_{vs}\sqrt{2\big{(}p_{c}-p_{s_{chamber}}\big{)} \rho_{c}}&\text{for }p_{s_{chamber}}<p_{c},y_{s}>0\end{array} \right. \tag{11}\]  
\[\frac{dm_{out}}{d\theta}=\frac{dm_{d}}{d\theta}=\left\{ \begin{array}{ll} \frac{1}{\omega}\varphi_{vd}A_{vd}\sqrt{2\big{(}p_{c}-p_{d_{chamber}}\big{)} \rho_{c}}&\text{for }p_{c}>p_{d_{chamber}},y_{d}>0\\ -\frac{1}{\omega}\varphi_{vd}A_{vd}\sqrt{2\big{(}p_{d_{chamber}}-p_{c}\big{)} \rho_{d_{chamber}}}&\text{for }p_{c}<p_{d_{chamber}},y_{d}>0\end{array} \right.