AN INTEGRATED OPTIMIZATION AND SIMULATION MODEL FOR REFINERY PLANNING INCLUDING EXTERNAL LOADS AND PRODUCT EVALUATION

Because of its potential benefits, petroleum refineries are increasingly concerned about their planning operations. Although some refinery models for production planning were proposed, they are quite limited in their usefulness. This study describes an integrated approach involving nonlinear optimization and simulation of refinery units in order to obtain a production planning for a given refinery that maximizes profit. The problem is modeled through the LINGO 16.0 software interface and it is solved using LINGO’s Global Solver on an Intel i5-2410M processor (8 GB RAM). A case study pertaining to the Refinaria de Paulínia (REPLAN) is proposed, and external loads, product adding, and product pricing is studied, achieving a global optimum solution for the blending in less than a second in every case. The small computational time assures the model usefulness in refinery planning, being important for sensitivity analyses and the determination of break-even points of external loads and of new products. The results indicate that this new approach has a considerable potential for achieving significant gains in terms of planning and profit increase. Therefore, the model can be used by planners, with significant advantages over other models. The flexibility of the model allied with its quick generation of optimum solutions is highlighted.


INTRODUCTION
A refinery consists of multiple processes that divide, blend and react hundreds of hydrocarbon types, inorganic and metallic compounds, with the purpose of obtaining commercial products.In a refinery, the required characteristics of a product are fixed.However, crude oil has characteristics that depend on crude origin.Then, if the proprieties of crude oils change and the proprieties of products are fixed, refineries must adapt their operational configurations.
In addition, a refinery suffers from rising oil prices, advances in environmental restrictions and pressure from consumers for lower prices, thus working with narrow profit margins.It is vital for a refinery to operate as nearly as possible on its optimal level and to seek opportunities for increasing the profits.However, without some form of computational modeling, an optimum production plan that maximizes profit is hard to obtain.For these reasons, almost every refinery nowadays use advanced process engineering tools to improve business results (Moro, 2003).
Since the invention of the Simplex algorithm by Dantzig in 1947, many computational mathematical models have been applied to solve specific subjects of a refinery, such as gasoline blending, refinery scheduling and planning (Bodington and Baker, 1990).Láng et al. (1991) present an algorithm and a FORTRAN program for modeling crude distillation and vacuum columns.The proposed approach presents a good convergence and low memory requirements.Nevertheless, the proposed algorithm cannot guarantee the optimality of the generated solutions.
To fulfill quality standards, the refineries blend gasoline's components using blending recipes.Finding the blending recipe that will yield the highest profit is the main objective of the blending recipe optimization problem.However, recipe optimization does not imply the optimum blend scheduling, as it does not consider a proper coordination of feedstock, products and economics.Glismann and Günter (2001), Li et al. (2010) and Cerdá et al. (2016) propose integrated approaches to solve recipe optimization and short-term scheduling.Shobrys and White (2002) present a review of the integration bottlenecks in planning, scheduling, and control of refining and petrochemical companies.Although linear programming models are most commonly applied, the introduction of reformulated gasolines has led the planners to use nonlinear models.Pinto et al. (2000) present a nonlinear planning model for refinery production, analyzing different market scenarios of Presidente Bernardes Cubatão refinery (RBPC) and Henrique Lage refinery (REVAP), and then comparing the results with the current situation of both refineries.The model has a great potential for increasing profitability embedded in the planning activity, reaching several millions of dollars per year.Pinto and Moro (2000) state that the existing commercial software for refinery production planning, such as RPMS (Refinery and Petrochemical Modeling System) and PIMS (Process Industry Modeling System) are based on very simple models that are mainly composed of linear relations.The production plans generated by these tools are interpreted as general trends as they do not take into account more complex process models and/or nonlinear mixing properties.
Process unit optimizers based on nonlinear complex models that determine optimal values for the process operating variables, as seen in More et al. (2010), have become increasingly popular.However, most are restricted to only a portion of the plant.Furthermore, single-unit production objectives are conflicting and therefore contribute to suboptimal and even inconsistent production objectives (Pinto and Moro, 2000).Li et al. (2006) present a linear programming model for integrated optimization of refining and petrochemical plants, obtaining a $1.0 million/ month profit increase in a case study.They conclude that integrated optimization of refining and petrochemical plants is a developing trend and it should attract more concern in the future.Moro and Pinto (2004) present a review of the technology of process and production optimization in the petroleum refining industry.An important conclusion of this study is that optimization approaches must be improved.Although the mathematical programming models can be useful in refining and petrochemical companies, these approaches still lack many real characteristics of the modeled systems to be widely applied in the corporate business.A nonlinear approach represents the real nature of the processing units, as stated by Alattas et al. (2011).Therefore, a linear model would result in a loss of precision of the model results (Li et al., 2005).Bueno (2003) presents some procedures to support the operational planning performed by oil refineries that are integrated to the logistics business of an oil company.A decision support system based on Solver, a Microsoft Excel toolbox, is proposed, using simulation, optimization and graphical interfaces combined with a what-if approach to support the refinery planning.Bueno (2003) recommended studies about external loads for their importance on a macro view of the refinery network, which will be addressed here.Pitty et al. (2008) and Koo et al. (2008) present a hybrid simulation-optimization model, with discrete and continuous variables, of an integrated refinery supply chain.The proposed approach can capture the dynamic nature of the real system.In addition, the optimization model can consider multiple objectives.Gueddar and Dua (2011) present a compact nonlinear refinery model based on input-output data from a process simulator, emphasizing the continuous catalytic reformer and naphtha splitter units.These authors propose artificial neural networks to deal with the complexity related with large amounts of data.However, there is not a focus on global optimization issues in the proposed approach.Menezes et al. (2013) develop a fractionation index model (FI) to add nonlinearity to the linear refinery planning models.The FI model is developed as a more accurate nonlinear model for the complex crude distillation unit (CDU) than the fixed yield or the swing cuts models.The results are compared to the common fixed yield and swing cuts models, concluding that the FI refinery planning model predicted higher profit based on different crude purchase decisions.
We can observe that there is a lack of refinery-wide planning that considers the many processes and its nuances, especially when using nonlinear models.In addition, the studies do not employ other methods to increase profit besides optimization.
The main objective is to obtain a production planning in a refinery that maximizes profit, simulating a refinery through a nonlinear programming model considering crude distillation units (CDU), fluid catalytic cracking units (FCC), hydrotreatment units (HDT) and delayed coking units (DCU), also optimizing the blending of finished grade products.To attend the profit maximization objective, the blend recipe is optimized for multiple finished grade products simultaneously, such as gasoline, petrochemical naphtha, diesel, and fuel oil.
The model takes into account external intermediate loads for blending into the refinery, allowing a realistic planning.We also propose methods combined with refinery optimization, such as sensitivity analysis and the determination of break-even points of external loads and of new products, which aims to enhance the refinery planning and increase its profit.
The external loads are explored deeply by providing methods to study which intermediates would be interesting to acquire.By comparing the results from similar intermediates, we can analyze how different intermediate properties may influence the acquisition choice.A sensitivity analysis is proposed to evaluate the produced volume of a product.The analysis can show capacity bottlenecks or undesirable products, enabling the planner to look for unseen potential improvements and problems.The planning for the addition of a new product in a refinery is poorly discussed in the literature.Analyzing the feasibility of new products can introduce the refinery to more profitable markets.This paper proposes a deeper study of the subject by comparing several new products and by classifying them by their profitability.

PROBLEM DESCRIPTION
A typical refinery carries out several physicochemical processes to obtain the required products.We can describe the general planning model of a refinery as a set of several processing units, which produce a variety of intermediate streams with different properties that can be blended to result in the desired kinds of products.A general scheme of a refinery is presented in Figure 1.The d distillation units receive the o oils, distilling them into the i intermediates that are going to possibly receive a load from external sources and/or be transformed into other intermediates through the w process units.The intermediates will be mixed in the b blending pools available, leaving the refinery as one of the p specified products.The refinery simulation occurs immediately before blending, while the optimization occurs in the blending stage, which is responsible for the nonlinearity of the problem.
Usually, in a refinery both oil acquisition and product selling are predefined by the organization.Therefore, a minimum and a maximum market for a product, and the volume of oil acquired are usually predefined in order to meet the organization expectations (Bueno, 2003).The refineries must check the feasibility of this planning, and in case of adversities (lack of supply, broken equipment, etc.), it must match to the new reality.The volume of each oil type acquired is the most important information, since it will affect the entire refining system.
Every distillation and process unit has minimum and maximum loads required and operational costs, which are a function of the volume processed and of attributes that determine the quantities and qualities of the intermediate products generated by the unit.The refinery has inventories, which hold the intermediate volumes not blended due to economical and/or product restrictions.

MODELS AND PROCEDURES
We intend to obtain a production planning in a given refinery that maximizes profit, considering operational constraints.We assume an ideal mixture, as the compounds in the petroleum are chemically similar, for easily adding intermediate volumes, thus lowering computational times.Hereafter, the notation used for the design of the model will be presented.
Similar to Bueno (2003), Pitty et al. (2008) and Koo et al. (2008), in this study we propose an integrated approach, which is composed of a simulation-optimization model and graphical interfaces.The simulation encompasses all distillation and process units, while the optimization encompasses the intermediate volume in each blending pool (QBL i,p ), which is optimized for the objective of maximum profit, having as constraints the entire scheme of the refinery and the market restrictions.
We developed a user-friendly interface for importing and exporting the refinery data, as illustrated in Figure 2.Such developments have proven to be of capital importance for efficiently optimizing production planning and scheduling by accurately addressing quality issues, as well as plant operational rules and constraints, in a straightforward way (Joly, 2012).Through Excel's interface, the necessary data to solve the model is inserted.The data is merged into the mathematical model and then the LINGO solver finds optimum values.These optimum values are exported to Excel and translated into information, which enables analysis by decision-making industry professionals.
The sensitivity analysis works by enabling the planner to modify some variables or parameters and promptly obtaining the optimized solution, allowing measurements of the impact of the adjustments aided by tables and graphics, as in the cases reported in the next section.
In refineries that receive intermediates from external sources, the loads must be taken into account at the planning to ensure good results.Thus, we consider in  our model the possibility of external intermediate load transfer to the refinery.The model is limited to adding distilled intermediates that go directly to blending, since adding intermediates that go to process units would largely increase the complexity of the model.The properties of the load must be specified, since it will affect the blending.
The objective function (1) maximizes the profit of a refinery by subtracting from the income (product sale) the purchase of crude oil, operational costs of units, and external intermediate loads costs.The first term is the income generated by the products sold.The second term represents the cost associated with crude oil purchase.The third term refers to total operational cost of distillation units in the refinery.The fourth term refers to total operational cost of processes units, except distillation, in the refinery.The fifth term refers to the cost of purchasing the external loads of intermediates transferred to the refinery.
The set of constraints (2a), (2b), and (2c) are similar.The first refers to the volume of distilled oil o in distillation unit d, the second refers to the total volume distilled in unit d, and the third the total volume distilled of oil o.Constraint (3) refers to the total volume of crude oil that enters the refinery.
The set of constraints (4) refers to the volume of distilled oil (intermediate) k that leaves the distillation process plus the volume of the external load of intermediate k transferred into the refinery (VTR i ).The sets of constraints ( 5), ( 6), (7), and (8) determine the specific mass, sulfur content, viscosity index and octane rating of each intermediate k, considering the addition of the external intermediate load.
Similar to (2b), the set of constraints (9) refers to the total volume processed in unit w.The sets (10) and ( 11) represent the specific mass and sulfur content in each unit w, which is related to each intermediate that enters the unit.
The set of constraints ( 12) determines the volume fraction of intermediate t, which is the product of a reaction of intermediate i.As the reaction occurs, there is some expansion, especially at FCC.Along the expansion, there are changes in sulfur content, being redistributed through the produced intermediates.The expansion of intermediate i in unit w is determined in the set of restrictions (13).The sulfur content in the intermediate t is determined by sets ( 14) and ( 15).
The intermediates produced or distilled i are either blended or stocked.Set of constraints ( 16) determines that the volume of every intermediate transferred to the blending pool of a product is the volume of the product produced, restating the ideal mixture already discussed.Set of constraints ( 17), ( 18), ( 19), and (20) determine the properties of the product: specific mass, sulfur content, viscosity index, and octane rating.Set (21) refers to the intermediates that will be stocked.
The sets of constraints ( 22), ( 23), ( 24), and ( 25) establish the expenses of distillation operation cost, processing unit operation cost, crude oil purchase, and external intermediate load purchase, respectively.Set (26) determines the income generated by product sales.The set (27) determines the naphtha proportion in gasoline produced.
The set of constraints (28) refers to the maximum and minimum market restraints for each oil acquisition.Sets of constraints ( 29) and (30) determine the capacity limits of distillation and non-distillation units, respectively.Sets of constraints ( 31), (32), and (33) establish the upper and/ or lower proprieties for sulfur content, octane rating, and viscosity index, respectively, for each product.Similar to set (28), set of constraints (34) refers to the maximum and minimum market restraints for the specific product p sale.Equation (35) restricts the maximum and minimum distilled naphtha proportion in gasoline.
Regarding external intermediate loads, Equations (4, 5, 6, 7, 8, and 21) compute the contribution of external intermediate loads into each one of the properties.Equation ( 25) determines the cost of external intermediate loads.Equations ( 27) and ( 35) restrict the maximum and minimum distilled naphtha proportion in gasoline.

Balance Equations
Oil volume in distillation units , Constraints for the volume of oil processed in unit w (30) Constraints for the sulfur content, octane rating, and viscosity index of product p Maximum and minimum volume constraints for the product p sale (34) Maximum and minimum naphtha proportion constraint in gasoline produced (35)

CASE STUDY
Refinaria de Paulínia (REPLAN) is one of the biggest refineries in Brazil.The refinery is owned by PETROBRAS, and it is located in Paulínia (São Paulo).It has two distillation units, two vacuum units, two FCC units, and one delayed coking and catalytic hydrotreatment unit.Since the units of atmospheric distillation, vacuum distillation, and the two units of FCC are very similar, they were considered as one.As stated by Bueno (2003) this presumption greatly simplifies the model without losing precision.In Table 1 are shown the unit types in REPLAN and their processing capacities.
In Table 2 the percentage of different crude marks that are received by REPLAN is presented.For this model, only representative fractions were considered: Marlim P-18, Algerian Condensate, North Albacora, and Bonny Light.
The process units operate on different campaigns, depending of the oils received and the products desired.According to Bueno (2003), REPLAN operates its distillation units on HSC campaign (High Sulfur Content), which separates intermediates with high sulfur content; ASPHALT campaign, which separates heavy vacuum residuum for asphalt production; RATCRACK campaign, which separates atmospheric residuum and NORMAL campaign, which does not separate by any characteristic of the intermediate.Since no oils selected for this study have high sulfur content, and since asphalt production is not analyzed in this case study, both HSC and ASPHALT campaigns are not considered.
The proposed model for REPLAN refinery is illustrated in Figure 3.The refinery contains four units: Distillation (CDU), Delayed Coking (DCU), Hydrotreatment (HDT), and Fluid Catalytic Cracking (FCC).The distillation separates crude oil into eight intermediates: liquefied petroleum gas (LP1), light naphtha (LN1), heavy naphtha (HN1), light gas oil (LD1), heavy gas oil (HD1), and kerosene (KR1).Those are likely blended directly.Vacuum gas oil (GO1), atmospheric residue (AR1), and vacuum residue (VR1) must first be treated in process units before blending.External loads of intermediates can be added in the system.The selection of the products is based on the table of product types sold, presented in Table 3. Except for LPG, gasoline A, and petrochemical naphtha, which are the only representative product of their group, only representative products were chosen for the model, such as aviation kerosene; diesel oil type B and type E, the last one by new market requirements; fuel oil export grade, fuel oil grade 2A and grade 9A representing low, medium and high viscosity oils, being selected by their composition, demand and quality difference.Coke is assumed to be burned for internal energy generation, thus it is not considered a product.We recommend adding to the model equations for the non-distillation units to consider the yield at different operational conditions, for assessing variations in the refinery profit, computational time and accuracy.

W
The model was solved in LINGO (Version 16), using the Global Solver.The solver reached the global optimum in every case studied, assuring precision of refinery planning results.The computational time required in each test was less than one second on an Intel i5-2410M processor, 8 GB RAM machine, using Windows 7. The small computational time assures the model usefulness in refinery planning, and is important for sensitivity analyses and the determination of break-even points of external loads and of new products.
In Table 4 we present the tests performed, the total number of variables, the number of iterations required by the solver, the average computational time required and its standard deviation, which are calculated based on a sample of 10 executions for each test, removing the highest and lowest value of the sample.
For each test, there were small fluctuations in the computational time required, as seen in the last column of Table 4.As stated by Touati et al. (2013), there are many factors for a binary program execution time to vary on a modern multicore processor, even using the same data input, the same binary and the same execution environment, such as: machine load, starting stack address in the memory, variable CPU frequency, dynamic voltage scaling, thread pinning on cores, cache effects, out of order execution, noise of measuring and imprecision of the measurement.Experiments to determine the nature of the fluctuations were carried out, such as hardware stress during solver's execution.Since LINGO's Global Solver is a deterministic method of solving nonlinear problems (Gau and Schrage, 2004) and the results from the experiments showed variations of the computational time according to the stress on hardware, we concluded that these fluctuations are caused by computational issues (such as the concurrent use of cache memory by the simultaneous execution of other software).
As the number of iterations and the number of variables increases, the computational time also tends to increase,   although not in a linear form because each test has its own peculiarities that influence the computational time required to solve through a specific method.For computational effort reasons, it is important to take note that all decision variables in the model are continuous.Some external loads were studied to analyze if they are economically possible.Three intermediate loads were studied, as presented in Table 5: Light Naphtha, LPG, and Aviation Kerosene.Every load was introduced alone, with different volumes and properties.It is important to note that all obtained results related to the break-even point (BEP) and the sensitivity analysis refer to the REPLAN case study.

Light Naphtha
In the first two possibilities, we can see that the BEP varies according to the volume of the intermediate load transferred.We can infer from the next three possibilities that octane rating cannot change the price, since huge quantities of the cut are needed to change gasoline octane rating.On the last two possibilities, we can see that the BEP varies according to sulfur content, since sulfur content restrictions are very limited to products that use light naphtha, e.g., diesel.

LPG
The actual price of LPG is 127.8 dollars/m³.Since LPG is not reacted nor belongs to any other product elsewhere in the model, the BEP equals to its acquisition price.
Kerosene Kerosene shows a similar price to the same quantity of light naphtha, so we can infer that they are equivalent choices.This equivalency gives flexibility for REPLAN.
There is a lack of studies about the effects of the product volumes in a refinery.A sensitivity analysis can be used by the planner for studying the profit behavior by varying the produced volume of a specific product, in this manner planning what product should be looked at for increasing profit.Three products were analyzed: gasoline, petrochemical naphtha, and fuel oil export grade, by varying the production over a range.The profit variation versus the produced volume of gasoline is presented in Figure 4. Gasoline presented a small profit variation, assuring the product with a good stability over volume variation.A local optimum of 296,000 m³/month is shown in the graph.
Here, the planner can infer that small volume variations of gasoline produced do not heavily affect REPLAN's profit.
The profit variation versus the produced volume of petrochemical naphtha is presented in Figure 5. Through the linear pattern of petrochemical naphtha, we can infer that a reduction in its production would benefit REPLAN in every case.The additional profit would reach about 3,500 dollars/month for the total cessation of production case.This graph shows the planner that petrochemical naphtha production should be avoided at REPLAN.The profit variation versus the produced volume of fuel oil export grade is presented in Figure 6.There is a local optimum that reaches 1,650 dollars/month.However, there is a wide range of production available to increase profit.The slope is steeper than in gasoline analysis: a reduction of a mere 5,000 m³/month increases refinery profit by approximately 670 dollars/month.The planner must pay attention to this behavior, since a small variation could directly influence the profit.
In the literature, there is a lack of detailed economic analysis about product addition.In this study, we propose a method for quickly evaluating the economical availability of adding a new product in the planning.After the addition of the new product in the model, the BEP was determined to analyze the impact caused by the product in the refinery.The results of the new products are presented in Table 6.
Brazilian laws recognize 18 variations of fuel oil, which are classified based on viscosity and sulfur content.The well-defined and continuous ranges of viscosity for fuel oils made this type of product a suitable option for analysis.The products chosen were fuel oil grades 3B, 5B, and 9B.They have low sulfur content (1.00% maximum) and present low, medium, and high viscosity, respectively.The model was run several times, producing a batch of 100,000 m³/month for each new product separately, varying the new product price until the profit matched the original one.This way we found the BEP.
Based on Table 6, we can infer that, since fuel oil 5B and 9B have the same BEP, both have the same profit capacity to REPLAN for a batch of 100,000 m³/month.Fuel oil 3B presents the maximum viscosity possible, since low viscosity intermediates in fuel oil are the minority, for economic reasons.As REPLAN must struggle to supply 100,000 m³/month of this product, the BEP increases.There is no problem of product limitation by sulfur content in any case.Fuel oil 9B gets close to the sulfur content's upper bound because the main intermediates that add viscosity, like VR1, have high sulfur content.

CONCLUSIONS
A global optimum in the blending operations was reached in every case studied using LINGO optimization solver, assuring optimal results on refinery planning.The model presented a quick solution time in every test performed, which is very important for sensitivity analyses that can be used by planners for studying a refinery's profit behavior.
The sensibility analyses showed that any variation in the produced volumes of fuel oil export grade at REPLAN can strongly influence its profit, and the production of petrochemical naphtha is bad at any produced volume.Other products such as gasoline gave flexibility to REPLAN, as they weakly influence its profit.This type of analysis can show capacity bottlenecks or undesirable products for any refinery and any product, enabling the planners to look for unseen potential improvements and problems.
Another contribution of this study was the modeling of the external load transfer to the refinery.The addition of intermediate loads does not interfere deeply with REPLAN's scheme, so it adds flexibility, an important characteristic for keeping up with the unstable market of the petroleum industry.The BEP was obtained for several intermediates that could be transferred into REPLAN, thus allowing a more detailed planning of the refinery, and allowing an increase of its profitability.Adjusting the proposed model, it is possible to analyze the acquisition of external loads for other refineries.
The properties of the external loads influence their BEP differently, as seen in the REPLAN study case: the light naphtha's BEP is influenced by the sulfur content, while the octane rating influences a lot less.It is also possible to determine equivalent products through the BEP: at REPLAN, light naphtha and aviation kerosene are equivalent acquisitions since their BEP is the same.
The product addition allows the implementation of profitable new products into the refinery production.It also allows the refinery to search for markets that are more profitable without disrupting the refinery scheme, since only the blending pools are modified.Sensitivity analyses obtained the BEP of several new products that could be produced at REPLAN and showed how the other products would be affected.By determining the BEP, it is possible to evaluate the profitability of the new product.
With the use of the proposed model, these analyses can be easily and quickly applied in refineries by planners, with significant advantages over simpler models.p ϵ P -set of products produced in the refinery.u ϵ U -set of all processing units in the refinery.d ϵ D -subset of distillation units U in the refinery.w ϵ W -subset of non-distillation units U in the refinery.b ϵ B -set of blending pools in the refinery.c ϵ C -set of available campaigns for distillation in the refinery.e ϵ E -set of available campaigns for non-distillation processes in the refinery.blending of intermediates (kg/m³).SUL p -sulfur content of the product p obtained by the blending of intermediates (% weight).IVI p -viscosity index of the product p obtained by the blending of intermediates.NPG -naphtha composition in gasoline (% volume).OCT p -octane rating of the product p obtained by the blending of intermediates.CDT -distillation unit operating cost ($).CPR -unit operating cost ($).RVP -income generated by product sales ($).

Intermediates and products
LP1 -fraction produced in the distillation unit (distillation range temperature up to 20°C) added to the final product LPG.LN1 -fraction produced in the distillation unit (distillation range temperature between 20°C and 140°C) routed to blending pools.HN1 -fraction produced in the distillation unit (distillation range temperature between 140°C and 170°C) routed to blending pools.KR1 -fraction produced in the distillation unit (distillation range temperature between 170°C and 225°C) routed to blending pools.LD1 -fraction produced in the distillation unit (distillation range temperature between 225°C and 306°C) routed to blending pools.HD1 -fraction produced in the distillation unit (distillation range temperature between 306°C and 405°C) routed to process units and blending pools.GO1 -fraction produced in the distillation unit (distillation range temperature between 405°C and 440°C) routed to catalytic cracking unit.AR1 -fraction produced in the distillation unit (distillation range temperature between 440°C and 560°C) routed to catalytic cracking unit.VR1 -fraction produced in the distillation unit (distillation range temperature beyond 560°C) routed to delayed coking unit and blending pools.LPC -fraction produced in the catalytic cracking unit added to the final product LPG.NFC -fraction produced in the catalytic cracking unit routed to blending pools.LCO -fraction produced in the catalytic cracking unit routed to catalytic hydrotreatment unit and blending pools.OLD -fraction produced in the catalytic cracking unit routed to blending pools.LPK -fraction produced in the delayed coking unit added to the final product LPG.LNK -fraction produced in the delayed coking unit routed to catalytic cracking unit.HNK -fraction produced in the delayed coking unit routed to catalytic hydrotreatment unit.
GLK -fraction produced in the delayed coking unit routed to catalytic cracking unit and catalytic hydrotreatment unit.GMK -fraction produced in the delayed coking unit routed to catalytic cracking unit, catalytic hydrotreatment unit and blending pools.GHK -fraction produced in the delayed coking unit routed to catalytic cracking unit, catalytic hydrotreatment unit and blending pools.HDI -fraction produced in the catalytic hydrotreatment unit routed to blending pools.LPG -Liquefied Petroleum Gas.

Distillation campaigns
HSC -High Sulfur Content campaign, which separates intermediates with high sulfur content ASPHALT -campaign that separates heavy vacuum residuum for asphalt production.RATCRACK -campaign that separates atmospheric residuum.NORMAL -campaign that does not separate by any characteristic of the intermediate.

Other
BEP -break-even point.

Figure 2 .
Figure 2. Schematic flowsheet for import/export the refinery data.
Specific mass, sulfur content, viscosity index, and octane rating of distillate k QDT o Specific mass and sulfur content of the load in unit w (10) (11) Volume of intermediate t produced in a process unit (12) Expansion of intermediate i processed through campaign e in unit w (13) Sulfur content of intermediate t produced in unit w (14) Sulfur content of intermediate t (15) Volume of the product p obtained by the blending of intermediates (16) Specific mass, sulfur content, viscosity index, and octane rating of the product p obtained by the blending of intermediates (17) (18) for the volume of oil distilled in distillation unit d (29)

Figure 4 .
Figure 4. Sensitivity analysis for gasoline production.The dots represent the optimized profit variation for the simulated data.Dashed is a tendency line.

Figure 5 .
Figure 5. Sensitivity analysis for petrochemical naphtha production.The dots represent the optimized profit variation for the simulated data.Dashed is a tendency line.

Figure 6 .
Figure 6.Sensitivity analysis for fuel oil export production.The dots represent the optimized profit variation for the simulated data.Dashed is a tendency line.
o ϵ O -set of oils used in the refinery.i ϵ I -set of intermediate fractions.k ϵ K -subset of intermediate fractions I produced at distillation.t ϵ T -subset of intermediate fractions I produced at other processes.

Table 1 .
Unit types and their processing capacities.

Table 2 .
Benchmark crudes and their percentage received.

Table 3 .
Percentage of products sold by categories.

Table 4 .
Computational time of global optimizations.

Table 6 .
Fuel oil product adding results RDT o,d,c,k -volumetric fraction of intermediate k, which belongs to oil o, processed through campaign c in distillation unit d (% volume).SPC o,d,c,k -specific mass of intermediate k, which belongs to oil o, processed through campaign c in distillation unit d (% volume).SUL o,d,c,k -sulfur content of intermediate k, which belongs to oil o, processed through campaign c in distillation unit d (% weight).IVI o,d,c,k -viscosity blending index at 50°C of intermediate k, which belongs to oil o, processed through campaign c in distillation unit d.The viscosity blending index is calculated as seen in Bueno (2003): OCT o,d,c,k -octane rating of intermediate k, which belongs to oil o, processed through campaign c in distillation unit d.RPR i,w,t,e -volumetric fraction of processed intermediate t, which belongs to intermediate i, processed through campaign e in unit w (% volume).RPR w,i,e -sulfur transfer factor for intermediate i, processed through campaign e in unit w (% weight).EXP i,w,e -expansion of intermediate i processed through campaign e in unit w (% volume).SPC w,t,e -specific mass of intermediate t, processed through campaign e in unit w (kg/m³).IVI w,t,e -viscosity index of intermediate t, processed through campaign e in unit w.SPCT k -specific mass of intermediate k from an external load (kg/m³).SULT k -sulfur content of intermediate k from an external load (% weight).IVIT k -viscosity index of intermediate k from an external load.OCTT k -octane rating of intermediate k from an external load.FOC i -octane enhance factor of intermediate i. SUL max,p -maximum sulfur content of product p (% weight).OCT min,p -minimum octane rating of product p.IVI min,p -minimum viscosity index of product p.IVI max,p -maximum viscosity index of product p.POS o -current oil o price ($/m³).CTS k -current external intermediate k load price ($/m³).PPS p -current product p price ($/m³).CDS d -operational cost of distillation unit d ($/m³).CPS w -operational cost of unit w ($/m³).VOL min,o -minimum volume of oil o (m³).VOL max,o -maximum volume of oil o (m³).QDT min,d -minimum distillation volume of unit d (m³).QDT max,d -maximum distillation volume of unit d (m³).QPR min,w -minimum process volume of unit w (m³).QPR max,w -maximum process volume of unit w (m³).MKC min,p -minimum market of product p supplied (m³).MKC max,p -maximum market of product p supplied (m³).NPG min -minimum naphtha composition in gasoline (% volume).NPG max -maximum naphtha composition in gasoline (% volume).-volume of distilled oil o, processed through campaign c in distillation unit d (m³).QPR i,w,e -volume of intermediate i processed in unit w through campaign e (m³).VTR i -volume transferred of intermediate i to the refinery (m³).QDTO o -volume of oil o processed in the refinery (m³).QDTU d -volume processed in distillation unit d (m³).QPRU w -volume processed in unit w (m³).SPC w -specific mass of the load in unit w (kg/m³).SUL w -sulfur content of the load in unit w (% weight).PDT k -volume of intermediate k produced in distillation (m³).PPR t -volume of intermediate t produced in a process unit (m³).SPC i -specific mass of intermediate i produced (kg/m³).SUL i -sulfur content of intermediate i produced (% weight).SUL t,w -sulfur content of intermediate t produced in unit w (% weight).SUL t -sulfur content of intermediate t (% weight).IVI i -viscosity index of intermediate i produced.OCT i -octane rating of intermediate i produced.EST i -volume of intermediate i that is stocked (m³).PBL p -volume of the product p obtained by the blending of intermediates (m³).SPC p -specific mass of the product p obtained by the