MP in Action‎ > ‎Oil Industry‎ > ‎

Modelling Oil Refineries using Linear Programming

This article continues the exploration of how Mathematical Programming is used in planning and scheduling oil refineries.

Elements of a Refinery Model

Planning and Scheduling in Oil Refineries outlined the hierarchy of problems involved in planning and scheduling oil refineries. This article approaches refinery modelling from the point of view of what linear programming can represent and how this relates to what really goes on in a refinery.

Figure 1 shows a simple schematic of a refinery.

Figure 1: Schematic of an Oil Refinery

From a modelling point of view, a refinery consist of a series of:

  • process units

which transform:

  • materials

into one another. Materials may also be:

  • blended

to make

  • finished products

which are subject to

  • quality specifications.

There are further aspects of a refinery, such as the utilities (fuel, steam, hydrogen, etc) but we shall disregard them here. We shall also defer to another article the issue of how to represent time and assume that we are working with a single time period.

Each of the bulleted items is a class of objects which behaves in fundamentally the same way from refinery to refinery and from area to area within a single refinery. We shall explore each of these objects in turn.

Materials

The concept of a material within a refinery model is, paradoxically, both obvious and highly complex. Oil refineries import crude oil, distill it into fractions such as naphtha, kerosine and gas oil, process some fractions further into components such as cracked distillate and alkylate and then blend various of these together to make finished products such as UK regular unleaded petrol. For each of these materials a refinery engineer could point to a pipe which contained the material and, for some of them, to one or more tanks as well.

Thus these substances with names have physical reality and are "materials". But there is more to a material than this. Take crude oil, for instance. There are many different crude oils, and they vary in their physical characteristics (density, sulphur content, waxiness, etc) and their price. There may be several crude tanks at a refinery but there will be a single pipe which delivers the crude feed to a crude distillation unit (CDU). As far as the CDU is concerned, it processes a single material, crude oil, but the composition of this material will change, depending on the crudes which the refinery has imported and which crude tank is on feed to the CDU.

Thus the composition of a material will change through time. This extends throughout the refinery (with the exception of the simplest products, such as methane and propane, which are chemically well-defined). Now in building a model of the refinery, our main decision variables will be the quantities of each material which we are using and what we are doing with it (processing it, blending it into one product or another, etc). So what we would like to be able to do is to have decision variables for:

  • how much of each material we have and what we are doing with it; and
  • what the composition is of the material.

This inevitably leads us into a model in which we are working with products of decision variables, i.e. to a nonlinear model. This is indeed what is increasingly done in refinery models. But there is an alternative, in which the model is kept linear and which is the basis of the "traditional" refinery LP model. In this a single physical material within the refinery is represented by several distinct "grades", just as the single pipe conveying crude oil to the CDU can contain many distinct crudes. Each of these grades has a well-defined (and constant) set of qualities.

The single physical material is represented as the sum of various quantities of the grades, which are defined so as to be able to represent the full range of variability of the physical material. This leads to purely linear constraints and ensures that the various qualities of the materials are conserved, but it gives the model the unrealistic extra freedom to use each of the grades separately.

For instance, suppose that the reformer process unit is making reformate of 96 octane. The 96 octane reformate may be represented as a 50:50 mix of 95 octane reformate and 97 octane reformate. The model might then say that it will use the 97 octane reformate in making 97 octane petrol and the 95 octane reformate in making 91 octane petrol. In fact there is no 97 octane reformate and the model cannot meet the quality specification for 97 octane petrol while running the reformer at 96 octane.

The nonlinear model would not make this mistake because it would represent the reformate as a single stream of 96 octane. But this is also not entirely realistic. In practice the qualities of materials do vary through time, for instance to reflect the different crudes being processed. A process unit may also be run in campaigns with different operating conditions to produce variants of a single material, e.g. the reformer may actually run part of the time at 97 octane and part at 95 octane. In this case the traditional LP model is closer to reality, although it may still do unrealistic things such as blending 97 octane reformate with another component which is only available at a mutually exclusive time.

Process Units

A process unit may have several feeds. Most often these can be considered as independent and for each one a set of output materials can be defined together with their yields. The process unit may have a number of control parameters (e.g. the octane rating of a reformer) and the yields and qualities of the output materials must be defined across the range of possible values of these.

The representation of yields and qualities by feeds and process conditions is usually the most complex part of the data set for a refinery model. With a traditional LP model the feeds are the "grades" of the physical materials. In the same way that the LP representation has to handle variable qualities of materials as combinations of grades, so it represents variable process conditions as combinations of process "modes", e.g. 97 octane mode, 95 octane mode. The yields of each "grade" of output material must be defined for each "grade" of input material and each process mode. As some of the grades are fairly artificial, this may require some interpolation and extrapolation from observed data.

It is somewhat easier for the nonlinear model. Each feed is considered to be broken down into its assay components. Crude oil consists of an enormous variety of hydrocarbons with boiling points from, say, 20oC to 500oC. If one divides this into successive 10oC increments, the hydrocarbons within each increment are fairly similar and it make sense to define the yield for each of these assay components for each process unit. Process modes may still be used to represent the variation in process conditions; alternatively a "base-delta" representation may be used. In this there is a "base" set of yields and then a "delta" set which shows how the yields change as the control parameter varies.

Finished Products

Each finished product is associated with a quality specification, i.e. a list of the maximum or minimum values (sometimes both) which a physical property must take, e.g. specific gravity, octane. For each product there is a demand which must be met and for some there is the possibility of making a surplus for spot sales. Finished products are therefore well-defined and do not require the artificial creation of "grades" as for other materials.

In practice, finished products are quite close to being grades of a parent material. For instance, there will be a certain pipe and set of tanks which hold unleaded petrol. At different times different types of unleaded petrol will be being made but the same facilities will be used for each. LP-based models, whether linear or not, represent the total storage capacity for such variant materials and do not attempt to sort out the sequence in which the different variants should be made or which tanks should be used for each.

Blending

Blending in oil refineries is similar to blending in other industries. In essence you are bringing together a number of components to meet a quality specification. In the traditional LP model the components are the "grades" of the physical streams within the refinery; in the nonlinear model they are the streams themselves. As each "grade" of the traditional model has constant qualities, this gives rise to the typical quality constraints of LP models. But the model has the freedom to decide how much of each "grade" to include in the blend. This leads to over-optimization, i.e. the solution is better than can be achieved.

In the nonlinear approach, each of the components of a blend is a physical stream with what amounts to the average qualities of that stream through the schedule period. This ensures that you don't split 96 octane reformate into 97 octane and 95 octane components and use them separately. But there may be times when this is what you do want to do, e.g. run the reformer at 97 octane for 97 octane petrol and then revert to 95 octane. Thus the nonlinear model tends to under-optimize and fails to suggest which products should be made using which crudes and which process modes.

Qualities

Some qualities, such as specific gravity and sulphur content, do blend linearly. Other qualities blend in a nonlinear way but without complex interactions between components. For most of these, engineers have developed "linear blend indices" which transform the measured qualities into index values which can be constrained using ordinary linear constraints. Further nonlinearities can be represented within a linear model using techniques which were described in But my Problem Isn't Linear!.

There remain some qualities which are so nonlinear that blend indices do not work. In a traditional LP model, a linear approximation to their behaviour is used which is based on the typical composition of the blend. Extra constraints are imposed to ensure that the composition of the blend does not stray too far. A nonlinear model represents such relationships directly.

Related articles include Planning and Scheduling in Oil Refineries and Representing Time in Refinery Models. To find other articles, refer to the MP in Action page.

Comments