Scheduling of Crude Oil Operations in Refinery without Sufficient Charging Tanks Using Petri Nets

A short-term schedule for crude oil operations in a refinery should define and sequence the activities in detail. Each activity involves both discrete-event and continuous variables. The combinatorial nature of the scheduling problem makes it difficult to solve. For such a scheduling problem, charging tanks are a type of critical resources. If the number of charging tanks is not sufficient, the scheduling problem is further complicated. This work conducts a study on the scheduling problem of crude oil operations without sufficient charging tanks. In this case, to make a refinery able to operate, a charging tank has to be in simultaneous charging and feeding to a distiller for some time, called simultaneously-charging-and-feeding (SCF) mode, leading to disturbance to the oil distillation in distillers. A hybrid Petri net model is developed to describe the behavior of the system. Then, a scheduling method is proposed to find a schedule such that the SCF mode is minimally used. It is computationally efficient. An industrial case study is given to demonstrate the obtained results.


Introduction
With the increasing importance of oil, the development of effective operations of an oil refinery has attracted wide attention.If an oil refinery is operated properly, one can reduce production and inventory cost [1], and may even increase profit $10 per ton of products or more [2].A refinery is operated hierarchically with three levels: production planning, production scheduling, and process control.With mature planning techniques [3,4], optimal production plans can be obtained by using linear programming-based commercial software [5].Meanwhile, the efficiency of process control is improved by the installation of advanced control systems [6].Production scheduling is at the middle level and should fulfill planning demands and instruct process control.A schedule defines and sequences detailed operation activities for the whole scheduling horizon, which makes the problem highly challenging [7].Because of the extreme complexity of short-term scheduling, we find no effective techniques and software tools to deal with it.This scheduling job is still done manually in practice.To bridge the gap between the production planning and process control, the development of effective short-term scheduling techniques is of paramount importance.
Mathematical programming models are applied to solve the crude oil scheduling problem.They can be categorized as discrete-time and continuous-time ones.The models in [8][9][10][11] are representative of the former.They are formulated by dividing the scheduling horizon into a number of time intervals with uniform time durations.An event, such as the start or end of an operation, should happen at the boundary of a time interval.Such a model has a major defect in that the time interval must be sufficiently small to describe the scheduling problem with acceptable accuracy.As a result, a model for real-life applications usually contains a computationally infeasible number of binary variables and Appl.Sci.2017, 7, 564 3 of 26 to general systems with K distillers.An industrial case study is given to show the application of the proposed methods in Section 6.Finally, Section 7 draws the conclusions.

Crude Oil Operations in Refinery
A general oil refinery process contains three stages: (1) crude oil operations; (2) production; and (3) product delivery.Since the whole refinery process is very complex, this paper addresses the short-term scheduling problem for crude oil operations only, which is one of the most challenging scheduling problems in operating a refinery.At the stage of crude oil operations, crude oil is carried to a port by crude oil tankers and is unloaded into storage tanks there.Oil in storage tanks is transported to charging tanks in the refinery plant through a pipeline.Then, from charging tanks, oil is fed into distillers for distillation.
During crude oil operations, crude oil can only be discharged into an empty storage or charging tank or one that holds the same type of crude oil.To obtain suitable components for distillation, different types of crude oil may be mixed when oil is transported from storage tanks to charging tanks or fed into distillers.If oil is mixed during oil feeding, at least two charging tanks are required to feed a distiller at the same time.As charging tanks are a critical resource and are limited, in general, only one charging tank is used to feed a distiller at a time and crude oil mixing is done during its transportation via a pipeline.Therefore, this paper only considers the case in which only one charging tank is used to feed a distiller at any one time.Moreover, crude oil mixing is not considered here, since a mixture can be simply treated as a new type of oil.
The brine in crude oil disturbs the distillation process.Thus, crude oil needs to be pretreated to separate brine from oil to ensure the stability, which is implemented by making oil stay in a tank for some time after a storage or charging tank is charged, leading to an oil residency time constraint in both storage and charging tanks.When a tank is required to satisfy such a constraint, we say that the tank operates under the normal mode.Under the normal mode for both storage and charging tanks, it is shown that generally a feasible schedule with maximal production rate can be found if there are three charging tanks for each distiller at any time [21,22,[25][26][27][28].Considering that crude oil has already been pretreated in storage tanks, when a refinery does not have enough charging tanks it has to adopt the SCF mode to keep the system in operation.Nevertheless, the SCF is not a desired mode and its use should be minimized to reduce the disturbance to the distillation process.Note that, by the SCF mode, before a charging tank can be used to feed a distiller, the tank should be charged with a certain amount of oil first; this is called the safety stock, also known as the SCF mode constraint.
Based on the above discussion, we summarize the constraints for scheduling crude oil operations as follows.We have resource constraints: (1) the limited number of storage and charging tanks and their capacities; (2) the limited flow rate of oil unloading and pipeline transportation; and (3) the available volume of various crude oil types in tanks and incoming tankers.We also have process constraints: (1) a distiller should be kept in working uninterruptedly unless a maintenance is needed; (2) at least one charging tank is dedicated to feed a distiller at any time; (3) oil residency time constraint for all storage and charging tanks under the normal mode; and (4) when SCF is applied, the SCF mode constraint should be met.

The Scheduling Problem
A crude oil operation process is composed of a series of operations.The short-term scheduling problem is to make decisions on what an operation should do and when and how it should be executed.To describe a short-term schedule, we first define an operation decision (OD).Definition 1.An operation is defined as OD = (COT, ζ, S, D, INT), where COT = the crude oil type; ζ = the volume of crude oil to be unloaded from a tanker to a storage tank, or transported from a storage tank to a charging tank, or fed from a charging tank to a distiller; S = the source from which the crude oil is to be delivered; D = the destination to which the crude oil is to be delivered; and INT = [a, b] a time interval, where a and b are the start and end time points of the operation, respectively.
The flow rate in delivering crude oil in [a, b] may be variable.However, it is scheduled as a constant for a single operation in practice for the sake of stability and simplification.Thus, given volume ζ and time interval [a, b] in an OD, ζ/(b − a) is its flow rate.Each OD is a control command that transfers the system from a state to another.
There are three types of ODs: OD of crude oil unloading (ODU), OD of transportation (ODT), and OD of feeding to a distiller (ODF), and their time intervals are denoted as [α, β], [λ, µ], and [ω, π], respectively.For ODU, S is a tanker and D is a storage tank.For ODT, S is a storage tank and D is a charging tank, and the transportation is performed through a pipeline.For ODF, S is a charging tank and D is a distiller.We use ODF ki to denote the ith OD for feeding distiller k during the scheduling horizon.Let Γ = [τ s , τ e ] be the scheduling horizon that often lasts for a week or ten days and g = ζ/(β − α), f = ζ/(µ − λ), and h = ζ/(π − ω) denote flow rates for tanker unloading, pipeline transportation, and distiller feeding decided by ODs, respectively.Let K be the set of distillers.Given the initial state at τ s , i.e., the inventory of crude oil and state of all devices, and information of tanker arrival, the short-term scheduling problem is to find a series of ODs described as follows: subjected to = ω ki , ..., and π kn = τ e for ∀k ∈ K and the constraints given in Section 2.1.Constraint (2) requires that the schedule should cover the entire scheduling horizon and a distiller cannot be stopped.Also, different objectives can be selected to optimize.Essentially, in the view of control theory, an OD is a control command that transfers the system state from one to another.If a state is reached such that any constraint is violated, this state is said to be infeasible.If not infeasible, it must be feasible.There may be a state that is feasible itself, but no matter what ODs are applied thereafter the system would eventually enter an infeasible state; such a state is called an unsafe one, and otherwise it is safe.A safe state guarantees the existence of a feasible schedule.

System Modeling with Petri Nets
With an OD being viewed as a control command, this work develops a method to schedule the system from a control perspective as done in [21,22].Although the PN models in [31][32][33] are hybrid ones with both discrete and continuous places, they are not developed to describe the continuous material flows as required by the ODs.Thus, we modify the hybrid Petri net model presented in [21,22], due to the fact that they can describe the continuous material flows well.We first present models for devices including tanks and pipeline, then integrate them to develop the model for the whole system.A reader is referred to [34,35] for the basic knowledge of PN.
The above scheduling problem involves discrete-event variables, such as the source and destination of an OD, and continuous variables, such as volumes of crude oil and flow rates.Hence, both discrete and continuous places, and discrete and continuous transitions are needed to model the system.In the proposed PN model, a discrete place with a discrete token in it is used to implement the control logic of the system.A token in a continuous place can be treated as both discrete and continuous ones.When treated as a discrete one, it is used to describe some attributes such as if there is oil in a tank, and if the oil in a tank is ready to be discharged.When it is treated as a continuous one, it is used to describe the volume of oil in a tank.Note that a token in a continuous place indicates that there is oil in the tank modeled by the place.Also, a tank can hold one type of oil at a time.Thus, in the model, a continuous place can hold at most one token.If a token is sent to a continuous place that holds one token in it, the two tokens are merged into one with the volume being the sum.The flow rate of oil is described by the firing rate of a continuous transition.Moreover, colors are introduced to identify different types of crude oil, and time is also needed to describe the scheduling problem. The

Device Modeling
The devices involved in crude oil operations include tanks (storage and charging tanks) and a pipeline.While scheduling a refinery without sufficient charging tanks, the crude oil must stay in storage tanks for ORT, but charging tanks may adopt the SCF mode during the execution of a schedule.Hence, the models for charging and storage tanks are different.
The PN model in Figure 2 describes the behavior of a storage tank and is the same as that in [21,22].A storage tank is modeled by two continuous places ps and pc to describe its state.In the PN model, a token in a discrete place is treated as a discrete one and acts just as that in a general PN.For example, a token in p4 is just a discrete one.A token in a continuous place can be treated as both discrete and continuous one.When it is treated as a discrete one, it indicates that there is oil in a tank.For example, one token in ps or pc or both denotes that there is oil in it.Also, when t2 fires, the token in ps is removed just like a discrete one.When the token in a continuous place is treated as a continuous one, it represents the crude oil in the device with a real number volume, which is called the token volume.If there is a token in an enforcing place, it enforces the output transitions to fire until it is empty.A discrete transition behaves the same as in a general PN.When a timed transition fires, it moves a token from an input place to an output place with a constant time delay, which is used to model the oil residency time constraint.When a continuous transition fires, oil is delivered from one place to another with a flow rate for a time duration, which is determined by an OD.Hence, crude oil

Device Modeling
The devices involved in crude oil operations include tanks (storage and charging tanks) and a pipeline.While scheduling a refinery without sufficient charging tanks, the crude oil must stay in storage tanks for ORT, but charging tanks may adopt the SCF mode during the execution of a schedule.Hence, the models for charging and storage tanks are different.
The PN model in Figure 2 describes the behavior of a storage tank and is the same as that in [21,22].A storage tank is modeled by two continuous places p s and p c to describe its state.In the PN model, a token in a discrete place is treated as a discrete one and acts just as that in a general PN.For example, a token in p 4 is just a discrete one.A token in a continuous place can be treated as both discrete and continuous one.When it is treated as a discrete one, it indicates that there is oil in a tank.For example, one token in p s or p c or both denotes that there is oil in it.Also, when t 2 fires, the token in p s is removed just like a discrete one.When the token in a continuous place is treated as a continuous one, it represents the crude oil in the device with a real number volume, which is called the token volume.If there is a token in an enforcing place, it enforces the output transitions to fire until it is empty.

Device Modeling
The devices involved in crude oil operations include tanks (storage and charging tanks) and a pipeline.While scheduling a refinery without sufficient charging tanks, the crude oil must stay in storage tanks for ORT, but charging tanks may adopt the SCF mode during the execution of a schedule.Hence, the models for charging and storage tanks are different.
The PN model in Figure 2 describes the behavior of a storage tank and is the same as that in [21,22].A storage tank is modeled by two continuous places ps and pc to describe its state.In the PN model, a token in a discrete place is treated as a discrete one and acts just as that in a general PN.For example, a token in p4 is just a discrete one.A token in a continuous place can be treated as both discrete and continuous one.When it is treated as a discrete one, it indicates that there is oil in a tank.For example, one token in ps or pc or both denotes that there is oil in it.Also, when t2 fires, the token in ps is removed just like a discrete one.When the token in a continuous place is treated as a continuous one, it represents the crude oil in the device with a real number volume, which is called the token volume.If there is a token in an enforcing place, it enforces the output transitions to fire until it is empty.A discrete transition behaves the same as in a general PN.When a timed transition fires, it moves a token from an input place to an output place with a constant time delay, which is used to model the oil residency time constraint.When a continuous transition fires, oil is delivered from one place to another with a flow rate for a time duration, which is determined by an OD.Hence, crude oil A discrete transition behaves the same as in a general PN.When a timed transition fires, it moves a token from an input place to an output place with a constant time delay, which is used to model the oil residency time constraint.When a continuous transition fires, oil is delivered from one place to another with a flow rate for a time duration, which is determined by an OD.Hence, crude oil unloading, transportation or feeding to distillers can be modeled by continuous transitions.
One token in p s indicates that the oil stays in the tank for less than ORT and is not ready for discharging.Only if there is a token in p c , and p s is empty, can the oil in the tank be discharged.Continuous place p 3 models the capacity of the tank available at the current marking.Continuous transitions t 1 and t 3 model the processing of charging to and discharging from a tank.Timed transition t 2 models the ORT constraint.When t 2 completes its firing with a given time delay, the token in p s moves to p c , indicating that the oil in the tank is ready for discharging.Notice that a non-emptied tank can be charged when the type of oil to be charged to the tank is same as that in the tank.In this case, when the firing of t 1 ends, both p s and p c hold a token such that both t 2 and t 3 are enabled.However, in this case, the firing of t 3 results in the violation of oil residency time constraint.Hence, inhibitor arc (p s , t 3 ) guarantees that t 3 can fire only when p s is emptied, which implies that the oil stays in the tank for ORT.If transition t 1 (t 2 , t 3 ) fires, one token in place p 4 is consumed at the beginning, and one token is put into place p 4 when its firing ends.Since there is only one token in p 4 , during the firing of one of transitions t 1 , t 2 , and t 3 , the others are disabled, which ensures that a storage tank cannot be filled and discharged simultaneously.Thus, a storage tank can only be operated under the normal mode and its behavior is well described.
A charging tank should operate under the normal mode if possible.However, when the charging tanks in the system are not enough, the SCF mode has to be adopted to keep the distillers in operation.Thus, a charging tank should be modeled such that the behavior of both modes is described; the obtained PN model is shown in Figure 3.In this model, p s , p c , t 1 , t 2 , and t 3 are the same as for the storage tank shown in Figure 2. Transitions t 4 and t 5 , and place p 5 are added to model the behavior of the SCF mode.Enforcing place p 5 that can hold at most one token at a time is a control place that decides the operation mode of a tank.If a charging tank starts to adopt the SCF mode, one token is created and put into p 5 such that t 2 and t 3 are disabled, and t 5 is forced to fire to move the token in p c back to p s immediately if p c is not empty.At the same time, t 4 is forced to fire for feeding a distiller and t 1 can fire to charge the tank, i.e., the SCF mode is applied.When an instruction is received to end the SCF mode and switch to the normal mode, the token in p 5 is removed away.Then, t 4 is not enabled and cannot fire, and the tank goes back to the normal mode.Note that a charging tank can start to operate under the SCF mode, but the crude oil in it is no less than the safety stock, i.e., one token can be put into p 5 only if the sum of the volume associated with the token in p s and p c is greater than or equal to the safety stock.This can be decided by a schedule.In this way, the behavior of a charging tank is well modeled.t2 models the ORT constraint.When t2 completes its firing with a given time delay, the token in ps moves to pc, indicating that the oil in the tank is ready for discharging.Notice that a non-emptied tank can be charged when the type of oil to be charged to the tank is same as that in the tank.In this case, when the firing of t1 ends, both ps and pc hold a token such that both t2 and t3 are enabled.However, in this case, the firing of t3 results in the violation of oil residency time constraint.Hence, inhibitor arc (ps, t3) guarantees that t3 can fire only when ps is emptied, which implies that the oil stays in the tank for ORT.If transition t1 (t2, t3) fires, one token in place p4 is consumed at the beginning, and one token is put into place p4 when its firing ends.Since there is only one token in p4, during the firing of one of transitions t1, t2, and t3, the others are disabled, which ensures that a storage tank cannot be filled and discharged simultaneously.Thus, a storage tank can only be operated under the normal mode and its behavior is well described.
A charging tank should operate under the normal mode if possible.However, when the charging tanks in the system are not enough, the SCF mode has to be adopted to keep the distillers in operation.Thus, a charging tank should be modeled such that the behavior of both modes is described; the obtained PN model is shown in Figure 3.In this model, ps, pc, t1, t2, and t3 are the same as for the storage tank shown in Figure 2. Transitions t4 and t5, and place p5 are added to model the behavior of the SCF mode.Enforcing place p5 that can hold at most one token at a time is a control place that decides the operation mode of a tank.If a charging tank starts to adopt the SCF mode, one token is created and put into p5 such that t2 and t3 are disabled, and t5 is forced to fire to move the token in pc back to ps immediately if pc is not empty.At the same time, t4 is forced to fire for feeding a distiller and t1 can fire to charge the tank, i.e., the SCF mode is applied.When an instruction is received to end the SCF mode and switch to the normal mode, the token in p5 is removed away.Then, t4 is not enabled and cannot fire, and the tank goes back to the normal mode.Note that a charging tank can start to operate under the SCF mode, but the crude oil in it is no less than the safety stock, i.e., one token can be put into p5 only if the sum of the volume associated with the token in ps and pc is greater than or equal to the safety stock.This can be decided by a schedule.In this way, the behavior of a charging tank is well modeled.The PN model for a pipeline that can hold three different segments of crude oil is shown in Figure 4 and is the same as that in [21,22].Places p1-p3 represent different oil segments in the pipeline.When discrete transitions t1 and t2 are enabled and fire, one token is moved from an input place into an output place immediately.Let TI = {tI1, …, tIk} and TO = {tO1, …, tOk}.As crude oil mixing is not The PN model for a pipeline that can hold three different segments of crude oil is shown in Figure 4 and is the same as that in [21,22].Places p 1 -p 3 represent different oil segments in the pipeline.When discrete transitions t 1 and t 2 are enabled and fire, one token is moved from an input place into an output place immediately.Let T I = {t I1 , . . ., t Ik } and T O = {t O1 , . . ., t Ok }.As crude oil mixing is not considered here, the pipeline receives crude oil from only one storage tank and feeds only one charging tank with the same rate at a time.Hence, only one transition in T I and one in T O can fire with the same rate at a time.
To simplify the PN model for the entire system, the pipeline is modeled in a hierarchical way and a macro transition y is used to describe the behavior of the pipeline when there is no confusion.In other words, when y fires, it implies that one transition in T I and one in T O fires at the same rate at the same time, which models the crude oil's transport from storage tank to charging tank via a pipeline.In other words, when y fires, it implies that one transition in TI and one in TO fires at the same rate at the same time, which models the crude oil's transport from storage tank to charging tank via a pipeline.

PN Model for the Whole System
The PN in Figure 5 models the whole system with two storage tanks, two charging tanks, and two distillers, where the discrete places, enforcing places, and their associated arcs, and the inhibitor arcs are omitted for concision.Crude oil is transported from storage tanks to charging tanks through a pipeline.Thus, y models both the discharging of storage tanks and the charging of charging tanks at the same time.In the model, {t11, t12, y, p1s, p1c, p13} and {t21, t22, y, p2s, p2c, p23} model the two storage tanks, while {y, t32, t33, t34, t35, p3s, p3c, p33} and {y, t42, t43, t44, t45, p4s, p4c, p43} model the two charging tanks.Place p0 with F tokens in it models a tanker carrying F types of crude oil when it arrives.Transition t1 can fire to move one token from p0 to p1 only if p1 is empty, and models that only one type of oil can be unloaded at a time.At the right part, places p3 and p4 model two distillers, and t5 and t6 represent distillation.However, it should be noted that the PN model just describes the structure of the system, not the detailed dynamics of the crude oil flow.From the definition of a shortterm schedule, the firing of a continuous transition is triggered by an OD.Thus, with the flow rate given by ODs and the transition enabling and firing rules, the dynamics of the crude oil flow in the PN model can be defined.

PN Model for the Whole System
The PN in Figure 5 models the whole system with two storage tanks, two charging tanks, and two distillers, where the discrete places, enforcing places, and their associated arcs, and the inhibitor arcs are omitted for concision.Crude oil is transported from storage tanks to charging tanks through a pipeline.Thus, y models both the discharging of storage tanks and the charging of charging tanks at the same time.In the model, {t In other words, when y fires, it implies that one transition in TI and one in TO fires at the same rate at the same time, which models the crude oil's transport from storage tank to charging tank via a pipeline.

PN Model for the Whole System
The PN in Figure 5 models the whole system with two storage tanks, two charging tanks, and two distillers, where the discrete places, enforcing places, and their associated arcs, and the inhibitor arcs are omitted for concision.Crude oil is transported from storage tanks to charging tanks through a pipeline.Thus, y models both the discharging of storage tanks and the charging of charging tanks at the same time.In the model, {t11, t12, y, p1s, p1c, p13} and {t21, t22, y, p2s, p2c, p23} model the two storage tanks, while {y, t32, t33, t34, t35, p3s, p3c, p33} and {y, t42, t43, t44, t45, p4s, p4c, p43} model the two charging tanks.Place p0 with F tokens in it models a tanker carrying F types of crude oil when it arrives.Transition t1 can fire to move one token from p0 to p1 only if p1 is empty, and models that only one type of oil can be unloaded at a time.At the right part, places p3 and p4 model two distillers, and t5 and t6 represent distillation.However, it should be noted that the PN model just describes the structure of the system, not the detailed dynamics of the crude oil flow.From the definition of a shortterm schedule, the firing of a continuous transition is triggered by an OD.Thus, with the flow rate Place p 0 with F tokens in it models a tanker carrying F types of crude oil when it arrives.Transition t 1 can fire to move one token from p 0 to p 1 only if p 1 is empty, and models that only one type of oil can be unloaded at a time.At the right part, places p 3 and p 4 model two distillers, and t 5 and t 6 represent distillation.However, it should be noted that the PN model just describes the structure of the system, not the detailed dynamics of the crude oil flow.From the definition of a short-term schedule, the firing of a continuous transition is triggered by an OD.Thus, with the flow rate given by ODs and the transition enabling and firing rules, the dynamics of the crude oil flow in the PN model can be defined.
The set of input places of transition t (input transitions of place p) is denoted as • t ( • p).Similarly, the set of output places of t (output transitions of p) is denoted as t • (p • ).Furthermore, colors are introduced into the PN model to distinguish different types of crude oil and we let φ i ∈ Φ denote the crude oil type i, i.e., the color of a token in a place.At marking M, the number of tokens with color φ i in p is denoted as M(p, φ i ) and the associated volume is denoted as With the above symbols, readers are referred to [21,22] for the transition enabling and firing rules.Then, we can discuss the scheduling problem by using the developed model.

Scheduling Method
To obtain a feasible short-term schedule, the most difficult step is to decide on ODTs and ODFs.In this paper, we assume that a refining schedule is given, as can be found in the methods in [28,30].Given a refining schedule that is set according to the crude oil availability during the scheduling horizon, the feeding rate to the distillers is known, which implies that there is enough crude oil in the storage tanks to be processed.Hence, finding a detailed schedule to realize a given refining schedule is independent of the number of storage tanks and their capacity, and the storage tanks in the system are ignored when a PN model is presented in the discussion thereafter.
According to Wu et al. [21,22], the existence of a feasible short-term schedule is the key to finding a schedule under the normal mode.With the SCF mode, a schedule should be available.Nevertheless, since the SCF mode is undesirable, its use should be minimized and the normal mode should be applied if possible.Thus, to schedule the system, we adopt both modes and the SCF mode is adopted only for some charging tanks during some periods when necessary.Under the normal mode, the system with initial state M 0 is said to be schedulable if there exists a feasible short-term schedule for a horizon (0, ∞) [21,22].A state M is said to be safe if, with M as its initial state, the system is schedulable.Based on this safety concept, we discuss the scheduling problem to minimize the use of the SCF mode.
To minimize the use of the SCF mode, we need to measure such usage.When the SCF is applied for a charging tank by starting at time τ 1 , this mode is applied without interruption until time τ 2 .Then we say that, during time slot from τ 1 to τ 2 , the SCF is applied to the charging tank.For a system with H charging tanks and K distillers, assume that charging tank CTK i adopts the SCF mode for N i time slots during the scheduling horizon.Let τ sin and τ ein denote the start and end time of the nth slot of applying the SCF mode for charging tank CTK i , respectively.Then the total time during which the charging tanks adopt the SCF mode is defined as Furthermore, let Γ = (τ s , τ e ) be the scheduling horizon.Then the usage of the SCF mode can be measured by δ = Π/K(τ e − τ s ), which gives the ratio of time during which the distillers are fed under the SCF mode.Hence, to minimize the usage of the SCF, we have to minimize δ.As the charging tanks are an important and limited resource, a utilization ratio is introduced to the charging tanks.A charging tank is at a working state if it is being charged, discharged, or t 2 in Figure 2 fires; otherwise it is at an idle state.Let N i denote the number of time slots during which charging tank CTK i is at a working state during the scheduling horizon, and ς sin and ς ein denote the start and end time of the nth working slot of CTK i , respectively.Then, the utilization ratio of CTK i is defined as ρ i = ∑ N i n=1 (ς ein − ς sin )/(τ e − τ s ), and the utilization ratio for the whole system is defined as ρ = ∑ H i=1 ρ i /H.We develop scheduling methods to find a schedule to minimize δ and increase ρ.
We use f dsi , f pmax , Ψ, and σ to denote the feeding rate to distiller DS i , the maximal oil transportation rate of the pipeline, the ORT, and the safety stock, respectively.Places p is and p ic are used for charging tank CTK i in the PN model.As a scheduling method, it is meaningful only if the production rate of the system can reach the maximum since productivity is a very important criterion.Hence, in the following discussion, for a refinery with K distillers, we assume that the system operates at the maximal production rate, or ∑ K k=1 f dsk = f pmax , where f dsk is the feeding rate to distiller DS k .For a refinery with only one distiller at the maximal production rate, as proven in [21], three charging tanks are necessary to schedule the operation under the normal mode, which can usually be satisfied in practice.Hence, we focus on analyzing a system with multiple distillers.For a system with K distillers, all the distillers have to process crude oil concurrently and uninterruptedly.Hence, at least one charging tank must be dedicated to a distiller, which implies that no schedule can be found even if the SCF mode is adopted if the number of charging tanks is less than K. Based on practical scenarios without sufficient charging tanks, for a refinery with K distillers and N charging tanks, we discuss the scheduling problem for cases with K ≤ N < 2K.Also, in the following discussion, we assume that each distiller processes different oil types since the obtained results in this case are applicable to cases when some distillers process the same oil type.

Systems with Two Distillers
In [21], it is shown that, under the normal mode, no feasible schedule with maximal production rate can be found for a refinery with one distiller and two charging tanks.Thus, it is clear that if there are only two charging tanks for a two-distiller system, to obtain a schedule, the two distillers must be fed by applying the SCF mode all the time, i.e., δ = 1.Then, we discuss the case with three charging tanks.For this case, with the PN model shown in Figure 6, we have the following results.Proposition 1. Assume that: (1) there are two distillers DS 1-2 with feeding rates f ds1 and f ds2 , respectively, and α = Ψ × f pmax , α 1 = Ψ × f ds1 , and α 2 = Ψ × f ds2 ; (2) there are three charging tanks CTK 1-3 with capacities ξ 1 , ξ 2 , and ξ 3 , respectively; (3) f pmax = f ds1 + f ds2 ; and (4) initially, the volume of oil type 1 in CTK 1 is ζ 1 , and the volumes of oil type 2 in CTK 2 and CTK 3 are ζ 2 and ζ 3 , respectively.Then, a schedule can be found such that δ = 0.5 if Condition (3) holds: By the proof of the proposition, a method is given to find a schedule.To schedule the system, Condition (3) presents the necessary amount of oil that is initially in the charging tanks, which is easy to meet.In fact, if all the charging tanks are initially empty, no schedule can be found according to the operational requirements, no matter how many charging tanks there are.If there is more oil at the initial state, a schedule can be obtained similarly.By the obtained schedule, in order to keep DS 1 in operation, CTK 1 has to apply the SCF mode during the whole scheduling horizon due to the limited charging tanks.For DS 2 , by carefully scheduling the system, it is alternately fed by two charging tanks, CTK 2 and CTK 3 , under the normal mode.If one of them is empty, the other can be used to feed the distiller.Hence, both CTK 2 and CTK 3 operate under the normal mode during the whole scheduling horizon.To do so, the key is that every time . Thus, a schedule can be found simply by using the proposed method.
Note that CTK 2 is empty during [τ 1 , τ 2 ], and the utilization ratio of can be made longer than Ψ, CTK 2 can be used to feed DS 1 for some time under the normal mode such that δ can be reduced by the full use of CTK 2 .Let = (µ × f ds1 − 2 × f pmax )/(f ds1 + f pmax ).We have the following result.
Proof.See Appendix A1.By the proof of the proposition, a method is given to find a schedule.To schedule the system, Condition (3) presents the necessary amount of oil that is initially in the charging tanks, which is easy to meet.In fact, if all the charging tanks are initially empty, no schedule can be found according to the operational requirements, no matter how many charging tanks there are.If there is more oil at the initial state, a schedule can be obtained similarly.By the obtained schedule, in order to keep DS1 in operation, CTK1 has to apply the SCF mode during the whole scheduling horizon due to the limited charging tanks.For DS2, by carefully scheduling the system, it is alternately fed by two charging tanks, CTK2 and CTK3, under the normal mode.If one of them is empty, the other can be used to feed the distiller.Hence, both CTK2 and CTK3 operate under the normal mode during the whole scheduling horizon.To do so, This schedule is obtained by modifying that created by Proposition 1.By the scheduling method given in the proof of Proposition 2, DS 2 is fed by CTK 2 and CTK 3 under the normal mode during the whole scheduling horizon, which is the same as that in Proposition 1.However, since CTK 2 and CTK 3 have idle time for feeding DS 2 , they can feed DS 1 under the normal mode during their idle time such that the usage of the SCF mode is reduced.To do so, when the charging tanks are charged with volume V 1 = µ × α 1 of oil type 1, we do not charge all the crude oil into CTK 1 at one time as done in Proposition 1; instead, V 1 is divided into three parcels and charged in the following order: charge By doing so, when the crude oil of type 1 in CTK 2 or CTK 3 is ready for discharging under the normal mode, it can be used to feed DS 1 until it is used up.Note that, by doing so, DS 2 is still fed under the normal mode.
For the obtained schedule using Proposition 2, CTK 2 is used to feed DS 2 and DS 1 during [τ 0 , τ 1 ] and [τ 3 , τ 4 ] under the normal mode, respectively.In this way, the utilization ratio of CTK 2 reaches ρ 2 = 1.Furthermore, CTK 1 and CTK 3 are occupied during the whole scheduling horizon too.Hence, δ is minimized and cannot be reduced any more.It should be pointed out that such a schedule can be obtained only if µ ≥ max{( × f ds1 + f pmax )/f ds1 , 2f pmax /f ds1 }, otherwise, CTK 2 cannot be used to feed DS 1 under the normal mode, and the system has to be scheduled using Proposition 1.

Scheduling a System with Three Distillers
For a system with three distillers, the scheduling problem is much more complicated than with two distillers.For such a system, if there are three charging tanks, it is obvious that we can use one tank to feed one distiller under the SCF mode and δ = 1.We then discuss cases with more than three charging tanks.
Similar to Proposition 1, if two charging tanks are assigned to a distiller, this distiller can be fed under the normal mode during the whole scheduling horizon.For the distiller with only one charging tank being assigned, the SCF mode has to be applied.Just as in Proposition 1, the key to the proposed method is that every time crude oil of type 1 (2, 3) is charged, the volume of oil to be charged is With the obtained schedule by using the method given by Proposition 3, charging tank CTK 3 is emptied at time τ 0 + Ψ and it is kept to be empty until it starts to be charged at time τ 1 .Hence, CTK 3 is not fully utilized and its utilization ratio is Similar to the situation in Proposition 1, CTK 3 can be used to reduce the usage of the SCF mode.Let = (µ × f ds1 + µ × f ds2 − 2 × f pmax )/(f ds2 + f pmax ).We have the following result.Proposition 4. Assume that: (1) there are three distillers DS 1-3 with feeding rates f ds1 , f ds2 , and f ds3 , respectively, and (2) there are four charging tanks CTK 1-4 with capacities ξ 1 , ξ 2 , ξ 3 , and ξ 4 , respectively; (3) f pmax = f ds1 + f ds2 + f ds3 ; and (4) initially, the volume of oil type 1 (2; 3; 3) in CTK 1 (CTK 2 ; CTK 3 ; CTK 4 ) is ζ 1 (ζ 2 ; ζ 3 ; ζ 4 ).Then, if Condition (6) holds, we can find a schedule with δ = (2µ − )/3µ.
Similar to Proposition 1, if two charging tanks are assigned to a distiller, this distiller can be fed under the normal mode during the whole scheduling horizon.For the distiller with only one charging tank being assigned, the SCF mode has to be applied.Just as in Proposition 1, the key to the proposed method is that every time crude oil of type 1 (2, 3) is charged, the volume of oil to be charged is With the obtained schedule by using the method given by Proposition 3, charging tank CTK3 is emptied at time τ0 + Ψ and it is kept to be empty until it starts to be charged at time τ1.Hence, CTK3 is not fully utilized and its utilization ratio is ρ3 = 1 − (μ × fds1 + μ × fds2 − fpmax)/(μ × fpmax) = 1 − (fds1 + fds2)/fpmax + 1/μ.Similar to the situation in Proposition 1, CTK3 can be used to reduce the usage of the SCF mode.Let ϖ = (μ × fds1 + μ × fds2 − 2 × fpmax)/(fds2 + fpmax).We have the following result.For this proposed scheduling method, CTK 3 or CTK 4 is used to feed DS 2 under the normal mode for some time.Similar to Proposition 2, when CTK 3 or CTK 4 finishes feeding DS 3 and becomes empty, it is charged with volume v = × α 2 of oil type 2. When the crude oil in it is ready for feeding under the normal mode, it starts feeding DS 2 until it is empty, resulting in the reduction of the SCF mode operation time of CTK 2 .
By the above obtained schedule, all the charging tanks including CTK 3 , which has idle time for the schedule obtained by using Proposition 3, are fully utilized and the utilization ratio for the system is ρ = 1.Thus, δ cannot be reduced further and the schedule is optimal in terms of the minimization of δ.Notice that, if CTK 3 is charged with oil type 1 instead of oil type 2 with volume ' × α 1 when it is emptied at τ 1 , where ' = (µ × f ds1 + µ × f ds2 − 2 × f pmax )/(f ds1 + f pmax ), the system can be scheduled similarly.Consequently, we have Π' = (2µ -') × Ψ ≤ (2µ − ) × Ψ = Π as f ds1 ≥ f ds2 .Hence, charging oil of type 2 into CTK 3 is better than charging oil of type 1 into it at time τ 1 .

Case 2: Five Charging Tanks
Now we discuss the situation where there are five charging tanks and three distillers, and the PN model for it is shown in Figure 8.For this system, DS 1 has only one charging tank, and the other two distillers have two charging tanks each.
of type 2 into CTK3 is better than charging oil of type 1 into it at time τ1.
The schedule generated by Proposition 6 is based on that obtained by Proposition 5.The difference is that CTK 4 is used to feed DS 1 under the normal mode for some time due to that CTK 4 has idle time for the schedule obtained by Proposition 5. Thus, by using the scheduling method given in Proposition 6, CTK 4 is fully utilized, but CTK 2 is empty and idle during [τ 0 + Ψ, τ 0 + (µ × α 1 )/f pmax ], i.e., the utilization ratio for CTK 2 and CTK 4 is ρ 2 = 1 − (µ × f ds1 − f pmax )/(µ × f pmax ) and ρ 4 = 1, respectively.In this case, we cannot make ρ = 1 for the entire system, since both CTK 2 and CTK 4 are emptied at time τ 0 + Ψ but only one of them can be charged at a time.Moreover, if we charge CTK 2 with oil type 3 instead of oil type 2 at time τ 0 + (µ × α 1 )/f pmax , the system can be scheduled similarly and the time taken for CTK 1 to feed DS 1 under the SCF mode is reduced to which implies δ = (µ − )/3µ − f ds3 /3f pmax .Moreover, we can further reduce δ by increasing the utilization of both CTK 2 and CTK 4 rather than just one of them.By doing so, a more complex schedule with a large number of charging tank switches may be obtained.However, δ is reduced slightly such that the obtained schedule is not meaningful in practice.Nevertheless, it is applicable for a system with more than three distillers, which is discussed in the next section.

Scheduling for General Systems
In the last section, we discussed the scheduling problem for different cases.In this section, we extend these results to a general system with K distillers.For a system with K distillers and K charging tanks, it is obvious that a schedule with one tank feeding one distiller under the SCF mode can be found such that δ = 1.Then, we discuss the case with 2K − N charging tanks, where N < K.
Case 1: 2K − N Charging Tanks For a system with K distillers and 2K − N charging tanks, where N < K, only one charging tank is assigned to each of distiller DS 1-N , and the other distillers have two charging tanks.Let charging tank CTK i be represented by {p is , p ic , t i2 , t i3 , t i4 , t i5 } and distiller DS i be represented by p i in a PN model.Then, we present the following results.Proposition 7. Assume that: (1) there are K ≥ 3 distillers DS 1-K with feeding rates f ds1 -f dsK , and 3) f pmax = f ds1 + f ds2 + . . .+ f dsK ; and (4) initially, the volume of oil type 1 (i; j; j) in CTK 1 (CTK ), i ∈ {2, 3, . . ., N} and j ∈ {N + 1, N + 2, . . ., K}.Then, if Condition (9) holds, a schedule can be found with δ = N/K.
Proposition 7 extends Propositions 1, 3, and 5 and presents a scheduling method for a general system with K distillers and 2K − N charging tanks.By the method given in Proposition 7, every time a charging tank for feeding distiller DS i , i ∈ {1, 3, . . ., K}, is charged, µ × α i of oil is charged no matter what the operation mode of the charging tank is.Also, if the normal mode is applied, a charging tank is emptied after feeding a distiller.Thus, a schedule is easily found.
Proof.See Appendix A.8. Proposition 8 is the extension of Propositions 2, 4, and 6 and presents a method to find a schedule for a general situation with 2K − N charging tanks.The method given by Proposition 8 improves the one given by Proposition 7 by using the idle time of charging tanks to feed distillers under the normal mode.Thus, one needs to examine the idle time of such charging tanks and schedule the idle time by the method given in Proposition 8.The key is that, during the idle time of charging tank CTK (2q+2K−2Q N−1) or CTK (2q+2K−2Q−N) , q ∈ {1, 2, . . ., Q}, for feeding DS (q+K−Q) , it is charged with volume q × α (q+N-Q) of oil type (q + N − Q), and feed DS (q+N−Q) under the normal mode for some time.However, the total volume of oil type k, k ∈ {1, 2, . . ., K} that is charged into charging tanks remains V k = µ × α k , which is the same as that in Proposition 7.However, for oil of type i, i ∈ {1, 2, . . ., N}, it may be divided into several parts and charged into the charging tanks sequentially according to the proposed method.
Note that, in order to reduce the number of switches in feeding distillers, we usually take the maximal value of µ.While adopting Proposition 8, the maximal µ is calculated first.Then, this value is used to calculate the corresponding .By examining the upper and lower bounds of µ and , we can decide Q and obtain the corresponding schedule.Note that the charging of CTK q is completed at time ≥ Ψ holds, CTK q can feed DS q under the normal mode during [τ 1 + Ω q + (1 + q ) × Ψ, τ 2 ], which further reduces δ.
In the proposed scheduling method, the initial crude oil in the charging tanks should meet the given requirement.For charging tanks CTK 1−N , the lower bound can be easily satisfied as σ is not large and there is usually crude oil in the charging tanks initially in practice.If the volume of initial crude oil exceeds the upper bounds, the pipeline can be set as idle for some time such that a charging tank keeps feeding without being charged until the crude oil in it is less than the upper bounds.For charging tanks CTK (N+1)−(2K−N) , the key is that the charging tank should be empty when the charging starts, which can be done if the pipeline is appropriately scheduled.
By the proposed scheduling methods, it is assumed that each distiller processes one type of crude oil only during the entire scheduling horizon.In practice, a distiller has to switch from processing one type of crude oil to another, which is not considered to ease the presentation of the proposed results.If a distiller has to process a new type of crude oil under the SCF mode, the crude oil with a volume larger than the safety stock should be charged into an empty charging tank first to satisfy the SCF constraint.Then, this charging tank can be used to feed the distiller under the SCF mode after the charging tank that is previously feeding the distiller finishes its discharging.For a charging tank that feeds DS i , i ∈ {N + 1, N + 2, . . ., K}, under the normal mode, it is charged with volume µ × α i every time.However, in some circumstances, the distiller has to process a new type of crude oil after ς < µ × α i of oil is processed.If ρ = 1 is not reached, an empty charging tank can be found and temporarily used for crude oil type switches.Then, the system is scheduled in the same way.Otherwise, it cannot be realized with the proposed method.In this case, we can use a charging tank in the system for oil type switches.Note that, as Q increases, ρ increases as well, resulting in δ being reduced; this, however, makes it harder to find an empty tank for the new type of crude oil.Hence, it is important to choose a suitable Q for the schedule.
It should be pointed out that, according to existing studies [21,22,27], three charging tanks for a distiller are generally required to find a feasible schedule with maximal production rate if only the normal mode is applied.Note that, in this paper, by carefully scheduling the system, we use two charging tanks for a distiller to realize the operation under the normal mode, and the SCF mode is adopted only when the number of charging tanks for a distiller is less than two.Thus, we minimize the number of charging tanks to find a schedule.When there are more charging tanks, a schedule can be more easily found.
Furthermore, with the proposed method, the SCF mode is avoided if it is possible when there are not enough charging tanks to allow for finding a feasible schedule under the normal mode.Also, by the proposed method, a schedule can be found to realize a given refining schedule with simple calculation, and we generate the detailed schedule step by step.Hence, it provides an efficient way to solve the scheduling problem for a refinery without sufficient charging tanks.

Industrial Case Study
This section presents a practical scenario of a refinery in China to show the application of the proposed method.The refinery has four distillers DS 1 -DS 4 with 10 charging tanks.A short-term schedule with 10-day scheduling horizon should be created three times a month to realize a target refining schedule.In this case, the refining schedule is shown in Figure 9, where #i denotes crude oil type #i, i ∈ {1, 2, . . ., 9}.The oil feeding rates for the distillers and maximal flow rate of the pipeline are f ds1 = 323 tons/h, f ds2 = 302 tons/h, f ds3 = 625 tons/h, f ds4 = 400 tons/h, and f pmax = 1650 tons/h, respectively, which indicates f pmax = f ds1 + f ds2 + f ds3 + f ds4 .Note that distillers DS 1 -DS 3 operate normally, while DS 4 is under maintenance at the beginning and will be put into operation at the beginning of the fifth day.The oil residency time for charging tanks is Ψ = 6 h, and the safety stock is σ = 1000 tons.The initial state for the 10 charging tanks is shown in Table 1.Initially, CTK1, CTK4, and CTK8 are feeding DS1, DS2, and DS3, respectively.Note that, according to the refining schedule, the crude oil in CTK10 is not to be processed during the scheduling horizon, and CTK2 is under maintenance and cannot be used.Hence, there are three charging tanks ready for charging at the initial time.By checking the crude oil in the charging tanks and the refining schedule, we find that: (1) the pipeline needs to deliver 22,000 tons of oil type #1 from the storage tanks to the charging tanks for feeding DS1 after the oil initially in CTK1 and CTK3 is used up; (2) DS2 first processes the crude oil in CTK4 and CTK5, then these two charging tanks are ready for charging; (3) CTK8 will be ready for charging after the oil initially in it is used up by feeding DS3; and (4) CTK9 is empty and free to be charged.Therefore, when DS4 starts its operation at the beginning of the fifth day, the system has four distillers operating concurrently but only eight charging tanks are usable, i.e., there are not sufficient charging tanks in the refinery.Hence, the SCF mode has to be adopted for some time, and the system is scheduled with CTK1 and CTK3 being assigned to DS1, CTK4, and CTK5 to DS2, CTK8, and CTK9 to DS3, CTK6, to DS4, and CTK7 is used for the oil type switch if necessary.The PN model for this system is shown in Figure 10.Note that we do not model the charging tanks that are not available because they have no effect on finding a schedule.Also, in the model, CTK7, which is used for oil type switches, is ignored for concision.In the model, {y, ti2, ti3, ti4, ti5, pis, pic, pi3}, i Є {1, 2, …, 10}, model CTKi, while pk and tk, k Є {1, 2, 3, 4}, model DSk and its distillation, respectively.
Based on the PN model shown in Figure 10, we code the scheduling method given by Proposition 8 and the evolution rules of the model to verify the proposed method.For this case study, we have μ ≤ min{ξ1/α1, ξ3/α1, ξ4/α2, ξ5/α2, ξ8/α3, ξ9/α3, ξ6/α4, ξ5/α1} = 8.To fully utilize the charging tanks, we set μ = 8.As fds2 < fds1 < fds3 holds, we have ϖ1  The initial state for the 10 charging tanks is shown in Table 1.Initially, CTK 1 , CTK 4 , and CTK 8 are feeding DS 1 , DS 2 , and DS 3 , respectively.Note that, according to the refining schedule, the crude oil in CTK 10 is not to be processed during the scheduling horizon, and CTK 2 is under maintenance and cannot be used.Hence, there are three charging tanks ready for charging at the initial time.By checking the crude oil in the charging tanks and the refining schedule, we find that: (1) the pipeline needs to deliver 22,000 tons of oil type #1 from the storage tanks to the charging tanks for feeding DS 1 after the oil initially in CTK 1 and CTK 3 is used up; (2) DS 2 first processes the crude oil in CTK 4 and CTK 5 , then these two charging tanks are ready for charging; (3) CTK 8 will be ready for charging after the oil initially in it is used up by feeding DS 3 ; and (4) CTK 9 is empty and free to be charged.Therefore, when DS 4 starts its operation at the beginning of the fifth day, the system has four distillers operating concurrently but only eight charging tanks are usable, i.e., there are not sufficient charging tanks in the refinery.Hence, the SCF mode has to be adopted for some time, and the system is scheduled with CTK 1 and CTK 3 being assigned to DS 1 , CTK 4 , and CTK 5 to DS 2 , CTK 8 , and CTK 9 to DS 3 , CTK 6 , to DS 4 , and CTK 7 is used for the oil type switch if necessary.The PN model for this system is shown in Figure 10.Note that we do not model the charging tanks that are not available because they have no effect on finding a schedule.Also, in the model, CTK 7 , which is used for oil type switches, is ignored for concision.In the model, {y, t i2 , t i3 , t i4 , t i5 , p is , p ic , p i3 }, i ∈ {1, 2, . . ., 10}, model CTK i , while p k and t k , k ∈ {1, 2, 3, 4}, model DS k and its distillation, respectively.
is used for the oil type switch if necessary.The PN model for this system is shown in Figure 10.Note that we do not model the charging tanks that are not available because they have no effect on finding a schedule.Also, in the model, CTK7, which is used for oil type switches, is ignored for concision.In the model, {y, ti2, ti3, ti4, ti5, pis, pic, pi3}, i Є {1, 2, …, 10}, model CTKi, while pk and tk, k Є {1, 2, 3, 4}, model DSk and its distillation, respectively.
Based on the PN model shown in Figure 10, we code the scheduling method given by Proposition 8 and the evolution rules of the model to verify the proposed method.For this case study, we have μ ≤ min{ξ1/α1, ξ3/α1, ξ4/α2, ξ5/α2, ξ8/α3, ξ9/α3, ξ6/α4, ξ5/α1} = 8.To fully utilize the charging tanks, we set μ = 8.As fds2 < fds1 < fds3 holds, we have ϖ1 = (μ × fds1 + μ × fds3 + μ × fds4 − 2fpmax)/(fds4 + fpmax) = 3.65.It can be verified that μ ≥ (ϖ1 × fds4 + fpmax)/fds4 = 7.78 and μ ≥ 2fpmax/(fds1 + fds3 + fds4) = 2.45 hold.As the conditions in Proposition 8 are satisfied, we set Q = 1 and use the idle time of CTK4 and CTK5 to feed DS4 under the normal mode for some time.As the initial state is not exactly the same as required by Proposition 8, we can adjust the crude oil in the charging tanks by properly scheduling the oil delivering via the pipeline.Let τ s = 0 h.According to Proposition 8, we schedule the pipeline as follows.When DS 4 starts its operation at time τ 1 = 96 h, one can use CTK 4 to feed DS 4 under the normal mode for some time.Thus, CTK 4 must be emptied at time τ 2 = τ 1 + Ψ = 102 h.Hence, we charge it with volume v 4 = (τ 2 − τ 0 )×f ds2 − 21,000 = 9804 tons of oil #4 only for feeding DS 2 when it is charged the first time.For this case, DS 1 has to process oil type #2 after 38,000 tons of oil type #1.We charge CTK 1 with 13,000 tons of oil type #1 and charge CTK 7 with 2504 tons of oil type #2 to realize the oil type switches.
To ensure the safety stock, we start charging CTK 6 with volume 1000 tons of oil #7 at time τ 3 = 95.4 h.By the above pipeline transportation schedule, at τ 1 , the initial crude oil in charging tanks satisfies Condition (10).By following the scheduling method given by Proposition 8, the volumes of crude oil that should be transported from storage tanks to charging tanks for feeding distillers DS 1 , DS 2 , DS 3 , and DS 4 are V 1 = µ × α 1 = 15,504 tons, V 2 = µ × α 2 = 14,496 tons, V 3 = µ × α 3 = 30,000 tons and V 4 = µ × α 4 = 19,200 tons, respectively.When oil type #7 is transported, it should first be charged into CTK 6 with volume v 1 = Ψ × f pmax = 9900 tons, then into CTK 4 or CTK 5 with volume v 2 = 1 × f ds1 = 8762 tons, and CTK 6 again with volume v 3 = V 4 − v 1 − v 2 = 538 tons.As DS 4 has to switch for processing different oil types, we charge CTK 6 with v 4 = 25,000 − V 4 = 4800 tons of oil type #7 and charge CTK 7 with v 5 = v 1 − v 4 = 5100 tons of oil type #8.When the oil #7 in CTK 6 for feeding DS 4 is used up at time τ 5 = 158.5 h and CTK 6 is emptied, CTK 7 starts feeding DS 4 with oil type #7 under the SCF mode.The sequence of charging the charging tanks and the time point for each event are shown in Figure 11.
satisfies Condition (10).By following the scheduling method given by Proposition 8, the volumes of crude oil that should be transported from storage tanks to charging tanks for feeding distillers  Therefore, a schedule that realizes the refining schedule is obtained and the Gantt charts in Figures 11 and 12 present the oil transportation from storage tanks to charging tanks and the detailed schedules of distiller feeding.Furthermore, the detailed schedule of charging tanks CTK4, CTK5, CTK6, and CTK7 for being charged and feeding distillers is presented in Figure 13, which clearly shows how the method given by Proposition 8 schedules the system to reduce the time during which DS4 is fed by the charging tanks under the SCF mode.Since CTK6 or CTK7 is not charged or used to feed a distiller while CTK4 or CTK5 is feeding DS4 for ϖ1 × Ψ = 21.9 h > Ψ, CTK6 or CTK7 can feed DS4 under the normal mode until it is charged by the pipeline again.Thus, we have Π = 3 × (2Ψ + ϖ1 × α4/fpmax) = 51.9h and δ = 51.9÷ (4 × 3 × 8 × 6) = 9% for the obtained schedule.Therefore, a schedule that realizes the refining schedule is obtained and the Gantt charts in Figures 11  and 12 present the oil transportation from storage tanks to charging tanks and the detailed schedules of distiller feeding.Furthermore, the detailed schedule of charging tanks CTK 4 , CTK 5 , CTK 6 , and CTK 7 for being charged and feeding distillers is presented in Figure 13, which clearly shows how the method given by Proposition 8 schedules the system to reduce the time during which DS 4 is fed by the charging tanks under the SCF mode.Since CTK 6 or CTK 7 is not charged or used to feed a distiller while CTK 4 or CTK 5 is feeding DS 4 for 1 × Ψ = 21.9 h > Ψ, CTK 6 or CTK 7 can feed DS 4 under the normal mode until it is charged by the pipeline again.Thus, we have Π = 3 × (2Ψ + 1 × α 4 /f pmax ) = 51.9h and δ = 51.9÷ (4 × 3 × 8 × 6) = 9% for the obtained schedule.For this case, a detailed schedule that realizes the given refining schedule with all constraints considered is efficiently found.As pointed out in [21], if a mixed integer programming model is applied, the number of binary variables is huge and makes it extremely difficult or even impossible to solve such a large problem.Furthermore, the scheduling situation without sufficient charging tanks has not been discussed before, and the method proposed in [21,22] cannot be applied here as the number of charging tanks is much less than that required by the methods there.With the proposed method in this paper, a schedule can be easily created for a refinery without sufficient charging tanks such that the SCF mode is minimally used.For this case, a detailed schedule that realizes the given refining schedule with all constraints considered is efficiently found.As pointed out in [21], if a mixed integer programming model is applied, the number of binary variables is huge and makes it extremely difficult or even impossible to solve such a large problem.Furthermore, the scheduling situation without sufficient charging tanks has not been discussed before, and the method proposed in [21,22] cannot be applied here as the number of charging tanks is much less than that required by the methods there.With the proposed method in this paper, a schedule can be easily created for a refinery without sufficient charging tanks such that the SCF mode is minimally used.For this case, a detailed schedule that realizes the given refining schedule with all constraints considered is efficiently found.As pointed out in [21], if a mixed integer programming model is applied, the number of binary variables is huge and makes it extremely difficult or even impossible to solve such a large problem.Furthermore, the scheduling situation without sufficient charging tanks has not been discussed before, and the method proposed in [21,22] cannot be applied here as the number of charging tanks is much less than that required by the methods there.With the proposed method in this paper, a schedule can be easily created for a refinery without sufficient charging tanks such that the SCF mode is minimally used.

Discussion and Conclusions
Short-term scheduling for crude oil operations is a complex problem since a schedule needs to provide detailed activities such that all resource and process constraints are satisfied.Because of its NP-hard nature, there are no efficient techniques and software tools, and the scheduling job is still done manually.While scheduling a refinery without sufficient charging tanks, the limited number of charging tanks further complicates the problem.It is more challenging than a scheduling problem with sufficient charging tanks as the operational constraints and costs must be considered.
Instead of mathematical programming models, this paper studies the scheduling problem of crude oil operations by following a two-level architecture that solves the problem based on control theory.By this method, a detailed schedule is provided at the lower level to realize a refining schedule that is generated at the upper level.With this idea in mind, Wu et al. [21,22,[24][25][26][27][28] built a hybrid PN model for the system to obtain a feasible schedule for crude oil operations.In these studies, generally, three charging tanks are needed for each distiller to find a schedule with the maximal production rate.Although their charging tank requirement can be satisfied for many refineries, there are refineries for which such a requirement is impossible.This is often the case when some charging tanks have to be maintained, or more distillers are installed without enough charging tanks being built.Hence, this work focuses on scheduling a refinery without sufficient charging tanks to solve such problem.We build a new PN model for the system to describe the process accurately.Based on this model, a method that can schedule the system is proposed, and a schedule with the minimal usage of the SCF mode can be efficiently obtained via simple calculation.
This paper focuses on finding a schedule to realize a given refining schedule.When there are not sufficient charging tanks, it is better to create a refining schedule with the conditions given in this paper as constraints such that the obtained refining schedule is easy to realize.Our future work will take up this challenge.its firing, and y fires with color φ 1 and volume µ × α 1 − α to charge p 1s as µ ≥ f pmax /f ds1 .At time τ Then, t 14 and t 33 continue their firing with color φ 1 and φ 2 to feed p 1 and p 2 , respectively, and y fires with color φ 2 and volume µ × α 2 to charge p 2s .At This marking is equivalent to M 0 .Hence, CTK 1 is feeding DS 1 under the SCF mode during [τ 0 , τ 3 ] and Π = µ × Ψ, resulting in δ = 0.5.

Figure 1 .
Figure 1.Icons in the model.

Figure 2 .
Figure 2. PN model for storage tanks.

Figure 1 .
Figure 1.Icons in the model.

Figure 1 .
Figure 1.Icons in the model.

Figure 2 .
Figure 2. PN model for storage tanks.

Figure 2 .
Figure 2. PN model for storage tanks.

Figure 4 .
Figure 4.The PN model for the pipeline.

Figure 5 .
Figure 5. PN model of the whole system.

Figure 4 .
Figure 4.The PN model for the pipeline.

Figure 4 .
Figure 4.The PN model for the pipeline.

Figure 5 .
Figure 5. PN model of the whole system.

Figure 5 .
Figure 5. PN model of the whole system.

Figure 6 .
Figure 6.The PN model for a system with three charging tanks and two distillers.

Figure 6 .
Figure 6.The PN model for a system with three charging tanks and two distillers.

Figure 7 .
Figure 7. PN model for a system with four charging tanks and three distillers.

Figure 7 .
Figure 7. PN model for a system with four charging tanks and three distillers.

Figure 8 .
Figure 8. PN model for a system with five charging tanks and three distillers.

25 Figure 9 .
Figure 9. Refining schedule for the case study.

Figure 9 .
Figure 9. Refining schedule for the case study.

Figure 10 .
Figure 10.PN model for the case study.Figure 10.PN model for the case study.

Figure 10 .
Figure 10.PN model for the case study.Figure 10.PN model for the case study.

Figure 11 .
Figure 11.Detailed schedule of oil transportation from storage tanks to charging tanks.

Figure 11 .
Figure 11.Detailed schedule of oil transportation from storage tanks to charging tanks.

Figure 13 .
Figure 13.The schedule of charging tanks for being charged and feeding distillers.

Figure 13 .
Figure 13.The schedule of charging tanks for being charged and feeding distillers.

Figure 13 .
Figure 13.The schedule of charging tanks for being charged and feeding distillers.

Table 1 .
Initial state for the charging tanks.