DOI: 10.3303/CET25115012 Paper Received: 18 October 2024; Revised: 03 December 2024; Accepted: 19 January 2025 Please cite this article as: Rahim M.A., Hassan O., Ahmed M.A., 2025, Quality Enhancement of Dar Crude Oil Pre-processing Using Model Predictive Control, Chemical Engineering Transactions, 115, 67-72 DOI:10.3303/CET25115012 CHEMICAL ENGINEERING TRANSACTIONS VOL. 115, 2025 A publication of The Italian Association of Chemical Engineering Online at www.cetjournal.it Guest Editors: Carlo Pirola, Antonio Espuña, Sabrina Copelli Copyright © 2025 AIDIC Servizi S.r.l. ISBN 979-12-81206-16-8; ISSN 2283-9216 Quality Enhancement of Dar Crude Oil Pre-Processing Using Model Predictive Control Mohamed A. Rahima*, Omnia Hassanb, Mohammed A.S. Ahmedc aDepartment of Chemical Engineering, University of Bahrain, Sakhir, Kingdom of Bahrain bChemical Engineering Department, Al-Neelain University, Khartoum, Sudan c International Sustainability Academy, Hamburg, Germany maosman@uob.edu.bh In large-scale industries such as oil refineries and petrochemicals, it is necessary to implement an advanced control strategy. This is of great importance, particularly in separation processes where high energy consumption is required during the operation. Thus, to implement a control system that guarantees high control efficiency with less energy and heat consumption, the first and second-stage separators in Central Processing Facilities (CPFs) operated with conventional PID controllers are replaced with a higher layer of Model Predictive Controller (MPC). In this paper, Aspen HYSYS software is used to characterize the Dar blend in the Sudanese oil field. Later, the existing PID controllers in the separators are simulated to reflect the current operation. The PID controllers are employed to control the liquid level in the first-stage separator and the bulk liquid temperature in the second-stage separator. Then, MATLAB System Identification Toolbox is used to identify the process model to be applied for the MPC controller. Finally, disturbance rejection and set-point tracking are applied for both PID and MPC controllers to assess and compare the performance of each controller quantitatively. The research revealed satisfactory performance in terms of disturbance rejection for both controllers with smoother operation and minimal load on the control valve in the MPC implementation case. Nevertheless, for the set-point tracking, the MPC controller exhibited a remarkably faster response that is nearly half the time required by the PID controller. 1. Introduction The critical goal of chemical process simulation is to characterize a process of chemical or physical conversion using mathematical models that comprise the determination of mass and energy balances together with phase equilibrium and chemical kinetics equations (Gmehling, Kleiber et al. 2019), (McBride and Sundmacher 2019). These mathematical models also comprised of equipment or process operations and physical or chemical properties represented by differential-algebraic equations, linear and nonlinear equations (Gil Chaves, López et al. 2016, Khayyam, Jazar et al. 2020). Mathematical models like other types of models that are used in chemical engineering, for design, scale- up/down, optimization, operation of reactors, separators, and heat exchangers (Haydary 2019, Zhao, Cheng et al. 2019, Hashmi, Mali et al. 2022). Mathematical models are similarly applied in the planning and assessment of experiments and for evolving mechanistic understanding of complex processes and they exist as computer programs or sets of mathematical formulas ( Alvear, Orabona et al. 2023). One of the main applications of mathematical models in industry is Model Predictive Control (MPC). The primary idea of MPC is to predict the system behaviour using a predefined mathematical model and optimize this prediction to provide the optimal decision regarding the control moves at present. Hence, mathematical models are the base of all the MPC formulations (S Taheri 2022). Since the initial state is used to determine the optimal control move of the dynamic system in MPC, a fundamental concept is applied to the MPC where the previous measurements are used to decide the most probable initial state of the system (Wang, Zheng et al. 2022). However, the implementation of the MPC has yet to be widely spread compared to the conventional Proportional Integral (PID) Controller. 67 https://scholar.google.com/citations?user=PTJ0QIQAAAAJ&hl=en&oi=sra Most of the control loops in petroleum refineries and large-scale plants are Multi-Input Multi-Output (MIMO) control loops. However, the problem arises because each controller output does not merely adjust a specific process variable. Instead, it also upsets other process variables in the system. Tuning MIMO PID controllers is a very challenging task in large-scale plants where too many decentralized PID controllers work independently and, subsequently produce a severe degradation in the control performance of the whole plant (Al-Naumani and Rossiter 2017). The MPC approach stands out owing to its capability to provide an optimal control performance to large-scale, nonlinear, complex, and highly interacting multivariable systems. In addition, the MPC framework gives excellent results and is much better than the PID when high noise occurs in the system due to possessing the PID system with the Kalman noise filter (Ibrahim, Kamran et al. 2021). On the other hand, the PID shows more effectiveness in disturbance and gives the systems greater flexibility and relative stability (Okasha, Kralev et al. 2022). The main objectives of the research are first: to simulate and model the dynamic system of the first and second- stage separators operating with Dar blend in the CPF and secondly, to improve the control performance by replacing the existing PID controllers with a high layer of MPC and ensure stable operation for the plant under multivariable closed-loop system, and finally to quantitatively assess the level of improvement attained in terms of smooth operation, setpoint tracking and disturbance rejection. 2. Materials and Methods In this section, the separation unit which contains first, second-stage separators and a heater, is simulated in a process flowsheet using Aspen HYSYS. All operating conditions and data to develop the process flowsheet in HYSYS as shown in Figure 1 were obtained from PETRODAR Operating Company, Sudan. Figure 1: Process Flowsheet 2.1 Oil specification The following Tables 1 and 2 are used to develop the steady-state mode by first characterizing the assay of the Dar blend using the physicochemical characterization of the blend delivered by the laboratory report from (Central Petroleum Laboratories 2019). The crude assay is stored in the HYSYS data bank, then the blend is calculated and the dynamic state process is constructed. Table 1. Crude Oil Production Description Quantity Feed (crude oil + water + gas) 150000 bbl/day Water cut 26% by volume Associated gas 3.12 % Weight 68 Table 2. Crude Oil Characteristics of Dar Blend Test Method Unit Results Density at 15°C ASTM D5002 g/cm³ 0.8964 Specific Gravity ASTM D5002 Degree 0.9141 API Gravity ASTM D5002 23.30 Kinematic Viscosity @50°C ASTM D445 mm²/s 440.5 Kinematic Viscosity @70 °C ASTM D445 mm²/s 139.8 Pour Point ASTM D97 °C 39 Asphaltine Content IP 143 % Wt 0.27 Total Acid Number ASTM D664 Mg KOH/g 4.45 Total Sulphur ASTM D4294 % m 0.1129 To compute the properties and the composition of the feed, the feed is characterized by describing relative crude assays and blends according to the information supplied (Central Petroleum Laboratories 2019). 2.2 Demulsifier A demulsifier is injected into the mixer as shown in Figure 1 to stimulate the separation of the oil-water emulsion by disrupting the interfacial film between the water and the oil droplets. Different commercial demulsifier species are available in the market. However, in this simulation, a 60% DEGlycol solution in xylene solvent was used. In the simulation, the following operating conditions were considered: 40°C, 400 kPa and 0.56 kmole/hr for temperature, pressure and molar flow, respectively. Then, the volume fraction of DEGlycol is specified as 0.6, m-xylene is 0.24 and o-xylene is 0.08. 2.3 Implementation of PID Level Indicator Controller (LIC) and Temperature Indicator Controller (TIC) In the LIC controller, as shown in Figure 2, the following parameters were specified: process variable range, PV minimum is 0% and PV maximum is 100%. The controller mode was changed from manual to auto and the set-point was specified and set equal to 70%, while the PID tuning parameters were set to Kc= 3, Ti= 1.5, and Td= 0.5. This level controller has a direct action, because when the liquid level increases inside the separator and becomes greater than the set point the valve opens more. To control the temperature in the second separator, PV in the TIC-100 controller is chosen as an object, Bulk Liquid Temperature is chosen as a variable and the operational parameters were set as follows: PV min=50°C, PVmax = 90°C, Set-point = 80°C while the PID tuning parameters were set to Kc= 1, Ti= 0.5, and Td= 0.1. 2.4 Step test for the dynamic model estimation for the MPC I. The step test is applied to the TIC-100 controller II. The bulk liquid temperature was defined as a CV while the TIC-100 opening was set as a MV. III. The set point for bulk liquid temperature was set at 80°C, all the controllers were initially run in automatic mode until reaching the steady state IV. Then the TIC-100 controller was changed to manual mode and the step test was applied with 12 steps of random input moves V. The data was stored in Aspen HYSYS historical data and exported to MATLAB Identification Toolbox. 2.5 System Identification (Process Model Estimation) The collected data of the step test from Aspen HYSYS is used for the process modeling stage by MATLAB System Identification Toolbox. A First Order Plus Time Delay (FOPTD) model was obtained with a process gain - 0.46, process time constant 3.41min and time delay 1.6 min. 2.6 MPC Implementation A state-space model of the decentralized structure of a plant consisting of M subsystems can be denoted using a linear discrete LTI model as follows 𝑥𝑖𝑖(𝑘 + 1) = 𝐴𝑖𝑖𝑥𝑖𝑖(𝑘) + 𝐵𝑖𝑖𝑢𝑖(𝑘) (1) Where, 𝐴𝑖𝑖 ∈ ℝ𝑛𝑖𝑖×𝑛𝑖𝑖 , 𝐵ii ∈ ℝ𝑛𝑖𝑖×𝑚𝑖 , 𝐶𝑖𝑖 ∈ ℝ𝑧𝑖×𝑛𝑖𝑖 is a realization for each input-output (𝑢𝑖 , 𝑦𝑖) pair such that (𝐴𝑖𝑖 , 𝐵𝑖𝑖) is stabilizable and (𝐴𝑖𝑖 , 𝐶𝑖𝑖) is detectable. 69 2.6.1 Interaction Models (IM) The Linear discrete Time Invariant LTI model is implemented to denote the influence of any interacting subsystem 𝒋 ∈ 𝕀𝑴, 𝒋 ≠i on subsystem 𝒊 ∈ 𝕀𝑴 𝑥𝑖𝑗(𝑘 + 1) = 𝐴𝑖𝑗𝑥𝑖𝑗(𝑘) + 𝐵𝑖𝑗𝑢𝑗 (2a) The equation for each subsystem is formulated as 𝑦𝑖(𝑘) = ∑ 𝐴𝑖𝑗𝑥𝑖𝑗(𝑘)𝑀 𝑗=1 (2b) To define the cost function of the decentralized control structure, the controller samples the state of the system 𝑥𝑖𝑖(𝑘) at decision instant k, and then solves an optimization problem of the following form to determine the control moves 𝐽𝑖(𝑥𝑖𝑖(𝑘), 𝑢𝑖(𝑘))𝑥𝑖𝑖(𝑘),𝑢𝑖(𝑘) min (3a) subject to: 𝑥𝑖𝑖(𝑙 + 1|𝑘) = 𝐴𝑖𝑖𝑥𝑖𝑖(𝑙|𝑘) + 𝐵𝑖𝑖𝑢𝑖(𝑙|𝑘), 𝑘 ≤ 𝑙 (3b) 𝑢𝑖(𝑙|𝑘) ∈ 𝛺𝑖 , 𝑘 ≤ 𝑙 (3c) 𝑥𝑖𝑖(𝑘) = �̂�𝑖𝑖(𝑘) (3d) The subsystem cost function in the decentralized MPC structure is 𝐽𝑖(𝑥𝑖𝑖(𝑘), 𝑢𝑖(𝑘)) = 1 2 ∑ [𝑥𝑖𝑖(𝑡|𝑘)′𝑄𝑖𝑖𝑥𝑖𝑖(𝑡|𝑘) +∞ 𝑡=𝑘 𝑢𝑖(𝑡|𝑘)′𝑅𝑖𝑢𝑖(𝑡|𝑘) (3e) 3. Results and Discussion The obtained process model was used as an internal model for the MPC controller in Aspen HYSYS. The process variables range was adjusted from 50 °C to 90 °C and the set point was set to 80 °C. Figure 2: Implementation of the MPC controller To evaluate the disturbance rejection capability of both controllers, the MPC controller was compared to the PID controller in terms of their ability to maintain the liquid temperature in the presence of disturbances in the feed flow rate. To test the MPC controller, the PID (TIC-100) was deactivated and the MPC was put in auto mode. Under this auto mode, the feed flow rate was changed from 150000 barrels/day to 160000 barrels/day in the dynamic process flowsheet. Then to test the PID controller, the MPC was put in manual mode, and the PID was put in auto mode and the same previous steps were done. The performance of the MPC and PID controllers is shown in Figures 3a and 3b, respectively. The MPC controller and the PID controller were also evaluated in terms of set-point tracking. The set-point of the liquid temperature in the second separator was changed from the steady-state temperature 80 oC to 65 oC, and then it was set back to 80 oC. This step test was done twice. First by putting the PID controller in auto mode while deactivating the MPC controller and secondly by reversing the setting by deactivating the PID controller 70 and keeping the MPC controller in auto mode. Finally, the response of the MPC and PID controllers to this setpoint change was evaluated and compared as shown in Figures 4a and 4b, respectively. Figure 3a: Response of MPC controller for disturbance rejection Figure 3b: Response of PID controller for disturbance rejection MPC and PID controllers show good performance in disturbance rejection. Both controllers took approximately four minutes to bring back the liquid temperature at the second-stage separator to 80 oC when the feed flow rate stepped from 150000 barrels/day to 160000 barrels/day. However, from Figures 3a and 3b (the blue lines), it is obvious that the response of the MPC is less oscillatory and has less valve opening (73.58) compared to the valve opening of the PID controller which is 75.25%, meaning that there is a minimal load applied on the final control element (the control valve), and subsequently, a smooth operation while maintaining the life span of the control valve. Figure 4a: Response of MPC controller for set-point tracking Figure 4b: Response of PID controller for set-point tracking Figure 4b shows that the PID controller took nearly 11 minutes to track the new set-point. Nevertheless, as seen in Figure 4a, the MPC controller reached the new set-point faster than the PID controller. The MPC shows more superb set-point tracking, taking less than 5 minutes to track the new set-point. 4. Conclusions This study aims to improve the overall control performance in the CPF plant by obtaining better set point tracking and disturbance rejection. This can ultimately lead to more energy conservation and smooth operation. Toward this end, the existing PID controllers in the CPF are upgraded with a higher layer of advanced control strategy, namely, the MPC controller. After characterizing the Dar blend crude oil, the flowsheets for the first and 71 second-stage separators in both steady-state and dynamic state are developed. Both controllers are implemented in the simulated flowsheet in HYSYS to be compared and evaluated. The MPC and the PID controllers are compared in terms of their ability to maintain the liquid temperature when disturbances are applied to the feed flow rate. In general, both controllers performed well in the disturbance rejection, yet, the MPC controller performed smoothly while acting on the final control element. This ultimately leads to more energy saving and additional lifetime for the control valve. In terms of set-point tracking, the MPC controller showed remarkable improvement with less oscillatory response and shorter settling time of about 5 minutes, almost equal to half of the time required by the PID controller, which was 11 minutes. Nomenclature A i j - State transition matrix of subsystem j to i A i - State transition matrix of subsystem i B i j - Input matrix of subsystem j to subsystem i B i - Input matrix of subsystem i C i j - Output matrix of subsystem j to subsystem i k - Sampling time J i (x i , u i ) Cost function of subsystem i m i - Input dimension of subsystem i M - Number of subsystems N - Finite control horizon p - Iterate of optimization problem Q I - Output weighting matrix R i - Input weighting matrix u i - Input (manipulated variable) of subsystem i up - Optimal input trajectory x i - State vector of subsystem i x ij - State interaction vector of subsystem j to i ɛ - Slack variable References Al-Naumani, Y. and J. Rossiter (2017). "Gas Phase Train in Upstream Oil & Gas Fields: PART-III Control System Design." IFAC-PapersOnLine 50(1): 13735-13740. Alvear, M., F. Orabona, K. Eränen, J. Lehtonen, S. Rautiainen, M. Di Serio, V. Russo and T. Salmi (2023). "Epoxidation of light olefin mixtures with hydrogen peroxide on TS-1 in a laboratory-scale trickle bed reactor: Transient experimental study and mathematical modelling." Chemical Engineering Science 269: 118467. Central Petroleum Laboratories, M. o. E., Sudan (2019). "DAR blend, Crude Assay Dar blend using physicochemical characterization ". Gil Chaves, I. D., J. R. G. López, J. L. García Zapata, A. Leguizamón Robayo, G. Rodríguez Niño, I. D. G. Chaves, J. R. G. López, J. L. G. Zapata, A. L. Robayo and G. R. Niño (2016). "Process simulation in chemical engineering." Process Analysis and Simulation in Chemical Engineering: 1-51. Gmehling, J., M. Kleiber, B. Kolbe and J. Rarey (2019). Chemical thermodynamics for process simulation, John Wiley & Sons. Hashmi, A. W., H. S. Mali, A. Meena, K. K. Saxena, A. P. V. Puerta, C. Prakash, D. Buddhi, J. Davim and D. S. Abdul-Zahra (2022). "Understanding the mechanism of abrasive-based finishing processes using mathematical modeling and numerical simulation." Metals 12(8): 1328. Haydary, J. (2019). Chemical process design and simulation: Aspen Plus and Aspen Hysys applications, John Wiley & Sons. Ibrahim, M. M., M. A. Kamran, M. M. N. Mannan, I. H. Jung and S. Kim (2021). "Lag synchronization of coupled time-delayed FitzHugh–Nagumo neural networks via feedback control." Scientific reports 11(1): 3884. Khayyam, H., R. N. Jazar, S. Nunna, G. Golkarnarenji, K. Badii, S. M. Fakhrhoseini, S. Kumar and M. Naebe (2020). "PAN precursor fabrication, applications and thermal stabilization process in carbon fiber production: Experimental and mathematical modelling." Progress in Materials Science 107: 100575. McBride, K. and K. Sundmacher (2019). "Overview of surrogate modeling in chemical process engineering." Chemie Ingenieur Technik 91(3): 228-239. Okasha, M., J. Kralev and M. Islam (2022). "Design and Experimental Comparison of PID, LQR and MPC Stabilizing Controllers for Parrot Mambo Mini-Drone." Aerospace 9(6): 298. Stewart, B. T., A. N. Venkat, J. B. Rawlings, S. J. Wright and G. Pannocchia (2010). "Cooperative distributed model predictive control." Systems & Control Letters 59(8): 460-469. Wang, H., X. Zheng, X. Yuan and X. Wu (2022). "Low-complexity model-predictive control for a nine-phase open-end winding pmsm with dead-time compensation." IEEE transactions on power electronics 37(8): 8895-8908. Zhao, W., Y. Cheng, Z. Pan, K. Wang and S. Liu (2019). "Gas diffusion in coal particles: A review of mathematical models and their applications." Fuel 252: 77-100. 72 250Rahim-PAGATO.pdf Quality Enhancement of Dar Crude Oil Pre-Processing Using Model Predictive Control