J.M. Pinto^{1}^{*}and L.F. L. Moro^{1,2}
^{1}Department of Chemical Engineering, University of São Paulo, São Paulo SP
05508900, Phone (5511) 8182237, Fax (5511) 8132380, Email jompinto@usp.br
^{2}PETROBRAS, Petróleo Brasileiro S/A
(Received: November 18, 1999 ; Accepted: April 6, 2000 )
]]>
Abstract  The main objective of this paper is to develop a nonlinear planning model for refinery production. The model described here represents a general petroleum refinery and its framework allows the implementation of nonlinear process models as well as blending relations. This model assumes the existence of several processing units, producing a variety of intermediate streams, with different properties, that can be blended to constitute the desired kinds of products. Two realworld applications are developed, one for the planning of diesel production in the RPBC refinery in Cubatão (SP) and the other for the general production planning in the REVAP refinery in S. José dos Campos (SP). In both cases, different market scenarios were analyzed using the planning optimization and the results were compared with the current situation, in which there is no extensive use of planning decision support tools. Results revealed that there is a very large potential of profitability embedded in the planning activity, reaching several millions of dollars per year.
Keywords: production planning, oil refining, nonlinear optimization.
INTRODUCTION
]]>The potential benefits of optimization for process operations in oil refineries have long been observed, with applications of linear programming in crude blending and product pooling (Symonds, 1955). In the past 20 years, the implementation of advanced control systems in oil refineries has allowed significant production increases at the plant units. The resulting savings have created a growing interest for more powerful systems that take explicitly into account production objectives.
Petroleum refineries are increasingly concerned with the improvement of their planning operations. The existing commercial software for refinery production planning, such as RPMS (Refinery and Petrochemical Modeling System  Bonner and Moore, 1979) and PIMS (Process Industry Modeling System  Bechtel, 1993) are based on very simple models which are mainly composed of linear relations. The production plans generated by these tools are interpreted as general trends as they do not take into account more complex process models and/or nonlinear mixing properties.
On the other hand, process unit optimizers based on nonlinear complex models, which determine optimal values for the process operating variables, have become increasingly popular. However, they are restricted to only a portion of the plant. Furthermore, singleunit production objectives are conflicting and therefore contribute to suboptimal and even inconsistent production objectives.
It has also been recognized that the integration of new technologies for process operations is an essential profitability factor and that it can only be achieved through appropriate planning (Cutler and Ayala, 1993; Macchietto, 1993).
In this work, we develop a general representation for refinery process units in which nonlinear equations are considered. The unit models are composed of the blending relations and process equations. The general framework is then applied to two different productionplanning situations of two realworld oil refineries and the results are compared to the current situation where there is no extensive use of planning tools.
PLANNING MODEL
]]> A typical oil refinery generates several streams that are blended in order to specify a commercial product. Furthermore, there are products with different grades that must satisfy market demands. The model described here assumes the existence of several processing units, producing a variety of intermediate streams, with different properties, that can be blended to constitute the desired kinds of products. The topology of the refinery is defined by sets that specify the connections among units as well as among streams and units. Figure 1 presents an overview of these concepts as applied to a typical unit.
(a) The model of a typical unit is represented by the following variables:
(b) Feed flow rate: it is the combination of every incoming stream.
(c) Feed Properties: these are derived from the mixing of individual streams calculated through blending algorithms that are, in general, nonlinear. ]]>
(d) Unit operating variables: variables such as heater outlet temperature and reaction temperature are used to control the unit performance. Usually these variables influence product flow rates and properties in a very nonlinear fashion.
(e)Product flow rates: each product flow rate stream is a function of feed flow rate, feed properties and operating variables. It is important to note that since each product stream can be sent to various destinations, it may be further split into several streams.
(f) Product properties: these are functions of the feed properties and unit operating variables.
The model of a typical unit is represented by the following equations:
]]> Feed flow rate of a generic unit u: " uÎ U 
(1) 
Equation (1) shows that the feed of a processing unit u (belonging to the set of units being considered U) represented by the variable QF_{u}, is calculated by adding up all the streams, represented by the symbol s, that flow from all the other units to unit u, Q_{u’,s,u}. U_{u} is the set of u’ units that can send streams to unit u and US_{u’,u} is the set of unit u’ streams that can be sent to unit u.
Feed properties:
]]> " u Î U, p Î PF_{u} 
(2) 
Equation (2) states that the property p of the feed of unit u, represented by PF_{u,p}, is a function of the flow rates and properties of all streams that flow from other units to unit u, symbolized respectively by Q_{u’,s,u} and PS_{u’,s,p}. While Q_{u’,s,u} represents the value of a variable, Q_{u’,s,u} represents a series of values defined over a set. Function f_{u,p} denotes a mixing algorithm for the property under consideration, and is, in general, a nonlinear function. In addition, P_{s} is the set of properties of stream s and PF_{u} is the set of properties of unit u.
The flow rate of each kind of product generated by unit u is a function of the flow rate and properties of the feed of this unit as well as of the operating variables, as shown in Eq. (3):
u Î U, s Î S_{u}  (3) 
In Eq. (3), V_{u} is the set of operating variables of unit u and S_{u} is the set of product streams generated by unit u.
]]> The properties of the product streams are functions of feed properties and operating variables, as shown in Eq. (4): u Î U; p Î P_{s;} s Î S_{u}  (4) 
Each product stream, representing one kind of product can be sent to different destinations, therefore it is split in several streams, as shown in Eq. (5):
 ]]> (5) 
In Eq. (5), SU_{s,u} represents the set of u’ units that can receive stream s from unit u.
Equations (1) and (2) represent the mixing of streams that constitute the feed of a given unit. These streams are clearly defined by the sets U_{u} and US_{u’,u}, which as previously stated, comprise the u’ units that can send streams to unit u and which streams produced by u’ can be sent to unit u, respectively. The properties of the resulting feed are linear or nonlinear functions of the properties of each stream that make up this feed.
Equations (3) and (4) together define the unit process model, relating the flow rate and properties of each product stream with the unit feed flow rate and properties and operating variables. It is important to note that the total mass balance may not necessarily be satisfied due to material losses and due to the possible existence of streams that are not modeled, because they are irrelevant to the study. Moreover, the process model may be a simple set of constant yields as well as a complex set of equations, based on conservation principles and on empiric relations. Equation (5) imposes a simple material balance on the product streams that account for the possibility of multiple destinations, which can be an endofline unit, known as pool units or any other process unit.
The model objective function is to maximize the total refinery profit, defined by the revenue obtained with the products minus the feed and operating costs.
The product revenue is calculated over all the units that belong to the set U_{p}, which is the set of units that produce final products. The feed costs are defined over the set of units fed by external streams, U_{f}. The operating cost per unit feed of each processing unit is linearly dependent on the operating variables. These operating variables are, in fact, deviation variables, representing a departure from a standard value.

(6) 
The intermediate streams that can be mixed to constitute a final product are:
LPG. It is a mixture of hydrocarbons with 3 and 4 carbon atoms used as domestic fuel for cooking and heating or as a source of petrochemical intermediates.
HN (Heavy Naphtha). It is usually destined to the petrochemical industry, but can also be added to the gasoline pool.
K (Kerosene). In general it is commercialized as jet fuel.
LD (Light Diesel). It is one of the constituents of the fuel for diesel engines.
]]> HD (Heavy Diesel). It is also a constituent of diesel fuel.AR (Atmospheric Residue). It is the crude distillation column bottoms product.
HTD (Hydrotreated Diesel). It is the product of a Hydrotreating unit when the feed is the heavy diesel. It presents low sulfur and high stability.
VGO (Vacuum gasoil) It is the product recovered from the vacuum distillation of atmospheric residue. It is used as feedstock for catalytic cracking.
VR (Vacuum Residue). Vacuum tower bottoms. It is a product of low commercial value and is used as fuel oil or as feedstock for the Deasphalting unit.
ASFR (Asphaltic Residue). It is a residual product of very high viscosity, density and carbon content. Therefore it is only used as lowgrade fuel oil.
CNAPH (Cracked Naphtha). It is the main product of the catalytic cracking unit and it is also the main constituent of the gasoline pool.
LCO (Light Cycle Oil). It is a catalytic cracking byproduct and presents low stability and low viscosity used, in general, as fuel oil. If hydrotreated, it can be added to the diesel pool.
DO (Decanted Oil). It is a residual stream of the catalytic cracking process. It is highly aromatic and presents very high density and relatively low viscosity. It can be used as fuel oil or for carbon black production.
CGO (Coker gasoil). It is produced by the delayed coking process and can be added to the diesel pool, provided it is hydrotreated to reduce instability.
]]> HK (Hydrotreated Kerosene), It is a highquality product with high stability and superb combustion characteristics, used necessarily as jet fuel.The different products are defined by their specifications, which are related to physicochemical properties of the hydrocarbon mix. In this paper we considered the properties listed in Table 2.
MODELS FOR REFINING UNITS
]]> Following, we describe with more detail each one of the units modeled in the study.Crude Distillation Unit  CD_{i}
The product streams are liquefied petroleum gas (also denoted as C3/C4), naphtha (light and heavy naphtha were considered as a single stream in this work), kerosene, light diesel, heavy diesel, and atmospheric residue. A refinery frequently possesses more than one of these units and to account for that a generic crude distillatiion is represented by CDi that belongs to the set CD.
The operating variable that best represents the unit operation in this case is the reduced crude heater outlet temperature (^{O}C). Throughout this study we consider the operating variables as deviation variables with respect to a base value.
The product stream properties, written in general form in Eq. (3), are calculated as the sum of two terms. These are the base value and the contribution of operating variable, in the form of a constant gain (Moro et al., 1998):
(7) 
In Eq. (7), _{CDi,s,p} is the base value for the property PS_{CDi,s,p}, while DPS_{CDi,s,p} is the change in this property for a unit change in HOT_{1}. The values of _{CDi,s,p} and DPS_{CDi,s,p} are obtained through industrial tests and rigorous simulation. The total flow rate of each product stream is calculated in a similar manner, but using yields:
QS_{CDi,s} = QF_{CDi} . (_{CDi,s} + D Y_{CDi,s} . ]]> . HOT_{i}) " sÎ S_{CDi}, CDi Î CD  (8) 
The yield base value is a function of crude oil composition. A yield database with several crude oils was used in this work.
Vacuum Distillation unit  VDj
Vacuum gasoil and vacuum residue are produced in this unit, which receives as feedstock atmospheric residue from the atmospheric distillation units. The unit model simply relies on constant yields. For this unit we considered a constant operating cost per unit feed; therefore the unit operating cost is simply a constant value multiplied by the unit feed rate.
Catalytic Cracking Unit  FCC
]]> The product streams of the FCC unit are C3/C4, cracked naphtha, light cycle oil and decanted oil. No operating variables are considered for the FCC unit. The reaction temperature, however, could be used for this purpose. This unit receives vacuum gasoil from the vacuum unit and deasphalted oil from the Deasphalting unit as feed streams.The model for this unit is also a simple yield model with linear corrections for feed properties. In this model we only considered the feed carbon residue (RCR) as a meaningful feed property.
Propane Deasphalting Unit  PDA
This unit processes the residue from the vacuum distillation unit and produces deasphalted oil (DAO), used as cracking feed, and the asphaltic residue (ASFR) which, as a residual fraction, can only be used to produce lowgrade fuel oil. No operating variables were considered although the extraction fraction could be an adequate choice. The product flow rates are calculated using constant yields and the operating cost is considered proportional to the feed rate.
Hydrotreating Units  HT_{k}
As a rule, oil refineries are provided with hydrotreating units, called HDTs, adapted to the processing of kerosene and diesel. In this study it is assumed the existence of several hydrotreating units, belonging to the set HT. This set is the result of merging the set of kerosene hydrotreating units HTK and the set of diesel hydrotreating units HTD. These units change some properties of the feed oil but have little influence over its flow rate. In our study we considered the product flow rate equal to the feed flow rate.
]]> The feed properties are calculated using a mixing algorithm as expressed by Eq. (9):
" HTkÎ HT, pÎ PF_{HTk }  (9) 
_{ }
Function f_{HTk,p} in (9) is nonlinear for most properties. Below we show, as an example, the equation for the Flash Point (FP) in the hydrotreating unit 3 (HT3):
]]> (10) 
where:
u={CD1,FCC},S_{CD1}={HD}, S_{FCC}={LCO}  (11) 
]]> The variables I_{CD1,HD,FP} and I_{FCC,LCO,FP} used in Eq. (10) and defined in Eq. (11) are the flash point mixing indexes. Similar indexes are defined for the remaining properties.
The most important hydrotreating unit operating variable is the hydrotreating severity (HTS) that is the degree of sulfur removal, expressed in weight fraction. The other properties remain unaffected by the hydrotreating process. The operating cost of a hydrotreating unit is proportional to the feed flow rate and to the severity.
Delayed Coking Unit  CK
This unit processes the vacuum residue and produces coke, a solid product similar to mineral coal, and coker gasoil (CGO), which is a product that boils in the same temperature range as the diesel oil. Due to the relative inflexibility of the coke yield and destination, it will not be considered in this study and so the coker gasoil is the only product taken into account. No operating variables were considered for this unit and both the CGO yield and properties are fixed.
C_{3}/C_{4} Fractionation Unit  DEPROP
This unit receives part of the C3/C4 produced at the FCC and distillation units and fractionates it into a stream rich in hydrocarbons with 4carbon atoms (C_{4}) and another rich in 3carbon atoms (C_{3}). The C_{3} stream is either sent to the propane pool or to the LPG pool. The C_{4} stream is used as feedstock for MTBE production or injected into the gasoline pool or sent to the LPG pool. The MTBE is a gasoline additive produced in the refinery and considered int this study, as explained in 3.8. We did not consider the existence of operating variables for this unit. The product streams flow rates are calculated through a fixed yield model.
]]>MTBE Production Unit  UMTBE
This unit receives the stream rich in C_{4} from the C_{3}/C_{4} fractionating column, and generates a stream rich in isobutene, which further reacts with methanol in order to produce MTBE (methyltertbutylether). In addition to this main product the unit also generates a byproduct stream constituted basically of nonreacted C_{4}, known as "raffinate", that can be sent to the LPG or butane pool. No operating variables were considered for this unit and therefore the product flow rates (raffinate and MTBE proper) are calculated using constant yields.
Product Pools
A product pool unit is simply a sink of streams. The unit model is composed by equations that account for the mixing of feed streams. There are several units of this kind representing the storage of each finished product of the refinery, ready to be marketed. The feed properties are calculated using the property indexes as previously explained. These units are not considered processing units and so do not modify the feed properties.
Feed Units (FEED)
]]>A unit of this type is simply a source of external streams. Several units may be present in a processing structure, but in the case of oil refineries only one unit, representing the crude oil, is considered. The modeling of these units presents no particular difficulties and it is similar to the previous cases with the particular aspects that the feed properties and flow rate are not changed.
EXAMPLE 1  REFINERYWIDE PLANNING
The first realworld case to be presented is the production planning of a moderately complex refinery, which include all the relevant products. The model was applied to the production planning of the Petrobras Henrique Lage refinery, located in S. José dos Campos. This refinery has one crude distillation unit (CD1), one vacuum distillation (VD1), one FCC unit (FCC), one Propanedeasphalting (PDA), three hydrotreating units (two for kerosene and one for diesel, referred to as HT1, HT2 and HT3), one C_{3}/C_{4} separation (DEPROP) and one MTBE production unit (UMTBE). Figure 2 shows the units, streams, and destinations of each stream modeled in this study. The objective is to analyze different market scenarios and to compare the different production frameworks in terms of profitability.
]]>
Two cases will be presented in this study. In the first case we tried to reproduce as closely as possible the current situation in terms of stream allocation, while in the second case we considered that the market has unlimited demand for any product, provided that all specifications are honored (free market). Although this situation does not occur in practice, it allows the evaluation of the profit improvement margin that can be achieved with planning optimization.
The modeling system GAMS version 2.25 (Brooke et al., 1992) was used to implement the refinery planning model, which was solved using the CONOPT algorithm, based on the generalized reduced gradient method.
Table 3 shows a comparison of the operating conditions of each processing unit (feed flow rates and operating variables). This table shows that the optimization increases the crude distillation severity, which in turn increases the production of heavy diesel (HD) at the expense of atmospheric residue. As a result of that the vacuum distillation feed flow rate is decreased and the diesel hydrotreating unit feed flow rate increases.
The optimization results show an increase in gasoline and jet fuel production, which are the most profitable products. The increase in gasoline production is obtained by the allocation of most of the Heavy naphtha to the gasoline pool, this allocation being limited by the octane specification. Some Heavy naphtha is also allocated to the metropolitan diesel pool, which decreases the sulfur content of this product. The naphtha addition to diesel is limited by the minimum density specification. Table 4 compares the allocation of CD1 streams and Table 5 shows a comparison of product flow rates and properties between base case and free market case.
]]>
It is important to stress that the comparison between the objective function values of both cases reveals a difference of US$ US$ 179.000/day, favoring the free market case. This difference, that reaches more than US$ 60.000.000/year, shows the huge profit enhancement potential embedded into the production planning activity applied to the petroleum refining process.
EXAMPLE 2  DIESEL PRODUCTION OF A COMPLEX REFINERY
]]>In this second case the model previously described was applied to the production planning of a complex refinery, that has the diesel fuel as its main product. This is the case of the Cubatão refinery. The units and streams not directly involved with diesel production were not considered in this study. The refinery is composed of three atmospheric distillation units, two vacuum distillation units, one FCC unit, one delayed coking (CK) unit, one diesel hydrotreating unit and three product pools. Figure 3 shows the flow sheet of refinery diesel production.
This refinery produces three types of diesel oil of which the Metropolitan Diesel, characterized by low sulfur levels is the most valuable. The lowvalued Maritime Diesel has high flashing point for safety reasons and the Regular Diesel is used in areas with no special concern for atmospheric pollution.
Currently the diesel production framework is defined without the aid of a computer optimization algorithm and the stream allocation is made based on prior experience, with the aid of manual calculations. In this way the production does not fully exploit all the opportunities presented by the market. As a result there are qualitygiveaways due to overspecification, which decreases the profitability.
The optimization algorithm was able to define a new point of operation, increase the production of more valuable oil, pushing the diesel specifications closer to the their constraints. As a result the production of metropolitan diesel was greatly increased, while the less valuable oil, the maritime, was kept at the minimum. This new operating point represents an increase in profitability of about US$ 6,000,000 per year.
]]> CONCLUSIONS
In this work we presented a general framework for building planning models for petroleum refineries. The model is composed of a representation of the refinery processing units and their interconnections and involves equations to represent the performance of such units as well as to represent the mixing of process streams. The result of this modeling process is a continuous nonlinear optimization problem that can be solved with the available algorithms. The application of this model to two different realworld situations showed the huge potential economic benefit associated to the improvement of production planning of petroleum refineries.
NOMECLATURE
Sets
CD  set of crude distillation units. 
HT  set of hydrotreating units 
HTD  set of diesel hydrotreating units. 
HTK  set of kerosene hydrotreating units. 
P_{s}  set of properties of stream s. 
PFu  set of feed properties of unit u. 
S_{u}  set of unit u streams. 
SU_{s,u}  set of units that can receive stream s from unit u. 
U_{p}  set of pool units 
U_{f}  set of units fed from external streams. 
U_{u}  set of u’ units that can send streams to unit u. 
US_{u’,u}  set of unit u’ streams that can be sent to unit u. 
VD  set of vacuum distillation units. 
V_{u}  set of operating variables of unit u. 
Indices
p  property 
s  product stream. 
u / u’  processing unit. 
v  operating variable. 
Variables
Cf_{u}  price of unit u feed ($/m^{3}). 
Cp_{u}  price of unit u feed ($/m^{3}). 
Cr_{u}  standard operating cost of unit u per volume of feed ($/m^{3}). 
Cr_{PDA}  standard operating cost of PDA unit per volume of feed ($/m^{3}). 
Cr_{HTk}  standard operating cost of HTk unit per volume of feed ($/m^{3}). 
Cv_{u,v}  cost of operating variable v of unit u per volume of feed ($/m^{3}). 
PF_{u,p}  value of property p of unit u feed. 
PS_{u’,s,p}  value of property p of stream s from unit u’. 
QF_{u}  volume of unit u feed (m^{3}). 
Q_{u’,s,u}  volume of stream s from unit u’ sent to unit u (m^{3}). 
QS_{u,s }  volume of stream s from unit u (m^{3}). 
]]> REFERENCES
Ballintjin, K., Optimization in refinery scheduling: modeling and solution, in Optimization in industry, vol. 3; Ciriani, T.A. and Leachman, R.C. eds., pp. 191199, John Wiley & Sons, New York (1993). [ Links ]
Bechtel Corp., PIMS (Process Industry Modeling System) User's manual, version 6.0, Houston (1993). [ Links ]
Bonner and Moore Management Science, RPMS (Refinery and Petrochemical Modeling System) A system description, Houston (1979). [ Links ]
Brooke, A.; Kendrick, D. and Meeraus, A., GAMS  A user's guide (release 2.25), The Scientific Press, San Francisco (1992). [ Links ]
Cutler, C.R. and Ayala, J.S., Integrating offline schedulers with real time optimizers, presented at the National AIChE Spring Meeting, paper 40a, Houston, (1993). [ Links ]
Lee, H.; Pinto, J.M.; Grossmann, I.E. and Park, S. MILP model for refinery short term scheduling of crude oil unloading with inventory management, Industrial Engineering Chemistry Research, 35, No. 5, p. 16301641 (1996). [ Links ]
Macchietto, S., Bridging the gap  integration of design, operations scheduling and control, in Foundations of Computer Aided Process Operations, Rippin D.W.T., Hale J.C., Davis J.F. eds., CACHE, Austin, p. 207230 (1993). [ Links ]
Moro, L.F.L.; Zanin, A.C. and Pinto, J.M., A Planning Model for Refinery Diesel Production, Computers & Chemical Engineering, 22 (Suppl.), p. S1039S1042 (1998). [ Links ]
Shah, N., Mathematical programming techniques for crude oil scheduling, Computers & Chemical Engineering, 20 (Suppl.), p. S1227 S1232 (1996). [ Links ]
Symonds, G. H., Linear Programming: The solution of refinery problems, Esso Standard Oil Company, New York (1955). [ Links ]
*To whom correspondence should be addressed
]]>