Friday, May 11, 2018

Refinery Planning and Optimization


The Planning and Scheduling departments of refineries are responsible for putting together weekly, monthly, quarterly, and/or annual production plans. They do this with input from other department in the plant-operations, process engineering, maintenance, long term capital projects and turnarounds, trading (typically not at site), finance, etc. The goal is to create a plan that captures maximum profit given market prices, unit and logistics constraints, planned and unplanned maintenance outages, etc.

Courtesy Pexels.com

LP Models

The production plan is put together by the refiner planner using the site LP model which is a linear equation based model that determines the optimal mode of operating by simultaneously solving thousands of equations.

As we saw in previous posts, at refinery consists of multiple process units. Imagine trying to model a complex chemical process using a series of equations. Consider a simple naphtha hydrotreater. Naphtha hydrotreaters remove sulfur, nitrogen, metals and other contaminants from naphtha (think gasoline) boiling range material in order to send it to a downstream reformer or isomerization unit for octane improvement or directly to the gasoline blending pool. There are certain specifications that are important to these downstream units and blend pool so we’d definitely want to have equations to carry these properties across the unit in the simulation. Reformers will require details like % aromatics, naphthenes, and paraffins. The gasoline pool will require octane, sulfur, density, etc. We’ll need to represent how these properties change across our naphtha hydrotreating unit. And of course we’ll want to know the resulting yields of the unit-how much fuel gas, LPG, Light Naphtha, and/or Heavy Naphtha will be generated in this unit.

For the simple case of determining NHT yields our equation might be constructed something like this:

Feed:

100% Untreated Naphtha + 5% Hydrogen (hydrogen is used in the conversion of sulfur and nitrogen to H2S and ammonia)

Product:

3% Hydrogen + 1% Fuel Gas + 3% LPG + 48% Light Naphtha + 50% Heavy Naphtha

So if X = the volume of Untreated Naphtha fed to the unit our equation would be:

1 X + .05X = .03X + .01X + .03X + .48X + .5X

We might also have another equation representing the sulfur removal across the unit. If the unit can removed 95% sulfur and we wanted to calculate the sulfur of the final product, where the sulfur content of the feed = Y we’d could create another equation to do this:

Y = % sulfur in the feed
X= Volume Untreated Naphtha

Sulfur in the feed = XY
Sulfur in the product = .95XY

If the planner told the LP that Sulfur product spec had to equal 5ppm as a constraint-the LP would manipulate other upstream units and/or crude slate through other equations in the model to achieve this product quality. Imagine the LP doing this for the thousands of equations required to simulate the refinery all in a matter of seconds and deriving the optimal combination of crudes, products, unit capacities, etc to maximize margin. As you can see the LP is a powerful tool.

Putting together a Plan

Turnarounds are refinery maintenance outages planned years in advance typically 5-10 years. All refineries have long term turnaround plans. These include catalyst changes, new and revamp unit projects, maintenance work that requires oil out of the unit. These are incredibly capital intensive projects (in the millions) and require years of planning to execute in a timely, cost competitive manner. Keep in mind every day the refinery or a unit is down is a day the refiner isn’t making money while still incurring base operating costs like staffing.

As a result, turnaround and routine maintenance downtimes are the first input to the annual business planning processes of publicly traded companies that must provide profit forecasts to share holders as well as being input to monthly and weekly plans. These downtimes determine the unit capacity constraints input to the refinery LP.

Once the maintenance plan is landed, the planning department will work with trading to determine the potential crude slate based on market price, availability, and the processing capability of the refinery. Some refineries have long term contracts on crudes and so their slates will not vary but for “merchant” refiners that regularly process different crudes, trading will provide an available crude slate for the refinery to evaluate for purchase.

Recall from previous posts all refineries have different configurations, crude processing, and product production capabilities. These constraints in addition to market price and availability will determine the crude slate. A refiner without residual bottoms processing capability (and not in the asphalt business) will not be able to profitably upgrade heavier crudes e.g. in the 10-20 API range with a large residue/bottoms yield. The result would be a significant amount of marine fuel oil production which in recent years has been selling far below crude price and will become particularly unprofitable with the upcoming IMO specs (2020 environmental regulations imposed on ships that burn fuel oil). However, refiners with Coking and Residual FCC’s or Hydrocrackers can often profitably process this material. Other constraints are limited light ends processing capability for heavy sour refiners not configured to process the dilbit added to oil sands Canadian crudes, light West Texas and North Dakota Tight Oils, and high TAN crudes which are highly acidic and corrode the overhead systems of crude units.

In addition to crude slate, refinery configuration and constraints, and maintenance outages, the final input to the production plan is the product slate. Typically refiners generally make the same products but the product planners will work with trading to understand product demand for specialty higher value gasoline blends and exports to other countries.

Once unit constraints and the crude and product slate are determined the planner will input these to the LP and create a first pass plan. Planning is an iterative process so the plan is then reviewed internally in the planning department as well as with other site and above site stakeholders for both plan acceptance and credibility. Refining is an around the clock business and the oil and oil products markets are constantly changes. The planning department must continually respond to both market movements and unplanned refinery outages to ensure margin is continually optimized.

Refinery Overview

The purpose of a refinery is to separate and upgrade crude oil to useful products like gasoline or diesel fuel.  In the diagram below, each block represents a refining technology that separates or reshapes the various crude oil components to be blended (mixed) in order to meet various product specs like octane for gasoline or sulfur content for diesel. 

                To understand what’s going on per a refinery flow diagram remember three things: 1) The crude enters the refinery through the Crude (Atmospheric) Column, 2) Any unit entitled Treating/Treater means sulfur/nitrogen/metals removal, 3)Any unit with Cracking in the title means breaking heavy material into lighter, more valuable products.  Given these rules of thumb and the unit glossary below you can understand the layout of any refinery.  For example, follow the heavy naphtha cut from the crude column (referred to as straight run naphtha because it comes directly from the crude unit) to a hydrotreater where organic sulfur and nitrogen are removed from the naphtha.  After hydrotreating, the naphtha goes to a catalytic reforming unit where it is reformed into higher octane material.  After reforming, the naphtha is directed to product blending where it is blended into the gasoline product pool.



Atmospheric Distillation
As we covered in the “Crash Course to Distillation” entry, the Crude Unit, also referred to as Atmospheric Column, is the first entry point for crude oil into the refinery.  In the Crude Unit, salts and other debris from the oil well or gained during transport are removed in the Desalters.  After desalting, the crude is heated to 700-800F in the Crude Furnace before entering the base of the Crude Column.  In the crude column, the crude is separated by distillation into various products: Fuel Gas, LPG, Naphthas, Kerosene/Jet Fuel, Distillate (Diesel), and Atmospheric Gas Oils.
Vacuum Distillation
Crude oil has a boiling range from -257.8F (boiling point of Methane) up to 1400-1500F.  The Crude Unit Furnace Outlet temperature is a maximum of 800 F; this means any 800-1500F range material cannot be vaporized and distilled in the Crude Unit.  Raising Crude Furnace outlet temperature to vaporize the entire boiling range of crude is impossible because these heavy components coke or polymerize (basically burn) before reaching their boiling points at atmospheric pressure.  Therefore, Atmospheric Gas Oil is directed to the Vacuum Tower, which operates under vacuum conditions (negative pressure), in order to distill heavy components without coking.  Typical Vac Tower products are Light Vacuum Gas Oil (LVGO-diesel range material), Heavy Vacuum Gas Oil (HVGO), and Vacuum Residue.
Gas Processing
Light components typically C4- and some naphtha from the crude units (and typically other units downstream of the Crude Tower) are directed to the Gas Processing Plant to separate these components into various light end products: fuel gas, LPG, butanes, and gasoline (naphtha).
Amine Treating
Many of the hydroprocessing and catalytic reforming processes have the byproduct hydrogen sulfide, H2S. H2S is a poisonous gas that is a danger to operating personnel as well as suppresses some refining unit operations.  As such, this gas is removed from refinery gas streams in an Amine Treating Unit.  Basically this unit works by allowing sour (H2S contaminated) gases to flow counter currently to amine rich caustic (basic) streams in an “Amine Contactor”.  The sour gas is essentially stripped of H2S which is carried away with the countercurrent caustic stream.
Merox Treating
In Merox Units, mercaptans, organic sulfur compounds in LPG, naphtha, and kerosene streams are removed.  First the feed is contacted with a countercurrent stream of caustic which captures the mercaptans.  The sweetened product stream then flows through a caustic settler to remove any remaining caustic followed by a salt bed to remove any water.  The caustic itself is then regenerated by contacting it with a liquid catalyst and oxygen to convert the mercaptans to disulfides and then later allowing them to settle out in a separator.
Claus Sulfur Plant
Sulfur Plants remove sulfur from H2S contaminated refinery streams by first burning the H2S and then sending it to a condenser which results in some elemental sulfur precipitating out.  In addition to elemental sulfur, SO2 , a combustion byproduct,  and unconverted H2S remain in the stream.  To complete the sulfur removal process, H2S and SO2 are passed over catalyst where they react to form elemental sulfur and water.
Hydrotreater
The purpose of a hydrotreater is to remove sulfur, nitrogen, oxygen compounds, organic halides (R-Cl), and metals compounds in order to 1) Prevent the poisoning (deactivation) of catalyst in downstream units and 2) meet environmental regulations for SOX and NOX.  Hydrotreaters work by passing hydrocarbon streams, e.g. naphtha, over a bed of catalyst in the presence of hydrogen. 
Isomerization
In isomerization, C4-C6 material is passed over a bed of catalyst in the presence of hydrogen.  The purpose of isomerization is to convert straight chain paraffins to branched paraffins which have higher octane for blending. 
Catalytic Reformer
Catalytic Reforming units accomplish two purposes: 1) increase the octane of naphtha feeds and 2) produce hydrogen to be used in other hydrogen consuming units in the refinery e.g. hydrotreaters. In fixed bed reformers, naphtha passes through multiple beds of reforming catalyst.  Several reactions occur that result in higher octane product molecules: straight chain paraffins become branched or form rings, naphthenes dehydrogenate to aromatics (generating hydrogen), and so on.  Octane increasing reactions compete with cracking reactions which consume hydrogen and reduce reformate yield.
Hydrocracker
Hydrocrackers provide both contaminant removal and upgrading of lower value products.  In the refinery above, heavy vacuum gas oil is directed to the hydrocracker where it typically first encounters a bed of hydrotreating catalyst where sulfur, nitrogen, oxygen, organic halide compounds and well as metals are removed in the presence of hydrogen.  After the treating section, several beds of hydrocracking catalyst follow in order to crack the treated HVGO to lighter material.  Hydrocrackers operate at incredibly high temperatures and pressures and are major consumers of hydrogen in refineries.
Alkylation
Alkylation Units allow the refiner to upgrade light end material to gasoline range material.  In the presence of Hydrofluoric Acid or Sulfuric Acid, isobutane is reacted with C3-C4 olefins to form C7-C8 naphtha range products.   
FCC Feed Treater
FCC Catalyst is very susceptible to metals poisoning, especially vanadium.  To prevent deactivation of FCC catalyst as well as removing sulfur and nitrogen to meet environmental specs, FCC feed is treated in a FCC Feed Treater.  The Cat Feed Hydrotreater works much like other hydrotreaters, gas oils pass through a series of catalyst beds at elevated temperatures and in the presence of hydrogen.
Fluid Catalytic Cracker (FCC)
FCC Units are referred to as the heart of the refinery because they are able to convert heavy gas oil material to more valuable gasoline, kerosene, and distillate products.  It does this by cracking the gas oil in the presence of a catalyst that selects for increased gasoline and distillate yields. FCC’s are considered the more complicated units in the refinery because instead of a fixed bed, the unit’s catalyst is fluidized and circulated throughout the reactor and regenerator sections.    
Delayed Coker
Delayed Coking is one of the thermal cracking (heat only-no catalyst) processes in the refinery.  Vacuum Tower Resid is heated in a furnace at incredibly high temperatures, typically 1000F, before entering large coke drums where the resid is allowed to coke or polymerize (burn).  Any material not burned in the drums rise as vapors and flow to the base of the coker fractionator where they are distilled to gas oil and lighter products.  The key to coking is that resid material is prevented from coking in the furnace tubes by achieving high velocities through the furnace tubes.  Once the drums are filled with coke, they are taken off line and the coke is cut out of the drums and sold as product depending on the grade of coke.
Asphalt Blowing

The Asphalt used to pave roads comes from the heavy vacuum residual material from the bottom of the vacuum tower.  This reside serves as a binder and is mixed with gravel and used in road construction.  Roads and highways face the stress of daily car use as well as changing weather conditions.  As such, the material used to pave roads must meet certain viscosity and strength tests in order to be used in asphalt.  To meet highway specification, asphalt is blown by exposing it to oxygen and heat in order to meet required viscosity specs in an Asphalt Blowing Unit.

What is Crude Oil?

So what is crude oil? Crude oil is a viscous, dark mixture of a variety of hydrocarbons of different shapes and sizes.  What’s a hydrocarbon?  Ok organic chemistry scholars out there-take a quick break-get coffee, run some errands, take a nap.  For the rest of us, hydrocarbons are molecules composed of carbon and hydrogen atoms…with, in the case of crude oil, a few miscellaneous atoms thrown in like nitrogen, oxygen, and sulfur, for example.   Sophomore/junior chemical engineering students and curve demolishing premeds originally encountered these molecules defined by chemistry professors the world over as alkanes, alkenes, cycloalkanes, and aromatics…you’ll be happy to know that the term aromatic is still used.  Unfortunately, the refining industry dumped the rest.  Alkanes are referred to as paraffins, alkenes as olefins, and cycloalkanes as naphthenes.  Examples of these are shown below to jog your memory coupled with a very cheesy overview of organic chemistry.  Ugh, bear with me.
Dabbling in Orgo
Paraffins

Paraffins are straight chain or branched (iso-paraffins) molecules examples of which are butanes and isobutanes.  Paraffins are considered fully saturated molecules because they have single bonds between carbon atoms and each carbon’s remaining outer octet shell is completed by bonding with hydrogen.  This is unimportant other than the fact that this molecular arrangement makes paraffins more stable, and less reactive than other unsaturated molecules.
Olefins

Olefins are similar to paraffins except they have one or more unsaturated, double carbon bonds.  Per the discussion above, this means that olefins are typically more reactive than paraffins.    

Naphthenes

Naphthenes, or molecules formerly known as cycloalkanes, are fully saturated ring compounds.  They are also very stable not only because of they are saturated but because their ring structure allows them to balance charge around the molecule…too much?  Ok I’ll stop.
Aromatics
Toluene

Aromatic compounds are unsaturated ring compounds are fairly stable because of their ability to balance charge around the ring.  However, they are still more reactive than their sister naphthenes because they are unsaturated.
Enough of that!
Crude Oil Quality
So crude oil is composed of paraffin, olefin, naphthene, and aromatic hydrocarbon compounds of various sizes and shapes all lumped together.  Hmmm…lumped together, different sizes and shapes?  Does this mean there different types of crudes?  Yes! How does that affect the type of products that can come from crudes? So glad you asked! 
                Because of the variability in the composition of crudes, chemical engineers have come up with different ways of defining the quality or the degree of difficulty refineries have to create various products from gasoline and diesel fuels to petrochemical derivatives used in plastics and detergents.  Typically, crude oil quality can be superficially determined by examining API Gravity and sulfur content.  API Gravity describes the density of the crude.  Sulfur is important because it is related to both the quality of products that can be derived from the crude as well as the cost to upgrade that crude to meet environmental regulations.
                API Gravity varies inversely with the density or specific gravity of the crude.  So heavy Oil Sands Bitumen, rock like crude, may have an API Gravity of 10 where a sweet Nigerian Crude or West Texas Intermediate may be in the mid-40’s.  API Gravity is related to specific gravity by the formula below:
where SG is specific gravity or the density of a substance divided by 62.4 lbs/ft^3 or 1000 kg/m^3 (the density of water in English and Metric Units).
                A crude’s sulfur content determines whether it is described as sweet or sour. Sour is any crude with greater than .5 weight percent sulfur content.  High sulfur content is typical of heavier crudes.  Not only will these crudes have to undergo expensive sulfur removal processing but, because sulfur atoms are typically part of heavier hydrocarbon compounds, this means that the crude most likely has lower quality, heavier components that will need to be cracked into the smaller, higher quality lighter molecules that make up gasoline and diesel.  Remember, the lower the quality of a crude, the greater the degree of processing required, the higher the cost to refine a crude, therefore, the lower the price of the crude relative to others.
                In addition to the API Gravity and Sulfur Content of the crude, refiners examine the crude’s distillation curve to understand its value.  Another brief chemistry rule of thumb: the weight of a molecule is directly proportional to its boiling point.  Lighter, smaller molecules vaporize (go from the liquid to gas phase or boil) more easily than heavier molecules.  It’s like me when I gain a little weight; it’s a bit harder for me to get off the couch or up the stairs.
Crude Distillation Curve
     Above is an example of a crude distillation curve.  It relates boiling point on the y-axis to percent volume of crude on the x-axis.  Butane and lighter products make up maybe 5% of this crude and boil below 60 degrees Fahrenheit.  Gasoline and Naphtha combined make up another 15% and Kerosene approximately 10%, with boiling ranges between 100-350F and 350-450F, respectively.  As you can see, lower value gas oils and residuum make up the bulk of this crude.  To be economical, the refinery upgrades this material to the lower boiling range, lighter products gasoline and kerosene (jet fuel).  Below is another view of the refinery product slate as it might be derived from a crude distillation column, the first unit in a refinery.


Crude Oil Assays
Crude Oil Assays are detailed laboratory analyses of crudes e.g. API Gravity, Sulfur, Nitrogen, and Metals Content, Distillation Curve, Viscosity, etc. Assays are typically described by crude boiling range.  See Chevron’s Bonny Light Assay properties below (see full assay).

Nigerian Bonny Light Assay Properties
Assays are used by the refinery’s planning and scheduling department to determine the most profitable product mix the refinery can produce for a given crude slate.  Refinery Planners input assays into LP (Linear Programming) Models which simulate how all of the refinery's or a group of refineries process units work together.  The LP Model is used to find the optimum operating mode of the refinery per the required feed and product qualities and prices and various operating constraints.  No modern refinery can be efficiently run without the use of an LP Model.

How Refineries Make Money



Petroleum Refineries make money upgrading crude oil to higher value products like gasoline, jet fuel, and diesel. A refiner’s profit is the difference between the revenue generated from selling refinery products minus the cost of crude and purchased intermediates, energy, and operating costs like equipment maintenance, personnel, and office supplies, etc.






Refinery Profit = Product Value - Crude/Intermediate Cost – Energy – Operating Cost

Gross Refinery Margin is the most important component of the Profit Equation and is the difference between Product Value and Crude and Intermediate costs. Crude is typically the highest cost for a refiner. A 100,000 barrel a day refinery at $70/bbl of crude will spend $70/bbl x 100,000bbl/day=$7mln/day on crude oil or $2.56 billion on crude alone in a single year (at a theoretical 100% utilization). That means that a refinery must make at least that much plus the cost of energy and operating costs on its finished products just to break even...but of course they and their shareholders all want to operate at a profit.

Consider a refinery with the following simple yield profile:

Feed

Crude: 100,000 bbls/day

Products

Gasoline: 40,000 bbls/day
Jet: 20,000 bbls/day
Diesel: 35,000 bbls/day
Other Products: 12,000 bbls/day

(Notice total refinery products is 107,000 bbls/day versus 100,000 bbls/day crude intake. Many chemical processes in the refinery result in a volume gain e.g. Fluidized Catalytic Cracking, Hydrocracking, Delayed Coking. Volume gain is an important contributor to refinery profitability. Mass is always conserved but volume can increase or decrease across the various units. But more on that later)

Prices

Crude Cost: $70/bbl
Gasoline Price: $90/bbl or $2.14/gallon
Jet Price: $92/bbl
Diesel Price: $95/bbl
Average Price Other Products: $82/bbl

Given the yields of a refinery plus feed and product costs it is simple to calculate gross refinery margin. As a convention I’ll use MBPD to indicate 1000 bbls/day.

(40 MBPD Gasoline x $90/bbl) 

   + (20 MBPD Jet x $92/bbl)

   + (35MBPD Diesel x $95/bbl) 

   + (12MBPD x $82/bbl) 

   – (100MBPD Crude x $70/bbl)    =    $2.749 mln in gross refinery margin per day.

$2.7mln-not bad but we still have to subtract energy and operating costs. Let’s say that energy e.g. natural gas for fired heaters and steam generation will cost us $150,000 per day. Now we’re down to $2.6mln in profit but we also need to account for operating costs like maintaining equipment, paying staff salaries and benefits, catalyst, water and chemicals usage, IT costs, office equipment, etc for $200k/day. This means our final profit is $2.3mln/day before taxes. But that is assuming the refinery runs at full rates 365 days/year.

However, few refineries can achieve this given that typically a portion or all of the refinery is periodically down for planned maintenance or unplanned equipment outages or refinery economics dictates some underutilization. Let’s assume that the refinery runs at about 80% crude unit utilization or around 80MBPD capacity on average for the year. Say, this under utilization is due to a planned turnaround as well as an outage for a major piece of equipment failure which impacts the site by100k/day of margin and 50k/day of additional maintenance cost.

For simplification purposes we’ll assume 80% utilization X $2.749mln Gross Refinery Margin = $2.2mln margin. Likely our energy usage will be higher due to inefficiency associated with idling units but we’ll assume the same cost for energy as well as base operating costs:

$2.2mln Gross Refinery Margin - $150k/day energy - $200k/day OPEX leave us with $1.85mln of profit. But now we have to pay for the unscheduled repair of our failed equipment minus another $50k/day so our profit is now $1.8mln/day versus $2.3mln/day at perfect rates. As you can see, optimizing planned maintenance and equipment reliability are key to optimal refinery profitability as subpar performance impacts both the top and the bottom lines.

Anyway we’ve just scratched the surface of refinery economics. Check back in periodically as I explore more of this fascinating area in future blog posts.