## Services on Demand

## Journal

## Article

## Indicators

## Related links

## Share

## Brazilian Journal of Chemical Engineering

##
*Print version* ISSN 0104-6632*On-line version* ISSN 1678-4383

### Braz. J. Chem. Eng. vol.19 no.2 São Paulo Apr./June 2002

#### http://dx.doi.org/10.1590/S0104-66322002000200008

**PLANNING AND SCHEDULING FOR PETROLEUM REFINERIES USING MATHEMATICAL PROGRAMMING**

M.Joly^{1}, L.F.L.Moro^{1,2} and J.M.Pinto^{1* }^{1}Department of Chemical Engineering, University of São Paulo

05508-900, São Paulo - SP, Brazil.

E-mail: jompinto@usp.br

^{2}PETROBRAS, Petróleo Brasileiro S/A

*(Received: December 20, 2001 ; Accepted: April 17, 2002)*

Abstract -The objective of this paper is the development and solution of nonlinear and mixed-integer (MIP) optimization models for real-world planning and scheduling problems in petroleum refineries. Firstly, we present a nonlinear planning model that represents a general refinery topology and allows implementation of nonlinear process models as well as blending relations. The optimization model is able to define new operating points, thus increasing the production of the more valuable products and simultaneously satisfying all specification constraints. The second part addresses scheduling problems in oil refineries, which are formulated as MIP optimization models and rely on both continuous and discrete time representations. Three practical applications closely related to the current refinery scenario are presented. The first one addresses the problem of crude oil inventory management of a refinery that receives several types of crude oil delivered exclusively by a single oil pipeline. Subsequently, two optimization models intended to define the optimal production policy, inventory control and distribution are proposed and solved for the fuel oil and asphalt plant. Finally, the planning model of Moro et al. (1998) is extended in order to sequence decisions at the scheduling level in the liquefied petroleum gas (LPG) area for maximization of the production of petrochemical-grade propane and product delivery.: optimization, planning, scheduling, operations research, mixed-integer programming.

Keywords

INTRODUCTION

The eighties were characterized by the emergence of international markets and the development of global competition. The chemical processing industry had to restructure in order to compete successfully in this new scenario and better economic performance with more efficient plant operation has been achieved (Moro et al., 1998).

Implementation of advanced control systems in oil refineries generated significant gains in productivity of the plant units. These results increased the demand for more complex automation systems that take into account production objectives. As a result, unit optimizers were introduced.

Nevertheless, the optimization of production units does not assure the global economic optimization of the plant. The objectives of individual units are usually conflicting and thus contribute to suboptimal and many times infeasible operation. The lack of computational technology for production scheduling is the main obstacle to the integration of production objectives into process operations (Barton et al., 1998). A more efficient approach would incorporate current and future constraints in the synthesis of production schedules. The short-term production objectives must be translated into operating conditions for the processing units. Such an approach supplies an analytical tool for the effect of economic disturbances in the performance of the production system and provides mechanisms to account for commercial and technological uncertainties.

This paper describes the approach taken in the development of optimization models for production planning and scheduling of oil refineries. The plant is divided into subsystems, which although coupled, allow development of the representation of the main scheduling activities within relevant time horizons. The final objective is to develop strategies for incorporating these models in an automated planning and scheduling system that generates short-term schedules.

This paper is organized as follows: first, an overview of planning and scheduling activities in oil refineries is introduced. Developments in mixed-integer representations for nonlinear planning models are presented, followed by a discussion of optimization work in refinery scheduling with applications in crude oil management, production and distribution of oil products, such as fuel oil, asphalt and LPG. Finally, conclusions are drawn and current as well as future developments are presented.

OVERVIEW OF PLANNING AND SCHEDULING IN OIL REFINERIES

The potential benefits of optimization for process operations in oil refineries with applications of linear programming in crude blending and product pooling have long been observed (Symonds, 1955). Oil refinery management is increasingly concerned with improving the planning of their operations. The major factor, among others, is the dynamic nature of the economic environment. Companies must assess the potential impact of variations in demands for final product specifications, prices and crude oil compositions or even be able to explore immediate market opportunities (Magalhães et al., 1998). Coxhead (1994) identifies several applications of planning models in the refinery and oil industry, such as crude selection, crude allocation for multiple refineries, partnership models for raw material supply and operations planning.

The availability of LP-based commercial software for refinery production planning, such as PIMS (Process Industry Modeling System - Bechtel, 1993), has allowed the development of general production plans for the whole refinery, which can be interpreted as general trends. As pointed out by Pelham and Pharris (1996), planning technology can be considered well developed and major breakthroughs should not be expected. The major advances in this area will be based on model refinement, notably through the use of nonlinear programming, as in Picaseno-Gamiz (1989) and, more recently, Moro et al. (1998) and Pinto and Moro (2000).

Bodington (1992) also mentions the lack of systematic methodologies for handling nonlinear blending relations. Ramage (1998) refers to nonlinear programming (NLP, MINLP) as a necessary tool for the refineries of the 21^{st} century, as a result of the significant progress made in the nineties (Viswanathan and Grossmann, 1990; Pörn et al., 1999).

On the other hand, there are few commercial tools for production scheduling and these do not allow a rigorous representation of plant particularities (Rigby et al., 1995; Moro et al., 1998). For that reason, refineries are developing in-house tools strongly based on simulation (Steinschorn and Hofferl, 1997; Magalhães et al., 1998) in order to obtain essential information for a given system (Moro and Pinto, 1998). In the open literature there are specific applications based on mathematical programming, such as crude oil unloading and gasoline blending (Bodington, 1992; Rigby et al., 1995; Shah, 1996; Lee et al., 1996). Ballintjin (1993), who compares continuous and mixed-integer linear formulations and points out the low applicability of models based only on continuous variables, also discusses the lack of rigorous models for refinery scheduling.

It has also been recognized that the integration of new technologies into process operations is an essential profitability factor and that this can only be achieved through appropriate planning (Cutler and Ayala, 1993; Macchietto, 1993). According to a survey of hydrocarbon processing companies, management pointed to sales and planning, planning and operations management and planning and distribution (Bodington, 1995) as major areas for process integration. Mansfield et al. (1993) discuss the issue of integration of the process control, optimization and planning activities into gasoline blending. Bodington and Shobrys (1996) and Steinschorn and Hofferl (1997) point out the importance of on-line integration of planning, scheduling and control.

**PLANNING MODEL**

This work focuses on the development of nonlinear planning models for refinery production. Planning activities involve optimization of raw material supply, processing and subsequent commercialization of final products over one or several time periods.

Moro et al. (1998) developed a nonlinear planning model for refinery production that can represent a general topology. The model relies on a general representation of refinery processing units in which nonlinear equations are considered. The unit models are composed of blending relations and process equations. Also, the unit variables must satisfy bound constraints, which consist of product specifications, maximum and minimum unit feed flow rates and limits on operating variables.

A typical oil refinery generates several streams that are blended in order to specify a commercial product. Furthermore, there are products of different grades that must satisfy market demands. The model assumes the existence of several processing units, which produce a variety of intermediate streams with different properties that can be blended to constitute the desired products. The topology of the refinery is defined by sets that specify connections between streams and units.

The model of a typical unit is represented by the following variables:

i) Feed flow rate: this is the combination of the rates of every incoming stream.

ii) Feed properties: these are derived from the mixing of individual streams calculated through blending algorithms that are generally nonlinear.

iii) Unit operating variables: variables such as heater outlet temperature and reaction temperature are used to control unit performance. These variables usually influence product flow rates and properties in a very nonlinear mode.

iv) Product flow rates: each product stream flow rate is a function of the feed flow rate, the feed properties and the 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.

v) Product properties: these are functions of the feed properties and unit operating variables.

A real-world application was developed for production planning at the REVAP refinery in S. José dos Campos (SP, Brazil), as illustrated in Figure 1 and described in detail in Pinto and Moro (2000).This refinery has one crude distillation unit (CD1), one vacuum distillation unit (VD1), one FCC unit (FCC), one propane-deasphalting unit (PDA), three hydrotreating units (two for kerosene and one for diesel, referred to as HT1, HT2 and HT3), one C_{3}/C_{4} separation unit (DEP) and one MTBE production unit (UMTBE).

Figure 1 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 are 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 an unlimited demand for any product, provided that all specifications are honored (free market). Although this situation does not occur in practice, it allows evaluation of the profit improvement margin that can be achieved with planning optimization.

The GAMS modeling system (Brooke et al., 1998) was used to implement the refinery planning model, which was solved using the CONOPT algorithm, based on the generalized reduced gradient method. The model is composed of 254 variables, 210 constraints and 438 nonlinear nonzero elements. The optimization results cause an increase in severity in the atmospheric distillation unit, thus increasing diesel production at the expense of vacuum distillation feed. As a net result of the changes in stream allocation and unit operating variables, the production of gasoline and jet fuel, the most profitable products, can be increased. These changes can be summarized as follows:

i) In the current situation, the heavy naphtha is split almost equally between petrochemical naphtha and gasoline. Optimization directed most of the heavy naphtha to the gasoline pool, limited by the octane specification. An additional amount was sent to the metropolitan diesel pool, which allows reduction of the sulfur content, the most limiting specification, in this stream.

ii) On the other hand, addition of naphtha to the diesel stream is limited by the minimum density specification.

iii) The kerosene stream was allocated in a similar manner in both situations, with the sole difference being that optimization did not send any of this stream to export fuel oil, thus achieving a slightly bigger production of jet fuel.

The optimization algorithm was able to define a new operating point, thus increasing production of more valuable oil and pushing product specifications closer to their constraints. For instance, production of propene and metropolitan diesel increased by three orders of magnitude, whereas the model indicated production of export fuel oil that was not part of the end product pool (Pinto and Moro, 2000). This new operating point represents an increase in profitability of approximately US$ 50,000,000, which shows the tremendous potential for financial gain embedded in the planning activity.

SCHEDULING AT OIL REFINERIES

As previously mentioned, scientific work in this area has concentrated on the development of optimization models and solution methods for refinery subsystems. This is mainly due to the complexity of scheduling operations, which are translated into large-scale combinatorial problems (NP-Complete, at least), and limitations in computing technology. One of the major issues has been on-time representation. Parallel research has been conducted on both discrete and continuous-time models. Another important aspect that is under study concerns compatibility between planning and scheduling models.

We address scheduling problems in oil refineries, which are formulated as mixed-integer optimization models and rely on both continuous and discrete time representations. The problem in crude oil inventory management that involves the optimal operation of crude oil unloading from pipelines, transfer to storage tanks and the charging schedule for each crude oil distillation unit is formulated and solved. Furthermore, the paper will cover the development and solution of optimization models for short-term scheduling of a set of operations in refinery production and distribution. Production problems in the fuel oil/asphalt and LPG areas of the REVAP refinery in São José dos Campos (SP, Brazil) are presented. The former area is described in detail in section 4.2, including two MIP formulations.

**Crude Oil Scheduling**

This work addresses the problem of crude oil inventory management at a real-world refinery that receives several types of crude oil, which are delivered by an oil pipeline (Moro and Pinto, 1998). The system consists of a crude oil pipeline, a series of storage tanks and distillation units. As in Lee et al. (1996) and Shah (1996), the problem involves transfers from the pipeline to the crude tanks, internally among tanks and to the crude distillation units. Processing times of the tasks involved may vary from 15 minutes to several hours.

Typically, an oil refinery receives its crude oil through a pipeline (Figure 2), which is linked to a docking station where oil tankers unload. The unloading schedule of these oil tankers is usually defined at the corporate level and cannot be changed easily. Thus, for a given scheduling horizon, the number, type and start and end times of the oil parcels are known a priori. In the pipeline, adjacent crude oil types share an interface, which has to be handled properly. If these adjacent batches of oil (known as parcels) have meaningfully different properties, it becomes necessary to take into account the mixing that always occurs within the pipeline, causing degradation of part of the higher quality oil. Therefore it is necessary to send this mixed oil to storage together with the lower quality oil or to a tank assigned to receive such mixtures. This operation is called interface separation and the volume of this interface is defined based on previous experience.

In the refinery, crude oil is stored in cylindrical floating-roof tanks with a total capacity in the range of tens of thousands of cubic meters, which is usually sufficient for a few days of refinery operation. Floating-roof tanks provide much smaller loss of volatile petroleum components than the usual fixed-roof tanks; on the other hand, they demand a minimum product volume of about 20% of total capacity so as to avoid damaging the floating device. The crude oil must be stored in these tanks for a specific amount of time until it can be processed in the distillation units. There is a minimum amount of time to allow separation of the brine that forms an emulsion with the oil. Thus it is not possible to feed the distillation units directly from the pipeline, even if an intermediate tank is used. It is possible to transfer oil between tanks, although these operations are seldom performed, since they are lengthy and it is usually simpler to blend oil from two or more tanks when feeding the distillation units.

If the quality of the oil in a given tank and the operating conditions of the distillation unit are not compatible, it is necessary to process this oil simultaneously with the oil from another tank. This situation may arise if a specific crude oil is too heavy, in which case there will not be enough of the product in the distillation tower top section to produce a proper amount of internal reflux, or if the crude is too light, which may cause difficulties in pressure control. As a rule these properties are known a priori by the refiner and can be correlated with the origin of the petroleum. On the other hand, it is mandatory that the distillation units be fed with an oil flow rate as close as possible to a target value, defined at the corporate planning level, to maximize production and, consequently, profit. It is imperative that these units be fed continuously with oil, because a shutdown is a very costly and undesirable operation.

This work analyzes the problem of generating an optimal schedule for crude oil operations for the petroleum refinery system described in Figure 2.

Firstly, a discrete-time mixed-integer optimization model was proposed for the generation of a schedule for refinery crude oil management. However, this model has severe computational limitations since it results in a large number of 0-1 variables, as in Kondili et al. (1993). This fact makes model solution infeasible for a relevant scheduling horizon, which is of at least three to four days.

To circumvent this difficulty we develop a second model with variable-length time slots, which represent crude oil receiving operations as well as periods between the receiving operations. The system generated by this model is capable of creating a short-term schedule, spanning a horizon of approximately one week and taking into account volume and quality constraints as well as operational rules. These rules include minimum time for crude utilization due to brine settling. There are also operational constraints such as the one that imposes the condition that any time only one tank can receive at the same time but several can feed the columns simultaneously and another that a tank cannot receive and send oil at the same time. Inputs to the problem are the crude arrival schedule, which describes the volumes and qualities of the crude oils to be received in the refinery within the desired horizon; the crude demands and the current levels and qualities of crude oil in the storage tanks. Calculation of crude properties for blended streams is a critical decision. These properties are normally represented by indices that are linear on a volumetric basis. Nevertheless, indices are nonlinear functions of the properties. This feature complicates solution of optimization models since it introduces nonconvex equations and requires the solution of mixed-integer nonlinear programming models.

Based on this information, a schedule is generated to cover the main decisions, such as the strategy for feeding oil from the storage tanks to the distillation units as well as internal transfers between the tanks along the scheduling horizon. A real-world application is developed for the scheduling of crude oil at the REVAP refinery in São José dos Campos (SP, Brazil), which receives on the order of ten different types of crude oil in seven crude storage tanks and has a distillation capacity of 200,000 barrels per day. The total time horizon spans 112 hours, during which four completely defined oil parcels have to be received from the pipeline.

Six oil tanks are available; all of them have the same capacity, but different amounts and qualities of oil at the beginning of the time horizon. We consider three different kinds of oil, Bonito, Marlin and RGN. The distillation unit has a target feed flow rate of 1,500 m^{3}/h during the entire time horizon.

The distribution of the oil parcels during the time horizon is shown in Figure 3, which also shows the subperiods and the number of time slots defined for each one of them. More detailed information on the oil parcels can be found in Table 1.

Table 2 describes the initial conditions of the oil tank. All tanks are assumed to be adequately prepared to feed the distillation unit, i.e., settling has already taken place. The tanks have the same dimensions and their capacity is 80,000 m^{3}, while the minimum operating volume is 13,000 m^{3}. The minimum settling time is defined as 24 hours and this is the minimum time necessary for brine separation after a tank receives oil from a pipeline.

The problem so defined, with 19 time slots, four oil parcels, six tanks and three kinds of oil, generates an MILP problem with 912 discrete variables and 5,599 equations, which was solved using the OSL solver (IBM, 1991) embedded in the GAMS software.

The solution can be seen in Figure 4. It is clear that the constraints of minimum settling time and the demand that the distillation unit be continuously fed are honored.

If the fixed-time-slot duration approach were used in this same problem, it would be necessary to define slot duration as being 15 minutes, thus generating an MILP problem with 21504 binary variables. The solution of this type of problem is far beyond the capabilities of current mixed-integer optimization technology.

**Fuel Oil/Asphalt Production**

While some mention that optimization of fuel oil production does not generally allow fruitful increases in refinery profitability (Rigby et al., 1995), the case of the Revap Refinery is unique (Magalhães et al., 1998) for the following reasons:

i) the plant has relevant storage limitations in the fuel oil area;

ii) most of the plant production is transferred through oil pipelines, which operate the intense flux between refineries;

iii) the plant generates approximately 80% of all fuel oil consumed in Brazil and

iv) the fuel oil monopoly has recently been broken (May 1999).

The objective is the development and solution of mixed-integer (MIP) optimization models for the related problems of fuel oil and asphalt production. Figure 5 illustrates the system configuration which includes one deasphalting unit (UDASF), one cracking unit (UFCC), two storage tanks for diluents, fifteen storage tanks for final products, four charging terminals and two oil pipelines as well as all their interconnections. During the scheduling horizon, asphalt residue (RASF) is produced in the UDASF as the bottom product and further diluted on-line with at least one of the following diluents: decanted oil (OCC) and light cycle oil (LCO) for the purpose of producing four grades of fuel oil (FO1, FO2, FO3 and FO4), or with another diluent, heavy gasoil (HG), to produce two asphalt specifications (CAP 07 and CAP 20). Moreover, the plant produces two grades of ultraviscous oil (UVO1 and UVO2) that must have only pure LCO from the UFCC as the RASF diluent. The UDASF production must also satisfy a minimal demand for pure RASF for the refinery oil header (roh). The major specification of all final products is the viscosity range, which has to be adjusted by proper dilution with the available diluents. The OCC (from the UFCC) and the HG supply streams are completely consumed by the plant; the HG supply stream is directed to storage in TK-42221 and the OCC stream from UFCC is either directly utilized for RASF dilution or directed to storage in TK-42208 (mix of LCO and OCC), since these two operations cannot occur simultaneously. In contrast to the above description, the LCO stream from the UFCC must be directed to the plant only when necessary, i.e., when it is required to charge TK-42208 or when UVO1 (or UVO2) must be produced. In this case, to assert that pure LCO is being utilized to dilute RASF, the TK-42208 level must increase at an appropriate rate while pure LCO flows in the dilution line (see Figure 5). A strategy of allocating the fuel oil production temporarily to a tank is feasible but undesirable since it implies additional processing steps, such as viscosity adjustment/homogenization. Storage tanks cannot be charged and discharged simultaneously; the HG storage tank, which is continually charged, is an exception The distribution of a given product by oil pipeline or trucks requires that two tanks that contain it are connected to the same line; TK-44108 and TK-43307, which operate individually, are exceptions. Hence, the option of replacing the supplier tank in the case of an urgent need to receive material does not exist. UVO/asphalt is only distributed by trucks (from 6:00 a.m. to 6:00 p.m.). Oils are only distributed by oil pipelines. Demands for these products have been previously defined by refinery planning and should be precisely met.

It is assumed that

(A1) the system is isothermal and at ambient temperature;

(A2) all fluids are incompressible;

(A3) there is a preassignment of products to tanks, as shown in Figure 5, and temporary storage is not allowed;

(A4) the viscosity of the oil mix is calculated by the weighed volumetric flow of streams into the mixer (see Figure 5) and their viscosity values;

(A5) the mix between RASF and diluents is ideal and there is perfect mixing in the mixer;

(A6) the initial plant conditions and demands are known a priori; there are no deadlines.

(A7) changeover times are neglected.

Unlike Moro and Pinto (1998), where the time required to carry out the task can vary considerably, this problem can be modeled under discrete time, as in Lee et al. (1996). Due to the dispatching timetable for UVO/asphalt, two modeling rules are imposed: (r1) the scheduling horizon (SchH) must start at either 6:00 a.m. or 6:00 p.m.; (r2) SchH must be a natural multiple of 12 hours. Table 3 shows the model nomenclature.

** (a) MINLP Model**

The first optimization model presented in this work generates an MINLP that is composed of objective function (1) and constraints (2a to 6b) as follows. The formulation relies on the model developed to represent the short-term scheduling of several operations that include receipt of product from processing units, storage and inventory management in intermediate tanks, blending in order to satisfy product specifications and demands, and transportation in oil pipelines, as in Pinto et al. (2000).

**(I) Operating Cost**

**Minimize **

Operating Cost = Raw-material cost + inventory cost + pumping cost

Subject to

**(II) Material Balance Constraints**

Fuel oil volume in storage tank i at time t = initial fuel oil volume in tank i + fuel oil flow rate from mixer to tank i up to time t – fuel oil flow rate transferred from tank i to oil pipelines up to time t.

Also, all capacities have lower and upper bounds.

Similar balances hold for UVO/asphalt and diluent storage tanks, as in (2c-2d) and (2e-2f), respectively.

**(III) Supply of Demand for Plant Products**

Total amount of fuel oil (sent by oil pipelines) as well as UVO/asphalt (delivered to the charging terminals) must precisely meet the foreseen demand. The minimal demand for (pure) RASF for the roh must also be satisfied.

**(IV) Operating Rules**

At each time t, continuous plant production must be directed, to storage in a specific single tank.

For operational reasons, storage tanks are not loaded and unloaded at the same time. An exception is made for TK-42221, which is continuously charged with an HG feeding stream.

The unloading conditions for fuel oil, UVO and asphalt storage tanks are stated by constraints (4d-4g). For security reasons, two storage tanks that contain the same product must be connected to the same line when one of them unloads. TK-44108 and TK-43307 are exceptions to this rule.

It is important to note that an oil pipeline can transport only one fuel oil grade at each time t, as stated by (4f).

When CAP-20 is unloaded, then XW_{t}=1 (0 otherwise). Hence, only two of three CAP-20 storage tanks are connected to the terminal line, as in (4g).

UVO and asphalt can be sent through the truck terminals only from 6:00 a.m. to 6:00 p.m.

Constraint (4h) takes this rule into account by setting XQD_{q,t}=0 during the nocturnal period.

where HT_{b} is given by (4i) and denotes the start time of the scheduling horizon, as follows:

Asphalt production requires HG as the RASF diluent, as in (4j). Note that XDRASF_{t} is set to 1 since HG may never be mixed with OCC and/or LCO.

UVO production claims pure LCO (i.e., from the UFCC) as the RASF diluent, as in (4k).

The continuous OCC production by the UFCC must either be stored in TK-42208 or sent directly to the mixer to produce fuel oil. However, the OCC stream (from the UFCC) can only be stored at time t if TK-42208 is able to receive material at this time, as in (4l).

While an UVO or asphalt is being produced, the OCC stream should be directed to storage in TK-42208, as stated by (4m-4n), since these products must not contain OCC.

**(V) Material Flow Constraints**

The continuous RASF production by the UDASF can be divided into two streams. One of them feeds the roh. The other is sent to the mixer, where at each time t, a fuel oil, UVO or asphalt is produced, as in (5a). Constraint (5b) imposes a lower bound on the RASF flow rate to the mixer.

The blended stream generated in the mixer is given by the sum of RASF and diluent streams directed to the mixer at time t, as in (5c). Furthermore, it must obey pump limitations in lines of the plant, as in (5d-5e).

A diluent storage tank can unload at time t if during this interval:

i) it is not being charged,

ii) the dilution line is not being used by the other diluent storage tank, and

iii) the plant is not producing UVO.

Note that i) does not hold for the HG storage tank since it is continuously charged. Constraints (5f-5g) consider these conditions for TK-42221 (HG) and TK-42208 (LCO+OCC), respectively.

As mentioned above, TK-42221 is continuously charged at a constant rate, as in (5h).

OCC production by the UFCC is either totally stored (TK-42208) or directed to the mixer, as in (5i-5j).

LCO production by the UFCC is directed to the plant only when charging TK-42208 and/or producing UVO is desired, as in (5k). In the latter case, to assure that pure LCO is being used as the RASF diluent, TK-42208 must be fed with a minimal LCO flow rate (FSEC) while UVO is produced, as stated by (5l).

Furthermore, the nominal LCO production rate of the UFCC must be obeyed, as in (5m-5n).

Flow rates must obey pump limitations, as stated by (5o-5p).

At each time t, the flow rate of product p in oil pipeline o is given by the summation of streams from fuel-oil storage tanks (restricted to the set P_{i} ) to this pipeline, as in (5q).

Also, when not null, the flow rate in oil pipelines has lower and upper bounds, as in (5r-5s).

Note that factor 0.5 in (5r) restricts the summation value on the right-hand side to either 0 or 1 since when XID_{i,o,t}=1 (i=1,3,5), we have XID_{i+1,o,t}=1 due to tank alignment.

**(VI) Viscosity Constraints**

At each time t, viscosity must be adjusted according to the product, as in (6a).

In addition, the availability of diluents should be considered, as stated by (6b). Here, the double summation is restricted to s £ 2 to avoid computation of FDRASF_{2,t} twice since the TK-42208 stores two kinds of diluents.

It is important to note that (6b), which results immediately from assumption (A4), is nonlinear. Furthermore, (6b) is a nonconvex bilinear equation, which is hard to solve (Quesada and Grossmann, 1995). On the other hand, a suitable mathematical treatment of equations (6a) and (6b), similar to that done by Lee et al. (1996), allows derivation of an exact MILP model.

**(b) MILP Model**

Due to the analogy between viscosity and composition implicit in assumption (A4), we reformulate the viscosity constraints (6a-6b) in a linear way. Details can be found in Joly (1999). In contrast to Lee et al. (1996), in which a rigorous linear reformulation could not be obtained due to the existence of lower and upper bounds for the product specification, an exact linear formulation may be derived since the problem has exact values for viscosity specifications. The linear formulation relies on management of viscosity by disaggregation of the stream variables into two sets. The first one is used to perform material balances in the system and the other, which is composed only of new variables, takes into account the viscosity characteristics of the streams. The reformulated linear constraints are given by (7a-7i).

Constraint (6b) is replaced by linear constraint set (7a, 7b, 7e, 7f, 7i), and therefore variable VISC_{t} is eliminated. The remaining constraints are due to the need to reformulate constraint (6a), since variable VISC_{t} no longer exists (constraints 7c and 7g), and to preserve to consistency of the reformulated model (constraints 7d and 7h). An important feature of this MILP model is that new constraints and continuous variables are necessary. However, it is important to note that the combinatorial aspect of the MINLP model is preserved. The MILP structure is composed of the same objective function given in (I) and constraints stated in (II), (III), (IV), (V) as well as constraints (7a-7i).

**(c) Computational Results**

The GAMS modeling system (Brooke et al., 1998) was used in order to implement the MIP optimization models and generate their solutions. The DICOPT++ outer-approximation code (Viswanathan and Grossmann, 1990) solved the nonconvex MINLP model, whereas the solution of the MILP model was obtained with an LP-based branch and bound (BB) search performed by OSL (IBM, 1991), which was also applied to the MILP master problems of DICOPT++. CONOPT2 (Brooke et al., 1998) and MINOS5 (Brooke et al., 1998) were used to solve the NLP subproblems. Stop on worsening NLP was the stopping criterion for DICOPT++.

A real-world example based on maximum plant capacity (200,000 m^{3}/month) is presented. The main plant data are reported in Table 4. Model dimensions are shown in Figure 6. Figures 7 to 9 illustrate some results. Four cases of unavailability of the oil pipeline to São Paulo are also considered: unavailability between t=0 and t=9 (case A), 9£ t£ 18 (case B), 18£ t£ 27 (case C) and 27£ t£ 36 (case D).

Table 5 shows the computational performance of the MIP models. Aiming to consider costs originating from the material loss produced by the undesirable mixing of products transported in oil pipelines, we incorporate transition constraints (TCs), as proposed in Pinto and Joly (1999). Figure 8 compares the resulting delivery schedules with and without TCs. Incorporating TCs increases substantially the MIP dimension; the MILP model now has 6733 variables, of which 1968 are binaries, and 7985 constraints.

**LPG Scheduling**

Liquefied petroleum gas (LPG) is basically a mix of hydrocarbons with three and four carbon atoms. This product may be used as domestic fuel for cooking and heating, and it is also an important source of petrochemical intermediate products, such as propene and iso-butane.

In a typical refinery, the catalytic cracking process is the major producer of LPG and approximately a quarter of its load is transformed into three- and four-carbon atom hydrocarbons. Additional amounts are produced by crude distillation, delayed coking etc. The fact that LPG can be liquefied at low pressures allows the storage of large amounts in spheres.

In the refinery studied, the LPG raw material stream is fed to a distillation column, which separates it into one stream that is rich in three-carbon-atom hydrocarbons and another that is rich in four-carbon-atom hydrocarbons. This column operates in two different modes: the normal mode, producing propane for use as domestic fuel (bottled gas or LPG), and the special mode, which employs a high internal reflux ratio, aiming at the production of propane for petrochemical purposes. This petrochemical propane is very profitable and its production must usually be maximized. When in this high-purity mode of operation, the capacity of the column is limited and it cannot process the entire LPG stream, which implies that part of it must be bypassed to storage.

The storage farm comprises eight spheres capable of handling LPG or propane (high pressure and low density) and four spheres suitable for butane storage (low pressure and higher density). The butane produced can also be marketed as bottled gas or injected into the gasoline pool or, more frequently, fed into the MTBE unit. This unit produces methyl-terc-butyl-ether, a gasoline additive. It is also possible to feed stored LPG or propane into the separation column, an operation known as reprocessing. The overall scheme of the LPG processing area is shown in Figure 10.

The main scheduling difficulties in this system arise from the fact that most LPG and LPG by-products are shipped from the refinery through a pipeline. Because of this, large quantities of each product must be available when pumping starts, since small amounts cannot be transferred. In general the refinery operates by almost reaching its storage capacity and then shipping most of the product, ending up with a very small amount. In contrast, the local market demand for LPG is almost continuous.

The problem is to make use of the processing resources, raw material and storage room in such a way that product delivery schedules and quantities can be honored. The objective function involves maximization of product deliveries and of the available inventory of intermediate propane for the minimal number of spheres used.

The optimization model relies on a Mixed-Integer Linear Programming (MILP) formulation. Two main decisions concerning this formulation are now to represent the time domain and how to structure the model, which involves definition of continuous and discrete variables as well as their relationships.

In the MILP formulation, time horizon is divided into a fixed number of time slots of unknown duration. For some of these time slots the initial or final instant in time is already known due to knowledge of decisions that occur at that instant in time. Other time slots are entirely free, but for the reason that they must occur in order and have no overlaps between them. The latter are known as soft time slots, whose duration is defined by the optimization algorithm. The former are known as hard time slots. The schedule of the inputs must be taken into account when defining the time slots to be used. Any operation whose precise start and/or end time is known in advance is defined as a "hard" time slot. On the other hand, the time between two hard time slots may be divided into a number of "soft" time slots, whose durations will be set by the optimization algorithm. The number of slots is in principle arbitrary; however, it must be defined in order to guarantee a sufficiently precise solution for a reasonable computational time.

The model assumes the existence of several processing units, which produce a variety of intermediate streams with different properties that can be blended to constitute the desired products. The basic aspects of this formulation were described in section 3 of the present paper and by Moro et al. (1998) for the planning problem, in which the time domain is not taken into account. In this work we extend that formulation to the scheduling problem, where decisions must be sequenced and time is an important issue. Nevertheless, in the present formulation aspects related to product quality were not investigated so the problem remains linear.

A unit is a processing element that transforms a feed into several products. The distribution and properties of these products are related to the feed flow rate and properties and the unit operating variables. A product can be the feed of another unit and the feed of any unit is the mix of every stream sent to it.

There are two classes of units in the formulation: the processing units and the storage units. The processing units continuously transform the feed into one or more products so that the steady-state material balance around them is always satisfied. On the other hand, for storage units the material balance must include the nonstationary accumulation term. The processing and storage units defined for the LPG scheduling problem are as follows:

i) Feed unit: it is used simply to mix all the external streams and distribute the resulting mixture to downstream units. It produces only one stream, a mix of C3 and C4 (C3C4) that can be distributed between the distillation column and the bypass unit.

ii) Distillation column: since the column can operate in two different modes it was necessary to create two units to represent it, and constraints were added to assure that only one can operate during a given time slot. The unit used to represent the high-purity propane operation mode produces special propane (C3i) and butane (C4). The other unit produces standard grade propane (C3n) and butane. In both cases the C3 stream can be sent to the spheres or to the bypass unit, while the C4 stream can be directed only to storage.

iii) MTBE unit: it is used to process a C4 stream producing MTBE and raffinate. The MTBE stream is directed to the corresponding product pool unit, while raffinate must be stored in a LPG or butane sphere.

iv) Spheres: these units have the capability to store the product so are considered storage units. The LPG spheres can send streams to LPG and C3 product pools and to the distillation column to be reprocessed. The butane spheres can feed the LPG and butane product pools and the MTBE unit.

v) Product pools: these units represent the product consumers and are modeled simply as a sink.

vi) Bypass: represents the pipe that is used to bypass the distillation column and send the product directly to the LPG spheres.

The desired product delivery schedule is an input into the optimization algorithm and the LPG production flow rate is also known in advance. During the overall time horizon propane, LPG and butane must be produced, sampled, analyzed and delivered. Furthermore the sphere farm must be adequately managed so that the maximum and minimum volumetric capacities are honored.

The following example is closely related to the actual refinery situation. The total time horizon spans 108 hours, during which propane, LPG and butane must be produced, sampled, analyzed and delivered to customers. Furthermore the tank farm, comprising eight LPG and propane spheres and four butane spheres, must be adequately managed so that the maximum and minimum volumetric bounds are satisfied.

The desired product delivery schedule and the LPG production flow rate are inputs into the optimization algorithm. The objective is to maximize product deliveries and the available inventory of intermediate propane.

According to these definitions, a total of twelve variable-size time slots were defined and the GAMS modeling system (Brooke et al., 1998) was used to implement the optimization model, which contains 536 discrete variables and 3294 equations, and was solved with the OSL solver (IBM, 1991). Solution of this type of problem in a Pentium II 300MHz PC may take several minutes to a few hours.

Figure 11 shows the operations performed during the scheduling horizon in the spheres. This figure makes clear that the main operating rules for the LPG and C3 spheres (EF01 to EF08) are satisfied, e.g., that the finished product can be withdrawn from a sphere only after the minimum resting time of 24 hours has elapsed. In this example, only five spheres were necessary to accomplish the operations. The results for the butane spheres (EF25 to EF28) reveal a similar behavior. Only three butane spheres were found to be necessary to perform the operations.

CONCLUSIONS

Applications in planning and scheduling for refinery operations have been addressed in this paper. Discrete and continuous time representation approaches for handling the highly combinatorial issues of these representations were tested. Continuous-time models were found to avoid the difficulty originating in the relevant differences in processing time of the operations involved, as in the case of the crude-receipt scheduling problem. Nevertheless, satisfactory results were obtained within a reasonable period of time by discretization of the scheduling horizon for important areas of the refinery.

It has been shown that planning/scheduling problems can be efficiently formulated as large-scale MIP models. Clearly, the complexity of these problems resides in the large number of combinatorial alternatives due to the operational decisions that must be taken in order to satisfy all product requirements. In order to provide a better understanding of modeling techniques, a more in-depth view of the inherent features of the fuel oil and asphalt production problem was presented. As discussed, the problem can in principle be modeled as a large-scale MINLP, which has the disadvantage that no global solution is guaranteed by conventional MINLP solution algorithms due to bilinear terms in viscosity constraints. These nonconvexities can be avoided by introducing individual entity flows. A rigorous MILP model derived from the previous nonlinear one is then obtained in order to ensure theoretical global optimality. This linearization causes an increase in model size; nevertheless it has the advantage of providing a lower bound to the objective function. Interestingly, similar results were obtained in terms of both solution quality and computational times.

Clearly, while susceptible to infeasible times to obtain global optimal solutions, these modeling and solution strategies enable the scheduler to explore market opportunities, mainly in the short term or in any unexpected situation, and thus provide an efficient tool. Therefore, the dynamic nature of the petrochemical industry requires continuous work in order to allow the necessary enhancements related to computer-aided scheduling tools to be made.

In fact, understanding of these real-world planning/scheduling problems constitutes the most difficult step in reaching this target, since several operational features of the plant are closely related to the process experts, a fact that presents an additional difficulty to the modeler. Many times, this is responsible for divergences between the modeler and the user. Suri et al. (1995) mention this fact as one of the major challenges in operations research during the last 15 years, since the scientific community frequently considers industrial problems to be solved as soon as a paper is published.

Other important areas of the refinery, such as the distillation units and the FCC area, which operate under different schedules, are currently under study. The problems of crude oil distribution between the refineries as well as the management of common oil pipelines are also fundamental to the efficient operation of an oil company. More general, important issues, such as integration of logistics, planning and scheduling as well as more efficient modeling and solution techniques, remain to be studied.

** **

REFERENCES

Ballintjin, K. (1993) Optimization in Refinery scheduling: modeling and solution. In: Optimization in industry, 3, Ciriani, T.A. and Leachman, R.C., Eds, 191-199. John Wiley & Sons, New York. [ Links ]

Barton, P.I., Allgor, R.J., Feehery, W.F. and Galán, S. (1998) Dynamic Optimization in a Discontinuous World. Ind. Eng. Chem. Res., 37, 966-981. [ Links ]

Bechtel (1993) PIMS (Process Industry Modeling System) User's manual. Version 6.0, Bechtel Corp., Houston.

Bodington, C.E. (1992) Inventory management in blending optimization: Use of nonlinear optimization for gasoline blend planning and scheduling. In: ORSA/TIMS National Meeting, San Francisco. [ Links ]

Bodington, C.E. (1995) Planning, Scheduling, and Control Integration in the Process Industries. McGraw Hill, New York. [ Links ]

Bodington, C.E. and Shobrys, D.E. (1996) Optimize the Supply Chain. Hydrocarbon Processing, 75(9), 55-60. [ Links ]

Brooke, A., Kendrick, D., Meeraus, A. and Raman R. (1998) GAMS - A user's guide. GAMS Development CO., Washington DC. [ Links ]

Coxhead, R.E. (1994) Integrated planning and scheduling systems for the refining industry. In: Optimization in industry, 2, Ciriani, T.A. and Leachman, R.C., Eds, 185-199, John Wiley & Sons, New York. [ Links ]

Cutler, C.R. and Ayala, J.S. (1993) Integrating off-line schedulers with real time optimizers. Paper 40a. In: AIChE National Spring Meeting, Houston. [ Links ]

IBM (1991) IBM-OSL guide and reference (release 2), Kingston.

Joly, M. (1999) Mixed Integer Optimization Techniques for the Scheduling and Production Management in Petroleum Refineries. M.Sc. diss. (in Portuguese), Escola Politécnica da Universidade de São Paulo, São Paulo (Brazil). [ Links ]

Kondili, E., Pantelides, C.C. and Sargent, R.W.H. (1993) A General Algorithm for Scheduling Batch Operations. Comput. Chem. Eng 17, 211-227. [ Links ]

Lee H., Pinto, J.M., Grossmann, I.E. and Park, S. (1996) Mixed-Integer Linear Programming Model for Refinery Short-Term Scheduling of Crude Oil Unloading with Inventory Management. Ind. Eng. Chem. Res., 35, 1630-1641. [ Links ]

Macchietto, S. (1993) 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, 207-230, CACHE, Austin. [ Links ]

Magalhães, M.V.O., Moro, L.F.L., Smania, P., Hassimotto, M.K., Pinto, J.M. and Abadia, G.J. (1998) SIPP – a solution for refinery scheduling. In: 1998 NPRA Computer Conference, National Petroleum Refiners Association, November 16-18, San Antonio. [ Links ]

Mansfield, K.W., Maphet, J.G., Bain, M.L., Bosler, W.H. and Kennedy, J.P. (1993) Gasoline blending with an integrated on-line optimization, scheduling and control system. In: AIChE National Spring Meeting, Paper 40b, Houston. [ Links ]

Moro, L.F.L, Zanin, A.C. and Pinto, J.M. (1998) A planning model for refinery diesel production. Comput. Chem. Eng, 22 (Suppl.), S1039- S1042. [ Links ]

Moro, L.F.L. and Pinto, J.M. (1998) A Mixed-Integer Model for Short-Term Crude Oil Scheduling. In: AIChE Annual National Meeting, paper 241c, Miami Beach. [ Links ]

Pelham, R. and Pharris, C. (1996) Refinery Operation and Control: A Future Vision. Hydrocarbon Processing, 75(7), 89-94. [ Links ]

Picaseno-Gamiz, J. (1989) A systematic approach for scheduling production in continuous processing systems. Ph.D. thesis. (in English), University of Waterloo, Waterloo (Canada). [ Links ]

Pinto, J.M. and Joly, M. (1999) MILP Model for Scheduling of Continuous Multiproduct Plant Distribution. In: 15^{th} Int. Conference on CAD/CAM Robotics & Factories of the Future, Águas de Lindóia (Brazil). [ Links ]

Pinto, J.M., Joly, M. and Moro, L.F.L. (2000) Planning and Scheduling Models for Refinery Operations Comput. Chem. Eng., 24, 2259-2276. [ Links ]

Pinto, J.M. and Moro, L.F.L. (2000) A Planning Model for Petroleum Refineries. Braz. J. Chem. Eng., 17(04-07), 575-585. [ Links ]

Pörn, R., Harjunkoski, I. and Westerlund, T. (1999) Convexification of Different Classes of Non-convex MINLP Problems. Comput. Chem. Eng., 23, 439-448. [ Links ]

Quesada, I. and Grossmann, I.E. (1995) Global Optimization of Bilinear Process Networks with Multicomponent Flows. Comput. Chem. Eng., 19, 1219-1242. [ Links ]

Ramage, M.P. (1998) The Petroleum Industry of the 21^{st} Century. In: Foundations of Computer Aided Process Operations – FOCAPO 98, Snowmass. [ Links ]

Rigby, B., Lasdon, L.S. and Waren, A.D. (1995) The Evolution of Texacos Blending Systems: From OMEGA to StarBlend. Interfaces, 25(5), 64-83. [ Links ]

Shah, N. (1996) Mathematical programming techniques for crude oil scheduling. Comput. Chem. Eng., 20 (Suppl.), S1227- S1232. [ Links ]

Steinschorn, D. and Hofferl, F. (1997) Refinery Scheduling Using Mixed Integer LP and Dynamic Recursion. In: NPRA Computer Conference, New Orleans. [ Links ]

Suri, R., Diehl, G.W.W., Treville, S. and Tomsicek, M.J. (1995) From CAN-Q to MPX: Evolution of Queuing Software for Manufacturing. Interfaces 25 (5), 128-150. [ Links ]

Symonds, G.H. (1955) Linear Programming: The solution of refinery problems. Esso Standard Oil Company, New York. [ Links ]

Viswanathan, J. and Grossmann, I.E. (1990) A Combined Penalty Function and Outer Approximation Method for MINLP Optimization Comput. Chem. Eng., 14(7), 769-782. [ Links ]