# Design of an IMCPID Optimized Neural Network for Stepless Flow Control of Reciprocating Machinery
## 2 Problem Formulation  
The stepless flow control system for a two-cylinder type reciprocating compressor [27] is shown in Figure 1, where \(r\) denotes the gas to be compressed and \(y\) denotes the compressed gas. In standard operating conditions, the gas satisfies the following ideal gas assumptions:  
\[P=\frac{\rho RT}{M}, \tag{1}\]  
\[\dot{m}=\frac{d}{dt}(\rho V), \tag{2}\]  
\[\dot{m}_{in}-\dot{m}_{out}=\rho\dot{V}+\dot{\rho}V, \tag{3}\]  
where \(P\) is gas pressure, \(\rho\) is gas density, \(R\) is gas constant, \(T\) is gas temperature, \(M\) is gas molar mass, \(m\) is derivative of gas mass, \(V\) is gas volume, \(\dot{m}_{in}\) is derivative of the gas mass flowing into the cylinder, \(\dot{m}_{out}\) is derivative of the gas mass flowing out of the cylinder and \(\dot{V}\) and \(\dot{\rho}\) are derivatives of the gas volume and gas density, respectively. Usually, the gas volume is invariable in the buffer tank, so \(V=0\). Combining Equations (1)-(3), the dynamic pressure change of the cylinder can be described as:  
\[\dot{P}=\frac{RT}{V}(\phi_{in}\dot{m}_{in}-\phi_{out}\dot{m}_{out}), \tag{4}\]  
where \(\phi_{in}\) and \(\phi_{out}\) are process coefficients of the inlet gas or outlet gas, which are ranging from 0 to 1 depending on the gas process characteristic. According to the mathematical model for reciprocating compressors introduced in paper [28], the gas mass flowing into the first stage cylinder and the second stage cylinder during the compressing process can be given as Equations (5) and (6), respectively. \[\dot{m}_{in1}=\frac{P_{s1}}{R_{m}}\frac{M}{T_{s1}}\frac{1}{T}V_{h1}\omega_{p1 }w_{t1}[1+\sigma_{1}-\sigma_{1}(\frac{P_{1}}{P_{s1}})^{\frac{1}{h_{1}}}] \theta_{1}, \tag{5}\]  
Figure 1: The stepless flow control system for a two-stage compressor. \[\dot{m}_{in2}=\frac{P_{1}}{R_{m}}\frac{M}{T_{s2}}\frac{1}{T}V_{h2}\omega_{p2}w_{l2 }[1+\sigma_{2}-\sigma_{2}(\frac{P_{2}}{P_{1}})^{\frac{1}{m2}}]\theta_{2}, \tag{6}\]  
where \(P_{s}\) is pressure of inlet gas, \(R_{m}\) is gas constant, \(T_{s}\) is temperature of inlet gas, \(T\) is temperature of buffer tank, \(V_{h}\) is volume of cylinder stroke volume, \(\omega_{p}\) is pressure coefficient, \(\omega_{t}\) is temperature coefficient, \(\omega_{t}\) is leakage coefficient, \(\sigma\) is volume coefficient, \(P\) is pressure of buffer tank, \(m\) is gas mass and \(\theta\) is working load. The subscript \(i\) (\(i=1,\ 2\)) indicates the cylinder number of the compressor. The gas compressed by the first stage cylinder will be sent into the second stage cylinder. Then, we can obtain the relationship between the outlet mass of the first-stage cylinder and the inlet mass of the second-stage cylinder. \[\dot{m}_{out1}=\dot{m}_{in2}. \tag{7}\]  
Considering the dynamic principle of the exhaust valve, the equation of the outlet mass of the second-stage cylinder can be expressed as  
\[\dot{m}_{out2}=C_{f}A_{0}C_{1}\frac{P_{2}}{\sqrt{T_{2}}}. \tag{8}\]  
Combing Equations (4)-(8), the dynamic change of cylinder pressure can be presented as:  
\[\dot{P}_{1}=\frac{RT_{1}}{V_{1}}\left\{ \begin{array}{l}\sigma_{in1}\frac{P_{ 1}}{R_{m}}\frac{M}{T_{s1}}\frac{1}{T}V_{h1}\omega_{p1}w_{l1}[1+\sigma_{1}- \sigma_{1}(\frac{P_{1}}{P_{1}})^{\frac{1}{m_{1}}}]\theta_{1}\\ -\sigma_{out1}\frac{P_{1}}{R_{m}}\frac{M}{T_{s2}}\frac{1}{T}V_{h2}\omega_{p2}w _{l2}[1+\sigma_{2}-\sigma_{2}(\frac{P_{1}}{P_{1}})^{\frac{1}{m2}}]\theta_{2} \end{array} \right\}, \tag{9}\]  
\[\dot{P}_{2}=\frac{RT_{2}}{V_{2}}\left\{ \begin{array}{l}\sigma_{in2}\frac{P_{ 1}}{R_{m}}\frac{M}{T_{s2}}\frac{1}{T}V_{h2}\omega_{p2}w_{l2}w_{l2}[1+\sigma_{2 }-\sigma_{2}(\frac{P_{2}}{P_{1}})^{\frac{1}{m2}}]\theta_{2}\\ -\phi_{out2}C_{f}A_{0}C_{1}\frac{P_{2}}{\sqrt{T_{2}}}\end{array} \right\}. \tag{10}\]  
The operation parameters of a two-cylinder reciprocating compressor with a stepless flow control system are listed in Table 1.  
Substituting the operation parameter values in Table 1 into Equations (9) and (10), the relationship between the outlet pressure and working load can be written as Equation