CET vol 99 DOI: 10.3303/CET2399107 Paper Received: 5 December 2022; Revised: 7 March 2023; Accepted: 14 April 2023 Please cite this article as: Marques F.H., Alvarez L.A., 2023, Model Predictive Control with Safety Constraint Embedded in Hazard and Operability Study, Chemical Engineering Transactions, 99, 637-642 DOI:10.3303/CET2399107 CHEMICAL ENGINEERING TRANSACTIONS VOL. 99, 2023 A publication of The Italian Association of Chemical Engineering Online at www.cetjournal.it Guest Editors: Sauro Pierucci, Flavio Manenti Copyright © 2023, AIDIC Servizi S.r.l. ISBN 978-88-95608-98-3; ISSN 2283-9216 Model Predictive Control with Safety Constraint Embedded in Hazard and Operability Study Fernando H. Marques, Luz A. Alvarez* School of Chemical Engineering, University of Campinas, Av. Albert Einstein 500, 13083-852, Campinas-SP, Brazil luzadri@unicamp.br Industrial accidents represent a critical issue in the chemical processes, which keep happening although all efforts to avoid them. There are many tools and methodologies employed in the industry to improve the safety of a chemical system, but they might still fail because accidents do not have a single or linear cause. Recently a new approach to process safety, based on a control-inspired view has gained attention, such as embedding model predictive control (MPC) with safety constraints developed from qualitative safety principles, for instance, HAZOP (Hazard and Operability study). MPC is a control technique formulated as an optimization problem, and consequently, it is possible to include mathematical constraints. In this context, this work proposes to investigate the use of an MPC with safety constraints for potential hazards, integrated with a dynamic simulation-based HAZOP methodology. We evaluated the effect of safety constraints as a recommendation to increase the safeguard of a styrene polymerization reactor, as a case study. To simulate potential hazards from a chemical process failure we used HAZOP deviations, and then evaluated the same disturbance to an MPC with a safety constraint, as a consequence of the HAZOP recommendation to avoid an accident. The simulation results present the effect of the safety constraint in the MPC as a recommendation to safeguard and the importance of the safety approach based on the control-inspired view, enhancing a safety system in a chemical process. 1. Introduction Accidents occur due to a succession of neglected events, and one of the most difficult tasks of safety engineering in the industry is to detect hazardous situations that could cause an accident. There are many techniques for hazard identification in industrial processes, e.g., fault-trees, event-trees, and Hazard and Operability study (HAZOP), the latter being the most widely used (Janošovský et al., 2016). HAZOP is a qualitative method to investigate unsafe conditions during the operability of a chemical plant. This approach is conducted with a team of experts that carry out brainstorming sessions to determine hazardous scenarios and analyse them. The HAZOP group divides the Piping and Instrumentation Diagram (P&ID) into a set of process nodes. After that, guide words (e.g. more, less, higher, lower, none) are used to establish and examine deviations of parameters from the process operating, such as temperature, pressure, and flow rate. Then, documentation is elaborated based on the possible causes and consequences of the scenario deviations; and in case of unsafe conditions, actions must be suggested to eliminate or reduce the risks (Mushtaq and Chung, 2000). Although all efforts to reduce hazardous conditions, accidents still occurring because the main process engineering tools for dealing with safety do not consider a chain-of-events that lead up to the disasters (Leveson and Stephanopoulos, 2014). For instance, conventional HAZOP excludes some important features, such as the domino effect, multivariable interactions, amplitude, and duration of a failure (Mokhtarname et al., 2020). Simulation-based HAZOP tool (Raoni et al., 2018) may overcome some weaknesses of traditional HAZOP, but few works support dynamic simulations with a process control approach (Danko et al., 2019). Leveson and Stephanopoulos (2014) presented a new perspective to process safety based on a control-inspired view, highlighting process safety as constraints in the control system, and failures represent violations of the safety constraints. Control-inspired view is capable to deal with multivariable interactions and the dynamic effects of process deviations. 637 In this context, Model Predictive Control (MPC) is a suitable control class that allows embedding mathematical constraints based on safety system (Albalawi et al., 2017). Furthermore, Infinite Horizon Model Predictive Control (IHMPC) with zone control is a favorable control structure for safety, since it has nominal stability and the zones could be understood as an additional safety constraint (González and Odloak, 2009). In this perspective, the aim of this work is to propose and evaluate a dynamic simulation-based HAZOP integrated with MPC containing safety constraints. This approach may improve conventional methodologies. Besides, it is possible to verify how safety constraint can improve the prevention of failure from deviation in the HAZOP, avoiding unsafe conditions. To illustrate this mechanism, a styrene polymerization reactor is used. 2. Methodology 2.1 HAZOP strategy First, we simulated hazard situations using HAZOP deviations to evaluate the system dynamic behavior against the failures (dynamic simulation-based HAZOP). The mathematical model for dynamic simulations consists of the mass and energy balances of the styrene reactor, according to Alvarez and Odloak (2012). From that, the safety constraint was generated and embedded in the IHMPC, and the same scenarios were evaluated again in the presence of the controller with safety features, as described in Figure 1. The MPC with safety constraint embedded in HAZOP was applied for a polymerization reactor, involving exothermic reactions, with complex kinetics and high viscosity. To exemplify the impact of the MPC with safety constraint as a recommendation to increase the safeguard of a styrene polymerization reactor, three HAZOP scenarios were investigated: • Scenario 1: Higher temperature of the reactor feed; • Scenario 2: Higher concentration of initiator in the feed; • Scenario 3: Higher Inlet temperature of cooling jacket fluid. Figure 1: Flowsheet for development of MPC with safety constraint embedded in HAZOP 2.2 Process description Figure 2b described a simplified diagram for the styrene polymerization reactor, a CSTR of volume equal to 3000 L, with a cooling jacket. There are three feed streams: pure styrene (monomer) with a flow rate of 378 L∙h- 1, and initial concentration of 8.6981 mol∙L-1; initiator (2,2’- azoisobutyronitrile, AIBN) in 108 L∙h-1, and 0.589 mol∙L-1; and benzene as solvent, with a flow rate of 459 L∙h-1. The reactor feed temperature is 330 K, while for cooling jacket, the inlet temperature is 295 K, and the flow rate is 471.6 L∙h-1. The effluent from the reactor consists of a mixture of polystyrene with unreacted monomer, initiator, and solvent. In this process, the product viscosity and reactor temperature must be regulated, for safety, quality, and economic requests. Alvarez and Odloak (2012) describe more details about the kinetic mechanism, process parameters, and mathematical model. 2.3 Control structure The control structure consists of the real time optimization (the economic layer); a Target Calculation (TC), which computes feasible targets to the controller from the RTO outputs; and the IHMPC, which receives the feasible target from TC and estimates the control actions for the process. The RTO layer is executed at a lower frequency (e.g., each one hour) than TC and IHMPC (that is executed with a time period of minutes). The control system has two inputs (𝑛𝑢 = 2) and two outputs (𝑛𝑦 = 2), the inputs are the initiator flow rate and jacket fluid flow rate, and the outputs are the product viscosity and reactor temperature. Figure 2a represents the control structure. The RTO layer calculates the optimum outputs (𝑦𝑅𝑇𝑂) and inputs (𝑢𝑅𝑇𝑂) for the system, based on an economic goal (objective function), and the nonlinear steady-state mathematical model of the process (mass and energy balance) are constraints for the problem. Besides, in this layer, we inserted the safety constraint developed from the dynamic simulation data obtained in the HAZOP deviation scenarios. 𝑆(𝑥) is a nonlinear function established from the process states and called safety index, the 𝑆𝑇𝐻 is a threshold for 𝑆(𝑥) . RTO is a nonlinear optimization problem, and it was solved using fmincon from MATLAB. 𝑦𝑅𝑇𝑂 and 𝑢𝑅𝑇𝑂 are estimated in the RTO layer and sent to TC, which computes new feasible inputs (𝑢𝑑𝑒𝑠,𝑘) and outputs (𝑦𝑑𝑒𝑠,𝑘) for the IHMPC. TC problem is 638 structured as an optimization problem, using quadratic programming (QP). 𝑦𝑑𝑒𝑠,𝑘 and 𝑢𝑑𝑒𝑠,𝑘 are sent to the IHMPC with zone, that computes the control actions (𝑢𝑘) for the polymerization reactor. The IHMPC presented in this work was proposed by González and Odloak (2009). This controller class utilizes the linear model representation called OPOM (Output Prediction Oriented Model). In addition, for IHMPC with zone control, the references (𝑦𝑠𝑝,𝑘) are decision variables because the zone represents bounds for the set point. In this context, the zones could represent an extra safety constraint. Likewise, the manipulated variables receive the targets from the TC, as a reference. The IHMPC with zone control contains slack variables to guarantee the objective function is bounded and the model feasibility. For this work, we adopt a prediction horizon, 𝑚 = 3. More details on how to implement the control structure for the polymerization reactor are described in Alvarez and Odloak (2012). As the control structure is based on the OPOM model, it utilizes a linear model representation of the styrene reactor, obtained from the transfer functions according to Table 1. (a) Control structure (b) Process system Figure 2: (a) Control structure with RTO, safety constraint, TC and MPC; (b) Process system: Simplified process diagram of the styrene polymerization reactor Table 1: Transfer functions model of styrene reactor for IHMPC with zone control 𝑢1(𝑄𝑖)[𝐿/ℎ] 𝑢2(𝑄𝑐)[𝐿/ℎ] 𝑦1(𝜂)[𝐿/𝑔] −66.69 (1 + 5.3474𝑠)(1 + 2.5274𝑠) 5.9425 (1 + 7.6525𝑠)(1 + 3.091𝑠)(1 + 2.7063𝑠) 𝑦2(𝑇)[𝐾] 144.7925 (1 + 6.7599𝑠)(1 + 1.5797𝑠) −47.5589 (1 + 7.6173𝑠)(1 + 2.3968𝑠) 3. Results and Discussion From conventional HAZOP, the consequences were obtained through dynamic simulations. Three deviations were analyzed; the inlet reactor temperature (𝑇𝑓) which is defined at 330 K, such Figure 3a presented the effect of the deviation in 𝑇𝑓 causes in the reactor temperature, being the most critical variable in the safety system for polymerization reactor. Figures 3b and 3c show the effect of inlet initiator concentration, and the inlet cooling jacket fluid temperature deviation caused in the reactor temperature, respectively. The inlet initiator concentration is defined as 0.589 mol∙L-1, and the inlet cooling jacket fluid temperature is 295 K. For the dynamic simulation, each deviation was analyzed in four different points as presented in Figure 3, with the purpose to understand the effect of these deviations in the states of the process. In all deviations analyzed, the change can lead to increasing reactor temperature, which represents a risk for the process safety, since a temperature increase may convert the process to a thermal runaway. In this context, it is necessary to establish recommendations to avoid the consequences of these deviations in the process. The recommendations defined in this work are related to the development of the safety constraint. Table 2 presents the HAZOP developed based on the deviations shown in Figure 3. This HAZOP study did not consider the failure causes, since the objective is to develop a safety constraint based on the process state as a safeguard. Besides, there is one consequences and recommendations column considered for all deviations. 639 (a) (b) (c) Figure 3: Effect of the temperature for the HAZOP deviation in the styrene reactor: (a) inlet reactor temperature; (b) inlet initiator concentration; and (c) inlet cooling jacket fluid temperature; from dynamic simulation at the steady-state Table 2: HAZOP study for polymerization reactor considering the safeguard as Recommendation for safety constraint (and without deviations causes) Parameter Guide word Consequences Recommendation for safety constraint Inlet reactor temperature Higher In all deviations, the reactor temperature increases; the reaction rate increases; cooling jack fluid temperature increases; and the polymer viscosity decreases. These could conduct the reactor to a thermal runaway. These consequences were obtained through of the simulations. Consider the reactor temperature impact in the 𝑆(𝑥), adding a higher weight to temperature deviations from the steady-state (𝜎𝑇 = 200). Consider the impact of the cooling jacket fluid temperature in the 𝑆(𝑥) with a weight of 𝜎𝑇𝐶 = 100. Consider the effect of the polymer viscosity deviation from the steady- state in the 𝑆(𝑥), including a weight of 𝜎𝜂 = 25. The safety threshold was defined as the value of 𝑆𝑇𝐻= 320.These values were added empirically. Inlet initiator concentration Higher Inlet cooling jacket fluid temperature Higher From the HAZOP study, the safety constraint was developed, according to Eq(1), such the deviation from the steady-state is penalized with weights as described in the Recommendation in Table 1. Eq(1) is inserted the RTO layer. For this work, the reactor temperature, temperature of the cooling jacket fluid, and polymer viscosity at the steady-state are defined as 𝑇𝑠𝑠 = 323.5 K, 𝑇𝐶,𝑠𝑠 = 305.2 K, and 𝜂𝑠𝑠= 3.89, respectively. 𝑆(𝑥) = 𝜎𝑇 ( 𝑇 𝑇𝑠𝑠 ) 2 + 𝜎𝑇𝐶 ( 𝑇𝐶 𝑇𝐶,𝑠𝑠 ) 2 + 𝜎𝜂 ( 𝜂 𝜂𝑠𝑠 ) 2 ≤ 𝑆𝑇𝐻 (1) Considering the Eq(1) for the control structure, we analyzed the deviation effect utilizing the IHMPC with zone control and with safety constraint, as safeguard for HAZOP study. For that, we defined the following control settings: the zone limits as 𝑦𝑚𝑖𝑛 = [3.5; 323.5]; 𝑦𝑚𝑎𝑥 = [4.15; 326]; the input bounds as 𝑢𝑚𝑖𝑛 = [0.015; 0.08]; 𝑢𝑚𝑎𝑥 640 = [0.07; 0.25]; and ∆𝑢𝑚𝑎𝑥 = [0.1; 0.1]. The tuning parameters for the control structure are 𝐶𝑦 = [0 1]; 𝐶𝑢 = [5 0]; 𝐶𝜀 = 1∙105∙[1 1]; 𝑚 = 3; 𝑄𝑦 = [1 1]; 𝑄𝑢 = [200 0]; 𝑅 = [10 10] ; 𝑆𝑦 = 1∙105∙[1 1]. The initial condition is 𝑢0 = [0.03; 0.131]; 𝑦0 = [3.9; 323.5]. Alvarez and Odloak (2012) describe more information and the data of RTO. Now, the undesired deviations presented in the HAZOP were investigated under the presence of the control structure. The deviations applied in the IHMPC with zone and safety constraint are: increasing the temperature of the reactor feed to 334 K; increasing the concentration of initiator in the feed to 0.689 mol∙L-1, and increasing the inlet temperature of cooling jacket fluid to 301 K. Figure 4 shows the profile of the controlled and manipulated variables for the failure in the temperature of the reactor feed. (a) (b) Figure 4: Profile of the (a) controlled variables; and (b) manipulated variable for the deviation in the temperature of the reactor feed at 334 K Scenario 1: In this scenario, the reactor was operating at the steady-state up to 110 hours, when occurs a failure, and the inlet reactor temperature rise from 330 K to 334 K. In this situation, there is a decreasing in the initiator flow rate, and the cooling jacket flow rate increases, to avoid the reactor temperature rising. Without the IHMPC, the temperature reactor reached about 331.5 K (being out of control zone) against 321 K. The polymer viscosity remained in the upper bound under the deviation. (a) (b) Figure 5: Profile of the (a) controlled variables; and (b) manipulated variable for the deviation in the concentration of initiator in the feed at 0.658 mol∙L-1 Scenario 2: Figure 5 describes the controlled and manipulated variables for the second deviation, such that the inlet initiator concentration rises from 0.589 to 0.658 mol∙L-1, causing an increase in the flow rate of the manipulated variables. This failure at 110 hours raised the reactor temperature from 321.4 to 322.5 K, representing a safety scenario for the safeguard developed from HAZOP. 641 (a) (b) Figure 6: Profile of the (a) controlled variables; and (b) manipulated variable for the deviation in the inlet temperature of cooling jacket fluid at 301 K Scenario 3: In this scenario, a failure causes a deviation in the inlet temperature of cooling jacket fluid at 110 hours. Avoiding failure propagation, the controller decreases both manipulated variables flow up to its lower bound to keep the reactor temperature, and polymer viscosity inside safety constraint range. With no safeguard, this deviation could cause a temperature increasing about 331 K against 323.5 K. 4. Conclusions The results of this study demonstrate that the combination of model predictive control and HAZOP, with a safety constraint can improve the safety system for industrial processes, ensuring the safeguard elaborated from dynamic simulation-based HAZOP. The safety constraint guarantees that critical process states, such as temperature, do not rise up to their limits, preventing thermal runaway of the styrene polymerization reactor. Moreover, the zone control for IHMPC can also be recognized as safe restriction in the control structure, since is a bound for the outputs. Consequently, this methodology provides a comprehensive safety approach based on control-inspired view. Acknowledgments The authors thank the financial support from CAPES (Coordenação de Aperfeiçoamento de Pessoal de Nível Superior) – Grant number 88887.337596/2019-00. References Albalawi, F., Durand, H., Christofides, P. D., 2017, Process operational safety using model predictive control based on a process Safeness Index, Computers and Chemical Engineering, 104, 76–88. Alvarez, L. A., Odloak, D., 2012, Optimization and control of a continuous polymerization reactor, Brazilian Journal of Chemical Engineering, 29(4), 807–820. Danko, M., Janošovský, J., Labovský, J., Jelemenský, Ľ., 2019, Integration of process control protection layer into a simulation-based HAZOP tool, Journal of Loss Prevention in the Process Industries, 291–303. González, A. H., & Odloak, D. (2009). A stable MPC with zone control. Journal of Process Control, 19(1), 110– 122. Janošovský, J., Labovský, J., Jelemenský, L., 2016, Automated Model-based HAZOP study in process hazard analysis, Chemical Engineering Transactions, 48, 505–510. Leveson, N. G., Stephanopoulos, G., 2014, A system-theoretic, control-inspired view and approach to process safety, AIChE Journal, 60(1), 2–14. Mokhtarname, R., Safavi, A. A., Urbas, L., Salimi, F., Zerafat, M. M., Harasi, N., 2020, Toward HaZOP 4.0 approach for managing the complexities of the hazard and operability of an industrial polymerization reactor, IFAC-PapersOnLine, 53(2), 13593–13600. Mushtaq, F., & Chung, P. W. H., 2000, A systematic Hazop procedure for batch processes, and its application to pipeless plants, Journal of Loss Prevention in the Process Industries, 13(1), 41–48. Raoni, R., Secchi, A. R., Demichela, M., 2018, Employing process simulation for hazardous process deviation identification and analysis, Safety Science, 101, 209–219. 642 294marques.pdf Model Predictive Control with Safety Constraint Embedded in Hazard and Operability Study