CHEMICAL ENGINEERING TRANSACTIONS VOL. 51, 2016 A publication of The Italian Association of Chemical Engineering Online at www.aidic.it/cet Guest Editors: Tichun Wang, Hongyang Zhang, Lei Tian Copyright © 2016, AIDIC Servizi S.r.l., ISBN 978-88-95608-43-3; ISSN 2283-9216 A Mixed-Integer Linear Programming Scheduling Optimization Model for Refinery Production Zhekui Zheng*, Hongjing Zhang Chengde Petrolume College, Chengde, Hebei 067000 China, zhekuizheng@126.com This paper addresses the problem of production planning and scheduling in an oil refinery process. In the process crude oil is transformed to bitumen and naphthenic special oils. The aim of the scheduling optimization is to decide which mode of operation to use in each processing unit at each point in time, in order to satisfy the demand while minimizing the production cost and taking inventory capacities into account. A mixed-integer optimization model is developed for the scheduling problem. The model can be regarded as a generalized lot-sizing problem, where inventory capacities are considered and more than one product is obtained for some modes of operation. It is shown how the optimization model can be used as a viable tool for supporting production planning and scheduling at the refinery, and that it is possible to analyze scheduling scenarios of realistic sizes. 1. Introduction A refinery is a production facility composed of a group of chemical engineering unit processes and unit operations refining certain materials or converting raw material into products of value. It is a chemical plant that processes crude oil and produces several valuable products. It contains many different types of units that perform a variety of different operations. The main goal is to take the undesirable components of the crude oil and upgrade them into more valuable products. Gasoline, diesel, and jet fuel are among the most valuable products, whereas fuel oils and lubricants are sometimes sold at a loss. Below is a list describing the different types of units found in a refinery: Separation units take an incoming stream and separate it into different components. No chemical reactions occur in these units. Desalter: Ions in the crude oil will corrode the pipes in the refinery and may deactivate the catalysts. It is important to remove these salts from the crude before any other processes are started. The process involves forcing water into the crude oil feed stream. Atmospheric Distillation: The distillation is performed at atmospheric pressures. The outputs of the distillation unit include light ends, kerosene, diesel, heavy gas oil, and atmospheric residue. Vacuum Distillation: This unit distills the atmospheric residue and produces light vacuum gas oil, heavy vacuum gas oil, and vacuum residue. The distillation occurs because the pressure inside of the unit is decreased to nearly zero, allowing the components of the atmospheric residue to boil at a lower temperature. Deasphalter: This unit takes the vacuum residue and pulls out all of the heavy particles leaving heavy gas oil that can be further refined or used as fuel oil, and asphalt, which is used in paving. Dewaxer: This unit precipitates long n-paraffins out of heavy vacuum gas oil creating lubricating oils that will withstand low temperatures without solidifying. Finishing units add the final touches before the product can be sold. Some chemical reactions may occur, but none that significantly alter the final product. Blending: These units take a variety of streams and mix them to meet certain criteria and compositions. Hydrotreater: Most crude oils today have a high sulfur content. Sulfur is a strong pollutant and must be removed to meet emission standards. Also, sulfur can deactivate catalysts in further refining units. Sulfur is removed by pumping hydrogen gas into any stream. The hydrogen reacts with a molecule and extracts the sulfur to produce hydrogen sulfide. DOI: 10.3303/CET1651152 Please cite this article as: Zheng Z.K., Zhang H.J., 2016, A mixed-integer linear programming scheduling optimization model for refinery production, Chemical Engineering Transactions, 51, 907-912 DOI:10.3303/CET1651152 907 Conversion units change the composition of input streams through chemical reactions. In the reactors, a low grade product is converted into a higher grade product. Catalytic Reformer: This unit takes HSR naphtha and unsaturates the hydrocarbons to produce aromatic rings and other various olefins. These aromatic rings and olefins are used in premium gasolines because of their high octane numbers. Hydrocracker: This unit performs the same operation as the catalytic cracker, but uses hydrogen gas instead of a catalyst to break long hydrocarbon chains into shorter ones. Also, the feedstock is light vacuum gas oil and the products are light and middle distillates. Delayed Coker: This unit uses a very severe version of thermal cracking to convert vacuum residue into light and middle distillates, as well as coke. Visbreaker: This unit employs a mild version of thermal cracking to convert vacuum residue into light and middle distillates, fuel oil, and coke or heavy gas oil into slightly lighter fuel oil. A typical oil refinery process is shown in Figure 1. Figure 1: Schematic flow diagram of a typical oil refinery In this paper, we consider a production plant in China. The production plant consists of one crude distillation unit and two hydro-treatment units, where crude oil is distillated and further processed and/or blended into various oil products, such as bitumen, naphthenic special oils and fuels. The production planning includes the aggregated production planning deciding where and when production should occur, the shipment planning where customer demand is transformed to schedules for the tankers transporting the products, the scheduling of the processing units, and finally the realization of the plans and the schedules with respect to the utilization of tanks and pipes. The scheduling problem which we focus on, concerns the question of which mode of operation to use in each processing unit at each point of time, in order to satisfy the demand for a given set of products. The main 908 characteristic of refinery scheduling is that a set of processing units concurrently produce multiple products, and a product obtained as output from one processing unit can be used as input to another processing unit. The main goals and contributions of this paper are that we propose a mixed integer linear programming model for the refinery scheduling problem. The optimization model can be regarded as a generalized lot-sizing problem, where more than one product is obtained for some modes of operation and where inventory capacities are considered. The contribution of this paper is to show how a refinery scheduling problem can be formulated using an optimization model, and that it is possible to solve and analyze scheduling scenarios of realistic sizes. We show that the optimization model can be used as a viable tool for supporting production scheduling at the refinery, and also to support the shipment planning and strategic decisions concerning new products and investments in storage capacity. This work is organized as follows. Section 2 describes related work. In Section 3 we introduce the refinery production process. In Section 4 the mathematical formulation of the production scheduling problem is presented. In Section 5 we conclude this paper. 2. Related work Unlike scheduling of batch processes which has received considerable attention in the literature, much less work has been reported in the scheduling of continuous multiproduct plants. A two product mix was addressed by Kella (Kella 1991), and an example of the planning of a multiproduct continuous process under resource constraints was presented by Kondili (Kondili et al., 1993). A petroleum refinery which has to process different crude oils is one example of continuous multiproduct plants, and many problems involving refinery planning have been studied since the 1950s. These problems included long-term supply and production planning of crude oil and the blending schedule for distilled crude oil products. Since the problem involves transition cost and inventory cost in its objective function, some of the literature s by Sahinidis (Sahinidis et al., 1991) and Pinto and Grossmann (Grossmann et al., 1994) on optimal cyclic scheduling of continuous multiproduct plants will also be used. A few literatures regarding the scheduling of operation modes in refineries using optimization models were reported. Alattas (Alattas et al., 2011) used a mixed-integer linear programming model to minimize the number of changeovers between operation modes. Optimization models have been more frequently used in operation mode scheduling areas. Linear programming models have been used for long-term aggregate production planning (Dewitt et al., 1989), and optimization models have also been used for blending problems (Amos et al., 1997). Other work related to the scheduling of operation modes concern unloading and blending of crude oil, feed management, and to some extent tank and pipe management (Lee et al., 1996). Shah gave an extensive review of problems and models within the area of refinery planning and scheduling (Shah 1996). 3. The refinery production process The refinery production process, which is illustrated in Figure 2, consists of three processing units: the crude distillation unit (CDU) which transform crude oil into naphtha, distillates and bitumen, and two hydrotreatment processes which transform distillates into naphthenic special oils. Figure 2: A schematic picture of the refinery production process 909 The CDU concurrently produces one bitumen product, four different distillates, and some naphtha by using approximately 4500 tons of crude oil each day. Since the CDU is operated using different modes of operation, a total of two bitumen base products and about five different distillates are produced at the refinery. The two base bitumen products can be blended into about five different bitumen products. Most of the distillates produced are further processed in the hydro-treatment process, where hydrogen is added in order to obtain the desired characteristics of the naphthenic special oils. The hydro-treatment is performed in two separate units denoted by HT (heavy hydrotreatment) and HF (light hydro-treatment). A third unit, called HT2, which equals HT in terms of capacity and characteristics, is planned for. The crude oil consists of an immense number of different hydrocarbons, and it is injected into the bottom of the CDU. Here, the temperature is very high and all the hydrocarbons except for the heaviest ones are transformed into gas. Higher up in the CDU the temperature is lower, and since the hydrocarbons differ with respect to their boiling temperatures, they are transformed back to liquid at different places of the CDU. The output from the CDU consists at the bottom of bitumen, which is the remains of hydrocarbons that have not been transformed into gas. Higher up in the CDU four distillates and a top fraction consisting of naphtha are obtained. There are 10-15 possible run-modes in the two hydro-treatment units (HF and HT). A run-mode represents the consumption of a particular distillate and the production of a particular naphthenic special oil, i.e. the run-mode defines the input and output of the process. The choices of run-modes in the two hydro-treatment units are restricted by the limited capacity of the hydrogen generating unit, and by the capacity of removing sulphur from the hydro-treatment units. The production plant has at their disposal some 300 oil tanks of various sizes for storing components and final products. The tanks used for storing bitumen are heated, otherwise the bitumen cannot be pumped. Some tanks are always used for the same product, whereas other tanks are so called multipurpose tanks where the stored products can change from one period to another. The products are transported in a large network of pipelines. The network of pipes and tanks may restrict the production somewhat. For example, it is not possible to fill a tank from the CDU and at the same time feed HT or HF with a distillate from the same tank. The bitumen products are stored in two main qualities and also in a few blended qualities. The production plant owns two tankers that are used for delivering bitumen to eight depots located along the coast or directly to depots and customers abroad. Fuel products are normally not kept in stock, but are delivered to the refinery sold directly to customers. The naphthenic oil products are blended from a set of naphthenic oil base products before they are distributed (usually by ship) from the refinery. Hence, a lot of tanks are needed for the blending of naphthenic oils. Finally, the following are the major operating constraints that must be met: equipment capacity limitations (tank capacity, pumping rate), quality limitations on each mixed crude oil (components in mixed crude oil stream), and demand of each mixed oil to be charged into CDU. In order to provide some insight into the nature of this optimization problem, consider the following small size problem. At the planning stage, two crude vessels are to arrive at days 1 and 5, and unloading for both vessels should be completed by day 8. Vessels 1 and 2 contain 1 million bbl of crude oil A and B, respectively. There is one CDU which has to process 1 million bbl of mixed crude oil X and Y, respectively. The weight fractions of sulfur which determine the quality of crude oil are 0.01 for crude oil A and 0.06 for crude oil B. Two crudes are mixed to make two types of mixtures: crude oil mixes X and Y. The sulfur concentration of X should be in the range of 0.015 and 0.025, while that of Y is between 0.045 and 0.055. The initial volumes of the storage tanks for crude oil A and B are respectively 250 000 and 750 000 bbl, while the initial volumes of the charging tanks for crude mix X and Y are all 500 000 bbl. The costs involved in this problem are inventory cost, vessel harboring cost, vessel sea waiting cost, and CDU changeover cost for crude oil mix charging mode change. Figure 3 shows the system overview for this example. Each arrow in the figure corresponds to flow transfer. Vessel 1 arrives at the docking station at day 1 and starts to unload crude oil A into storage tank A. It should complete unloading before day 6 and leave the docking station. At every point in time, crude oils can be transferred and mixed into charging tank X and charging tank Y. Mixed crudes then charge the CDU. CDU can process only one type of crude mix at a time, and setup costs are involved each time charged crude oil is switched. Vessel 2 arrives at day 5 and unloads crude oil B into storage tank B. Unit inventory cost for each storage tank and charging tank are 8×10-3 and 5×10-3[$/(day × bbl)] , respectively. Changeover cost for crude charging to CDU is 50 × 103$, each time it occurs. Costs involving the vessels are due to waiting in the sea and harboring for unloading the crude oil. These costs are 5 ×103 and 8×103 [$/day], respectively; i.e., unloading incurs higher costs. Ideal mixing is assumed in the charging tank, and the crude mix cannot be fed into the CDU while crude oil is transferred from storage tanks to charging tanks. 910 Figure 3 Operation schedule for motivating example 4. Model formulation In this section we present the mathematical formulation of the production scheduling problem. We will formulate the model using general notation, which shows on the possibility of using the model for general refinery production scheduling. For each product and time period we specify the available storage capacity pt I . This capacity is defined as the total capacity of the tanks normally used for the product. Each tank explicitly do not be considered. The storage capacities of tanks in which different products can be stored (multipurpose tanks) are added to the inventory capacities of the individual products. In addition to the upper bounds on the inventory levels, pt I  representing requirements on safety stock levels for product p in period t. The following mixed integer linear programming model for the production scheduling problem can now be formulated. min , q I S pt pt mt mt t T p P t T q Q m M c I c s            (1) s.t. 0, , q pt pm mt q Q m M x a y p P t T         (2) 0, , q pt pm mt q Q m M z b y p P t T         (3) , 1 , , p t pt pt pt pt I x z d I p P t T        (4) , , pt pt pt I I p t TI P      (5) 1, , , q mt m M y q Q t T      (6) , 1 , , , m t mt mt y s y m M t T      (7) 911 , , 0, , , pt pt pt I x z p P t T   (8) , {0, 1}, , . mt mt y s m M t T   (9) The objective function (1) expresses the total production scheduling cost composed by the inventory cost and the cost of performing the start-ups. Constraints (2) and (3) relate the usage of a run-mode with the quantity produced and consumed, respectively, of the products. Note that these constraints allow a product to be produced or consumed at multiple processing units. Constraints (4) are the inventory balancing constraints, and the constraints (5) specify the restrictions on the maximal and the minimal inventory levels of the products. Only one run-mode can be used at a given point in time for each processing unit, and this is ensured by constraints (6). Whenever there is a change of the run-mode, the corresponding variable smt is forced to take the value one. This is achieved with constraints (7). The model allows variable smt to take the value one also when the corresponding variable ymt equals zero. However, since the cost-coefficient Smtc is positive this will never be the case in any optimal solution to the model. 5. Conclusions In this paper, we have studied the production planning and scheduling at a refinery. An optimization model for the production scheduling was formulated, and it was illustrated how this model can support decision making at both strategic/tactical and operational planning levels. There are several directions for future research. One main direction is to develop and extend the scheduling model to better describe the planning situation. The potential for connecting the scheduling model to the utilization of tanks and pipes, and to the blending of products, should also be investigated. Reference Alattas M., Grossmann E., Palourivera I., 2011, Integration of Nonlinear Crude Distillation Unit Models in Refinery Planning Optimization, Industrial & Engineering Chemistry Research, 11, 6860-6870, DOI: 10.1021/ie200151e Amos F., Rönnqvist M., Gill G., 1997, Modelling the pooling problem at the New Zealand refining company, Journal of the Operational Research Society, 48, 767-778, DOI: 10.2307/3010703 Dewitt W., Lasdon S., Waren D., 1989, OMEGA: An Improved Gasoline Blending System for Texaco, Interfaces, 1, 85-101 Kella O., 1991, Optimal manufacturing of a two product mix, Operations Research, 3, 496-501, DOI: 10.1287/opre.39.3.496 Kondili E., Shah N., Pantelides C., 1993, Production planning for the rational use of energy in multiproduct continuous plants, Computers & Chemical Engineering, 3, 123-128, DOI: 10.1016/0098-1354(93)80217-B Lee H., Pinto M., Grossmann E., Park S., 1996, Mixed-integer linear programming model for refinery short- term scheduling of crude oil unloading with inventory management, Industrial Engineering Chemistry and Research, 35, 1630-1641, DOI: 10.1021/ie950519h Pinto M., Grossmann E., 1994, Optimal cyclic scheduling of multistage continuous multiproduct plants, Computers & Chemical Engineering, 9, 797-816, DOI: 10.1016/0098-1354(93)E0021-Z Sahinidis V., Grossmann E., 1991, MINLP model for cyclic multiproduct scheduling on continuous parallel lines, Computers & Chemical Engineering, 2, 85-103, DOI: 10.1016/0098-1354(91)87008-W Shah N., 1996, Mathematical programming techniques for crude oil scheduling, Computers and Chemical Engineering, 20, 1227-1232, DOI: 10.1016/0098-1354(96)00212-8 912