Reactive Scheduling Framework for a Multiproduct Pipeline with

Jul 21, 2007 - ... pipeline schedule and the inventory management at the tank farm. The improvements include variable flowrate, pipeline stoppages, an...
0 downloads 4 Views 558KB Size
Ind. Eng. Chem. Res. 2007, 46, 5659-5672

5659

Reactive Scheduling Framework for a Multiproduct Pipeline with Inventory Management Susana Relvas,†,‡ Henrique A. Matos,† Ana Paula F. D. Barbosa-Po´ voa,*,§ and Joa˜ o Fialho‡ CPQ, IST-UTL, AV. RoVisco Pais, 1049-001 Lisboa, Portugal, CEG, IST-UTL, AV. RoVisco Pais, 1049-001 Lisboa, Portugal, and CLC, EN 366, km 18, 2050 AVeiras de Cima, Portugal

Real world scenarios on the planning and scheduling of the complex oil supply chain represent challenging problems. However, there is a growing need to establish decision support tools capable of dealing with competition within this industry so as to replace simple procedures, such as spreadsheets, with more efficient tools. This work studies a medium term scheduling problem of a pipeline and associated end-of-pipe tank farm. The mixed integer linear problem (MILP) formulation proposed by Relvas et al. [Ind. Eng. Chem. Res. 2006, 45, 7841-7855] is improved. This model represents the articulation between the pipeline schedule and the inventory management at the tank farm. The improvements include variable flowrate, pipeline stoppages, and variable settling period with product. On this scheduling model, a novel rescheduling methodology is developed, taking into account the variability of real plant changes with the definition of revisions of schedules in an effective way. The model and respective rescheduling strategy are applied to a scenario of a Portuguese oil distribution company. Problems covering 1 month of time horizon, including initial plans and their revisions, with more than one perturbation, have been successfully solved. 1. Introduction Supply chain decision makers are, nowadays, widely focused on the objective of continuously improving the efficiency of the system they manage. Technology growth has been exponential, but its full potential has not been enough exploited to overcome complex issues on the planning and scheduling tasks. One of the most competitive market areas is the refining industry, where the gap between profits and costs gets tighter day after day. Due to this environment, the urge to upgrade from simple spreadsheets to advanced process engineering tools is common.1 Despite being a challenge, refineries and associated scheduling operations’ face several opportunities that should be explored such as the articulation of schedulers with planners, traders, and refinery managers.2 Nevertheless, the human factor plays a major role in day-to-day operations, where the optimal performance should be obtained from the blending of operational staff and innovation-oriented engineers. The former have great experience in operations, meanwhile the latter seek new solutions and technologies and test new tools.3 Any scheduling system is usually a combination of several types of technology, covering simulation, heuristics, constraint programming, discrete optimization methods, and other emerging technologies.3 The oil supply chain end is focused on products’ distribution, becoming a demand-driven business model. Agrawal and Balasubramanian2 state that it is fundamental to account for enduser demand data to obtain schedules that indicate “when” to do each operation, ensuring product availability, timing and, location of products. One of the major distribution channels in the refining industry are the pipelines. This type of equipment transports large amounts of products over long distances, with no need for separating devices between different batches. Pipelines represent a cost-effective distribution method; how* To whom all correspondence should be addressed. Tel.: +351 218417203 or +351 214233265. Fax: +351 218417979. E-mail: [email protected]. † CPQ, IST-UTL. ‡ CLC. § CEG, IST-UTL.

ever, due to their operational complexity, it is necessary to be prepared with specific decision support tools for this equipment, other than spreadsheets. However, these tools are scarce. Work in this area covers methodologies to integrate planning and scheduling in oil supply chains4,5 and production planning and operations scheduling in refineries.6-13 Some of these works deal with pipelines. However, there can be pipelines between ports and refineries, for oil feed and pipelines for derivatives’ distribution. This implies different approaches for model representation, mainly because pipelines for oil feed usually have previously known schedules due to vessels having specific unloading time windows.4,6,11-13 On the other hand, pipelines for oil products’ distribution have been addressed by Rejowski and Pinto,14 Cafaro and Cerda´15 and Magata˜o et al.16 Nevertheless, these works focused essentially on pipeline operation, leaving open the opportunity to explore its interaction with distribution and market operations. This vision was first addressed by Relvas et al.17 This work focuses on the coordination between pipeline scheduling and inventory management at an end-of-pipe distribution tank farm. Despite being directed to integrate the decision support tools framework described by Valleur and Grue,3 the works presented above leave open opportunities on the rescheduling field. Rescheduling is essential to generate updated schedules that deal with unforeseen situations. Indeed, in real-time, the ability to rapidly react to such unexpected events and revise the schedule in an effective way is as important as the scheduling problem itself. This work not only presents an improved version of the work by Relvas et al.17 but also studies the problem applied to the system described. Reactive scheduling has been scarcely addressed in works on oil supply chains. Some works focused minimization between planning and scheduling throughputs at CDUs13 (Crude Distillation Units), but rescheduling over system perturbations has not been considered yet. This field is very interesting from an academic point of view and has a direct application at the industrial level. Most of the works studying rescheduling problems are oriented to general batch plants. Vin and Ierapetritou18 proposed

10.1021/ie070214q CCC: $37.00 © 2007 American Chemical Society Published on Web 07/21/2007

5660

Ind. Eng. Chem. Res., Vol. 46, No. 17, 2007

Figure 1. Oil supply chain end, focusing on the system under study.

a reactive scheduling two-stage algorithmic approach to a multiproduct batch plant. The first stage is to obtain a deterministic schedule, whereas the second stage incorporates in a systematic method all the alternatives to cope with changes. These authors address as disturbances machine breakdown and rush order arrival. Later, Mendez and Cerda´19 implemented a reactive scheduling framework that can address new order arrivals, batch due dates and sequence-dependent changeovers, deviations in processing times, or equipment breakdown. Both of these works take advantage of the reordering possibility inherent to batch plants. The rescheduling problem over a pipeline implies readjustments over a continuous operation. In addition, the interaction of the pipeline with the inventory feasibility problem, both at the refinery and at the tank farm, tightens the margin on severe modifications over the initial schedule. On the other hand, in an industrial point of view, a decision support tool capable of dealing with unpredicted situations is an advantage because it permits the management of a highly uncertain system, under the influence of several exterior agents and where global operation has to be constantly pursuing the best profit margin. One of the ways to follow is, definitely, being able to readjust operational objectives in a systematic and quick response manner, so as to face any unpredicted factor over the initial schedule: a rescheduling procedure. The present article is organized as follows: in the following sections, the system under study is introduced and model building considerations are analyzed. Then, the representation of the problem as a mixed integer linear problem (MILP) model is performed, where the modifications and extensions to the original one by Relvas et al.17 are described and discussed. Following that, the rescheduling strategy for this system is described. The results obtained for a real case study are then presented. The paper ends with discussion and conclusions on the work presented, and some future work in this area is proposed. 2. Problem Definition The system under study comprises a refinery, a pipeline, and a tank farm that works as a distribution center, as schematized in Figure 1. The refinery produces and distributes oil derivatives, the pipeline being the transportation method between the refinery and the tank farm. The transport is done with no separating devices between different products. The distribution center is constituted by sets of tanks, where each set is allocated to store permanently a fixed product. The tank farm is located in a strategic market, and clients fulfill their demands on site. The objective of the problem is to find both a pipeline schedule and inventory management plan at the tank farm such that all clients’ demands are fulfilled while guaranteeing that all the quality and approving tasks are carried out under their respective constraints. The problem can be summarized as follows.

Given, for each scenario, are the following: (a1) the time horizon extent; (a2) clients’ demands by day and by product; (a3) initial inventory of each product on each tank at the tank farm; (a4) initial batches of products inside of the pipeline; (a5) minimum and maximum number of batches to be pumped; (a6) minimum and maximum flowrate inside the pipeline. To define the system under study, it is still necessary to give the following data to the model: (b1) the pipeline volume; (b2) the set of products; (b3) the matrix of possible pairs of consecutive products inside the pipeline; (b4) the available storage capacities for each product and by tank; (b5) the minimum settling period for each product. The mathematical model is optimized under the desired objective, which can be either economical or operational. 3. Model Building Considerations Within the model building considerations, five main points need to be analyzed in detail. These are respectively the time and volume scales and the associated pipeline stoppage, product sequences, the daily client information, the tank farm representation, and the settling period. These are described in detailed below. 3.1. Continuous Time and Volume Scales. One of the first considerations to be done in the model building for the system in study is the time and volume scales. The result is mainly based on the type of pipeline. This is an oil derivative transportation pipeline, which means that it has to deal with very different batch volumes, unknown schedules (they depend both on refinery production and tank farm demand and are the objective of the problem), and a map of possible/forbidden product sequences due to quality issues on interfaces that are formed. This type of operation will be translated in a large number of batches during the time horizon. The pipeline can be viewed as a volume axis, where the origin is the refinery and the destination is the tank farm. To represent the volume scale, the minimum volume unit to discretize the pipeline would be much smaller than the pipeline volume, because it should be a divisor of all different batch volumes. In this way, a continuous representation becomes more accurate. On the time issues, in order to account for the complete batch volume, one should use a continuous time scale using operational events. To build the continuous time scale, the model uses a single event per batch, i.e., whenever a new batch i finishes being pumped to the pipeline, a new time point corresponding to this event is added to the continuous time scale, Figure 2. Having both scales defined, the coordination between both scales has to be considered. Due to the large “in-transit” time between pipeline ends, the model needs to update at each time interval the position of each batch inside the pipeline. In a mathematical approach, at each new point of the time scale, every upper volumetric coordinate of each inside batch is updated, adding the volume that entered the pipeline during that interval. The last issue to be discussed is the pipeline stoppages. The model time scale architecture captures the end time of each new batch that is pumped to the pipeline. The difference between this point and the previous must not necessarily correspond to

Ind. Eng. Chem. Res., Vol. 46, No. 17, 2007 5661

Figure 2. Continuous time scale definition.

Figure 3. Pipeline stoppage model representation: (a) pipeline stop between two batches; (b) pipeline stop during one batch

Figure 4. Heuristics approaches to deal with product sequence: (4.1) fixed sequence; (4.2) mixed sequence; and (4.3) free sequence.

the pumping time of the new batch. If the pipeline stops, this can be easily incorporated in a time slot, as shown in Figure 3. In a situation where the pipeline stops between two batches (Figure 3a), from time point Ci-1 to Ci-1 + ∆t1 (situations 1 and 2), no volume was pumped to the pipeline. After Ci-1 + ∆t1 (situation 3), the new batch i starts to be pumped, until the batch is completed at Ci (situation 4). However, if the pipeline stops during the pumping of batch i (Figure 3b), it is stopped between Ci-1 + ∆t1 and Ci-1 + ∆t2 (situations 1 and 2). After the pipeline startup, batch i finishes being pumped until Ci (situations 3 to 4). 3.2. Product Sequence. The product sequence is one of the main pieces of information contained in the pipeline schedule. This sequence needs to answer the product needs at the tank farm. But, additionally, the products’ sequence must not contain forbidden sequences between pairs of products, due to quality aspects. As seen from the previous discussion, the time scale will have as many points as the batches that are pumped to the pipeline. This implies that the products’ sequence will highly influence the time scale, which may be an indication of complexity. A simple approach to overcome complexity in the sequence selection is to use knowledge from the problem process, i.e.,

using information to build possible cycles of products. Three possibilities are accounted for: - If a cycle can be repeated, this will arise in a fixed sequence (Figure 4.1); - If a base sequence can be built, but leaving open some decisions to the solution-finding process, then it will be defined as a mixed sequence (Figure 4.2); - If no simple heuristic can be applied, then the model solution process needs to decide over the entire sequence, giving origin to a free sequence (Figure 4.3). Further knowledge of the problem may allow the construction of more sophisticated heuristics. 3.3. Daily Client Information. Client demands are an important issue in this model, because they will be responsible for decisions on what to transport and in what quantities. Furthermore, their representation over time is very important. Usual models only account for end-of-period client demands or/and medium values (using constant demand rates), where the period varies between 1 week to the entire time horizon. However, product demands can vary during the time horizon, during weekends or holidays or for other reasons. Therefore, more accurate client descriptions should be used, i.e., daily client information.

5662

Ind. Eng. Chem. Res., Vol. 46, No. 17, 2007

Figure 5. Discrete to continuous time scales operator.

In this case, the main issue to overcome is the transformation of the daily client information (discrete representation) into continuous time scale information. For this reason, a time scale transformation operator is included in the model. This is exemplified in the daily scale in Figure 5. This has associated demands for each product, for each day. A demand of product P3, for instance, allocated to day 5 will lie between time points 8 and 9 of the continuous time scale, which is built in the solution finding process. In the end, this demand will concern time point 9. 3.4. Tanks’ Representation. At this point, it is important to discuss tanks’ representation in this model. Usually, each product uses a group of tanks. On a mathematical model, either each tank is represented individually, or an aggregate tank is used instead to represent the group of tanks for each product. For the current model, the second option is used. However, in future work, more detail will be added, representing each tank and the corresponding decisions over tanks that need to be accounted for in real world tank farm inventory management. 3.5. Settling Period. One of the major improvements in the present model when compared to the previous version proposed by Relvas et al.17 is the modification performed in the settling period extension. A usual procedure at a tank farm for each new batch is to settle for a certain period. This is either for batch quality improvement or to accomplish a set of batch control and approval tests. This is an important inventory management restriction since the quality and approving task is usually based on national and/or European norms and specifications vary with the product. On model representation, one can either use a more coarse representation, using an overall settling period and building a simpler model, or create a more detailed model to account for settling periods by product. In the first situation, the model representation becomes less complex. However, the scheduler should choose a value of settling period such that it is feasible for all products. This means that the highest of all the settling periods is the one to use in the model. The major drawback is that if this value is high, the solution space may become reduced and an increase in the difficulty to find an inventory management plan that accommodates a large settling period before freeing products to satisfy client demands may occur. The alternative of having the settling period varying with the product turns the mathematical modeling into a slightly more complex issue, but there are gains both on getting closer to reality and maintaining the solution space. For this reason, this model representation adopts this alternative. The final consideration is on how to deal with a single tank by product (aggregated tank) where three different situations may be happening: (i) receiving product from the pipeline, (ii) waiting through a settling period, and (iii) delivering product to clients. The key idea is that the volume that is received from the pipeline will only be added to the tank after completing the settling period. However, it is necessary to ensure that once the batch arrives at the tank farm, the tank has enough free space for it. At the end, what happens mathematically is that two

inventory levels are required: total inventory and inventory available for clients. 4. Model Formulation 4.1. Nomenclature. The different indices/sets, parameters, and variables used in the MILP model and rescheduling strategy have been defined in the nomenclature section at the end of the article. 4.2. Model Formulation. The complete model presented in this section is an extended version of the one published before.17 The main modifications and extensions are related to the following: (i) variable flowrate, (ii) minimum settling period varying with product, and (iii) pipeline stoppages. These modifications and extensions will be analyzed in section 4.3. • Batch Sequencing

Ci - Li g Ci-1 ∀ i ∈ Inew

(1)

Li e Ci ∀ i ∈ Inew

(2)

Ci e hmax ∀ i ∈ Inew

(3)

• Relation between batch volume and pumping duration

vbmin × Li e Qi e vbmax × Li ∀ i ∈ Inew

(4)

• Forbidden sequences

lmin )

min(lotsp,lt) vbmax

(5)

lmax )

max(lotsp,lt) vbmin

(6)

∑yi,p × lmin e Li ep∈P ∑yi,p × lmax

i ∈ I new

(7)

p∈P

yi-1,p + yi,p′ e 1 + sequencep,p′ ∀ i ∈Inew, ∀ p, p′ ∈ P

(8)

• Upper and lower volume coordinates of batch i i′ + Wi′i ) Fi′i ∀ i ∈ I, ∀ i′ ∈ Inew, i′ > i Fi+1

(9)

• Pipeline end tasks

Qi ) Wii + Dii ∀ i ∈ Inew

(10)

Fii ) Wii ∀ i ∈ Inew

(11)

Wi′i ) Wi′-1 - Di′i ∀ i ∈ I, ∀ i′ ∈ Inew, i′ > i i

(12)

Ind. Eng. Chem. Res., Vol. 46, No. 17, 2007 5663

Di′i e Dmax × xi′i ∀ i ∈ I, ∀ i′ ∈ Inew, i′ g i

(13)

∑Demp,k × dmi,kFinal

∀ i ∈ Inew, p ∈ P

(32)

i′ g (1 - xset,i ) × Dmin ∀ i ∈ I, i′ ∈ Inew, i′ > i Wi′-1 i

(33)

qdp,i )

k∈K

Fi′i g σ × xi′i ∀ i ∈ I, ∀ i′ ∈ Inew, i′ g i

(14) • Settling period

i′-1 e σ - Di′i + (1 - xi′i ) × Mvol Fi+1

∀ i ∈ I, ∀ i′ ∈ Inew, i′ > i (15) Wi′-1 g Dmin × xi′i ∀ i ∈ I, ∀ i′ ∈ Inew, i′ > i i Di′i

∀ i ∈ I, ∀ i′ ∈ I

Wi′-1 i

e

new

, i′ > i

(16)



yi,p e

p∈P



∀ i ∈ Inew

(18)

yi-1,p ∀ i ∈ Inew

(19)

∀ i ∈ Inew

(20)

• Choice of batch volumes

(35)

i′ i′-1 e Tset,i + Ci′ - Ci′-1 ∀ i ∈ I, i′ ∈ Inew, i′ > i Tset,i

lsi,p,lt ) yi,p ∀ i ∈ Inew, p ∈ P

(21)

∑ ∑ (lsi,p,lt × lotsp,lt) p∈P lt∈LT

∀ i ∈ Inew

∀ i ∈ I, i′ ∈ Inew, i′ > i (37)

Qi′ )

i′ i′ Tsetp,i,p ) Tset,i ∑ p∈P

∀ i ∈ I, i′ ∈ Inew, i′ > i

Di′i ∑ i∈I,iei′

∀ i′ ∈ Inew

(23)

Wi′-1 ) Wo,i ∀ i ∉ Inew, i′ ) first(Inew) i

(24)

i′-1 i′ Tsetp,i,p e Trep,p + xavailable,i × hmax

∀ i ∈ I, i′ ∈ Inew, i′ > i (41) i′ i′ i′-1 xclients,i ) xavailable,i - xavailable,i ∀ i ∈ I, i′ ∈ Inew, i′ > i



∀ i′ ∈ Inew, i′ g i

(25) (26)

i′ DVi,p - qdi′p

∀ p ∈ P, i′ ∈ I )

i′ i′ Dclients,i e xclients,i × Dmax ∀ i ∈ I, i′ ∈ Inew, i′ > i (45)

+ IDi′p ) IDi′-1 p

i′ DVclients,i,p - qdi′p ∑ i∈ I,iei′

∀ p ∈ P, i′ ∈ Inew (46)

i∈I,iei′

i IDtotal,p

(43)

∀ i ∈ I, i′ ∈ Inew, i′ > i (44)

i′ e Dmax × yi,p ∀ i′ ∈ Inew, p ∈ P, i′ g i DVi,p

i′ i′-1 ) IDtotal,p + IDtotal,p

(42)

i′ i′ g Qi - (1 - xclients,i ) × Dmax Dclients,i

• Inventory control at the distribution center

i′ DVi,p ) Di′i ∑ p∈P

(39)

∀ i ∈ I, i′ ∈ Inew, i′ > i (40)

i′ Dclients,i e Qi ∀ i ∈ I, i′ ∈ Inew, i′ > i

• Initial conditions inside the pipeline

(38)

i′-1 i′ Tsetp,i,p g Trep,p × (yi,p + xavailable,i - 1)

(22)

• Overall volume balance to the pipeline ends while injecting batch i′

(36)

i′ i′-1 i′ Tset,i g Tset,i + Ci′ - Ci′-1 - (1 - xset,i ) × hmax

i′ e yi,p × hmax ∀ i ∈ I, i′ ∈ Inew, i′ > i Tsetp,i,p

lt∈LT

Qi )

i′ i′ e xset,i × hmax ∀ i ∈ I, i′ ∈ Inew, i′ > i Tset,i

p∈P

∑p yi,p ) 1 ∑

(34)

(17)

• Product allocation constraints

∑yi,p e 1 p∈P

i′ xset,i e 1 - xi′i ∀ i ∈ I, i′ ∈ Inew, i′ > i

ID0p

new

i ) 1, ∀ p ∈ P

i′ IDtotal,p e IDmax,p ∀ p ∈ P, i′ ∈ Inew

IDip ) ID0p i ) 1, ∀ p ∈ P

(46a)

IDi′p e IDmax,p ∀ p ∈ P, i′∈ Inew

(47)

(27) (27a) (28)

• Client demands

i′ i′ DVclients,i,p ) Dclients,i ∑ p∈P

∀ i ∈ I, i′ ∈ Inew, i′ > i (48)

i′ e Dmax × yi,p DVclients,i,p

Ci g TDem,k × dmei,k ∀ i ∈ Inew, k ∈ K

(29)

Ci e TDem,k + hmax × dmei,k ∀ i ∈ Inew, k ∈ K

(30)

Final dmi,k ) dmei,k - dmei-1,k ∀ i ∈ Inew, k ∈ K

(31)

∀ i ∈ I, i′ ∈ Inew, p ∈ P, i′ > i (49) • Pipeline stoppages

Ci -1 g Tstop × pmatchi-1 ∀ i ∈ Inew

(50)

5664

Ind. Eng. Chem. Res., Vol. 46, No. 17, 2007

Ci-1 + Li e Tstop + pmatchi × hmax ∀ i ∈ I new (51) pstopi ) pmatchi - pmatchi-1 ∀ i ∈ I new

(52)

Ci g Ci-1 + Li + (Tstart - Tstop) × pstopi ∀ i ∈ Inew, i′ ∈ Inew, i > i′ (1a) • Auxilliary conditions

∀ i ∈ I, ∀ i′ ∈ Inew, i′ > i Fi′i g Fi′-1 i

(53)

- Wi′-1 ∀ i ∈ I, ∀ i′ ∈ Inew, i′ > i (54) Fi′i - Wi′i g Fi′-1 i i Fi′i g Wi′i ∀ i ∈ I, ∀ i′ ∈ Inew, i′ g i Di′i ) ∑ ∑ (lsi,′p,lt × lotsp,lt) ∑ i∈I,iei′ p∈P lt∈LT



(55)

∀ i′ ∈ I new (56)

Final dmi,k )1 k∈K

(57)

i∈Inew i′′ei′



i′ xi′′ i g xset,i k ∈ K

(58)

i′′∈Inew,i′′gi

• Additional operational restrictions i′ g SSmin × IDmax,p p ∈ P, i′ ∈ Inew IDtotal,p

∑ ∑ i∈I

Di′i g

i′∈Inew

(

∑ ∑ i∈I

min

Di′i -

i′∈Inew

(59)

∑ ∑ Demp,k

(60)

p∈P k∈K

• Objective function

∑ ∑ Demp,k

p∈P k∈K

hmax × vbmax



-2

)

Li

i∈Inew

hmax

Table 1. Calculation of Clients’ Availability Decision Variable, i′ xavailable,i

(61)

4.3. Model Modifications and Extensions. 4.3.1. Relation between Batch Volume and Pumping Duration. The extended formulation accounts for variable flowrate in contrast with the constant flowrate used by Relvas et al.17 As the flowrate is not a model variable (can be only obtained as an end calculation), it has to be controlled using the pumping duration and batch volume. The minimum and maximum flowrates are vbmin and vbmax. Condition 4 states that the batch volume (Qi) has to be confined to a maximum and minimum value, that are obtained with the respective pumping duration (Li) and flowrate limits. The pumping duration limits lmin and lmax are obtained through eqs 5 and 6, where it is necessary to find the minimum and maximum possible batch volumes (right-hand sides). Finally, pumping duration will only have a value different than zero, if the product allocation variable is different than zero, as stated in condition 7. This is mandatory to be included in the model formulation if no fixed number of batches is used. 4.3.2. Settling Period. An additional innovation of the present model, when compared to the original one by Relvas et al.,17 is that the formulation now accounts for minimum settling period, varying with the product. Each new batch that arrives from the pipeline to the tank farm needs to settle for a given period. In this way, at any given moment of the time horizon i, there will be a certain inventory for each product p that is available for clients, IDip, but there is also a total inventory of product p, i , that accounts also for inventory on the settling period, IDtotal,p calculated through condition 27.

i′-1 |yi,p)1 < Trep,p Tsetp,i,p i′-1 Tsetp,i,p |yi,p)1 > Trep,p

condition 40

condition 41

i′ xavailable,i )1 not relevant

i′ )1 xavailable,i

not relevant

The key idea for this operation formulation is to start to count the settling period at the moment each batch has completely i′ left the pipeline. For this purpose, a new decision variable xset,i is defined that controls the settling time of batch i. Unless both of the following situations have already happened, the settling time is set to 0: (a) batch i has not been pumped to the pipeline or is still inside the pipeline; (b) batch i is being discharged from the pipeline. i′ i′ Considering that variable xset,i is defined such that xset,i ) 0, i′ e i, it is necessary to add two restrictions to completely translate situations (a) and (b). The former is granted by condition 33 and the later by condition 34. Condition 33 states that if in the previous time interval there was no fraction of batch i in the pipeline, then the decision i′ variable xset,i is activated. Condition 34 states that, at any given time interval, at most one of two situations can happen to batch i: discharge or settling. i′ Decision variable xset,i can now control values of the settling i′ period through condition 35, where Tset,i is the settling time of batch i while injecting a later batch i′. The settling period counting, when nonzero, is updated using the length of each time interval. This is achieved using restrictions 36 and 37. If the settling period is nonzero, the fourth term on the right-hand side of condition 37 becomes redundant. However, it is essential on time intervals where batch i is not settling. As the settling period is already controlled and being updated i′ , is at each new time interval, a new decision variable, xavailable,i introduced indicating that a batch i has already performed a i′ i′ minimum settling period (xavailable,i ) 1) or not (xavailable,i ) 0). If this decision variable takes a value of 1, this means that at the current time interval i′ batch i is available for clients. However, the minimum settling period is a parameter that varies with the product contained in batch i, Trep,p. For this reason, it is necessary to the relate settling period to the product contained i′ i′ in batch i. Tset,i is disaggregated in p to obtain Tsetp,i,p , as indicated through restrictions 38 and 39. i′ In this way, the relation between Trep,p and Tsetp,i,p , using the i′ respective decision variable, xavailable,i, is represented by conditions 40 and 41. A table of results can be constructed for these conditions. Note that they become both redundant whenever yi,p ) 0. Therefore, Table 1 considers results for yi,p ) 1. In this way, it is ensured that if at time interval i′ - 1 batch i of product p has completed the minimum settling period Trep,p, then it will become available for clients from time interval i′ i′ on, xavailable,i ) 1. i′ As the binary variable xavailable,i will assume values such that a discontinuity is well defined, an event variable can be calculated and represents the exact interval i′ where batch i has i′ . This calculation is been made available for clients, xclients,i done through condition 42. The associated volume of batch i made available for clients i′ at time interval i′, Dclients,i , is obtained by conditions 43-45. i′ is nonzero, it will Conditions 43 and 44 state that, if Dclients,i be equal to batch volume Qi. The event variable is used in

Ind. Eng. Chem. Res., Vol. 46, No. 17, 2007 5665 Table 2. System Perturbations that Require a Rescheduling Task number

situation

description

S1

variation on clients demands

Due to time horizon evolution, clients adjust their demands on a periodic basis, e.g., daily or weekly.

S2

imposition on product sequence

Due to economical or inventory management reasons economical reasons: to transport a batch of product A instead of B or include a batch of product A in the pipeline schedule inventory management reasons: variation on operational conditions at the tank farm or at the refinery

S3

unpredicted pipeline stoppages

Due to product shortage at the refinery, several reasons (internal or external) may result in unforeseen pipeline stoppages.

S4

batch volume modifications

Due to refinery imposition (product shortage, for example)

S5

flowrate adjustments

Mainly due to economical reasons or to meet an unexpected client demand in a short time

S6

variation on maximum storage capacity

Due to tank maintenance, this may only happen when the tank is empty.

i′ restriction 45 to control the single nonzero value of Dclients,i during the time horizon. Furthermore, it is now possible to define an inventory of available products to clients (IDip) calculated through conditions 46 and 47. The initial inventory available for clients must be given to the model. In eq 46, the volume made available for clients of batch i at time interval i′ appears, but it is disaggrei′ gated by product, calculated through eq 48, DVclients,i,p . This variable is referred to decision variable yi,p as stated in eqs 48 and 49. i The model will track the total inventory (IDtotal,p ) as well as i the inventory available for clients (IDp). At any moment in the time horizon, both of these inventories must be feasible. The first ensures that it is possible to accommodate incoming batches being discharged from the pipeline, meanwhile the second is set in a way such that even with some amounts of product performing the required settling period, it is possible to fulfill client demands. Initial inventories are given by eqs 27a and 46a. Finally, an additional auxiliary condition in the new formulation is required, condition 58. This condition assists the i′ . It is an calculation conditions for the decision variable xset,i alternative definition of condition (a) in settling period section. Restriction 58 states that until the summation of all of past values of variable xi′i starts to become greater than 0, variable i′ xset,i is set to 0. This is a way to enforce that the discharge of batch i has always to take place before the settling period. 4.3.3. Pipeline Stoppages. A scheduler or scheduling procedure should be able to include in their planning any pipeline stoppage that is planned for the coming time horizon. If this happens, a small change has to be done to the formulation. Parameters Tstop and Tstart should be given to the model. These represent respectively the time points where the pipeline is going to stop and when it starts its operation again. Additionally, two decision variables have also to be included. pmatchi is a binary variable that relates Tstop with the continuous time scale. Whenever Ci > Tstop, then pmatchi ) 1. This variable is determined using conditions 50 and 51. The event variable that indicates the time interval where the pipeline stoppage is located is pstopi. It is calculated through eq 52. Once the time interval where the pipeline stop is located is identified, it is necessary to include the pipeline stop duration in that interval. For this reason, restriction 1 should be replaced by eq 1a. This new restriction states that whenever a pipeline stoppage is allocated to time interval i, then the duration of that interval not only corresponds to the pumping time of batch i, but it is also added to the stoppage duration (Tstart - Tstop). As

the event that controls the continuous time scale is the pumping end of each batch, it is not necessary that the pumping beginning of that batch corresponds to the pumping end of the previous batch. This formulation was derived to accommodate a single pipeline stoppage, but it is easily extended to consider more than one stoppage. 4.3.4. Additional Operational Restrictions. Constraints can be added to the model in order to represent specific situations that must be verified. In this section, we present two possible situations (i) minimum stock during the time horizon and/or (ii) lower limit on total volume transported by the pipeline. When a minimum stock needs to be maintained, a parameter to express the percentage of total inventory, SSmin , is included as described by eq 60. This condition is optional and represents a hard constraint on inventory. In the second case, a certain volume to be transported can be imposed to the pipeline. For instance, at least the same volume that is going to be delivered for clients must be transported. With this imposition, expressed in condition 60, a certain level of inventory can be kept at the tank farm. Objective Function. The objective function to be used may be operationally or economically oriented. However, behind some operational objectives, there are also economical issues represented, such as flowrate minimization (indirect way of minimizing pumping costs). The most used in previously published works is the economical field. However, in real world scenarios, operational objectives are frequently used. This will be assumed in the present work, where the objective function is represented by expression 61. This represents a new target when compared to the original model, by Relvas et al.,17 where the maximization was of the amount of products transported plus the total inventory at the end of the horizon. In the present model, it is considered essentially the minimization of the difference between the total amount of products transported by the pipeline and the total amount of outputs to clients and maximization of the total pumping time. The first term minimizes the difference between volume transported and client demands. The effect of this term is opposite to condition 60. The net result is that in the end this difference is close to zero, meaning that the pipeline transports the same volume that was delivered for clients. The second term maximizes the amount of time that the pipeline is pumping. All the terms in the objective are normalized. The combination of both terms is an indirect way to minimize the pumping flowrate.

5666

Ind. Eng. Chem. Res., Vol. 46, No. 17, 2007

Figure 7. Trevision algorithm.

Figure 8. Iini algorithm.

Figure 6. Rescheduling framework: premodel preparation procedure.

5. Rescheduling In real world scenarios, it is very difficult to maintain a single schedule and inventory management plan throughout the entire time horizon. There are several reasons that move schedulers to revise and readapt what was planned. In this section, a survey on situations that may occur in the system in this study, presented in section 2, is discussed. Also, the ways of modeling these situations using the MILP model proposed are analyzed. Table 2 presents several typified situations that may origin a new plan, or a rescheduling. These situations are probably the most likely to happen, but a scheduler may be aware of other situations not listed. On another hand, some of these situations may be overcome using an optimized schedule and inventory management plan, instead of heuristic-developed methods. The main advantage to have a systematic scheduling procedure is that on rescheduling situations it may be possible to eliminate certain aspects from revision due to inefficient heuristic-based plan development. While situations 1-4 are simple to address, some considerations must be outlined for situations 5 and 6. The approach to overcome situation 5 can only be formulated for situations that report to the pipeline origin, due to the problem definition, i.e., if it is necessary to control pumping start and end times, it is a straightforward task because all events in the system are already related to pumping end times at the pipeline origin. Situation 6 may be developed for the present model where tanks are described in an aggregated manner. However, in future work, it will be revised, when tanks become modeled as individuals. The rescheduling framework receives new data on perturbations in order to establish the conditions for the new schedule. This methodology is presented in the following section. The mathematical formulation that addresses all the perturbations indicated in Table 2 is presented in the subsequent sections.

5.1. Rescheduling Framework. The procedure to address all the perturbations to be verified in a new schedule can be built in a systematic method, presented in Figure 6. This procedure precedes the model solution finding process. The main goals are (i) the activation/deactivation of the mathematical formulation for each perturbation, taking into account if it is to be addressed or not, and (ii) definition of past and future events, these being the candidates for rescheduling issues. It will be considered that past events are denoted by the index ini, while events under rescheduling are denoted by the index resc. The first step of this procedure is to retrieve the inputs required, namely the previous model solution (which now represents the previous schedule) and the information on perturbations to the system, including updated data and timing questions, i.e., the time points where these perturbations are to be considered. Having all the information gathered, it is necessary to define (i) a new set t ∈ T, representing timing issues on perturbations; (ii) a new parameter revisiont, which assigns a time instant to each perturbation; and (iii) a new parameter Trevision, which will represent the time point where the rescheduling starts to take effect. Having defined all the time instants for parameter revisiont, any zero value means that the perturbation does not take place, whereas a value different than zero will mean that the perturbation formulation will become activated. A small note should be added to the definition of set t ∈ T. This set will include all perturbation timing issues Tclients, Tsequence, Tstop, Tstart, Tinventory, Tflow, and Tcapacity. The respective values are now represented by parameter revisiont. At this point, a parallel algorithm (Figure 7) is run in order to determine Trevision, which has to take a value different from zero but equal to the earliest activated perturbation time (set by parameter revisiont) or to the present instant of the time horizon. For instance, if it is known during day 12 that the pipeline must stop at day 15 and that a tank will be shut down for maintenance at day 14, Trevision will be the time point for day 12. But if the pipeline stops at day 12 due to product shortage, then Trevision is day 12 but it will correspond to the perturbation time point itself. Following in the rescheduling framework (Figure 6), there is now the definition of two sets: (i) Iini, containing all the past (and therefore fixed) events, and (ii) Iresc, representing all event candidates for rescheduling purposes. Note that any events partition for rescheduling must be such that Iini ∪ Iresc ) I. The definition of the previous sets enables the second algorithm (Figure 8) that defines the contents of both sets, comparing Trevision to the continuous time scale obtained for the previous schedule.

Ind. Eng. Chem. Res., Vol. 46, No. 17, 2007 5667

The subsequent action fixes all past variables. Therefore, any variable of the rescheduling model (Variableresc) reporting to a past event i, will be set equal to the corresponding variable from the previous schedule (Variableresc ) Variableini). It was chosen to fix only the variables Ci, Li, Qi, yi,p, and lsi,p,lt, because all the remaining ones can be easily obtained from these. The activation/deactivation of perturbation formulations can be simply derived through the following step of the rescheduling framework, where a loop covers all the values of revisiont. Whenever the value of revisiont > 0, the assigned perturbation formulation is activated. When the end of the rescheduling procedure is reached, the model is ready to be run with the data for the rescheduling and now under the objective function with penalization terms regarding deviations to the previous schedule. This procedure should be repeated as many times as each schedule requires reformulations. 5.2. Mathematical Formulation for System Perturbations. 5.2.1. Variation on Client Demands. It should be included in set T an element Tclients that indicates the moment when client demand information is revised and, therefore, is to be considered in a new schedule. In addition, the new client demands should be also given to the model. No additional model formulation is needed. 5.2.2. Imposition on Product Sequence. This perturbation is probably the one that might have more variants. For this reason, only a simple situation is presented where a single lot of one product is considered. Any other variant can be easily accommodated in the model formulation. If, for any reason, the pipeline schedule did not consider a certain product Px and, due to economical reasons, it was decided by the logistic decision makers that one batch of that product should be transported during the current time horizon, then a new schedule revision is required. The time point when this perturbation should be included is identified by Tsequence ∈ T, and condition 62 should be added to the model formulation.

∑ yi,P ) 1

i∈Inew

x

Px ∈ P

(62)

This condition imposes that exactly one batch of all pumped batches must be of product Px. 5.2.3. Unpredicted Pipeline Stoppages. Pipeline stoppages can be planned or not. When it is known that a pipeline stoppage must be included in the plan, the model formulation presented previously is used. However, if it is necessary to stop the pipeline due to an unexpected situation, the scheduler must revise the initial plan. In this situation, new elements of set T, Tstop and Tstart, are necessary as well as the event variable pstopi. The procedure to establish the right time interval where the pipeline stoppage takes place is now different. It is necessary to evaluate the previous schedule and find a time interval such that condition 63 applies: stop ∧ Cini pstopi ) 1 if Cini i >T i e revisionTstart (63)

For all the remaining time intervals where the condition does not apply, pstopi ) 0. After establishing the correct time interval where the pipeline stoppage is allocated, restriction 1a is enabled. When a solution of a rescheduling procedure, including an unpredicted pipeline stoppage, is obtained, it is necessary to make some end calculations.

The model is built in such a way that the time interval (and corresponding pumping batch i) is known (once the solution is obtained) where the stoppage is located. As the beginning and end of the stoppage are also known (parameters), it is now possible to calculate the fraction of batch i that was pumped before the stoppage and the fraction that was pumped after, considering that the flowrate is maintained (obtained also as an end calculation). On the other hand, if before the stoppage, the flowrate is different from the flowrate after the stoppage, it is possible to calculate the fractions pumped before and after the stoppage. Note that in this second situation, the average flowrate between flowrates before and after the pipeline stoppage must be equal to the one calculated through the problem solution. 5.2.4. Batch Volume Modifications. In these rescheduling circumstances, several situations may occur that motivate recalculations, e.g., (i) the refinery does not have the necessary amount of product and reduces the batch volume and (ii) with regard to inventory management issues, the destination tank may need to be changed, and therefore, the batch volume may have to be adjusted. The time instant when it is necessary to reschedule due to inventory adjustments is Tinventory, which is an element of set T. For situation i, it is necessary to add a new set Iinv ⊂ I, which includes the batch or batches that will have imposed volumes. For all i ∈ Iinv, there will be a new parameter Qfixed that i indicates the imposed volumes for batches i such that i ∈ Iinv. Additionally, eq 22 must now have a restriction on sets definition:

Qi )

∑ ∑ (lsi,p,lt × lotsp,lt) p∈P lt∈LT

i ∈ Inew ∧ i ∉ Iinv

(22a)

A new restriction is included to match batch volumes that are excluded from the previous condition:

i ∈ Iinv Qi ) Qfixed i

(64)

Situation (ii) is rather simple to overcome. The scheduler only needs to preset the decision variable lsi,p,lt value to the desired choice. 5.2.5. Flowrate Adjustments. Flowrate adjustments on a model formulation where flowrate is not a variable must be done in an indirect manner. When analyzing a schedule, the scheduler may desire to impose for a certain batch to be pumped earlier or later than planned. It is then necessary to define the set Iflow ⊂ I that includes the batches for which flowrate must be adjusted. The element of set T that reflects rescheduling due to flowrate variance is Tflow, and it must also be provided a that indicates time restrictions for batches parameter Tcompletion i whose flowrate is being revised. A new restriction must be added to the rescheduling model:

{}

g i ∈ Iflow Ci ) Tcompletion i e

(65)

This condition will be totally defined when one of the following situations is specified: (i) if the pumping end time of batch i must be greater than the respective Tcompletion , then i the greater or equal (g) sign is adopted; (ii) if the pumping of batch i must be exactly set to the respective Tcompletion , then the i equal sign ()) is adopted; (iii) finally, if the pumping end time is not desired before Tcompletion , then the less or equal sign (e) i is employed.

5668

Ind. Eng. Chem. Res., Vol. 46, No. 17, 2007

Table 3. Pairs of Products: Possible Sequences

P1 P2 P3 P4 P5 P6

P1

P2

P3

P4

P5

P6

× x x x × ×

x × × × × ×

x × × x x ×

x × x × x ×

× × x x × x

× × × × x ×

Table 4. Tank Farm Characteristics by Product possible batch volumes (vu)

product (p)

max storage capacity (vu)

lotsp,1

lotsp,2

lotsp,3

min settling period (h)

P1 P2 P3 P4 P5 P6

81500 32000 24000 27800 10320 13120

21800 16000 16000 16000 3440 6560

18000 8000 8000 8000 1720 4920

17300 3800 860 8200

24 48 24 24 6 6

Table 5. November 2006 Initial Data P1

P2

P3

P4

P5

P6

total

initial inventory 40690 15706 13867 18276 7771 6734 103044 (vu) total demand 188765 53640 7181 58031 13150 24448 345215 (vu) total demand 183355 53190 6981 56231 12650 24464 336871 (revised) (vu)

5.2.6. Variation on Maximum Capacity Storage. A situation that happens frequently in the tank farm is the nonavailability of a certain tank due to maintenance reasons. The maintenance is usually scheduled for a given day, where, usually, an internal or external service is requested for this purpose. However, maintenance takes place when the respective tank is empty, which may happen during the current time horizon. For a model formulation that represents tanks in an aggregated manner, it is only possible to impose that at a certain time point maximum storage capacity for a product is reduced (or increased if a tank returns from maintenance) to a new value. The time point when the rescheduling takes place and when the maximum storage capacity changes will be defined through Tcapacity ∈ T. From this point on, the maximum storage capacity maintenance . of a product p is then set to a new value, IDmax,p 5.3. Objective Function. The objective function on rescheduling situations can support additional terms, where solutions that differ significantly from the original schedule are penalized. Generally, these terms are of the following type:

R × |Variableini - Variableresc|

(66)

where R is a term that may account for a weight and/or normalization issues. It is necessary to use the absolute value of the difference such that the final result is always a positive value. In this way, the term is (i) added to the objective function if the direction of the optimization is the minimization or (ii) is diminished if the direction is the maximization. The rescheduling structure adopted for this system implies that revisions are made over the current schedule and may occur (more often) when the time horizon is already taking place. This implies that a part of the schedule is past and, therefore, fixed. What will be changed are future operations. In theory, it would not be necessary to stick to the previous schedule and our concern could only be to include changes and obtain, under new conditions, the best remaining schedule. The need to include penalization terms has an operational reason behind it, which is to keep as much as possible what was originally planned,

such that both the refinery and tank farm know in advance that minimum changes will be held. This is important because there are other interests external to the system and, therefore, it is necessary to minimize perturbations. Recalling the objective function 61, it is constituted by normalized terms, which has also to be maintained in penalization terms. Furthermore, in the rescheduling structure, it was established that five past variable groups have to be fixed, two binary (yi,p and lsi,p,lt) and three continuous (Ci, Li, and Qi). To keep rescheduling procedure assumptions, these variables are the most suitable variables to have penalization terms in the objective function. Binary variables translate model decisions over the system’s management. If a given situation A happens, usually, the remaining possibilities, e.g., B, C, and D, do not happen. So, the penalization term must take into account only the group of binary variables that had a value equal to 1 in the past. For example, binary variable yi,p ) 1 states that batch i contains product p. This means that for the same batch i, yi,p′ ) 0 if p′ is different from p. In the penalization term, only the differences between the original and new schedule for batches whose original value was 1 will be calculated:

(∑∑|

|)

ini resc yi,p - yi,p

i∈I p∈P

yi,pini)1

(67)

The same criteria is applied to the batch volume allocation variable, lsi,p,lt:

(∑ ∑ ∑ |

ini resc lsi,p,lt - lsi,p,lt

i∈I p∈P lt∈LT

|)

lsi,p,ltini)1

(68)

No weight is included for these terms. Any change when compared to the original schedule will have weight equal to 1. For the continuous variables, the penalization term is similar to term 66. No weight different from 1 will be included. However, normalization terms have to be included.

∑ i∈I

resc |Cini i - Ci |

∑ i∈I ∑ i∈I

hmax

(69)

resc |Lini i - Li |

lmax

(70)

resc |Qini i - Qi |

Qavg

(71)

where Qavg represents the average of all possible batch volumes. Given all the penalization terms, the decision maker should analyze the behavior of the model under several instances of the objective function. For the present model, the terms 67 and 68 will be added to the objective function 61. However, the performance of the rescheduling procedure can be easily tested using all the penalization terms. 6. Model Application: Case Study Results 6.1. Case Study. The mathematical model and respective rescheduling framework presented in the previous sections can be applied to real world problems. One of the possible examples

Ind. Eng. Chem. Res., Vol. 46, No. 17, 2007 5669 Table 6. Agenda of Perturbations during November 2006 operational plan

description

timing

R0 (initial plan)

Given the initial conditions, an initial plan is obtained

middle October 2006

R1

New and more detailed client demands were received (S1)

fourth week of October (revisionTclients ) 0)

R2

Due to economical reasons, the decision makers decided to remove the batch of product P3 from the pipeline schedule (S2) and replace it with P4 (concurrent product for the same place).

revisionTsequence ) 72

R3

The second pipeline stop must start 6 h earlier (S3) and batch 34 (of product P4) is expected to face a feed shortage at the refinery. This will be set to 3000 vu (rather than 3800 vu) (S4). The batch is immediately before the pipeline stoppage. It was decided to impose a batch 35 pumping end to 2 h later (S5).

revisionTinventory ) 418, revisionTflow ) 500, revisionTstop ) 636, revisionTstart ) 672, and revisionTcompletion ) 672

R4

A tank with 17300 vu of capacity of product P1 will be off for maintenance (S6), so the maximum capacity for product P1 becomes 64200 vu.

revisionTcapacity ) 600, but revision was undertaken at 450 h

Table 7. Model Performance through the Rescheduling Procedure revision

R0

R1

R2

R3

R4

# continuous variables # binary variables # equations # nodes explored # iterations CPU (s) objective function relative gap (%) relative gap (%, before polishing option)

25838 6206 46512 193 28790 112.2 -1.7499 0.01 2.45

25840 6186 46552 212 28473 88.4 -1.7306 0.00 0.00

25840 6186 46552 1195 70810 175.6 1.2509 0.07 18.79

25823 5615 47137 115 7658 12.718 -0.7327 0.00 121.79

25823 5659 47150 891 106011 67.921 4.2679 1.72 2.49

Table 8. Final Inventories, Operational Balance, and Indicators inventory (vu) P1 P2 P3 P4 P5 P6 total inventory total (inputs outputs) medium flowrate (vu/h) pipeline usage (%) minimum inventory (%)

R0

R1

R2

R3

R4

45725 18066 14686 10845 8221 5536 103079

51135 18516 14886 12645 8721 5520 111423

51135 18516 6886 12645 8721 5520 103423

51835 18516 6886 11845 8721 5520 103323

34535 18516 14886 19845 8721 7070 103523

+35

+8379

+379

+279

+529

548.0

548.0

535.3

540.3

540.7

87.5

87.5

87.5

86.7

86.7

1.78 (P4) 6.45 (P4) 21.94 (P6) 21.94 (P6) 21.94 (P6)

is the case of CLC-Companhia Logı´stica de Combustı´veis, which is a Portuguese oil products distribution company. CLC is connected through a pipeline to a refinery from Galpenergia located in Sines, covering a distance of 147 km. The volume of the pipeline is 18 000 volume units (vu), and the operating flowrates can vary from 400 to 720 vu. This pipeline transports a considerable part of the production of the refinery, and it feeds CLC’s tank farm, which, in turn, distributes six oil products (P1-P6) to the center part of Portugal. Four of the products are white products, and the remaining two are liquefied gases. The tank farm is organized in a way such that each product is always stored in the same set of tanks. As the transportation is performed without any separating device between different products, the interfaces formed are cut in specific points related to density. In this way, a small part of the interface is diluted in the batch, so that one of the adopted practices is to fill up any tank with a product with its origin in a single batch in order to minimize contamination. Only after completing the minimum settling period, the product is made available for clients.

Due to the formation of interfaces, there are some pairs of products whose sequence is forbidden, as indicated in Table 3. In addition, all new batches have to settle for a given amount of time before being available for clients. Table 4 sumarizes the total capacity, possible batch volumes, and minimum settling period by product. The usual operation is planned over a time horizon of one calendar month. The objective of the schedulers is to find a feasible pipeline schedule that matches with a feasible inventory management plan. This task is performed by reffering to common spreadsheets (one for the pipeline and another for the inventory) and the scheduler’s knowledge of the system. When adjustments have to be made, the scheduler makes adjustments on the spreadsheets in order to reestablish the feasibility of the plan. 6.2. Case Study Scenario and Results. The usual procedure for any new month is to gather all the information, including client demands (prevision) and expected initial conditions, during the previous month and obtain an initial plan for all the operations. Given the initial information for the calendar month of November 2006, the objective of this model application is to do the following: (1) obtain a valid initial plan, including pipeline schedule and inventory management, for the given month; (2) given an agenda of perturbations to the system occurring during the time horizon, reschedule over the current plan to answer all the changes. Table 5 provides information on initial inventory and total demand by product. It also indicates total client demands revised, which will have to be used for rescheduling purposes. It is desired to maintain the flowrate between 500 and 600 vu/h. On this particular month, due to pipeline maintenance, operation will start during day 2 (60 h). Furthermore, there is a planned pipeline stop between 642 and 672 h. Initial conditions show that the initial inventory is at 54.6% of total capacity and that clients overestimated their demands by 2.5%. This will be translated in a demanding initial plan, mainly because decision makers impose that, even with having almost 4 days with the pipeline stopped (90 h), at least the same amount that is going to be delivered for clients should be transported, in order to maintain the total capacity occupancy level. The initial product sequence is fixed, with 39 batches (one inside the pipeline and the remaining to be pumped), and was obtained through simple analysis made at the beginning of every month by CLC’s schedulers. Table 6 sumarizes the perturbations and all the information required, that motivated rescheduling. It can be verified that

5670

Ind. Eng. Chem. Res., Vol. 46, No. 17, 2007

Figure 9. Inventory profiles by product, along the time horizon.

there were four revisions undertaken and that on revision R3 three parallel perturbations had to be considered. The model was implemented using GAMS 22.320 and solved using CPLEX 10.0. All the reported results were obtained in a Pentium D820 with two 2.8 GHz processors, with 2 GB RAM and running Microsoft Windows XP Professional. All scenarios were run using as stopping criteria either a maximum resource time of 7200 CPU s (reasonable amount of time considering a real world operation and scheduler work) or a final solution within a tolerance of 5%. At the end of each computation, CPLEX’s polishing option is used, where an amount of time for solution polishing can be specified. In this case, it was set at 15 s. Table 7 summarizes model performance for the initial plan and all the four revisions. The main conclusion is that model size decreases whenever the revision is undertaken closer to the time horizon end. The most time-consuming revision is R2, where the model faces a product sequence modification early in the time horizon. Revision R4 faced a computational effort higher than the previous revision (R3), even with fewer binary variables, but it had to rearrange the plan in order to fulfill the storage capacity reduction. It can be seen through the value of the objective function that some penalizations occurred. More precisely, two changes in product sequence and four changes in batch volumes. It can be additionally stated that the polishing option is quite effective, namely on revisions R2 and R3, where

a strong polish was made, moving down drastically the upper bound of the problem. Table 8 summarizes the values of the operational indicators for all scenarios. These indicators are final inventories for each product and in total, the balance between inputs (from the pipeline) and outputs (to clients), medium flowrate through the entire time horizon, temporal pipeline usage, and minimum inventory verified. It is easily identified that, from the initial plan to the first revision, a medium flowrate is maintained, but there is a significant increase in the positive balance between inputs and outputs. This reflects the overestimation on client demands in their initial prevision. The medium flowrate decreases from revision R2 on, reflecting lower demands by clients and diminishing the balance over inputs and outputs toward zero (which is one of the directions included in the objective function). The pipeline usage is below 90% in all scenarios, but a simple calculation is sufficient to verify that, despite the mandatory pipeline stoppages, the pipeline is pumping in the remaining time horizon. In scenarios R0 and R1, the minimum inventory belongs to product P4. Exceptionally in the initial plan, it reaches, at some point, a level below 2% of the total inventory. This was one of the reasons behind the change performed in revision R2. From this revision on, it can be seen that minimum inventory is now

Ind. Eng. Chem. Res., Vol. 46, No. 17, 2007 5671

on product P6, but this value is above 20%, which is a comfortable operational margin. The product shortage at the refinery verified on product P4 is easily identified on revision R3, where the difference to the values of R2 is exactly 800 vu, corresponding to the reduction imposed. This means that no adjustments were necessary on the remaining batches to eliminate any severe effect of this perturbation. Revision R4 presents some differences when compared to R3, mainly on final inventory levels, due to adjustments to answer to capacity reduction on product P1. Figure 9 represents the inventory profiles obtained for all scenarios for each product. Despite being imposed late in the time horizon, the maximum capacity decrease on product P1 is easily accommodated in revision R4 but leads to a lower profile at the end of the time horizon when compared to the previous scenarios. Actually, through all products, the most uncharacteristic revision is R4. It can be easily identified that products P3 and P4 had a clear benefit with this perturbation, meanwhile P1 and P2 had some depletion on their inventory. On the remaining revisions, the similarities on inventory profiles are evident, meaning that the objective function’s penalization terms are effective. From the analysis of the inventory profiles, the initial period of the time horizon can be identified, where the pipeline is stopped during the first 60 h, leading all inventories to lower values early in the time horizon. 7. Conclusions and Further Work This paper improved the work presented by Relvas et al.,17 where the original model was extended in order to enable the use of a variable settling period by product, variable flowrate, and pipeline stoppages. Additionally, the authors propose a novel procedure to account for reactive scheduling, which enables the decision makers to obtain revised schedules that take into account unexpected events. The rescheduling over the original operational plan can be either performed before or during the time horizon and can accommodate several stand alone or combined perturbations in a single revision. This is highly important in the industrial context, namely, in the oil supply chain, where uncertainty is an unavoidable operational issue. Compared to previous works in this area, this model is innovative either in the system representation or in the rescheduling framework. The system modeled not only focuses on the pipeline operation but also accounts for its interaction with an end-of-pipe distribution tank farm and its respective requirements. The results obtained reveal that (i) the model is suitable to develop either an initial plan, given the initial conditions of the system or (ii) rearrange any current schedule in order to accommodate unexpected changes. The reactive schedule procedure is built in a way that the minimum changes to the previous schedule are obtained. This gives a final schedule with the main operational indicators in the range of values well compared with the initial proposal. Additionally, it proved to be robust to address radical changes, such as a deep storage capacity reduction. Further work should focus on two major issues: (i) development of heuristic procedures providing a set of favorable product sequences prior the model run to reduce model complexity and (ii) development of a new model extension to account for inventory management at the tank farm (tank desegregation).

Acknowledgment The authors gratefully acknowledge financial support from Companhia Logı´stica de Combustı´veis and Fundac¸ a˜o de Cieˆncia e Tecnologia, grant SFRH/BDE/15523/2004. Nomenclature Indices/Sets i ∈ I ) batches p ∈ P ) products lt ∈ LT ) volumetric batches k ∈ K ) days Inew ⊂ I ) batches whose pumping will be performed during the time horizon Iinv ⊂ I ) batches whose volume is imposed by external decisions Iflow ⊂ I ) batches whose flowrate must be adjusted due to external decisions Iini ⊂ I ) batches whose pumping end time has already taken place before the rescheduling procedure time point Iresc ⊂ I ) batches whose pumping end time, determined by the previous schedule, is suitable to rescheduling issues t ∈ T ) perturbation time points Tstop ∈ T ) pipeline stoppage instant (h) Tstart ∈ T ) pipeline startup instant, after pipeline stoppage (h) Tclients ∈ T ) time point when client demands are revised and are to be considered (h) Tsequence ∈ T ) time point when it is included a compulsory change on products sequence (h) Tinventory ∈ T ) time point when it is imposeda restriction on batch volumes is imposed(h) Tflow ∈ T ) time point when it is necessary to adjust flowrate scheduling issues (h) Tcapacity ∈ T ) time point whenit is changed the maximum storage capacity for a given product is changed (h) rp ∈ RP ) perturbations that require rescheduling ini ) denotes a variable whose value was obtained in the initial schedule resc ) denotes a variable whose value is to be obtained in a reschedule procedure Parameters hmax ) time horizon (h) vbmin ) minimum flowrate (volume unit/h) vbmax ) maximum flowrate (volume unit/h) Dmax ) upper limit on the volume of any batch that can be transferred from the pipeline to the distribution center (volume unit) Dmin ) lower limit on the volume of any batch that can be transferred from the pipeline to the distribution center σ ) volumetric coordinate of the distribution center (volume unit) Mvol ) big-M, related to pipeline volume SSmin ) minimum safety stock fraction Trep,p ) minimum settling period for a batch of product p (h) IDmax,p ) storage capacity for product p (volume unit) Wo,i ) volume of batches i that originally are inside the pipeline (volume unit) TDem,k ) Dailybased (k) time scale for information on client demands (h) lotsp,lt ) matrix of possible batch volumes lt for each product p (volume unit) DEMp,k ) client demands of each product p at each day k (volume unit)

5672

Ind. Eng. Chem. Res., Vol. 46, No. 17, 2007

sequencep,p′ ) matrix of possible sequences between subsequent products inside the pipeline, p and p′ ID0p ) initial inventory of product p at the tank farm (volume unit) T completion ) imposed completion time for a batch i that is i under flowrate rescheduling analysis (h) Qfixed ) imposed batch volumes on inventory rescheduling i issues (volume unit) maintenance IDmax,p ) redefinition of maximum storage capacity of product p if changes occur due to tank maintenance (volume unit) revisiont ) time points when perturbations take place (h) Trevision ) time point when a reschedule process associated to a perturbation takes place (h) Continuous Variables Ci ) completion time of pumping batch i (h) Li ) length of pumping batch i (h) Qi ) volume of batch i (volume unit) Fi′i ) upper volumetric coordinate of batch i while injecting a later batch i′ (volume unit) Wi′i ) volumetric fraction of batch i still inside of the pipeline while injecting a later batch i′ (volume unit) Di′i ) volumetric fraction of batch i discharged to the distribution center while injecting a later batch i′ (volume unit) i′ Dclients,i ) volume of batch i made available for clients after accomplishing the settling period while injecting a later batch i′ (v.u.) qdip ) demand of product p while injecting batch i (volume unit) i′ DVi,p ) volumetric fraction of batch i of product p discharged to the distribution center while injecting a later batch i′ (volume unit) i′ DVclients,i,p ) volume of batch i of product made available for clients after accomplishing the settling period and while injecting a later batch i′ (volume unit) IDitotal,o ) total inventory of product p available at the distribution center while injecting batch i (volume unit) IDip ) inventory of product p available for clients while injecting batch i (volume unit) IDheur p,k ) total inventory of product p at day k, calculated assuming that the pipeline is stopped during the time horizon (for heuristic purposes) (volume unit) i′ T set,i ) total time that batch i had already settled while injecting a later batch i′ (h) i′ T setp,i,p ) total time that batch i of product p had already settled while injecting a later batch i′ (h) Binary Variables yi,p ) indicates that product p is contained in batch i whenever yi,p ) 1 xi′i ) indicates that a fraction of batch i can be transferred to the distribution center while a later batch i′ is being pumped, whenever xi′i ) 1 lsi,p,lt ) indicates that batch i has batch volume lt of product p whenever lsi,p,lt ) 1 dmei,k ) indicates that day k (0 h) is located in time interval [0,Ci] whenever dmei,k ) 1 dmFinal i,k ) indicates that 0 h of day k are located in time interval )1 [Ci-1,Ci] whenever dmFinal i,k i′ ) indicates that batch i has already performed a settling xset,i i′ period over Trep whenever xset,i )1

i′ ) indicates that batch i is already available for clients xavailable,i i′ )1 when a later batch i′ is being pumped whenever xout,i i′ xclients,i ) indicates that batch i is available for clients when a i′ )1 later batch i′ is being pumped whenever xclients,i pmatchi ) indicates that pipeline stop time (Tstop) is lower than Ci whenever pmatchi ) 1 pstopi ) indicates that the pipeline stoppage is located at time interval i when pstopi ) 1

Literature Cited (1) Moro, L. F. L. Process Technology in the Petroleum Refining Industry - Current Situation and Future Trends. Comput. Chem. Eng. 2003, 27, 1303-1305. (2) Agrawal, A.; Balasubramanian, K. Consider adopting next-generation refinery scheduling. Hydrocarbon Process. 2006, (September), 65-68. (3) Valleur, M.; Grue, J. L. Optimize short-term refinery scheduling. Hydrocarbon Process. 2004, (June), 46-49. (4) Neiro, S. M. S.; Pinto, J. M. A General Modeling Framework for the Operational Planning of Petroleum Supply Chains. Comput. Chem. Eng. 2004, 28, 871-896. (5) Ma´s, R.; Pinto, J. M. A Mixed-Integer Optimization Strategy for Oil Supply in Distribution Complexes. Optim. Eng. 2003, 4, 23-64. (6) Shah, N. Mathematical programming techniques for crude oil scheduling, Comput. Chem. Eng. 1996, 20, S1227-S1232. (7) Lee, H.; Pinto, J. M.; Grossmann, I. E.; Park, S. Mixed-integer programming model for refinery short-term scheduling of crude oil unloading with inventory management. Ind. Eng. Chem. Res. 1996, 35, 1630-1641. (8) Jia, Z.; Ierapetritou, M. Efficient Short-term Scheduling of Refinery Operations Based on a Continuous Time Formulation. Comput. Chem. Eng. 2004, 28, 1001-1019. (9) Jia, Z.; Ierapetritou, M. Mixed-integer linear programming model for gasoline blending and distribution scheduling. Ind. Eng. Chem. Res. 2003, 42, 825-835. (10) Moro, L. F. L.; Pinto, J. M. Mixed-Integer Programming Approach for Short-Term Crude Oil Scheduling. Ind. Eng. Chem. Res. 2004, 43, 8594. (11) Reddy, P. C. P.; Karimi, I. A.; Srinivasan, R. A New Continuoustime Formulation for Scheduling Crude Oil Operations. Chem. Eng. Sci. 2004, 59, 1325-1341. (12) Reddy, P. C. P.; Karimi, I. A.; Srinivasan, R. A Novel Solution Approach for Optimizing Crude Oil Operations. AIChE J. 2004, 6 (50), 1177-1197. (13) Magalha˜es, M. V. O. Refinery Scheduling. Ph.D. Thesis, Imperial College, London, 2004. (14) Rejowski, R., Jr.; Pinto, J. M. Efficient MILP formulations and valid cuts for multiproduct pipeline scheduling. Comput. Chem. Eng. 2004, 28, 1511-1528. (15) Cafaro, D. C.; Cerda´, J. Optimal Scheduling of Multiproduct Pipeline Systems Using a Non-discrete MILP Formulation. Comput. Chem. Eng. 2004, 28, 2053-2068. (16) Magata˜o, L.; Arruda, L. V. R.; Neves, F., Jr. A mixed integer programming approach for scheduling commodities in a pipeline. Comput. Chem. Eng. 2004, 28, 171-185. (17) Relvas, S.; Matos, H. A.; Barbosa-Po´voa, A. P. F. D.; Fialho, J.; Pinheiro, A. S. Pipeline Scheduling and Inventory Management of a Multiproduct Distribution Oil System. Ind. Eng. Chem. Res. 2006, 45 (23), 7841-7855. (18) Vin, J. P.; Ierapetritou, M. G. A new approach for efficient rescheduling of multiproduct batch plants. Ind. Eng. Chem. Res. 2000, 39 (11), 4228-4238. (19) Mendez, C. A.; Cerda´, J. An MILP framework for batch reactive scheduling with limited discrete resources. Comput. Chem. Eng. 2004, 28, 1059-1068. (20) Broke, A.; Kendrick, D.; Meeraus, A. A.; Raman, R. GAMS - a user’s guide; GAMS Development Corporation: Washington, DC, 2006.

ReceiVed for reView February 6, 2007 ReVised manuscript receiVed June 6, 2007 Accepted June 11, 2007 IE070214Q