MP in Action‎ > ‎Oil Industry‎ > ‎

Planning and Scheduling in Oil Refineries

This article picks up from Mathematical Programming in the Oil Industry and continues the exploration of how Mathematical Programming is used in its economically most important application, planning and scheduling oil refineries.

How Refineries Work

Oil refineries are complex process plants which turn crude oil into a range of products, from petrol through diesel and heating oil to the bitumen used in tarmac. They do this by three main mechanisms:

  • fractional distillation, which separates the extremely complex mixture of hydrocarbons in cude oil into components, each of which is a less complex mix with distinct physical properties;
  • conversion processes, which split or re-form the backbone of carbon atoms in a hydrocarbon molecule in order to make new components of higher value;
  • desulphurisation, which substitutes hydrogen atoms for sulphur atoms in the hydrocarbons, thereby reducing the pollution caused when the ultimate products are burned;

followed by

  • blending together of the resulting components to make finished products.

This is shown in schematic form in Figure 1.

Figure 1: Schematic of an Oil Refinery

Oil refineries used to consist almost entirely of fractional distillation with very limited conversion processing. But in recent years the market for heavy fuel oil (used for generating electricity) has largely fallen away and so oil companies have invested heavily in conversion units which transform heavy fuel oil into components used in making petrol, for which demand remains buoyant.

The Flexibility of Oil Refining

Whether a refinery is simple or complex, it has considerable freedom in what it does. The extent of that freedom can be appreciated by comparing an oil refinery with a manufacturing plant, such as a car plant.

Although some car plants can switch production from one model to another relatively quickly, they are essentially in the business of assembling a large number of components to make multiple copies of the same vehicle. There is a fixed recipe for making each variant: 1 engine; 4 doors; 1 steering wheel; 5 wheels; etc. There are slightly different recipes for different variants, e.g. 4 or 6 cylinders in the engine; and 2 or 4 doors, but the variant's specification determines what the recipe is. At a finer level of detail, certain components may be capable of being interchanged (for instance there may be several alternative suppliers of window glass) but in such cases this is only because there are multiple sources for a single component.

By contrast, the consumers of the output of oil refineries grant them enormous freedom. The purchaser of a gallon of petrol does not know what it contains, nor does he care, so long as it runs properly in his engine. Nor is he interested in the source of the crude oil which is used to produce the components which have been blended to make the petrol. Still less is he interested in how the refinery has turned that crude oil into the blend components and what it has done with the rest of the components.

From the refiner's point of view what matters is that the required products are made to specification and that they are available when required in the offtake schedule. The refinery has to cope with the crudes which are delivered (which are largely outside its control) and is faced with the problem of turning those crudes into the required products at the required times.

Thus the scope of action of the refiner is much greater than that of the man in charge of a car production line. All of these factors combine to present the refiner with a challenging problem; and an opportunity. He has the freedom to take advantage of flexibility in:

  • which crudes to process;
  • which products to make;
  • how to operate the refinery.

The flexibility in the first two will be limited, at least at the level of the production planner in the refinery. But at the level of the oil company which owns the refinery, all of these can be varied, at least within the capabilities of the refinery. And those can themselves be changed by investing in new conversion units or otherwise upgrading the facilities. Thus oil refining is an industry which presents its management with an enormous number of options in deciding what to do. That is why the planning and scheduling of oil refineries is a well-defined function in oil companies.

Timescales for Planning and Scheduling

Most refineries (at least outside the USA) are owned by integrated oil companies which have a spread of interests, potentially from exploration and production through refining and marketing to retail sales. Within such an organisation the refinery is essentially executive, i.e. it is told what to do. Head Office negotiates long-term crude supply contracts while the Supply and Trading function buys crudes and sells products. The refinery itself typically works within a nested set of time horizons:

  • there is an annual cycle, perhaps with a shutdown for planned maintenance, variations in the demand for seasonal products, and changes twice a year between summer and winter specifications for road fuels;
  • there is a rolling set of monthly schedules, which provide the framework of what the refinery is to do: the crudes to be processed and the products to be made;
  • at the weekly level the refinery knows precisely which crudes it has and must decide which crude cocktails to run; how long to do so and how it is going to meet any particularly large or difficult product offtakes;
  • at the daily level it must decide the cut points to use on the crude distillation units (CDUs), the process conditions to use on the various units, roughly how it will be doing the blending, and how it will be handling any logistical difficulties with the tanks;
  • from hour to hour it must monitor and control the various processes to keep them working optimally, operate the valves to keep materials flowing to and from tanks, and manage the blending of individual products both into tanks and as "direct blends" for export;
  • from second to second it must be using advanced control systems to maintain process conditions;
  • from millisecond to millisecond it must be using basic feedback loops to maintain safety.

There is thus a hierarchy of decision-making, with the decisions made at one level cascading into fixed data for the next lower level. This is not necessarily a strict hierarchy: there may be some feedback from the lower level where it turns out not to be possible to achieve what the higher level has specified.

Reflecting this, the degree of precision increases as we move to shorter time horizons. At the higher levels we are only aiming for an "80% solution": we know that things won't happen exactly as we predict and therefore there is no point in seeking a solution which is complete and precise. At the lower levels we have got to handle the logistical difficulties that there are only so many pipes and valves connecting two pieces of equipment and that it is impossible to keep separate two product streams flowing through a single pipe at the same time.

The greater precision at the lower levels translates into greater detail in the representation of what is happening in the refinery. But this does not mean that the problems necessarily become larger or more difficult to solve. As we move to the lower levels the "big" decisions have been made and are presented as fixed data. To take an example, crude cocktails will have been decided and will be on feed to the CDUs. The cut points may also have been decided and so the problem of running each CDU reduces to the process control one of maintaining it at the specified conditions.

Within the parent organisation there is a similar hierarchy of decision-making. This extends from the long-term (say, 5 years) down to tactical day-to-day trading:

  • long-term global investment (1 - 5 years): where should new refineries be built? existing ones upgraded? unprofitable ones closed? These questions interact with:
  • global crude supply and market allocation (6 months - 3 years): what long-term contracts should be put in place to supply refineries with part of the crude which they will process? which markets should each refinery supply and with which products?
  • short-term planning (1 - 6 months): within each region of the world, which crudes should be bought for the refineries within that region and which products sold? These then give rise to a more detailed production plan, although one which will still not be entirely complete;
  • tactical supply and trading (up to 1 month): at the margin of each refinery's activities, what cargoes of crude can be bought advantageously and extra products sold? Checks need to be made with the refinery about the practicability of this extra processing but it can provide useful profits, particularly from "distressed" cargoes.

As with decision-making within a refinery, there is a general increase in the level of detail as we move towards the shorter term. Likewise the problems decompose as we focus on individual refineries or groups of refineries within a region rather than on the whole world. And the decisions which had to be taken at the strategic investment stage (the locations and facilities of the refineries) become fixed data for the lower levels.

Mathematical Programming models are used to support decision-making at many of these levels. Not only do the decision variables and the data differ from level to level to reflect the decisions to be taken, the structure of the model and the modelling technology used also vary. These issues will be explored further in subsequent articles.

Related articles include Mathematical Programming in the Oil Industry and Modelling Oil Refineries Using Linear Programming. To find other articles, refer to the MP in Action page.