# Low Temperature Combustion Modeling and Predictive Control of Marine Engines
## 2 Materials and Methods
### RTM and Model Predictive Control Design
\[\frac{\partial Q_{c}}{\partial E_{\text{fuel}}} =\frac{Q_{c}}{E_{\text{fuel}}}, \tag{20}\] \[\frac{\partial Q_{c}}{\partial\text{BR}} =a_{1}\frac{Q_{c}}{\text{BR}},\] \[\frac{\partial p_{cyl}}{\partial E_{\text{fuel}}} =\frac{dp_{cyl}}{dE_{\text{fuel}}},\] \[\frac{\partial p_{cyl}}{\partial\text{BR}} =a_{2}\frac{dp_{cyl}}{d\text{BR}},\] \[\frac{\partial\text{IMEP}_{\text{gross}}}{\partial E_{\text{fuel}}} =\frac{d\text{IMEP}_{\text{gross}}}{dE_{\text{fuel}}},\] \[\frac{\partial\text{IMEP}_{\text{gross}}}{\partial\text{BR}} =\frac{d\text{IMEP}_{\text{gross}}}{d\text{BR}}\]  
This linear relation is based on [29] and was adapted for RCCI combustion by [PERSON] et al. [14]. HRR and in-cylinder pressure are obtained from CHR according to the first law of thermodynamics similarly as in Equations (12) and (14). Equation (20) describes the changes of \(E_{\text{fuel}}\) and BR affecting \(Q_{c}\), \(p_{cyl}\) and \(\text{IMEP}_{\text{gross}}\). Additionally, incorporation of coefficients \(a_{1}\) and \(a_{2}\) are due to the fact that \(\frac{\partial Q_{c}}{\partial\text{BR}}\) and \(\frac{\partial p_{cyl}}{\partial\text{BR}}\) could be negative or positive. Therefore, \(a_{1}\) and \(a_{2}\) are tuned such that \(Q_{c}\) are \(p_{cyl}\) are changed accordingly. The matrix B in Equation (19) is calculated numerically according to the linear relation. Details on the linearization of RCCI combustion model, i.e., expanded form of Equation (20) can be found in [14]. As previously explained in Section 2, \(\theta_{50}\) is defined as crank angle at 50% of energy released. Therefore, \(\theta_{50}\) is obtained from \(Q_{c}\). The system states (\(X\)) are \(X=\left[Q_{c}\quad p_{cyl}\quad\text{IMEP}_{\text{gross}}\right]^{T}\) and outputs (\(Y\)) are \(Y=\left[\theta_{50}\quad\text{IMEP}_{\text{gross}}\right]^{T}\). The control variables are changes of \(E_{\text{fuel}}\) and BR fed to the process, not their respective absolute values. Thus, a control signal is presented as \(\Delta U=\left[\Delta E_{\text{fuel}}\quad\Delta\text{BR}\right]^{T}\). The control problem is formulated as linear quadratic optimization problem with the following cost function. \[J=(Y_{\text{ref}}-Y)^{T}Q(Y_{\text{ref}}-Y)+\Delta U^{T}R\Delta U \tag{21}\]  
where \(Y_{\text{ref}}\) is the reference output vector over prediction horizon, Q and R are weights on the reference tracking and control variables, respectively. The optimal control within the optimization window is presented as  
\[\Delta U^{*}(k) =\operatorname*{arg\,min}_{\Delta U(k)}J\] (22) s.t. \[\Delta u^{\min}\leq\Delta u(k)\leq\Delta u^{\max}\] \[y^{\min}\leq y(k)\leq y^{\max}\] \[\frac{\partial Q_{c}}{\partial\text{BR}} =a_{1}\frac{Q_{c}}{\text{BR}},\]0  
where \(\Delta u^{\min}\) and \(\Delta u^{\max}\) are the constraints on the control variable incremental variation, and \(y^{\min}\) and \(y^{\max}\) are the output constraints. The entire model-in-loop (MiL) framework is implemented in Simulink environment with embedded Matlab functions. The schematics of the adaptive MPC system is presented in Figure 2 and parameter values of the MPC are presented in \[\frac{\partial Q_{c}}{\partial\text{BR}} =a_{1}\frac{Q_{c}}{\text{BR}},\]1 The adaptive MPC uses \(\Delta E_{\text{fuel}}\) and \(\Delta\text{BR}\) to control outputs \(\text{IMEP}_{\text{gross}}\) and \(\theta_{50}\) of the nonlinear RCCI combustion model previously described in Section 2.1. The controlled outputs along with other main outputs, i.e., \(Q_{c}\), \(p_{cyl}\), \(E_{\text{fuel}}\) and BR, control signals and states are connected back to the RTM, which updates the predictive model of the MPC based on the current operating condition for the next cycle. The values of the MPC in Table 1 are chosen to achieve the best performance and low steady state error.