# Encrypted Model Predictive Control of a Nonlinear Chemical Process Network

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Preliminaries

#### 2.1. Notation

#### 2.2. Class of Systems

#### 2.3. Achieving Stability through Lyapunov-Based Feedback Control

#### 2.4. Paillier Cryptosystem

- Select two large random prime integers (p and q) satisfying the condition $\mathrm{gcd}(pq,(p-1\left)\right(q-1\left)\right)=1$.
- Calculate the product of these integers, denoted by $M=pq$.
- Select a random integer g such that $g\in {\mathbb{Z}}_{{M}^{2}}^{*}$, where ${\mathbb{Z}}_{{M}^{2}}^{*}$ is the multiplicative group of integers modulo ${M}^{2}$.
- Calculate $\lambda =\mathrm{lcm}(q-1,p-1)$.
- Define $L\left(x\right)=(x-1)/M$.
- Check the existence of the following modular multiplicative inverse:$u={\left(L\left({g}^{\lambda}\phantom{\rule{0.222222em}{0ex}}\mathrm{mod}\phantom{\rule{0.222222em}{0ex}}{M}^{2}\right)\right)}^{-1}\phantom{\rule{0.222222em}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}M$.
- If the inverse does not exist, return to step 3 and select an alternative value for g. In the event that the inverse does exist, we obtain the public key $(M,g)$ and the private key $(\lambda ,u)$.

#### 2.5. Quantization

## 3. Design of the Encrypted MPC

**Remark 1.**

#### Encrypted Lyapunov-Based MPC

## 4. Application to a Chemical Process Operating at an Unstable Steady State Using Aspen Plus Simulator

#### 4.1. Process Description

#### 4.2. Dynamic Model in Aspen Plus Dynamics

- Inlet stream configuration: We enter the inlet stream components, concentrations, and temperatures into Aspen Plus and supply it to each reactor through Hexane solutions with flow rates ${F}_{1}$ and ${F}_{2}$. Using Hexane ensures the inlet flows remain in the liquid phase at the feeding temperature. ${C}_{E},{C}_{B},{C}_{EB}$, and ${C}_{DEB}$ represent the concentrations of Ethylene, Benzene, Ethylbenzene, and Di-Ethylbenzene in the inlet stream, respectively. ${T}_{i},{\rho}_{i},{V}_{i},$ are the temperature, liquid density, and volume of ${\mathrm{CSTR}}_{i}$, $i=1,2$. ${C}_{P}$ represents the mass-specific heat capacity of the liquid mixture and is assumed to remain constant throughout the process in both reactors. Table 1 specifies the process parameters used. The subscript “o” denotes the state in the inlet stream, and “s” indicates the steady-state conditions.
- Pressure drop selection: Valves play a crucial role in establishing a dynamic model for Aspen Plus Dynamics, as they serve as connectors between components and regulate fluid flow by controlling the pressure drop across the system. A suitable pressure drop specifies the flow direction, ensuring a smooth simulation run. In our model, valves ${v}_{1},\phantom{\rule{4pt}{0ex}}{v}_{2},\phantom{\rule{4pt}{0ex}}{v}_{3}$, and ${v}_{4}$ are assigned pressure drops of 5, 5, 2, and 14 bars, respectively.
- Reaction and reactor specification: We define the reaction parameters and stoichiometry in Aspen Plus. All reactions mentioned in Equation (14) are selected in the kinetic specifications of both the CSTRs. We set the initial pressure of each CSTR to 15 bar and equip them with a heating/cooling jacket to provide or remove heat at a rate denoted by ${Q}_{i}$, where i represents the reactor number. The initial temperatures of the first and second CSTRs are 350 K and 400 K, respectively. These settings ensure that the reactants and products remain in the liquid phase throughout the process. After completing the reaction specification for both reactors, we carry out a steady-state simulation.
- Reactor geometry: Before exporting the steady-state model from Aspen Plus to Aspen Plus Dynamics, it is necessary to define the reactor geometry. In our model, the vessels are of the vertical type with flat heads, and each CSTR has a length of ten meters.
- Pressure verification: To ensure the accuracy of the dynamic model, perform a pressure check using the integrated Aspen Plus pressure checker. This step verifies that no errors arise during the dynamic process. Once the steady-state model successfully passes the pressure check, we export it to Aspen Plus Dynamics for further analysis and simulation.
- Dynamic model initialization: Level controllers are added to each reactor to maintain them at the desired capacity. We perform a steady-state simulation to determine the steady-state values of the dynamic model. The values obtained are listed in Equation (14). Further, we specify the initial values of the states in both reactors for the dynamic simulation. Through an initialization run, we ensure the values entered are thermo-kinetically consistent with the model specifications.
- Manipulated input configuration: For external control of the manipulated variables ${Q}_{1}$ and ${Q}_{2}$ (heat duty of reactor 1 and 2, respectively) during the dynamic simulation, the heating type of the reactors is switched to constant heat duty. With these adjustments, the dynamical process model is now fully established. Figure 3 depicts the corresponding model flow sheet.

#### 4.3. First-Principles Model Development

**Remark 2.**

#### 4.4. Linking the Dynamic Models

**Remark 3.**

#### 4.5. Implementing the Encrypted LMPC

**Remark 4.**

#### 4.6. Utilizing MPC over Traditional Control

**Remark 5.**

#### 4.7. Simulation Results of the Encrypted LMPC

**Remark 6.**

**Remark 7.**

## 5. Effect of the Quantization Parameter d and Encryption–Decryption on the Total Computational Time

#### 5.1. Effect of the Quantization Parameter d on Computational Time

**Remark 8.**

#### 5.2. Effect of Encryption–Decryption on the Total Computational Time

**Remark 9.**

**Remark 10.**

**Remark 11.**

**Remark 12.**

## 6. Conclusions

## Author Contributions

## Funding

## Data Availability Statement

## Conflicts of Interest

## References

- Kushner, D. The real story of stuxnet. IEEE Spectr.
**2013**, 50, 48–53. [Google Scholar] [CrossRef] - Barrett, M.P. Framework for Improving Critical Infrastructure Cybersecurity (Version 1.1); Cybersecurity Framework; NIST: Gaithersburg, ML, USA, 2018. [Google Scholar]
- Huang, L.; Nguyen, X.; Garofalakis, M.; Hellerstein, J.M.; Jordan, M.I.; Joseph, A.D.; Taft, N. Communication-efficient online detection of network-wide anomalies. In Proceedings of the 26th IEEE International Conference on Computer Communications, Anchorage, AK, USA, 6–12 May 2007; pp. 134–142. [Google Scholar]
- Omar, S.; Ngadi, A.; Jebur, H.H. Machine learning techniques for anomaly detection: An overview. Int. J. Comput. Appl.
**2013**, 79, 33–41. [Google Scholar] [CrossRef] - Agrawal, S.; Agrawal, J. Survey on anomaly detection using data mining techniques. Procedia Comput. Sci.
**2015**, 60, 708–713. [Google Scholar] [CrossRef] - Wu, Z.; Albalawi, F.; Zhang, J.; Zhang, Z.; Durand, H.; Christofides, P.D. Detecting and Handling Cyber-attacks in Model Predictive Control of Chemical Processes. Mathematics
**2018**, 6, 173. [Google Scholar] [CrossRef] - Chen, S.; Wu, Z.; Christofides, P.D. A cyber-secure control-detector architecture for nonlinear processes. AIChE J.
**2020**, 66, e16907. [Google Scholar] [CrossRef] - Wu, Z.; Chen, S.; Rincon, D.; Christofides, P.D. Post cyber-attack state reconstruction for nonlinear processes using machine learning. Chem. Eng. Res. Des.
**2020**, 159, 248–261. [Google Scholar] [CrossRef] - Durand, H. A nonlinear systems framework for cyberattack prevention for chemical process control systems. Mathematics
**2018**, 6, 169. [Google Scholar] [CrossRef] - Durand, H.; Wegener, M. Mitigating safety concerns and profit/production losses for chemical process control systems under cyberattacks via design/control methods. Mathematics
**2020**, 8, 499. [Google Scholar] [CrossRef] - Elgamal, T. A public key cryptosystem and a signature scheme based on discrete logarithms. IEEE Trans. Inf. Theory
**1985**, 31, 469–472. [Google Scholar] [CrossRef] - Suryavanshi, A.; Alnajdi, A.; Alhajeri, M.; Abdullah, F.; Christofides, P.D. Encrypted model predictive control design for security to cyberattacks. AIChE J.
**2023**, 69, e18104. [Google Scholar] [CrossRef] - Wu, Z.; Tran, A.; Rincon, D.; Christofides, P.D. Machine Learning-Based Predictive Control of Nonlinear Processes. Part I: Theory. AIChE J.
**2019**, 65, e16729. [Google Scholar] [CrossRef] - Wu, Z.; Tran, A.; Rincon, D.; Christofides, P.D. Machine Learning-Based Predictive Control of Nonlinear Processes. Part II: Computational Implementation. AIChE J.
**2019**, 65, e16734. [Google Scholar] [CrossRef] - Lin, Y.; Sontag, E.D. A universal formula for stabilization with bounded controls. Syst. Control Lett.
**1991**, 16, 393–397. [Google Scholar] [CrossRef] - Paillier, P. Public-key cryptosystems based on composite degree residuosity classes. In Advances in Cryptology—EUROCRYPT’99, International Conference on the Theory and Application of Cryptographic Techniques, Prague, Czech Republic, 2–6 May 1999; Springer: Berlin/Heidelberg, Germany, 1999; pp. 223–238. [Google Scholar]
- Darup, M.S.; Redder, A.; Shames, I.; Farokhi, F.; Quevedo, D. Towards encrypted MPC for linear constrained systems. IEEE Control Syst. Lett.
**2017**, 2, 195–200. [Google Scholar] [CrossRef] - Heidarinejad, M.; Liu, J.; Christofides, P.D. Economic model predictive control of nonlinear process systems using Lyapunov techniques. AIChE J.
**2012**, 58, 855–870. [Google Scholar] [CrossRef] - Mhaskar, P.; El-Farra, N.H.; Christofides, P.D. Stabilization of nonlinear systems with state and control constraints using Lyapunov-based predictive control. Syst. Control Lett.
**2006**, 55, 650–659. [Google Scholar] [CrossRef] - CSIRO’s Data61. Python Paillier Library. 2013. Available online: https://github.com/data61/python-paillier (accessed on 3 March 2023).
- Wächter, A.; Biegler, L.T. On the implementation of an interior-point filter line-search algorithm for large-scale nonlinear programming. Math. Program.
**2006**, 106, 25–57. [Google Scholar] [CrossRef] - Liu, J.; Munoz de la Pena, D.; Ohran, B.J.; Christofides, P.D.; Davis, J.F. A two-tier control architecture for nonlinear process systems with continuous/asynchronous feedback. Int. J. Control
**2010**, 83, 257–272. [Google Scholar] [CrossRef] - Liu, J.; Chen, X.; de la Pena, D.M.M.; Christofides, P.D. Iterative distributed model predictive control of nonlinear systems: Handling asynchronous, delayed measurements. IEEE Trans. Autom. Control
**2011**, 57, 528–534. [Google Scholar] - Mercorelli, P. A fault detection and data reconciliation algorithm in technical processes with the help of Haar wavelets packets. Algorithms
**2017**, 10, 13. [Google Scholar] [CrossRef] - Schimmack, M.; Mercorelli, P. An adaptive derivative estimator for fault-detection using a dynamic system with a suboptimal parameter. Algorithms
**2019**, 12, 101. [Google Scholar] [CrossRef]

**Figure 4.**Temperature state and input profiles of p-control (red solid line) and MPC (green dashed line) strategies employed using the Aspen dynamic model.

**Figure 5.**Temperature state and input profiles of the LMPC with encryption (red solid line) and without encryption (green dashed line) for the Aspen dynamic model, with $d=1$.

**Figure 6.**Temperature state and input profiles of the LMPC with encryption (red solid line) and without encryption (green dashed line) for the Aspen dynamic model, with $d=4$.

**Figure 7.**Temperature state and input profiles of the LMPC with encryption (red solid line) and without encryption (green dashed line) for the Aspen dynamic model, with $d=8$.

**Figure 8.**Ratio of the total time spent for encryption–decryption to the sum of the total time required for MPC computation and encryption–decryption at each sampling instance.

${T}_{1o}={T}_{2o}=350\mathrm{K}$ | ${T}_{1s}=321.15\mathrm{K}$ |

${V}_{1}={V}_{2}=60{\mathrm{m}}^{3}$ | ${T}_{2s}=442.99\mathrm{K}$ |

${F}_{1}=43.2{\mathrm{m}}^{3}/\mathrm{h}$ | ${F}_{2}=47.87{\mathrm{m}}^{3}/\mathrm{h}$ |

${C}_{{E}_{o1}}=4.43\mathrm{k}\mathrm{m}\mathrm{o}\mathrm{l}/{\mathrm{m}}^{3}$ | ${C}_{{E}_{1s}}=4.33\mathrm{k}\mathrm{m}\mathrm{o}\mathrm{l}/{\mathrm{m}}^{3}$ |

${C}_{{B}_{o1}}=5.54\mathrm{k}\mathrm{m}\mathrm{o}\mathrm{l}/{\mathrm{m}}^{3}$ | ${C}_{{B}_{1s}}=5.55\mathrm{k}\mathrm{m}\mathrm{o}\mathrm{l}/{\mathrm{m}}^{3}$ |

${C}_{{E}_{o2}}=4.02\mathrm{k}\mathrm{m}\mathrm{o}\mathrm{l}/{\mathrm{m}}^{3}$ | ${C}_{{E}_{2s}}=0.196\mathrm{k}\mathrm{m}\mathrm{o}\mathrm{l}/{\mathrm{m}}^{3}$ |

${C}_{{B}_{o2}}=5.02\mathrm{k}\mathrm{m}\mathrm{o}\mathrm{l}/{\mathrm{m}}^{3}$ | ${C}_{{B}_{2s}}=1.31\mathrm{k}\mathrm{m}\mathrm{o}\mathrm{l}/{\mathrm{m}}^{3}$ |

${C}_{E{B}_{1s}}=0.53\mathrm{k}\mathrm{m}\mathrm{o}\mathrm{l}/{\mathrm{m}}^{3}$ | ${C}_{E{B}_{2s}}=4.22\mathrm{k}\mathrm{m}\mathrm{o}\mathrm{l}/{\mathrm{m}}^{3}$ |

${C}_{DE{B}_{1s}}=8.76\times {10}^{-4}\mathrm{k}\mathrm{m}\mathrm{o}\mathrm{l}/{\mathrm{m}}^{3}$ | ${C}_{DE{B}_{2s}}=0.0078\mathrm{k}\mathrm{m}\mathrm{o}\mathrm{l}/{\mathrm{m}}^{3}$ |

${k}_{1}=1.528\times {10}^{6}{\mathrm{m}}^{3}.\mathrm{k}\mathrm{m}\mathrm{o}{\mathrm{l}}^{-1}.{\mathrm{s}}^{-1}$ | ${E}_{1}$ = 71,160 kJ/kmol |

${k}_{2}=2.778\times {10}^{4}{\mathrm{m}}^{3}.\mathrm{k}\mathrm{m}\mathrm{o}{\mathrm{l}}^{-1}.{\mathrm{s}}^{-1}$ | ${E}_{2}$ = 83,680 kJ/kmol |

${k}_{3}=0.4167{\mathrm{m}}^{3}.\mathrm{k}\mathrm{m}\mathrm{o}{\mathrm{l}}^{-1}.{\mathrm{s}}^{-1}$ | ${E}_{3}$ = 62,760 kJ/kmol |

${\rho}_{1}=639.153\mathrm{k}\mathrm{g}/{\mathrm{m}}^{3}$ | ${\rho}_{2}=607.504\mathrm{k}\mathrm{g}/{\mathrm{m}}^{3}$ |

$\Delta {H}_{1}=-1.04\times {10}^{5}\mathrm{k}\mathrm{J}/\mathrm{k}\mathrm{m}\mathrm{o}\mathrm{l}$ | $\Delta {H}_{2}=-1.02\times {10}^{5}\mathrm{k}\mathrm{J}/\mathrm{k}\mathrm{m}\mathrm{o}\mathrm{l}$ |

$\Delta {H}_{3}=-5.5\times {10}^{2}\mathrm{k}\mathrm{J}\mathrm{/}\mathrm{k}\mathrm{m}\mathrm{o}\mathrm{l}$ | ${C}_{p}=2.411\mathrm{k}\mathrm{J}.\mathrm{k}{\mathrm{g}}^{-1}.{\mathrm{K}}^{-1}$ |

${Q}_{1s}=-1074.63\mathrm{k}\mathrm{W}$ | ${Q}_{2s}=-6768.83\mathrm{k}\mathrm{W}$ |

${C}_{p}=2.411\mathrm{k}\mathrm{J}.\mathrm{k}{\mathrm{g}}^{-1}.{\mathrm{K}}^{-1}$ | $R=8.314\mathrm{k}\mathrm{J}.\mathrm{k}\mathrm{m}\mathrm{o}{\mathrm{l}}^{-1}.{\mathrm{K}}^{-1}$ |

Heat transfer option | Dynamics |

Temperature approach | $77.33\mathrm{K}$ |

Heat capacity of coolant | $4.2\mathrm{k}\mathrm{J}.\mathrm{k}{\mathrm{g}}^{-1}.{\mathrm{K}}^{-1}$ |

Medium holdup | $1000\mathrm{k}\mathrm{g}$ |

$\mathit{d}$ | ${\mathit{g}}_{{\mathit{l}}_{\mathit{1}},\mathit{d}}$ Time | ${\mathit{f}}_{{\mathit{l}}_{\mathbf{2}},\mathit{d}}$ Time | Enc. Time | Dec. Time | ${\mathit{f}}_{{\mathit{l}}_{\mathbf{2}},\mathit{d}}^{-\mathbf{1}}$ Time | Total Time |

1 | $4.8\times {10}^{-4}\mathrm{s}$ | $2.6\times {10}^{-4}\mathrm{s}$ | $2.49\mathrm{s}$ | $0.72\mathrm{s}$ | $2.9\times {10}^{-4}\mathrm{s}$ | $3.204\mathrm{s}$ |

2 | $4.5\times {10}^{-4}\mathrm{s}$ | $2.9\times {10}^{-4}\mathrm{s}$ | $2.48\mathrm{s}$ | $0.71\mathrm{s}$ | $3.1\times {10}^{-4}\mathrm{s}$ | $3.190\mathrm{s}$ |

3 | $4.7\times {10}^{-4}\mathrm{s}$ | $2.7\times {10}^{-4}\mathrm{s}$ | $2.48\mathrm{s}$ | $0.7\mathrm{s}$ | $2.8\times {10}^{-4}\mathrm{s}$ | $3.179\mathrm{s}$ |

4 | $4.8\times {10}^{-4}\mathrm{s}$ | $2.9\times {10}^{-4}\mathrm{s}$ | $2.48\mathrm{s}$ | $0.71\mathrm{s}$ | $2.8\times {10}^{-4}\mathrm{s}$ | $3.182\mathrm{s}$ |

5 | $5.3\times {10}^{-4}\mathrm{s}$ | $2.7\times {10}^{-4}\mathrm{s}$ | $2.5\mathrm{s}$ | $0.71\mathrm{s}$ | $2.8\times {10}^{-4}\mathrm{s}$ | $3.214\mathrm{s}$ |

6 | $5\times {10}^{-4}\mathrm{s}$ | $2.9\times {10}^{-4}\mathrm{s}$ | $2.47\mathrm{s}$ | $0.71\mathrm{s}$ | $3.2\times {10}^{-4}$ s | $3.182\mathrm{s}$ |

7 | $5.1\times {10}^{-4}\mathrm{s}$ | $3\times {10}^{-4}\mathrm{s}$ | $2.49\mathrm{s}$ | $0.71\mathrm{s}$ | $3.3\times {10}^{-4}\mathrm{s}$ | $3.194\mathrm{s}$ |

8 | $5.4\times {10}^{-4}\mathrm{s}$ | $2.9\times {10}^{-4}\mathrm{s}$ | $2.5\mathrm{s}$ | $0.73\mathrm{s}$ | $3.1\times {10}^{-4}\mathrm{s}$ | $3.225\mathrm{s}$ |

**Table 3.**Operations required for ${g}_{{l}_{1},d}$, generating ${\mathbb{Q}}_{{l}_{1},d}$, and time required to generate ${\mathbb{Q}}_{{l}_{1},d}$.

$\mathit{d}$ | Operations for ${\mathit{g}}_{{\mathit{l}}_{\mathbf{1}},\mathit{d}}$ | Operations to Generate ${\mathbb{Q}}_{{\mathit{l}}_{\mathbf{1}},\mathit{d}}$ | Time to Generate ${\mathbb{Q}}_{{\mathit{l}}_{\mathbf{1}},\mathit{d}}$ |

1 | 192 | 65,534 | $0.02\mathrm{s}$ |

2 | 204 | 131,070 | $0.04\mathrm{s}$ |

3 | 216 | 262,142 | $0.07\mathrm{s}$ |

4 | 228 | 524,286 | $0.15\mathrm{s}$ |

5 | 240 | 1,048,574 | $0.29\mathrm{s}$ |

6 | 252 | 2,097,150 | $0.55\mathrm{s}$ |

7 | 264 | 4,194,302 | $1.11\mathrm{s}$ |

8 | 276 | 8,388,606 | $2.27\mathrm{s}$ |

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |

© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Kadakia, Y.A.; Suryavanshi, A.; Alnajdi, A.; Abdullah, F.; Christofides, P.D.
Encrypted Model Predictive Control of a Nonlinear Chemical Process Network. *Processes* **2023**, *11*, 2501.
https://doi.org/10.3390/pr11082501

**AMA Style**

Kadakia YA, Suryavanshi A, Alnajdi A, Abdullah F, Christofides PD.
Encrypted Model Predictive Control of a Nonlinear Chemical Process Network. *Processes*. 2023; 11(8):2501.
https://doi.org/10.3390/pr11082501

**Chicago/Turabian Style**

Kadakia, Yash A., Atharva Suryavanshi, Aisha Alnajdi, Fahim Abdullah, and Panagiotis D. Christofides.
2023. "Encrypted Model Predictive Control of a Nonlinear Chemical Process Network" *Processes* 11, no. 8: 2501.
https://doi.org/10.3390/pr11082501