ΠΑΝΕΠΙΣΤΗΜΙΟ ΘΕΣΣΑΛΙΑΣ ΕΦΑΡΜΟΓΕΣ ΕΠΙΧΕΙΡΗΣΙΑΚΗΣ ΕΡΕΥΝΑΣ Ενότητα 2: Scheduling of Loading and Unloading of Crude oil in a Refinery Γεώργιος Κ.Δ. Σαχαρίδης Τμήμα Μηχανολόγων Μηχανικών Refinery • A refinery is a system composed of docks, pipelines, a series of tanks to store the crude oil (and prepare the different blends), CDUs, VDUs production units, blenders and tanks to store the raw materials and the final products. 2 The Problem • Once the quantities and the types of crude oil required are known, schedulers must schedule the loading and unloading of tanks. The problem that arises then is how to schedule the transfer of crude oil from the docks to the tanks and from the tanks to the CDUs/VDUs, minimizing the setup cost of the system. 3 Refinery Manifold Vessels Docks Crude oil tanks CDU/VDU Στο σχήμα βλέπουμε μια τυπική διάταξη από ένα Oil Refinery. Δεξαμενόπλοια έρχονται στις αποβάθρες, ξεφορτώνουν το πετρέλαιο στις δεξαμενές, το οποίο πετρέλαιο στην συνέχεια περνάει από τις εγκαταστάσεις δυίλισης. 4 Typical Refinery • A typical refinery is composed of 1 to 10 tanks for the storage of the crude oil, 2 to 4 CDUs/VDUs and 1 or 2 docks, which can accommodate 4 to 5 vessels per month. • The storage capacity of each tank can range from 80000 m3 to 150000 m3. Crude oil flows from the docks to the tanks, and its flow depends on the unloading capacity of the boats, ranging from 1000 m3/hour to 5000 m3/hour. Duration of a boat’s unloading is typically defined a priori by contract (ex. 36 hours). • Each CDU/VDU has a distillation capacity that can range from 200 m3/hour to 2000 m3/hour. 5 Refinery • A refinery is a system composed of docks, pipelines, a series of tanks to store the crude oil (and prepare the different blends), CDUs, VDUs production units, blenders and tanks to store the raw materials and the final products. 6 The Problem • Once the quantities and the types of crude oil required are known, schedulers must schedule the loading and unloading of tanks. The problem that arises then is how to schedule the transfer of crude oil from the docks to the tanks and from the tanks to the CDUs/VDUs, minimizing the setup cost of the system. 7 Data of the system • Dimensions of the refinery; • Arrival dates of vessels based on medium-term planning, • Demand of crude oil by the CDU/VDU; • Initial conditions (quantity and composition in each tank) and the system’s capabilities (operational times, tanks capacity and flow limits); 8 Data of the system • The number of tanks available for storage and their storage capacity are known; • The production rates; • The recipe preparation alternative; • The blending mode. Modeling • Continuous and binary decision variables: • The continuous variables correspond to flows from docks to tanks, flows from tanks to CDUs/VDUs, and quantities stored in the tanks. • Binary variables are used to specify connections between docks and tanks, connections between tanks and CDUs /VDUs, and also the availability and setup for loading and unloading of the tanks. 10 Modeling • The constraints necessary to describe the system include: a) satisfying operations rules; b) satisfying material balances; c) meeting storage capacity constraints; d) satisfying blend properties; e) establishing a connection between docks and tanks; f) establishing connections between tanks and CDUs/VDUs; and g) setup of tanks for loading or unloading. 11 Reference example • The system under study is composed of two docks, six tanks for the loading of crude oil, and two crude distillation units (CDU) fed by these six tanks; • The unloading time of a boat is equal to 36 hours and fixed by contract with the suppliers of crude oil; • The distillation flow for the two CDUs are 270-350 m3/hour for CDU1 and 300-1660 m3/hour for CDU2; • The blends are prepared using the pipelines just before the CDUs. 12 Reference example • The period of planning is equal to 30 days (720 hours); • The arrival plan of three boats (when, which type, and what quantity of the crude oil they carry) is known a priori; • The demand of 12 different blends (composed of a maximum of three different types of crude oil) by the two CDUs (when, which type, and what quantities of blend) is given; • The initial state of each tank at the beginning of a scheduling period and their storage capacity is given(100000 m3). 13 Reference example Το σχήμα έχει 3 παράλληλες γραμμές που απεικονίζουν τον χρονικό ορίζοντα: • Αφίξεων των δεξαμενόπλοιων • Ζήτηση σε πετρέλαιο ανεξαρτήτως τύπου για κάθε μονάδα διύλισης 14 Reference example The objective is to minimize the setup cost of six tanks for the unloading of three boats, which arrive at precise hours, while preparing the 12 blends requested and unloading them towards the CDUs when appropriate. Why setup cost is important? • The setup of tanks, involving loading the quantities of crude oil at the docks and unloading the quantities of blends or crude oil toward the CDU/VDU, requires a series of operations that are expensive for the refinery. 16 Why setup cost is important? • The most critical and expensive operations associated with a tank’s setup at each stage are: • Before loading/unloading: • Configuring the pipeline network (e.g. opening of valves, configuration of pumps, etc.); • Filling pipelines with crude oil which is a dangerous and lengthy procedure; • Sampling of crude oil for chemical analyses; • Measuring of the crude oil stock in tank before loading/unloading; • Starting the loading/unloading; and • Stopping the loading/unloading. 17 Why setup cost is important? • The most critical and expensive operations associated with a tank’s setup at each stage are: • After loading/unloading: • Configuring the pipeline network which is a dangerous and lengthy procedure (e.g. closing of valves, configuration and maintenance of pumps, etc.); • Emptying of pipelines; and • Measuring the crude oil loaded/unloaded in the tanks. 18 Why setup cost is important? • Costs associated with these operations require that the loading and unloading of tanks be completed with the minimum number of setups. • The minimization of the number of setups is required also for security reasons, as the above operations are complicated and with each start of a new loading and unloading, the system is strained. 19 Current practice – Heuristic approach • Currently, the obtained schedule is generated based on managerial experience and on manual calculations giving rise to a unique optimal schedule for each period, separately taking into account all the constraints and minimizing the number of the tanks used. • This type of optimization gives for the reference example a sub-optimal solution (feasible solution), leading to twentyfive setups. • These 25 setups of six tanks are required for the loading of crude oil quantities transferred by the three boats and the tank unloading, in order to satisfy the request of 12 different blends by the two CDUs. 20 General context of scheduling of crude oil • The objective is to present a general model which gives the optimal solution for the scheduling of crude oil and can also be used in any equivalent system 21 General context of scheduling of crude oil • The potential financial and operational benefits associated with the development of this model are enormous, as an advanced optimization tool for scheduling could allow the refinery to: • a) minimize the flow problems and the loss of crude oil; • b) obtain the optimal periodic plans of production; • c) give direction for the future; 22 General context of scheduling of crude oil • d) re-optimize the system in case of stochastic events (ex. accidents, machine failures, new arrivals, changes to distillation schedules); and • e) compare the results obtained from various distinct scenarios. Summarizing loading and unloading of crude oil is one of the most critical activities in a refinery. • Better analysis of this activity gives rise to better use of a system’s resources, as well as improved total visibility and control of production units and of the entire supply chain. Main features of the system under study • Blending preparation: • The different blends could be produced using the pipelines just before the CDU/VDU in a place called the manifold. In this case, only one type of crude oil can be stored in each tank at a time • The blends required by the CDU/VDU are prepared in the tanks themselves. In this case, a quantity of a given type of crude oil is already loaded in a tank then stored and kept on standby until a quantity of another type of crude oil is unloaded into the same tank, in order to produce the required blend. 24 Main features of the system under study • Recipe preparation alternatives: • The standard recipe preparation. The required blend must satisfy an exact composition of crude before being distilled in a CDU, regardless of blending mode. For example, the blend required by a CDU must contain 20% of crude oil type A and 80% of crude oil type B for an exact, a priori defined quantity. • The flexible recipe (relaxation of the standard recipe preparation). The components of the required blend must satisfy lower and upper bounds. For example, a CDU requires a quantity of a blend, where type A can constitute at least 20% of the total quantity and not more than 50%. 25 Refinery Rules • Rule 1: Physical limitations exist in the system (e.g. tank capacity, flow and pumping rates); • Rule 2: If a given tank is feeding a distillation unit, it cannot be simultaneously loaded and vice versa; • Rule 3: Meet the constraints imposed by the blending type; and • Rule 4: Meet the constraints imposed by the distillation option. 26 Mathematical Modeling Nomenclature Index NZ NP NCDU NJ NT Data Cap the number of tanks; the number of docks; the number of crude distillation units; the number of various types of crude oil; the number of periods. E i ,t the storage capacity of tanks (the same for any tank); the total quantity of the crude oil available, in dock i, for period t; aei , j ,t the percentage of the crude oil ( Ei ,t ) of type j, of the quantity available in S k ,t dock i, for period t; the total quantity requested from CDUk, for the period t; as k , j ,t the percentage of the crude oil ( S k ,t ) of type j, required by CDUk, for period t; a k , j ,t equal to 1 if the CDUk requests crude oil of type j, for period t and equal to zero if not; acceptable minimal percentage, of type j, for the blend unloading towards CDUk, for period t; acceptable maximal percentage, of type j, for the blend unloading towards CDUk, for period t; equal to 1 if a boat is in dock i and brings crude oil of type j, for period t; equal to zero otherwise; equal to 1 if the CDUk requests crude oil of type j, for period t; equal to zero otherwise; the minimal number of tanks needed for crude oil unloading of boat arriving at dock i, for period t; number of different crude oil types requested by CDUs for period t; amin k , j ,t amaxk , j ,t W 1i , j ,t W 2k , j ,t W 3i ,t S2t G2t L j ,t Decision Variables number of different blends requested by CDUs for period t; equal to 1 if the crude oil of type j is requested by CDUs for period t; equal to zero otherwise. 27 Decision Variable • We consider two types of decision variables (continuous and binary): • The continuous variables are associated with the flow between docks and tanks, flow between tanks and CDUs/VDUs, and the quantities of various types of crude oil in the tanks. 28 Decision Variable • We consider two types of decision variables (continuous and binary): • The binary variables represent decisions regarding the loading, unloading and setup of a tank (which is necessary either before the loading of a quantity available at the dock or before unloading crude oil or a blend of crude oil towards the CDU/VDU). The binary variables represent decisions regarding the loading, unloading and setup of a tank (which is necessary either before the loading of a quantity available at the dock or before unloading crude oil or a blend of crude oil towards the CDU/VDU). The binary variables represent decisions regarding the loading, unloading and setup of a tank (which is necessary either before the loading of a quantity available at the dock or before unloading crude oil or a blend of crude oil towards the CDU/VDU). 29 Mathematical Modeling Decision Variables X i , z , j ,t Y z , k , j ,t I z , j ,t C i , z ,t D z , k ,t SCi , z ,t SDi , z ,t Fz , j ,t z , k ,t continuous variable which corresponds to the quantity of crude oil type j, loaded by dock i, in tank z, for period t (flow dock tank); continuous variable which corresponds to the quantity of crude oil type j, unloaded by tank z, with CDUk , for period t (flow tank CDU); continuous variable which corresponds to the quantity of crude oil type j, stocked at the end of period t, in tank z. We specify that variables I z , j , 0 are data corresponding to the quantities stored in the tanks at the beginning of scheduling period; binary variable (0-1) which is equal to 1 if connection is established between the dock i and tank z, for period t and equal to zero if not; binary variable (0-1) which is equal to 1 if connection is established between the tank z and CDUk, for period t and equal to zero if not; binary variable (0-1) which is equal to 1 if setup of tank z is established for loading crude oil from the dock i, at the beginning of the period t and equal to zero if not; binary variable (0-1) which is equal to 1 if setup of tank z is established for unloading crude oil towards CDUk, at the beginning of the period t and equal to zero if not; binary variable (0-1) which is equal to 1 if tank z contains type j, for the period t and equal to zero if not; integer variable that takes value in the interval [0,100] and defines the percentage of the total quantity stored in the tank z unloaded towards the CDUk in period t. 30 Constraints • Four groups of constraints which guarantee certain operational conditions: • Constraints which guarantee that the quantities loaded in tanks are equal to the quantities available to docks in each period • Constraints expressing that the quantities unloaded towards CDUs/VDUs are equal to the quantities required by them • Constraints expressing the material balance • Constraints guarantee that quantity stored in a tank is not greater than its storage capacity. 31 Constraints applicable in any case • Constraint (1) is a loading constraint and guarantees that the sum of the quantities loaded in tanks, at dock i, for period t, is equal to the quantity available at the dock. • Constraint (2) is an unloading constraint and guarantees that the sum of the quantities unloaded by all the tanks, towards CDUk, for period t, is equal to the quantity required by the CDUk. 32 Constraints applicable in any case • Constraint (3) is the material balance constraint expressing that the quantity of crude oil, type j, which is stored in tank z, at period t, is equal to the quantity which was stored at period t-1, plus the sum of quantities of the same type that are loaded for this period by all docks i, less the sum of the quantities unloaded by this tank towards all CDUs. Constraints applicable in any case • The capacity constraint is defined by constraint (4) where the sum of different types of crude oil should be less than or equal to the total storage capacity. • Constraints (5-6) are associated with operation rules and express the connection if a flow between a tank z and dock i or CDUk is established for loading or unloading. (Notice that the constant M used in the following equalities takes a value equal to the storage capacity of the tanks. 34 Constraints applicable in any case • Constraint (7) guarantees that loading and unloading does not take place at the same time. We notice that the sum over i in constraint (7) results from the fact that a maximum of only one boat unloads crude oil to a tank z in the time period t. • Constraints (8-9) are the setup constraints. These constraints guarantee that during the loading or unloading of a tank z, a setup cost is charged at the beginning of the loading or unloading period. Objective Function • The objective function for the developed model is to minimize the total number of tank setups necessary for the loading and unloading of the crude oil. 36 Blending in the manifold • When the blend is prepared just before the CDU in the manifold using pipelines, the following decision variables and constraints should be added. The additional decision variable ( ) is a binary variable (0-1) which is equal to 1 if tank z contains type j, for the period t and equal to zero if not. 37 Blending in the manifold • Additional constraint should guarantee that only one type j of the crude oil can be stored in a tank z, in the period t and should ensures the coherence between decision variables I z , j ,t Fz, j,t 38 Blending modes – Standard recipe preparation /OM11 - OM12 models • Standard recipe preparation • Flexible recipe preparation 39 Blending in tanks • When blend is prepared in the tanks, It is necessary to introduce a new term: the acceptable blend: • Preparation of blend in tank – Standard recipe preparation /OM21 model • In order that a tank z is unloaded towards CDUk, at period t, the quantity of the j type must be equal to the total quantity which exists in the tank multiplied by the rate required by CDUk. Preparation of blend in tank - Flexible recipe preparation /OM22 model • In order that a tank z is unloaded towards CDUk, at period t, the quantity of the j type must satisfy the upper and lower bounds of the component j required by the CDUk. 40 Blending in the manifold and tanks • When a percentage of the crude oil is unloaded from the tank z, to the CDUk, in period t then all the types of crude oil are unloaded simultaneously in a quantity which satisfies the proportion of the mixture. 41 Blending in the manifold and tanks • Standard recipe preparation / OM31 model • The sum of the quantities unloaded by all the tanks, towards CDUk, for period t, is equal to the quantity required by the CDUk • Flexible recipe preparation / OM32 model • With the flexible distillation, the additional constraints are that the sum of quantities type j unloaded by all tanks, for period t, towards CDUk satisfies the upper and lower percentage of the quantity required by this CDUk 42 Heuristic Optimization vs. Exact Optimization Example Ex.1 Ex.2 Ex.3 Ex.4 Ex.5 Ex.6 Ex.7 Ex.8 Ex.9 Ex.10 Ex.11 Ex.12 Ex.13 Ex.14 Ex.15 Ex.16 Ex.17 Ex.18 Ex.19 Ex.20 Model HM11 9 setups 8 setups 14 setups 22 setups 13 setups Model HM12 16 setups 13 setups 20 setups 23 setups 16 setups Model HM21 23 setups 18 setups 19 setups 35 setups 17 setups Model HM22 33 setups 22 setups 19 setups 22 setups 32 setups Model OM11 8 setups 7 setups 13 setups 19 setups 12 setups Model OM12 13 setups 12 setups 15 setups 18 setups 13 setups Model OM21 20 setups 15 setups 18 setups 30 setups 15 setups Model OM22 26 setups 20 setups 16 setups 17 setups 27 setups Relative difference 11.11% 12.5% 7.14% 13.63% 7.69% CPU Resolution 10h 11h 13h 17h 13h 18.75% 7.69% 25% 21.73% 18.75% 16h 15h 17h 19h 16h 13.04% 16.66% 5.26% 14.28% 11.76% 16h 16h 19h 22h 19h 21.87% 9.09% 15.78% 22.72% 15.62% 19h 18h 18h 17h 18h 43 Time representation Το σχήμα έχει 3 παράλληλες γραμμές που απεικονίζουν τον χρονικό ορίζοντα: • Αφίξεων των δεξαμενόπλοιων • Ζήτηση σε πετρέλαιο ανεξαρτήτως τύπου για κάθε μονάδα διύλισης 44 Time representation 200 hours = 200 periods 200 hours = 4 periods Arrival A Vessels Arrival t=t4 CDU1 Demand Το σχήμα έχει 3 παράλληλες γραμμές που απεικονίζουν τον χρονικό ορίζοντα: Vessels Arrival • Αφίξεων των δεξαμενόπλοιων • Ζήτηση σε πετρέλαιο ανεξαρτήτως τύπου για CDU Demand κάθε μονάδα διύλισης Ο χρονικός ορίζοντας έχει διαιρεθεί σε χρονικές ζώνες. CDU Demand Arrival A t=t5 t=t4 t=t5 1 Mix type A Mix type B t=t3 CDU2 Demand Mix type A Mix type A Mix type B Mix type B t=t3 2 Mix type D t=t1 Mix type E t=t2 Mix type D Mix type E Mix type E Mix type E t=t1 Period 1 t=t2 Period 2 Period 3 Period 4 45 Event-based time representation 200 hours = 200 periods 200 hours = 4 periods Arrival A Vessels Arrival t=t4 CDU1 Demand Arrival A Vessels Arrival t=t5 t=t4 t=t5 CDU1 Demand Mix type A Mix type B Mix type A Mix type A Mix type B Mix type B t=t3 t=t3 CDU2 Demand CDU2 Demand Mix type D t=t1 Mix type E t=t2 Mix type D Mix type E Mix type E Mix type E t=t1 Period 1 Hourly representation t=t2 Period 2 Period 3 Period 4 Event-based representation Το σχήμα έχει 3 παράλληλες γραμμές που απεικονίζουν τον χρονικό ορίζοντα: • Αφίξεων των δεξαμενόπλοιων • Ζήτηση σε πετρέλαιο ανεξαρτήτως τύπου για κάθε μονάδα διύλισης Εκτός της διακριτοποίησης του χρόνου, βλέπουμε και την διακριτοποίηση σε περιόδους. 46 Reference example - Event based time representation 0 2 102 204 240 342 378 480 516 618 720 0 1 2 3 4 5 6 7 8 9 0 0 0 Type 0 120000 0 Type 1 110000 0 Type 0 90000 0 0 0 Type 0 15000 Type 2 15000 Type 0 27750 Type 0 9750 Type 0 27750 Type 0 9750 Type 0 9800 Type 1 9800 Type 2 15400 Type 0 6000 Type 1 5250 Type 0 17000 Type 1 14875 Type 0 17000 Type 1 14875 0 Type 0 24600 Type 2 35400 Type 0 30000 Type 2 15600 Type 2 44400 Type 0 60000 Type 1 30000 Type 2 20000 Type 0 15000 Type 1 25000 Type 1 10000 Type 2 40000 Type 0 60000 10 periods Vessels Arrival CDU1 Demand CDU2 Demand Παράδειγμα βασιζόμενο στην προηγούμενη αναπαράσταση του χρόνου. 47 Size of the mathematical models MO1,1 Number of periods Number of decision variables Number of constraints CPU resolution time Optimal solution Partition based on hour Partition based on events 720 10 112320 1560 116640 1620 16 hours 1 hour 21 setups 21 setups Table 3: Comparative results 48 Linearization of constraints • Modeling with bilinear products of continuous and 0-1 decision variables Considering the bilinear products of the form is a continuous decision variable. Wz ,k ,t I z , j ,t z,k,j,t where W z , k ,t is a binary variable and I z , j ,t In order to linearize this bilinear product, the continuous decision variable should be bounded: L I z , j ,t U . For this purpose and based on the case study we define the L and U. 49 Linearization of constraints The basic idea is to introduce new variables Η z ,k , j ,t Wz ,k ,t I z , j ,t z,k,j,t for each bilinear product. Then introduce 4 additional constraints for each z,k,j,t : I z , j ,t U (1 Wz ,k ,t ) H z ,k , j ,t I z , j ,t L(1 Wz ,k ,t )z,k,j,t LWz ,k ,t H z ,k , j ,t UWz ,k ,t z,k,j,t 50 Linearization of constraints • The above formulation corresponds to a nonlinear model where we have a bilinear product of continuous and general integer variable. In order to apply the above method we need a preprocessing step. The general integer variable should be expressed as a function of auxiliary binary variables leading to new bilinear product of binary and continuous variables: W 2W 4W 8W 16W 32W 64W z .k .t 0 z , k ,t 1 z ,k ,t 2 z , k ,t 3 z , k ,t 4 z , k ,t 5 z , k ,t 6 z , k ,t W , q {0,...,6} where z .k .t [0,100] , and z ,k ,t are the auxiliary binary variables needed for the discetization of the general integer decision variable. q Linearization of constraints Replacing the decision variable linear constraint [20]: z , k ,t with the above formulation we obtain the following modified non- 100Yz .k . j ,t W z0, k ,t I z , j ,t 2W z1, k ,t I z , j ,t 4W z2, k ,t I z , j ,t 8W z3, k ,t I z , j ,t 16W z4, k ,t I z , j ,t 32W z5, k ,t I z , j ,t 64W z6, k ,t I z , j ,t 52 Linearization of constraints 53