Back to guides
2
9 min

AI for Refinery Process Optimization

Crude Diet Optimization, Distillation Control, and GRM Maximization

Crude Diet Optimization: Blending for BS-VI at Minimum Cost

Indian 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 BS-VI 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. Indian refineries running heavy-sour crudes (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

Reliance Jamnagar: The Scale Problem

Jamnagar processes 1.4 million bpd across two refineries — the world's largest single-location refining complex. 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 arrivals, tank farm logistics.

Reliance uses 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.

IOCL Panipat: BS-VI Transition

IOCL Panipat's challenge during the BS-VI transition was meeting 10 ppm sulfur in diesel while processing high-sulfur crudes (>2% S). The hydrocracker 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-diesel cut point on the CDU:

  • Lowering the cut point shifts material from diesel to kerosene. Kerosene is lower value but this improves diesel quality (lower density, higher cetane). If you are diesel-long and kerosene-short (common in India where ATF demand is growing), this adds margin.
  • Raising the cut point shifts material from kerosene 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 kerosene).

    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, kerosene, diesel, AGO]
    
    Soft sensor outputs:
      kerosene_flash_point, kerosene_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 BPCL Mumbai refinery, soft sensors reduced kerosene 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 kerosene from the diesel pool. Annual value: ₹15-20 crore.

    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. Indian refinery GRMs have ranged from $2-12/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 (Indian Oil Corporation posted prices, Singapore benchmark), and unit operating costs for a representative Indian 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 (BS-VI)
      Hydrogen balance (reformer production vs hydrocracker/hydrotreater consumption)
      Fuel gas/fuel oil balance
      Environmental emission limits

    HPCL Vizag: Petrochemical Integration

    HPCL Vizag's integrated refinery-petrochemical complex adds another dimension: the choice between selling naphtha as gasoline blendstock versus feeding it to the naphtha 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 Singapore naphtha crack spread and India polyethylene/polypropylene prices 30 days ahead, enabling proactive routing decisions. The model uses:

  • Brent crude price and term structure
  • Singapore refinery margins (published by Reuters/Platts)
  • India polymer demand indicators (auto sales, packaging indices, construction activity)
  • Naphtha 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 ₹50-80 crore 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 (₹50-200 crore for a hydrocracker reload).

    ML models predict catalyst activity decline from feed quality trends and operating history. For IOCL refineries 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 ₹15-50 crore/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.

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

    View course details