Fuzzy logic control of a catalytic naphtha unit

This work examines the fuzzy logic-based control of a catalytic reformer. The control process requires development of an exact process model valid over a wide range of operating conditions. Two control methods, proportional integral derivative (PID) and Fuzzy-PID, were applied to determine the optimal operating conditions. The output temperature from the feedback fuzzy controller was sent to the PID controllers as a setpoint in the heating system loop, and two fuzzy logic systems, one in the forward path and one in the feedback path were developed to give setpoints for temperature control loops in the four reactors. A fuzzy logic-based optimal control scheme was established to increase the aromatics yield, subject to constraints on the inlet temperature of the reactors. A rigorous kinetic model was then developed by expressing the heat and mass balances under unsteady state conditions. This model was used to determine the temperature and concentration profiles of three main hydrocarbons, naphthenes, paraffins, and aromatics, across the four reactors. A reaction scheme involving 27 pseudo components connected using a network of 71 reactions for components in a wide range of carbon numbers was thus modelled. The simulation results for the model were compared with previous studies to validate the model, and good agreement was found between the reformate composition of the proposed model and the plant reformate composition and temperature. The simulation results also showed that the PID –Fuzzy controller is accurate but that it requires additional time to reach a steady state value.


Introduction
The catalytic reforming of naphtha is an essential process to produce high-octane number gasoline. The process uses low octane naphtha as a feedstock to produce more valuable products with higher aromatics contents, with hydrogen and light hydrocarbons produced as side products. The necessary reactions are achieved in three or four adiabatic fixed bed reactors with heaters that are located before each reactor to reheat the stream into the reaction range. The process operates at a temperature range of between 450 and 520 °C, a total pressure range between 10 and 35 bar, and a molar hydrogen to hydrocarbons (H2/HC) ratio of 3 to 8.
Due to the increasing use of the catalytic reforming process in refining, the development of an appropriate kinetic model able to predict detailed reformate composition is required, in order to simulate catalytic reforming reactors for optimisation [1]. Dynamic modelling of the entire configuration of the catalytic reforming process is difficult, however, because it must include a series of three or four fixedbed reactors with fired heaters placed between them. At start-up conditions, the feed flows through the first reactor and the endothermic reactions cause the temperature to decrease; the temperature must therefore be raised to the same value as at the entrance of the first reactor before being fed to the next reactor, and this operation must be repeated for each reactor. Dynamic modelling of this in a series reactor-fired heater arrangement thus requires additional computing time and programming effort [2]. The influence of commercial reformer costs on overall refinery profits thus lends itself to applying process control strategies based on the application of a suitable mathematical model to rationally and accurately reproduce the main dynamics and stable gains of the process. Dynamic mathematical models are developed by compiling the mass and energy balance on the system of all reforming reactions. The mass balance gives the variation of concentrations of various components along each reactor, while the energy balance provides the variation of temperature. Mass and energy balances for each reactor can be represented by nonlinear partial differential equations in space and time, and the resulting model can be analysed over a wide range of operating conditions; a fuzzy logic-based optimal control scheme has thus been developed to control the aromatics yield. The process variable with the greatest influence on aromatics yield is the inlet temperature of the four reactors: increasing the inlet temperatures of all the reactors thus produces a higher aromatics yield.
In this work, two fuzzy logic systems, one in the forward path and the other in the feedback path, are designed to generate optimal temperature setpoints for the temperature controllers of all four reactors. The kinetic model of the catalytic reformer is simulated and, along with the simulated model, the optimal control scheme developed is used to change the setpoint of the temperature control loops to maintain the aromatics yield at the desired value even where the feed contains a low aromatics content.

Mathematical modelling of the catalytic reformer unit
A naphtha feed is very complex mixture containing several hundred components, each of which undergo various reactions. Developing a detailed model for all these components and reactions is thus a daunting task, and instead, the components can be grouped by carbon number based on similar properties and kinetic behaviours.

Kinetic model
A kinetic model describes the rates of various reactions that take place in the reformer and the associated mass and heat balance using a system of equations. The kinetic model developed by Ancheyta-Juárez and Villafuerte-Macías was used in this work because it is both simple and popular. This model takes into account the formation of cyclohexane (N6) by methylcyclopentane (MCP) isomerization (MCP↔ N6), the production of methylcyclopentane from six-carbon paraffins (P6 ↔ MCP), and the reaction path (P6 ↔ N6 ↔ A6) [3]. The importance of benzene content in reformate must be recognised, however, so in this work, the reactions in which benzene is produced were added [4].
The model is an extension of that suggested by Krane et al. [5], which used lumped mathematical modelling of 53 reactions, with all kinetics represented by 71 pseudo first order reaction steps combined into 24 rate equations, one for each component [6]. Table 1 shows all the reactions considered, together with the kinetic rate constants at 495 K. From these reaction steps, it is possible to write a set of equations that represent the net rate of reaction for each species [7].

Reactor model
The dynamic mathematical model of a fixed bed reactor was developed by assembling the material and energy balances on the system and including the kinetic model as part of the overall reactor model. Mass and energy are both partial differential equations in space and time [8]. For catalytic reactions, it is common to carry out the mass balance over a catalyst weight element (Δw) contained within the reactor rather than the reactor volume element. The mass balance under unsteady-state conditions in a catalyst weight (Δw) element is thus written as [ the following partial deferential equation is developed To convert equation (3) to a function of reactor length rather than catalyst weight, the catalyst weight may be expressed as the product of bed density and reactor volume: where z is the length of reactor. Dividing equation (4) by Ԑ/ B gives where ŕi= ri*mwt Equation (5) must then be divided by total moles of all reactants ( G) in order to substitute in the net rate of reaction of the various species in their original units: where yi = Ci/ . With regard to energy balance, the general form of packed bed reactors, as reported by [9], was utilised. The energy balance for the gas phase is written as

Reactions
while the energy balance for the solid catalyst is represented by the equation A pseudo-homogeneous model can be developed based on the fact that the temperature difference between the gas and catalyst at any axial position of the reactor is insignificant. Hence, in practical terms, Tg = TS = T, and final energy balance equation for gas and solid phase is thus [10] (ԐGCpg G + ԐsCps s) Particle density is then calculated as follows [11]: CpG is average heat capacity of all components within the reactor, and dividing equation (10) by G gives the energy balance as The heats of reaction are then determined using the following equations: ΔHR = ∑ vp Hf p -∑ vr Hf r (12) Hf i = H°f i + ∫ 298 pdT (13) with the values of standard heats of formation H°f and the constants (a, b, c, and d) used for calculating the heat capacity (Cpi) [12]. Other parameters involved in mass and energy equations were taken from Poling et al. [13], and bed porosity was calculated from a correlation reported in [14]. The partial differential equations were then solved using the backward finite difference method to discretise the partial derivatives of y and T with respect to z [15]. The main approximation of the finite difference method was based on Taylor series, which can be expanded backward to calculate a previous value based on the present value. The general form of the backward finite difference method is expressed as and the discretised mass and energy balance can be written in the following forms: For mass balance: For energy balance:

Fuzzy logic control method
No general or mathematically optimal solution can be applied to a control where the process to be controlled is complex and has high levels of variable interaction. Fuzzy logic, however, can be used to program an automatic controller to behave more like a human operator. The first application of fuzzy common-sense controllers used a set of fuzzy if-then rules to decide control actions. The first step in developing a fuzzy logic controller (FLC) is to develop a rule base based on linguistic descriptions of control protocols acquired from domain experts. Fuzzy controllers can then be built from a set of ifthen rules in the same way that a human operator controls a process by employing experience and training with regard to controlling variables [15]. A fuzzy logic system in the forward path was employed to minimise the disturbances due to the changes in feed composition. This takes aromatics concentration and rate of change of aromatics concentration as inputs and produces an optimal setpoint for the temperature controllers of the four reactors. Although the disturbances of feed composition are diminished by this feed forward fuzzy system, other disturbances due to process parameters can also disturb the yield. A further fuzzy system was thus developed in the feedback path to minimise the effect of these disturbances and to maximise the aromatics yield by manipulating the same variables as the feed forward system. The feedback fuzzy system utilises the error, the rate of change of error, and the current inlet temperature of the reactor as input and gives the required change in inlet temperature as output. This change can thus be added to the present temperature. The outputs of the feed forward and feedback fuzzy systems thus together generate the setpoint of the temperature controllers of the four reactors. The maximum values are selected and compared with the upper limit values in the selector block; if the value is greater than the upper limits, the default value is chosen to be the setpoint for the four temperature controllers [16].

Simulation work
The derived model was tested against a commercial catalytic reforming unit composed of four reactors positioned in series with interstate heaters. The following operating conditions were used for the simulation: inlet temperature of the feed of 495 °C, pressure of 10 bar, and a naphtha flowrate of 198.7 m 3 /h with 740 kg/m 3 liquid density. The feed composition is presented in table 2, while the main characteristics of each of the four commercial reactors in the semi-regenerative reforming unit simulated in this work are detailed in table 3 [1].  Table 3. Main characteristics of the commercial reactors [1].
The fuzzy logic control architecture for the catalytic naphtha reforming unit consisted of two systems, the feed forward system and the feedback system. The two inputs to the feed forward system were the change of concentration of aromatics and the rate of change of concentration, which were divided into seven fuzzy regions. For change concentration, the membership functions were quantified into equally spaced levels in the range 15 to 50, as shown in figure 1. The membership functions for the rate of change in concentration are shown in figure 2. The output from the feed forward fuzzy architecture is the inlet temperatures of the four reactors, which were divided into five regions, as shown in figure 3. The seven fuzzy sets' definition generated 49 rules, outlined in table 4.
The three inputs to the feedback system are error, change of error, and current temperature, which were divided into five equal regions. For error, the memberships functions were quantified into levels in the range 0 to 30, as shown in figure 4. The membership functions for the rate of change of error in yield are shown in figure 5, while for inlet temperature, the membership functions are shown in figure  6. The output variable is the change in temperature, which was divided into seven regions as shown in figure 7. The five fuzzy sets' definition thus generated 25 rules for each error range, making a total of 125 rules to be implemented for the feedback controller. The fuzzy rules for each change of error are shown in tables 5 to 10.          Table 5. Rules of feedback fuzzy logic system for very small error. Table 6. Rules of feedback fuzzy logic system for small error.  Table 8. Rules of feedback fuzzy logic system for medium error. Table 9. Rules of feedback fuzzy logic system for large error.

Results and Discussion
The simulation work was validated by comparing the predicted results with industrial data for a commercial semi-regenerative reforming unit with four reaction beds with interstage heaters, taken from Ancheyta-Juarez et al. (2001). Table 11 shows this comparison, highlighting that good agreement was obtained between predicted and plant data. The simulation results show an increase in light paraffins yield (P5 -P6), as these are produced by hydrocracking and hydrogenolysis; however, there is little increase in P7 paraffin. The heavier paraffins (P8 -P11) proceed to completion, especially in the last two reactors. Naphthenes with N5 to N11 carbon atoms react very fast, and their reactions proceed to completion; such naphthenes exhibit high conversion in the first and second reactors, and thus approach a very small steady state value in the last two reactors. The aromatics content increases as the feed passes through the reforming unit. There is a significant increase in light aromatics (A6 -A9), while for the heavier aromatics (A10, A11), the increase is much lower. There is a much smaller change in paraffin content in first two reactors than in the later reactors, and as the naphthene content reaches a low steady state in the third and fourth reactors, any increase in aromatics content in the final reactors must arise from the removal of paraffins during dehydrocyclization reactions. The hydrogen molar flow rates increase in all four reactors, despite the 10 differences in the types of reactions taking place in the reformer. Dehydrogenation of naphthenes and dehydrocyclization of paraffins are the most important reactions producing hydrogen. The simulated output temperatures of the four reactors were compared with the actual values, as shown in table 12. The comparison showed good agreement between the MATLAB simulation results and the actual data. The major reactions that take place in the first reactor are rapid endothermic reactions, such as the dehydrogenation of naphthenes, which cause very sharp decreases in temperature from 495 °C to 445.7 °C. This quenches all reactions, so any increase in the first reactor temperature would not increase the conversion rate or efficacy. In the second reactor, the isomerization of paraffins and dehydrogenation of remaining naphthenes reactions take place; these are less endothermically charged than those reactions in the first reactor, and only a moderate temperature drop is observed, from 495 °C to 455 °C. The temperature drops in the third and fourth reactors are even lower due to the exothermic nature of the hydrocracking of paraffins.
The comparison between the simulated and actual temperatures shows that the reactor model predictions are in line with the data reported for the commercial unit, with a maximum absolute difference between predicted and actual reactor temperature values of less than 10 °C.  The fuzzy control was built by applying the principles of fuzzy logic-based decision making to control tasks. Through this simulation, the dynamic responses to the predicted temperature of the fuzzy controller and the aromatics yield were measured with regard to step change in feed temperature, space velocity, hydrogen to hydrocarbon ratio, and aromatics set point. Initially, the aromatics content was about 58.9% which represented the desired value at 495 °C, for a 16 hr -1 space velocity and a 6.3 H2/HC ratio. The closed loop response for the fuzzy logic controller was then calculated by applying step changes in the feed temperature, hydrogen to hydrocarbon ratio, weight hourly space velocity, and the desired setpoint. The responses of the fuzzy logic controller to step changes in feed temperature are shown in figure  8. When the feed temperature was stepped from 495 °C to 480 °C, the fuzzy logic controller responded to the change by increasing the temperature set point to about 496.7 °C, a 1.7 °C offset from the optimal value, causing a disturbance in aromatics yield, and an offset of about 1% from the set point. When the feed temperature was stepped from 495 °C to 520 °C, the fuzzy controller was more accurate, however, and the temperature set point was close to optimal, with the aromatics yield showing good agreement with the desired value, as shown in figure 9.
When the hydrogen to hydrocarbon ratio was stepped from 6.3 to 4, the fuzzy controller decreased the set point temperature of the PID system from 495 °C to about 490 °C to maintain the aromatics yield at the desired value. Similarly, when the ratio was stepped from 6.3 to 8, the fuzzy controller increased the set point of the PID system from 495 °C to about 498 °C to maintain the aromatics yield at 58.9%. The responses of the fuzzy controller and the aromatics yield to the step changes in hydrogen to hydrocarbon ratios are shown in figures 10 and 11, respectively.
When the feed space velocity was stepped from 16 hr -1 to 12 hr -1 , the fuzzy output temperature was lowered to 488 °C, which represents the temperature setpoint moving to maintain the desired value of aromatics yield at 58.9%. When the space velocity was stepped from 16 hr -1 to 18 hr -1 , the fuzzy controller increased the temperature to 498 °C, as shown in figure 12. The aromatics yield showed good overall agreement with the desired value, although it was most accurate in case one, when the space velocity was stepped to 12 hr -1 , as shown in figure 13.
The response of the fuzzy logic controller to step changes in the aromatics' desired value was determined by applying disturbances in the desired setpoint of aromatics from 58.9% to 50% and 65%. When the setpoint of aromatics was stepped from 58.9% to 50%, the fuzzy logic controller reduced the inlet temperature from 495 °C to about 478 °C and the aromatics yield went to about 51.6%, an offset of 1.6% from the desired value. When the setpoint was stepped from 58.9% to 65%, the inlet temperature of the four reactors was increased from 495 °C to about 516 °C, and the aromatics yield was about 66.3% an offset of about 1.3%, as shown in figure 14.

Conclusions
A kinetic model for a naphtha catalytic reforming unit was developed and used to simulate a commercial semi regenerative unit consisting of four catalytic reforming reactors in series. This model considers the most important reactions of the catalytic reforming process, with the reformate composition of aromatics, paraffins, and naphthenes used to provide information about the extent of conversion in each of the four reactors. The simulation results showed very close agreement with actual plant data, explaining the dynamic behaviour of the system; the system also showed good response to disturbances in feed temperature, H2/HC ratio, and space velocity. The optimal control of the catalytic naphtha reforming unit was determined using fuzzy logic, with two fuzzy logic systems, one in the feed forward and the other in the feedback path utilised to give optimal temperature setpoints for the temperature controllers to maintain the aromatics content at the desired values. The fuzzy controller response to any disturbance in feed temperature, H2/HC ratio, space velocity, or desired value was reasonable.