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.
| Component | LP Approach | ML-Enhanced Approach |
|---|---|---|
| Crude blending | Linear mixing rules | Neural network blend models (viscosity, compatibility) |
| CDU yields | Fixed yield vectors per crude | Gradient boosted regression on cut points + crude properties |
| FCC conversion | Linear model with delta-base vectors | Kinetic-ML hybrid: 4-lump + residual correction network |
| Product quality | Linear blending indices | Nonlinear blending models for octane, cetane, pour point |
| Crude pricing | Point estimates | Stochastic 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:
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 limitsHPCL 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:
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
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