Back to guides
2
9 min

AI for Refinery Process Optimization

Crude Diet Optimization, Distillation Control, and GRM Maximization

Crude Diet Optimization: Blending for Tier 3 / Euro 6 at Minimum Cost

Large refineries process 30-40 different crude grades simultaneously. Each crude has a unique assay — API gravity, sulfur content, TAN, naphtha yield, diesel yield, residue yield, metal content. The refinery's job: blend these crudes and process them through CDU/VDU/FCC/hydrocracker/delayed coker to produce US EPA Tier 3 / ULSD and EU Euro 6 / EN 590 compliant fuels at maximum gross refining margin (GRM).

The crude diet problem is a constrained optimization with 50+ decision variables (crude purchase quantities, unit throughputs, product yields) and 200+ constraints (crude availability, tank capacity, unit capacity, product specifications, environmental limits). Linear programming (LP) has been the standard tool since the 1970s — every refinery runs PIMS/RPMS/Aspen PIMS monthly.

Where AI Improves on LP

LP assumes linear yield relationships. Real refinery yields are nonlinear — FCC conversion is a sigmoid function of riser temperature, hydrocracker yield shifts with catalyst age, crude blending is non-additive for viscosity and pour point. US Gulf Coast refineries running heavy-sour crudes (Maya, Arab Heavy, Basra Heavy, Upper Zakum) see significant nonlinearity.

Open data/crude-assay-data.csv — each row is a crude grade with full TBP distillation, sulfur distribution, density profile, and metal content.

ComponentLP ApproachML-Enhanced Approach
Crude blendingLinear mixing rulesNeural network blend models (viscosity, compatibility)
CDU yieldsFixed yield vectors per crudeGradient boosted regression on cut points + crude properties
FCC conversionLinear model with delta-base vectorsKinetic-ML hybrid: 4-lump + residual correction network
Product qualityLinear blending indicesNonlinear blending models for octane, cetane, pour point
Crude pricingPoint estimatesStochastic optimization with price scenarios from ML forecasts

Motiva Port Arthur: The Scale Problem

Motiva's Port Arthur refinery processes ~640,000 bpd — the largest refinery in North America. At this scale, a 0.1% improvement in crude diet optimization is worth $50-70 million/year. The complexity: 60+ crude grades, 50+ processing units, 100+ product streams, crude delivery scheduling from VLCC and Aframax arrivals, tank farm logistics.

Operators of this scale use a multi-layer optimization: strategic crude procurement (quarterly LP with price forecasts), tactical crude scheduling (weekly MILP with tank constraints), and operational unit optimization (daily neural network models for each process unit). The AI contribution is primarily in the tactical and operational layers — where nonlinearity matters most.

Marathon Galveston Bay: Tier 3 / ULSD Transition

A US Gulf Coast refiner's challenge during the EPA Tier 3 gasoline (10 ppm sulfur) and ULSD diesel (15 ppm sulfur) era is meeting these specs while processing high-sulfur crudes (>2% S). The hydrocracker, FCC gasoline post-treater, and diesel hydrotreater operating windows narrowed significantly. An ML model trained on 2 years of historical data predicted diesel sulfur from crude blend composition, hydrotreater temperature, pressure, LHSV, and catalyst age — enabling feed-forward control that maintained 8-9 ppm sulfur versus the 6-12 ppm range under conventional APC.

Distillation Column Control: Cut Point Optimization

Distillation is 40-50% of refinery energy consumption. The CDU alone consumes 2-3% of crude throughput as fuel. Cut point optimization — adjusting the temperatures at which products are separated — directly affects both yield value and energy consumption.

The Cut Point Trade-off

Open data/distillation-unit-data.csv — each row is an hourly snapshot: feed rate, feed temperature, column pressures, tray temperatures, reflux ratios, product draw rates, and product qualities (flash point, pour point, sulfur, density).

Consider the kerosene/jet-diesel cut point on the CDU:

  • Lowering the cut point shifts material from diesel to jet/kerosene. Jet is often a higher-value barrel and this improves diesel quality (lower density, higher cetane). If you are diesel-long and jet-short (common when jet demand recovers), this adds margin.
  • Raising the cut point shifts material from jet to diesel. More diesel volume but potentially marginal quality. If diesel sulfur is already near spec limit, this can force the hydrotreater to work harder — consuming hydrogen and energy.
  • The optimization requires predicting product qualities as a function of cut points — and these relationships are nonlinear due to overlap (the light diesel tail mixes with heavy jet).

    Soft Sensors for Real-Time Quality

    Laboratory analysis of product qualities takes 2-4 hours. During this window, the column operates without quality feedback. AI soft sensors — neural networks trained on column operating data to predict product quality — close this gap.

    Soft sensor inputs (sampled every minute):
      tray_temperatures: [T1, T5, T10, T15, T20, T25, T30]
      reflux_ratio, reflux_temperature
      reboiler_duty, reboiler_return_temperature
      feed_rate, feed_temperature
      column_pressure_top, column_pressure_bottom
      product_draw_rates: [naphtha, jet, diesel, AGO]
    
    Soft sensor outputs:
      jet_flash_point, jet_smoke_point
      diesel_pour_point, diesel_cetane_index, diesel_sulfur
      naphtha_ibp, naphtha_fbp, naphtha_paraffin_content
    
    Model: 1D CNN on 60-minute input windows → quality predictions
    Update: retrained weekly with lab data (online learning)

    At a Valero Gulf Coast refinery, soft sensors reduced jet flash point violations from 4-5/month to <1/month while allowing the cut point to be optimized 2°C tighter — recovering 200 bpd of jet from the diesel pool. Annual value: $2-3 million.

    GRM Maximization Through Product Slate Optimization

    Gross Refining Margin is the difference between the value of products produced and the cost of crude consumed — the single most important KPI for any refinery. US Gulf Coast cracking margins have ranged from $2-30/bbl over the past decade, with the difference between a good month and bad month often being $3-4/bbl.

    Real-Time Margin Optimization

    Open data/refinery-economics.json — it contains daily crude costs, product prices (US Gulf Coast / Platts pipeline and waterborne benchmarks), and unit operating costs for a representative refinery.

    The product slate optimization adjusts unit throughputs and operating severities to maximize:

    GRM = Σ(product_volume × product_price) - (crude_volume × crude_cost) - operating_costs
    
    Decision variables:
      FCC severity (riser outlet temperature: 510-540°C)
      Hydrocracker conversion (60-90%)
      Delayed coker throughput (% of residue processed)
      Reformer severity (RON 92-98)
      Product routing (naphtha to reformer vs petrochemicals)
    
    Constraints:
      Unit capacity limits
      Product specification compliance (EPA Tier 3 / ULSD, Euro 6 / EN 590)
      Hydrogen balance (reformer production vs hydrocracker/hydrotreater consumption)
      Fuel gas/fuel oil balance
      Environmental emission limits (Clean Air Act / NSPS)

    ExxonMobil Baytown: Petrochemical Integration

    An integrated refinery-petrochemical complex like ExxonMobil's Baytown site adds another dimension: the choice between selling naphtha as gasoline blendstock versus feeding it to the steam cracker for ethylene/propylene production. The margin differential between fuel and petrochemical routes swings by $100-200/MT with market conditions.

    An ML model predicts US Gulf Coast naphtha and ethane crack spreads and North American polyethylene/polypropylene prices 30 days ahead, enabling proactive routing decisions. The model uses:

  • Brent and WTI crude price and term structure
  • US Gulf Coast refinery margins (published by Platts/Argus)
  • North American polymer demand indicators (auto sales, packaging indices, construction activity)
  • Steam cracker turnaround schedules (publicly announced)
  • The forecast accuracy (MAPE < 8% at 30-day horizon) is sufficient to shift 5-10% of naphtha routing decisions per month — adding $6-10 million annually in margin improvement.

    Catalyst Deactivation and Run Length

    FCC catalyst deactivates through metals poisoning (V, Ni from residue processing), coke deposition, and hydrothermal sintering. Hydrocracker catalyst deactivates through coke and metals, requiring temperature increases of 1-2°C/month to maintain conversion. The decision: when to replace catalyst is a trade-off between declining yields and catalyst cost ($6-25 million for a hydrocracker reload).

    ML models predict catalyst activity decline from feed quality trends and operating history. For refiners processing opportunity crudes (high metals, high CCR), these models predict the economic end-of-run 2-3 months ahead — enabling catalyst procurement and turnaround planning that saves 5-10 days of unplanned downtime.

    Key Takeaways

  • Crude diet optimization benefits from nonlinear yield models — LP is necessary but insufficient. ML-enhanced yield models capture real refinery behavior (FCC conversion, blending nonlinearity) and add $1-3/bbl to optimization accuracy.
  • Distillation soft sensors close the quality feedback gap — 2-4 hour lab delays mean columns run conservatively. Neural network soft sensors enable tighter cut point optimization worth $2-7 million/year depending on refinery size.
  • GRM maximization is a multi-unit problem — optimizing individual units in isolation leaves 30-50% of the refinery-wide optimization opportunity on the table. Integrated models that capture hydrogen balance, fuel gas balance, and inter-unit constraints are essential.
  • Catalyst lifecycle prediction prevents costly surprises — ML models trained on feed quality and operating history predict end-of-run 2-3 months ahead, enabling planned turnarounds versus emergency shutdowns.
  • This is chapter 2 of AI for Oil & Gas / Energy (Global).

    Get the full hands-on course — free during early access. Build the complete system. Your projects become your portfolio.

    View course details