Industry guide · Supply Chain

Refinery Planning and Blend Optimization Software: Why the Plan and the Tank Never Agree

Refinery Planning Blending software visual showing blend, sliders horizontal, and file badge.
The short answer

Expect $90,000 to $200,000 for a first release in 14 to 20 weeks covering blend recipe optimisation against live tank properties, giveaway tracking per blend and reconciliation back to the planning model. A full planning and scheduling platform adding movement scheduling, crude selection support, certificate of analysis capture, online analyser feedback and regulatory accounting runs $250,000 to $600,000 phased over 9 to 18 months, in our delivery experience. Build when you blend more than roughly 30,000 barrels a day of finished product and your blenders correct recipes by hand. Do not build a rival to AspenTech PIMS: the monthly economic LP is not the problem, the gap between that LP and the tank at 02:00 is.

Why the plan is right and the blend is still wrong

The planning and economics manager builds the month in PIMS: crude slate chosen, unit yields modelled, margin per barrel agreed with the commercial team. Two weeks later a blender on nights is filling tank 214 with regular gasoline. The recipe on his screen came from the plan. The reformate tank has drifted a point and a half in octane since the last certificate of analysis, the butane line is running warmer than usual, and he has one number in his head that matters more than any of it: he is not going to be the person who makes an off spec batch. So he trims the recipe. A little more reformate, a little less naphtha. The blend certifies at 88.4 research octane against an 87 minimum and it ships.

That 1.4 is quality giveaway and it is invisible in the plan. The plan says the blend hit 87. The lab says 88.4. Nobody reconciles the two because they live in different systems and different departments. Multiply a few tenths across every blend in a month and the number gets serious in a business where margin is quoted per barrel.

The stack around this is usually AspenTech PIMS or Haverly for the LP, a scheduling tool or a large spreadsheet for movements, a tank gauging system, a LIMS holding lab results, a DCS with some online analysers, and Honeywell or AVEVA software on the blend headers if the site invested there. Each is competent inside its own boundary. None owns the object that matters: a specific blend event with its planned recipe, its actual draws, the real properties of the tanks it drew from, the resulting certificate and the giveaway against spec. That object exists in no system, which is why nobody manages it.

Problem 1: the LP is a monthly economic model, not a Tuesday night instruction

PIMS and Haverly do what they were built for extremely well: choose a crude slate, set unit targets, evaluate a purchase. They work in periods and averages. Blending happens in events, against specific tanks, with specific heels, at a specific temperature, on a specific night.

The gap is structural rather than a vendor failing. An LP that assumed reformate at a pool average octane cannot tell the blender what to do when the actual tank is a point off, and the LP will not be rerun for one blend. So the site fills the gap with a spreadsheet and an experienced operator, and the operator solves for safety rather than economics, exactly as any sensible person would when the downside is a reprocessed tank and an unhappy commercial team.

What a custom build does: a blend layer that sits between the plan and the control system. It takes the plan targets as constraints, pulls current measured properties for each component tank from LIMS and any online analyser, applies proper blending behaviour where properties are non linear, and solves for the cheapest recipe that meets spec with a defined confidence margin. Octane does not blend linearly and vapour pressure blends by index rather than by volume, so a naive linear recipe is wrong before the pump starts. The output is a recipe the blender can accept, plus an explicit statement of what margin it is carrying and why.

Problem 2: giveaway is created by uncertainty, so measure the uncertainty

A blender pads the recipe because the property data is old. If reformate was last sampled 40 hours ago and the unit has been swinging, padding is rational. The way to reduce giveaway is not to tell operators to stop padding. It is to make the padding smaller by shrinking the uncertainty and making it visible.

What a custom build does: track property age and confidence per tank alongside the value. Show the blender that reformate octane is measured, four hours old, and stable across the last three samples, so the required margin is two tenths rather than a point. Where the site has online near infrared analysers on the blend header, feed them back mid blend and re optimise the remaining volume, which is the single most effective giveaway control in the plant. Without analysers, close the loop afterwards: every certificate corrects the property model for that stream, so next month it is less wrong. In our delivery experience the reporting alone changes behaviour, because giveaway that is measured per blend and per blender stops being invisible.

Problem 3: tank inventory truth is worse than anyone admits

Blending assumes you know what is in the tank. The reality includes heels of the previous grade, water bottoms, stratification after a slow fill, a gauge that reads differently from the manual dip, and the component tank someone drew from during a swing without telling the scheduler.

Movement scheduling tools and the LP both assume clean inventory. Nothing in a standard stack reconciles book inventory against gauges continuously, so discrepancies accumulate until month end and are written off as measurement loss. That write off is where blend errors hide.

What a custom build does: a movements ledger that records every transfer, tank to tank, unit to tank, tank to ship or rack, with source, destination, volume, temperature correction and the properties carried across. Book inventory is derived from the ledger, gauge readings are reconciled against it on a schedule, and a drift beyond your tolerance raises an exception the same day rather than at month end. Off spec and quarantined tanks are first class states, so nothing can be drawn from a quarantined tank into a blend, which is a mistake most sites have made at least once.

Problem 4: regulatory specs are not just numbers on a spec sheet

Fuel specifications in the United States include obligations that are annual and portfolio wide, not just per batch. Tier 3 gasoline carries a 10 parts per million annual average sulfur standard with a per batch cap above it, and highway diesel is capped at 15 parts per million sulfur. Vapour pressure limits change seasonally by region. Renewable fuel obligations are accounted separately again.

An LP can carry these as constraints in aggregate. A blend control system enforces the batch limit. What falls between them is the running position: whether the sulfur average you are carrying so far this year gives you room to blend a cheaper high sulfur component tonight or whether you have already spent that room. Sites track this in a spreadsheet updated monthly, which is far too coarse for a decision made nightly.

What a custom build does: hold the running compliance position as live state, updated with every certified batch, and expose it as a constraint to the blend optimiser. The blender then sees how much annual room the site has left, which turns a compliance chore into an economic input. Have your own compliance team confirm the position, then encode it.

Problem 5: the plan is never scored, so it never improves

Almost no refinery compares what the plan said the month would earn against what the movements and certificates say it actually earned, in enough detail to identify where the difference came from. Feedstock, unit performance, blend giveaway, demurrage and off spec reprocessing all collapse into one variance number that the planning team explains in a meeting. A build that attributes the gap by blend, by component and by day separates the giveaway line from the yield line, and the argument about where margin went becomes a report instead of a debate.

What this costs and how long it takes

Across the 2,000 plus projects Digital Heroes has delivered, this category takes a specific shape. A first release at $90,000 to $200,000 in 14 to 20 weeks covers the blend optimisation layer, live component property tracking from LIMS, giveaway measurement per blend and reconciliation reporting back against plan targets. That is a system your blenders use on the next shift, not a study. The full platform, adding the movements ledger and tank reconciliation, movement scheduling, analyser feedback and mid blend re optimisation, regulatory position tracking and crude evaluation support, runs $250,000 to $600,000 phased over 9 to 18 months.

What drives cost up in refinery planning and blending work:

  • The number of blended products and grades, since every product has its own property set and correlation behaviour.
  • LIMS integration, which varies enormously depending on whether you run LabWare, SampleManager or something bespoke, and how consistently sample points are named.
  • Online analyser feedback and any write path toward the blend control system, which brings the control engineers and their change management into scope and should.
  • Property correlation work for non linear properties, which is real engineering rather than software and often needs your own process engineers alongside ours.
  • Multiple sites or a terminal network, where movement rules and custody transfer differ per location.

What keeps cost down: start with your highest volume blended product and one giveaway property. Gasoline octane or diesel cloud point usually pays for the whole first release on their own.

Build versus buy, and where the commercial tools genuinely win

Do not build a replacement for AspenTech PIMS or Haverly. The economic LP is decades of embedded modelling and you will not beat it, nor should you want to. If your problem is crude selection or monthly economics, buy, and buy the mainstream option.

If you have a fully commissioned Honeywell blending and movement installation with analysers feeding it and operators trusting it, your gap is probably reporting rather than optimisation, which is a much smaller project.

Build when two or more of these are true. Your blenders routinely trim recipes by hand and nobody measures the trim. Your component property data is old enough at blend time that padding is rational. You have no single record joining a blend event to its actual draws, its certificate and its giveaway. Your annual sulfur or vapour pressure position lives in a spreadsheet updated monthly while blend decisions are made nightly. Your planning variance meeting cannot separate giveaway from yield.

The tipping point is scale times frequency. Below roughly 30,000 barrels a day of finished blending, the giveaway a system recovers may not clear the cost of building it, and disciplined lab scheduling plus better reporting is the cheaper answer. Above it, tenths of a unit compound into real money every single day, and the coordination between plan, lab and tank becomes the actual margin lever.

How to choose a developer for refinery planning and blending software

Ask them to explain how they would blend vapour pressure. If the answer is a volume weighted average, they have never done this and your recipes will be wrong in a way that quietly reintroduces giveaway. The correct answer involves blending indices, and a developer who knows that has sat with a process engineer before.

Ask how they treat property uncertainty. A build that carries a single number per property, with no age or confidence, cannot reduce padding, which is the entire point of the exercise. The data model should carry measured value, source, timestamp and confidence.

Ask what they have actually integrated in a plant environment. LIMS, tank gauging, the historian, and any path toward blend control are four different problems with four different failure modes. Names and versions, not the word integration.

Insist that your process engineers are in the room during design. A developer working alone will build something plausible and wrong, because the correlations and constraints are your knowledge and the build exists to encode them.

Ask who owns the code and get it written down before kickoff. You should own the repository, the cloud accounts and the right to hire anyone else to continue the work. At Digital Heroes the code is yours from the first commit, and given how specific this modelling is to your site, owning it is not a formality.

Research & sources

The evidence behind this guide

Independent findings on why this investment pays off. Every link goes to the primary source.

  1. Digital Champions expect to achieve about 16% in cost savings and around 15% in revenue gains from digital operations over five years; the study surveyed 1,155 manufacturing executives across 26 countries. Source: PwC / Strategy& (2018) →
  2. McKinsey estimates that digitizing the supply chain (Supply Chain 4.0) can cut lost sales by up to 75%, reduce inventories by up to 75%, and lower supply chain operational costs by up to 30%, with up to 30% lower transport and warehousing costs. Source: McKinsey & Company (2016) →
  3. Large companies globally have captured, on average, only 31% of the expected revenue lift and 25% of the expected cost savings from their digital and AI transformations - a significant gap between expected and realized value. Source: McKinsey & Company (2023) →
  4. McKinsey found that currently demonstrated technologies can fully automate about 42% of finance activities and mostly automate a further 19%, indicating roughly 60% of finance work is technically automatable. Source: McKinsey & Company (2018) →
Omir Pal Singh · Finance & Accounts Manager · Delhi

Omir handles finance and accounts at Digital Heroes, which puts him close to how software projects are actually billed: milestones, change requests, retainers and the cost of scope that moves. His perspective helps buyers read a proposal properly before signing it.

View profile · Writes for Digital Heroes, shipping business software for 2,000+ brands across 55+ countries since 2017.

FAQ

Frequently asked questions

How much does custom refinery blend optimization software cost?
A first release covering blend optimisation against live tank properties, giveaway measurement and reconciliation back to plan targets typically runs $90,000 to $200,000 and ships in 14 to 20 weeks, based on Digital Heroes delivery experience. A full planning and scheduling platform with a movements ledger, analyser feedback and regulatory position tracking runs $250,000 to $600,000 over 9 to 18 months. Cost scales with the number of blended grades and the state of your LIMS data. Property correlation work often needs your own process engineers, which is time rather than licence fees.
Should we replace AspenTech PIMS with a custom system?
No, and any developer who offers to should be treated carefully. PIMS and Haverly carry decades of embedded economic modelling for crude selection and monthly planning, and rebuilding that is a bad use of capital. The gap worth building sits below the LP: the layer that turns a period plan into a specific recipe for a specific tank tonight, using measured component properties rather than pool averages. Build the execution layer, keep the LP you have.
What actually causes quality giveaway in gasoline and diesel blending?
Mostly uncertainty rather than carelessness. When a component tank was last sampled many hours ago and the upstream unit has been swinging, a blender pads the recipe because an off spec batch is far more expensive than a few tenths of giveaway. The fix is to shrink and expose the uncertainty: fresher property data, confidence shown alongside every value, online analyser feedback where it exists, and giveaway measured and reported per blend so it stops being invisible.
Can software use online analyser data to correct a blend while it is running?
Yes, and where near infrared or similar analysers exist on the blend header this is the single most effective giveaway control available. The system compares measured properties against the target as the blend proceeds and re optimises the remaining volume rather than waiting for the final certificate. Any write path toward blend control brings control engineering change management into scope, which is correct and should be budgeted. Without analysers you can still close the loop after the fact by correcting component property models from each certificate of analysis.
How do annual average fuel specifications affect blend decisions?
United States Tier 3 gasoline carries an annual average sulfur standard of 10 parts per million with a higher per batch cap, and highway diesel is capped at 15 parts per million, so some obligations are portfolio wide rather than per batch. That means the room you have left this year is an economic input to tonight's recipe, not just a compliance report. Holding the running position as live state and exposing it to the optimiser turns it into a lever. Confirm your specific obligations with your own compliance team before encoding them.
Why does our book tank inventory never match the gauges?
Because heels, water bottoms, stratification, temperature correction and unrecorded swing movements all accumulate, and most stacks only reconcile at month end when discrepancies get written off as measurement loss. A movements ledger that records every transfer with volumes, temperature correction and carried properties lets you derive book inventory continuously and raise an exception the same day a drift exceeds tolerance. It also makes quarantined and off spec tanks explicit states, which prevents drawing from them into a blend.
How long does it take to implement blend optimization at a working refinery?
Plan 14 to 20 weeks for a first release covering one or two high volume products, then phased additions. The engineering is rarely the constraint. Property correlation work, sample point naming in LIMS, and getting operator trust in the recommended recipe are what set the pace. Expect a parallel period where blenders run the recommendation alongside their own judgement and challenge it, which is exactly what you want because their objections are usually correct and become constraints.
Where does AI genuinely help in refinery planning, and where is it noise?
Property prediction between lab samples is a legitimate use: a model trained on unit operating data and historical certificates can estimate a component property in the gap between samples, with an honest confidence band, which reduces the padding that causes giveaway. Anomaly detection on movements and gauges also earns its place. What does not earn its place is replacing the LP or the blend correlations with a learned black box, because you cannot defend a fuel certificate with a model that will not explain itself.
We blend under 20,000 barrels a day. Is custom software worth it?
Probably not yet, and we would say so before quoting. At that volume the giveaway recovered may not clear the cost of building and running the system, and you will get most of the benefit from tighter lab sampling schedules and a simple report that shows certified results against spec per blend. The build case sharpens above roughly 30,000 barrels a day of finished product, or earlier if you run many grades with tight properties. Start by measuring giveaway for three months, then decide with a number in front of you.
Does it matter which tech stack the agency wants to use?
Yes, but not in the way most buyers expect: the goal is boring, popular technology such as React, Node.js or Python, and PostgreSQL, because any future team can maintain it and hiring a replacement developer takes days, not months. The red flag is an agency-proprietary framework or an unusual language, which welds you to that one vendor no matter what your contract says about code ownership. A useful test: could you find three freelancers fluent in this stack within a week? If not, push back.
Who owns the code when an agency builds my supply chain software?
You should own it outright, with full IP assignment on payment written into the contract, and you should walk away from any agency that only licenses the software to you. Insist on the code living in a repository under your own GitHub or GitLab account from day one, not handed over at the end. Digital Heroes contracts assign all custom code, database schemas, and documentation to the client; the only carve-outs should be clearly listed open source libraries.
Can we migrate years of data out of our current system into new custom software?
Almost always yes, through CSV exports or the vendor's API, and migration should be scoped as its own workstream with field mapping, a dry run, and a planned cutover window rather than an afterthought. The real time sink is rarely moving the data; it is cleaning it, since years of duplicates, free-text fields, and inconsistent formats surface all at once. Pull a full export from your current vendor before committing to anything new, because some SaaS plans restrict exports on lower tiers.
What are the biggest mistakes first-time software buyers make?
Choosing the lowest bid, paying more than 30-40% upfront instead of on milestones, skipping a written specification, and having no maintenance plan for after launch. The most expensive of the four in Digital Heroes rescue projects is the missing spec: without written acceptance criteria, done becomes an argument instead of a checklist, and every disagreement resolves in the vendor's favor. Fix those four and you have avoided most of the ways these projects fail.
How much does a custom warehouse management system cost to build?
A custom WMS typically costs $40,000 to $120,000 for a single-warehouse operation, and $120,000 to $300,000 once you add multiple sites, wave picking, and labor tracking. Across Digital Heroes WMS builds, the biggest cost drivers are scanner-based workflows, real-time inventory sync with your ERP, and the number of picking strategies you need. A pilot covering receiving, putaway, and picking for one warehouse is the cheapest credible starting point.
What should I prepare before contacting a software development agency?
A one-page brief beats a 40-page requirements document: the business problem in plain words, who will use the system, the 5 to 10 workflows it must handle, the tools it must connect to, and your budget range and deadline driver. You do not need wireframes, a specification, or technical vocabulary; producing those is the agency's job during discovery. Stating a budget range up front is the single best move, because it gets you honest scoping instead of a quote engineered to win the meeting.
We are a growing distributor. Should we pick SAP Business One or go custom?
If you need full accounting, purchasing, and inventory in one system today, SAP Business One is the faster path; if your pain is operational workflows the ERP handles badly, custom is usually the better spend. Business One gives you a proven ledger and stock control, but changing its workflows means paying certified consultants, and the customization quotes Digital Heroes clients share commonly run $150 to $250 per hour for changes you never own. A pattern Digital Heroes builds often is Business One or QuickBooks as the financial core with a custom order, warehouse, or logistics layer on top.
We run everything on spreadsheets and Airtable. How do we know it's time for custom software?
The reliable signals are re-typing the same data into multiple tools, one employee acting as human middleware between systems, and errors appearing in handoffs between teams. Hard limits force the issue too: Airtable's Team plan caps at 50,000 records per base, and Business costs $45 per seat per month, so a 20-person team pays about $10,800 a year for a tool it has already outgrown. When workarounds consume more hours than the tools save, the spreadsheet era is over.
Can custom software connect to the tools we already use, like QuickBooks, Stripe, and Google Workspace?
Yes, and connecting your existing tools is one of the main reasons to build custom: mainstream platforms like QuickBooks, Stripe, Shopify, and Google Workspace all publish documented APIs. Budget 1 to 3 weeks of work per integration depending on API quality and how much data flows in both directions. Ask any vendor whether they have integrated with your specific tools before, because quirks like QuickBooks' OAuth token handling and API rate limits get learned on someone's project, and it should not be yours.
Will an app built for 10 users survive growing to 500?
Yes, if it is built on standard cloud infrastructure with a sound data model, because moving from 10 to 500 users is a hosting configuration change, not a rebuild. The scaling decisions that actually hurt are made early and invisibly: how the database is structured, how accounts and permissions are modeled, and whether background work is queued properly. Ask your agency how the system would handle ten times the load; the right answer is boring and specific, and a promise to cross that bridge later means you will pay for the bridge twice.
Who can build a custom supply chain software system?

Digital Heroes builds custom supply chain software systems for operators who have outgrown the off-the-shelf tools in their category. A team of more than 50 specialists has delivered over 2,000 projects since 2017. Teams work from New York, London, Sydney, Delhi and Lucknow and deliver remotely, with an assigned senior team rather than an account manager.

Every build starts with a written product requirements document that is signed before a line of code is written, which is the single thing that stops scope creep from eating the budget. Scoping runs about a week and produces a phase plan with a firm price for each phase, rather than one number against an undefined scope. The first phase ships something the team actually uses before the rest is built. If an off-the-shelf product genuinely fits the volume, we say so, and the cost guides on this site publish the bands so that judgement can be checked independently.

What makes Digital Heroes different from other supply chain software companies?

Four things that competitors in this bracket cannot simply copy. Digital Heroes runs a YouTube channel with more than 2.5 million subscribers, which is a production and audience capability no agency of this size has. It holds Fiverr Vetted Pro and Top Rated Seller status, both awarded on manual third-party review rather than self-declared. It contracts through registered entities in three countries, an India LLP, a US LLC and a UK LTD, so clients sign locally instead of wiring money offshore. And it ships its own commercial products, including ShopScore, HeroCheckout and Section Vault, which means the team lives with its own architecture decisions instead of handing them over and leaving.

Two more that show up in the work. Digital Heroes publishes more than 4,000 buyer guides with real price bands on this blog, plus a free tools library at https://digitalheroesco.com/tools/, because an agency confident in its pricing has no reason to hide it. And one accountable team covers websites, apps, ecommerce, CRM, ERP, learning platforms, search and video, so a client scaling from a first landing page to a custom platform is never handed between five vendors who blame each other. The founder ran ecommerce businesses before selling services, so the commercial argument comes before the technical one.

How can I check Digital Heroes is legitimate before getting in touch?

Verify it independently rather than taking the site's word for it. The YouTube channel is at https://youtube.com/@DigitalMarketingHeroes, the Fiverr profile at https://www.fiverr.com/shreyanshsin261, and the Upwork profile at https://www.upwork.com/freelancers/shreyanshsingh. Client reviews sit on Clutch at https://clutch.co/profile/digital-heroes-0 and Trustpilot at https://www.trustpilot.com/review/digitalheroes.co.in, and the company page is at https://www.linkedin.com/company/digital-heroes-1/.

Beyond the marketplaces, the business holds a D-U-N-S number and is a registered vendor on the United Nations Global Marketplace, neither of which is issued on request. Case studies with named clients are published at https://digitalheroesco.com/case-studies/. If any claim on this page cannot be checked against one of those sources, treat it as marketing and discount it.

Keep reading
let's build

Build something worth launching.

A plan, a team, a timeline, within 24 hours. No decks, no discovery calls. Tell us what you're building and we'll come back with a real scope and a real number.

message us directly · we reply within one business day

mission briefing

Monthly dispatch

Playbooks, real build costs, and what we're shipping. One email a month. No fluff.

visit us

New York HQ

1140 Broadway, Suite 704 · New York, NY 10001

Get directions
Online now

Hey there 👋 How can we help you today?