Tank Farm Planning Algorithm for Production Scheduling in Refineries (A–B–C–D)

The Role of Accumulative Tank Farms in Planning Logic

       In modern refinery and oil & gas logistics systems, accumulative tank farms are no longer treated as passive storage infrastructure. Instead, they function as intermediate coordination nodes between production processes and downstream distribution activities, supporting residual management, residual planning, and storage capacity management. Their primary role is to ensure that product flows are not only stored, but also structurally aligned with operational planning, batch production, and dispatch scheduling requirements across multiple time horizons. At the same time, the planning process must continuously account for residual constraints, available storage capacity, and changing refinery operations to maintain reliable production and shipment performance. Learn how operators can manage production planning at runtime in accumulative tank farm control. Material balance is also influenced by additional tank farm flows, including losses and additives. This planning mechanism is implemented through request-based production planning. The effectiveness of these planning strategies can be evaluated using request statistics.

Accumulative Tank Farms as a Node Between Production and Dispatch

       An accumulative tank farm operates as a synchronization interface between upstream Plant production and downstream shipment systems. Similar planning principles are applied in crude oil supply chain simulation Production units typically generate continuous or semi-continuous product flows, while shipment operations are governed by discrete schedules, contractual obligations, and transport constraints.
       Without an intermediate coordination layer, these two temporal regimes—continuous production and discrete logistics—cannot be efficiently aligned. The tank farm resolves this mismatch by acting as a buffering and structuring element, where incoming flows are accumulated, reorganized, and released according to planned shipment profiles.
       In this sense, the tank farm is not simply a storage location, but a temporal mediator between production dynamics and logistics execution. The influence of storage location is discussed in tank farm placement in refinery simulation models.

Why a Simple “Storage Tank” Model Is Not Sufficient

       A conventional “storage tank” abstraction assumes that residuals behaves as a passive volume container with uniform accessibility and unrestricted inflow/outflow behavior. The distinction between storage models is discussed in flowing vs accumulative tank farm modeling. While this simplification is sufficient for basic mass balance calculations, it becomes inadequate in planning-driven environments.
       In real operational systems, accumulative tank farms must account for several additional constraints:
       Planning horizons: residuals is linked to current and future shipment schedules, not just instantaneous demand
       State-dependent usability: stored product may not be immediately available for dispatch due to quality verification or operational constraints
       Multi-objective allocation: available capacity must be distributed between current fulfillment, future preparation, and operational reserves
       Temporal coupling: product inflows and outflows are driven by structured schedules.
       As a result, a simple storage model fails to capture the essential behavior of accumulative systems: they are planning-aware dynamic allocation structures, not passive buffers. To correctly represent their role, a more advanced modeling approach is required—one that incorporates planning logic directly into the operational behavior of the storage system.
In large refinery storage systems, these limitations can also be addressed through dynamic tank reallocation. Instead of permanently assigning tanks to a single tank farm, reserve or idle tanks may be temporarily reassigned to storage areas experiencing capacity shortages, improving storage utilization and operational flexibility.

Conflict Between Planning Logic and Physical Storage Constraints

       In accumulative logistics systems, the core modeling difficulty arises from a fundamental mismatch between planning representations and physical storage behavior. Three primary layers of inconsistency typically emerge:
       Calendar-based shipment plans define expected outbound volumes over discrete time intervals (e.g., monthly or daily schedules). These plans assume ideal execution conditions and stable availability of residuals.
       Actual residual inventory levels (residuals) evolve dynamically and depend on production variability, prior dispatch execution, losses, and intermediate handling constraints.
       Tank farm constraints impose hard physical limitations, including total capacity, minimum operational volumes and structural limitations of how product is distributed across multiple tanks.
       Storage capacity distribution across tank farms introduces an additional operational constraint. While one tank farm may experience storage shortages, another may simultaneously contain idle or reserve tanks. Efficient refinery operation therefore requires mechanisms for dynamic tank reallocation to temporarily balance storage capacity without modifying the physical process configuration.
       Because these three representations evolve on different principles, direct alignment between plan and execution becomes non-trivial.

The “Unavailable Volume” Problem (Available ≠ Usable)

       A key modeling distortion arises from the difference between nominal storage availability and operational usability. Not all physically stored volume can be considered available for dispatch. Constraints such as:
        - minimum fill levels required for operational readiness,
        - tanks under quality verification or passportization,
        - losses and additives that may modify residual requirements,
create a gap between available volume (physical capacity perspective) and usable volume (planning and dispatch perspective). This divergence is especially critical in systems with strict shipment schedules, where timing and batch integrity are as important as total quantity.

Need for Priority-Based Flow Management

       Due to the inconsistencies between planning, residuals, and physical constraints, a purely reactive is insufficient. Instead, accumulative systems require a priority-driven flow control mechanism that continuously arbitrates between competing objectives, such as:
        - fulfilling current shipment obligations,
        - preparing for future planning periods,
        - maintaining minimum operational tank conditions,
and allocating remaining capacity to strategic product reserves.
This introduces the need for a structured decision hierarchy in which oil and gas flows are not simply balanced, but actively orchestrated according to planning priorities and system state constraints.

Priority-Based Control Principle (A–B–C–D)

       Accumulative tank farm operation in planning-driven environments is governed by a structured priority hierarchy, which defines how limited storage capacity and oil and gas flows are allocated across competing operational objectives. This hierarchy serves as the primary mechanism for resolving resource contention and aligning physical behavior with planning requirements. Instead of treating all incoming demands equally, they organizes into a structured sequence of request classes. Each class corresponds to a different planning objective and operational horizon. This hierarchy transforms the tank farm from a passive storage unit into an active decision layer, where allocation is continuously guided by ordered priorities rather than reactive flow balancing.

       The request hierarchy typically follows a four-level structure:
       Priority A — Current period fulfillment. Ensures execution of the active shipment plan for the current planning window. This level dominates all system behavior and directly enforces contractual or operational obligations.
       Priority B — Next period preparation. Allocates remaining capacity to pre-accumulation for upcoming shipment cycles, ensuring continuity between planning horizons.
       Priority C — Operational readiness and minimum volume enforcement. Ensures that tanks reach minimum usable volumes required for operational validation, certification, or functional readiness constraints.
       Priority D — Strategic or user-defined reserves. Utilizes remaining capacity for optional accumulation targets defined by operational strategy.

Deterministic processing order

       A defining property of this mechanism is its strictly deterministic execution order. Requests are not evaluated simultaneously or competitively within a single optimization loop. Instead, processing follows a sequential cascade:
  1. Priority A is fully satisfied first
  2. Only remaining capacity is passed to Priority B
  3. Priority C is processed based on residual availability
  4. Priority D is applied last using leftover capacity
       Because storage capacity is inherently limited, multiple request classes may compete for the same physical resources. This creates a capacity arbitration problem, where allocation decisions must be made under strict scarcity conditions. In this framework, conflicts are not resolved through cost-based optimization or utility maximization. Instead, they are resolved through hierarchical dominance rules, where higher-priority requests fully override lower-priority ones. Higher priority levels always preempt lower priority levels when resource constraints are binding. As a result, the system avoids ambiguity in allocation decisions and ensures that critical operational objectives (such as current shipment fulfillment) are never compromised by secondary or strategic accumulation goals.

Priority A — Current Month Plan Fulfillment

       Priority A is responsible for ensuring execution of the active monthly shipment plan. The effectiveness of these planning strategies can be evaluated using request statistics. It represents the execution-critical layer of the system and has the highest allocation precedence. At this level, the tank farm performs residual-aware distribution, accounting for existing residuals when determining whether planned shipment volumes can be satisfied. The primary objective is to close any gap between planned outbound volumes and available tank farm residuals.

       Key functions include:
        - verification of coverage for current shipment obligations
        - adjustment of incoming mass requirements based on shipment demand constraints and available residual inventory levels
        - compensation of shortages or surplus volumes within the current plan window
        - coordination of distribution across available tanks to ensure feasible dispatch configuration
       This level directly shapes how additional mass flow is distributed between reservoirs, prioritizing configurations that guarantee fulfillment of committed shipment schedules under physical and operational constraints.

Priority B — Next Month Preparation

       Priority B focuses on predictive accumulation to support the subsequent planning period. Unlike Priority A, which is execution-driven, this level is anticipation-driven and aims to ensure continuity of supply in future shipment cycles.

       Key functions include:
        - formation of buffer inventory for the next month
        - proactive accumulation based on forecasted shipment plans
        - reduction of future deficit risk under uncertain production or demand conditions
        - use of planned schedules to guide forward-looking stock buildup
       The main distinction from Priority A is temporal orientation: Priority A ensures current execution, while Priority B ensures future readiness based on future plans demand.

Priority C — Minimum Operational Level Completion

       Priority C ensures that tanks reach the minimum technically and operationally valid tank fill levels required for certification (passportization) and subsequent dispatch. This level addresses a practical modeling issue where, after execution of Priority A or B, the final active tank may contain a marginal or physically unrealistic volume.
       For example, a tank with a minimum operational threshold of 10 tons and a maximum of 100 tons may be only 11 tons. Although numerically feasible, such a state is operationally non-viable, as the tank cannot realistically enter passportization or be used for dispatch at this marginal fill level.
       To resolve this, Priority C performs controlled top-up of partially filled tank to the minimum reasonable threshold at which: passportization becomes valid, product is considered dispatchable, and the tank is operationally stabilized. Priority C is applied only to the last active tank currently connected for loading, ensuring controlled completion of its minimum operational fill level.

       Key functions include:
        - ensuring compliance with minimum fill constraints
        - eliminating non-dispatchable low-volume residuals
        - completing partially filled last active tank.

Priority D — User-Defined and Strategic Reserves

       Priority D represents additional user-defined or strategic accumulation targets. It is used to allocate remaining capacity for optional objectives such as safety stock, scenario-based buffers, or custom fill requirements defined by the planner. This level is conditionally activated and operates only after all higher-priority requirements have been satisfied.

System behavior under constraints

       When operational constraints occur, the system follows a strict temporal and procedural handling logic.
       If no free tank is available, the request is held in a pending state until the end of the current planning period. At the start of the next month, planning data and residual requirements are recalculated, and unresolved requests are re-evaluated within Priority A logic. Unfulfilled portions from the previous period are not carried over directly as active obligations. In case of shipment blocking, execution remains paused until the constraint is resolved. At the beginning of each planning cycle, shipment plans and residual targets are refreshed, and previous uncompleted residuals are discarded rather than propagated into the new period.

Practical Applications

       The described accumulative tank farm logic is widely applicable in oil & gas and refinery simulation environments where planning and physical constraints must be tightly coupled.

       It is used in:
       - oil refining systems for coordinating intermediate and final product flows
        - refinery product tank farms managing scheduled storage and dispatch operations
        - gas and condensate storage systems handling phase-dependent accumulation and shipment constraints
        - terminals and logistics hubs supporting multimodal transport and shipment scheduling
        - integration with production planning systems, where residuals dynamics are aligned with demand forecasts and execution schedules
       In all cases, the same core requirement applies: aligning continuous production with discrete, plan-driven distribution under physical storage constraints.

Petroleum Refining Library implementation

       Petroleum Refining Library provides a unified modeling framework for linking production planning with physical storage and shipment execution in accumulative systems.
       It separates planning logic from physical flow processing by transforming shipment plans into structured requests handled by accumulative tank farm components. A built-in four-level priority system (A–D) ensures deterministic execution of competing demands across different planning horizons, including current plan fulfillment, future pre-accumulation, operational minimums, and optional reserves. The model is accounting for residual levels, tank constraints, and usability conditions, which prevents fragmentation and non-dispatchable states. Shipment nodes act as the interface between external planning systems and internal execution logic, ensuring consistent alignment between production output, storage allocation, and dispatch operations.
       The priority-based planning algorithm is configured in the accumulative tank farm component under the ReservoirPark, Requests menu section. Each priority level is enabled independently using a dedicated checkbox, allowing users to activate only the planning functions required for a particular model.

Priority A — Current Month Plan
When Priority A is enabled, at least one ShipmentNode must be specified. These nodes load shipment plans from the database and provide the planned dispatch volumes used to calculate the required inventory levels within the tank farm. Accumulative tank farm compares these planned volumes with the current residuals and automatically generates an additional accumulation request.

Optionally, one or more LoadingRack objects can also be specified. This allows the algorithm to account for the "volume on wheels"—product that has already left the tank farm but has not yet been registered as shipped by the corresponding ShipmentNode.
Priority A is enabled by the enablePriorityAShipmentPlan parameter (Label: A: Fulfillment shipment plan). One or more ShipmentNode objects are assigned via the priorityAShipmentNodes parameter (Label: R: Shipment nodes (ShipmentNode[])). Optionally, one or more LoadingRack objects can be also assigned via the priorityALoadingRacks parameter (Label: O: Loading racks (LoadingRack[])).

Priority B — Next Month Pre-Accumulation
Priority B is configured using two parameters:
        - minimum shipment plan for the next month, above which pre-accumulation is activated
        - additional accumulation volume, defining how much extra product should be stored.
For example, if the next month's planned shipment exceeds 5,000 t, the system can automatically request an additional 2,000 t of inventory.
Priority B is enabled by the enablePriorityBNextMonthPlan parameter (Label: B: Additional load for next month). The activation threshold is specified by the nextMonthMinimumPlanValue parameter (Label: Minimum planned load for next month (tons)), which defines the minimum planned shipment volume required to trigger pre-accumulation. The additional accumulation volume is configured using the nextMonthAdditionalMass parameter (Label: Additional mass (tons)).

Priority C — Final Last Tank Top-Up
Priority C requires the user to specify the minimum operational fill level of the last active loading tank. If the calculated residuals remains below this threshold after execution of higher priorities, the Petroleum Refining Library generates an additional request to complete the last active tank to the specified level before passportization begins.
Priority C is enabled by the enablePriorityCExtraLoad parameter (Label: C: Active tank additional load). The minimum operational fill level required to complete tank loading and initiate passportization is specified using the priorityCMinPassportLoadLevel parameter (Label: Min tank amount to end loading (tons)).

Priority D — User-Defined Reserve
Priority D is configured interactively during simulation. An additional runtime menu allows the user to specify an extra accumulation volume, which is added as a low-priority request after all higher-priority requirements have been satisfied.

Additional operational behavior can be configured using two optional parameters
       The forceFillMode parameter (Label: Top-up all tanks) keeps the inlet valve open even after Priority A has been fulfilled. In this mode, the reservoir park continues accepting incoming product until all available storage capacity has been utilized. Storage availability may also change during tank repair simulation. This option is useful when the objective is to maximize inventory rather than stop accumulation immediately after the current shipment requirements have been satisfied.
       The forceLastTankPassportization parameter (Label: Force last tank passportization) provides finer control over the behavior of the last active loading tank when forceFillMode is enabled. When activated, the last active tank is forced into the passportization state immediately after the Priority A accumulation target has been reached, even if the tank is not completely full. This option is recommended for systems with intermittent or low inflow rates. Otherwise, the last active tank may remain in the filling state for an extended period, delaying passportization and shipment even when sufficient inventory is available to satisfy the shipment plan. For continuous high-flow systems, this option is typically unnecessary because the last tank naturally reaches full capacity and proceeds to passportization.

Conclusion

       The priority-based model is essential for correctly aligning planning logic with physical storage constraints in accumulative systems. It provides a structured mechanism for resolving competing demands across different planning horizons while supporting effective operational planning, inventory planning, and storage capacity management.
       Compared to static storage modeling, this approach enables explicit handling of inventory management, inventory fragmentation, usability constraints, and multi-level dispatch scheduling, which cannot be represented in traditional buffer-based models. As a result, the system behaves not as a passive storage representation, but as a constrained scheduling engine that continuously allocates limited resources according to deterministic priority rules while respecting inventory constraints and the operational requirements of batch production.
       In this context, the accumulative tank farm functions as a planning execution component that translates structured demand into physically feasible flow distribution under real refinery operations and storage constraints.
       The priority-based planning algorithm implemented in accumulative tank farm enables deterministic execution of production plans under real storage constraints. By combining shipment requirements with the location of the tank farm, future production demand, tank state management, and user-defined priorities, the algorithm provides a practical approach for residual management, production planning, and dispatch scheduling in refinery digital twins, supporting reliable batch production and day-to-day operational planning. The planning algorithm becomes even more effective when combined with dynamic tank reallocation, allowing refinery digital twins to optimize not only shipment priorities but also storage capacity distribution across multiple tank farms.

FAQ

1 What is the main purpose of an accumulative tank farm in planning systems?
It acts as an intermediate layer between production and shipment, aligning continuous inflows with discrete, schedule-driven dispatch requirements.

2 Why is a simple storage tank model insufficient?
Because it cannot represent planning constraints, residuals fragmentation, usability restrictions, or multi-period shipment dependencies.

3 What defines Priority A?
It ensures execution of the current monthly shipment plan, adjusting allocation based on available residuals and correcting deficits or surpluses.

4 How does Priority B differ from Priority A?
Priority B is anticipatory: it prepares residuals for the next planning period, while Priority A focuses strictly on current execution.

5 What is the role of Priority C?
It ensures tanks reach minimum operational volumes required for passportization and prevents non-dispatchable low-volume states.

6 What is Priority D used for?
It allocates remaining capacity to optional user-defined or strategic reserves such as safety stock or scenario-based buffers.

7 How does the system handle capacity conflicts?
Conflicts are resolved deterministically through a strict priority hierarchy where higher levels always override lower ones.

8 What happens when no storage capacity is available?
Requests are held until the next planning cycle and re-evaluated under updated Priority A conditions.

9 Does the system use optimization algorithms for allocation?
No, allocation is rule-based and deterministic, following ordered priority execution rather than cost optimization.

10 Can unfulfilled requests carry over to the next period?
No, they are re-evaluated in the next planning cycle rather than being directly propagated as persistent obligations.

Last updated on 25.06.2026