Why Tank Farms Make Refinery Simulation Difficult?

       Many refinery models assume continuous oil and gas flows that can be described using smooth material balance equations. Accurate tank farm simulation is therefore a fundamental requirement for refinery digital twins, production planning, and logistics optimization. Tank farms fundamentally change this assumption by coupling continuous production with discrete storage and shipment operations. Consequently, refinery behavior depends not only on flow rates but also on inventory distribution within the storage system. Under storage constraints, even small changes in tank inventories can make an otherwise optimal production plan infeasible. Tank farms convert a continuous refinery into a hybrid dynamic system. Therefore, accurately representing tank farms is essential for realistic refinery simulation and optimization.
A refinery cannot produce what it cannot store or ship!
       Ultimately, the objective of refinery optimization is not to maximize production itself, but to maximize economic value under market, operational, and logistical constraints. From this perspective, production capacity represents only one part of the problem. An economically optimal refinery must be able not only to process crude oil but also to store, blend, transport, and ship its products in accordance with market demand and contractual commitments. Consequently, the true production capability of a refinery is determined not only by the capacity of its process units but also by the availability and operational state of its storage and logistics infrastructure. A refinery that cannot store or ship additional products cannot continue increasing production, regardless of the available processing capacity. For this reason, storage and logistics are not auxiliary systems but fundamental components that define the feasible operating region of the entire refinery. Ignoring them inevitably leads to optimization results that may be mathematically optimal but operationally infeasible.
       Tank farms can be modeled using several levels of abstraction, including a full digital twin, a direct-flow approximation, and equivalent storage models with and without product certification. The following example compares these approaches and evaluates their accuracy under different operating conditions.

Tank Farms as a Material Balance Node in Digital Twin Systems

       In refinery simulation, every unit and pipeline is typically treated as part of a material balance network where mass conservation must hold at all times. Tank farms, however, occupy a special position in this structure: they are storage nodes with history-dependent behavior that store, redistribute, and synchronize flows across the entire system.
Within a digital twin environment (such as AnyLogic-based refinery models), tank farms act as coupling points between continuous production and discrete logistics decisions. Unlike process units, their behavior depends not only on instantaneous flow rates but also on accumulated residuals, historical usage, and future shipment obligations.
Unlike process units, whose behavior is largely determined by the current state of the process, tank farms possess memory. Their response depends not only on current inflows and outflows but also on the sequence of previous operations that produced the current inventory distribution. Consequently, identical instantaneous operating conditions may require different control decisions because the future obligations and operational flexibility depend on the storage history.
       This makes tank farms a critical extension of the material balance graph. They enforce global conservation of mass while simultaneously introducing local constraints on capacity, product segregation, and operational rules. As a result, they do not simply pass oil and gas flows through the system—they redefine the feasible set of the optimization problem through state-dependent constraints.
       An important characteristic of tank farms is the inherently binary nature of the constraints they impose on incoming flows.
       1 When the storage reaches its allowable upper limit, the inlet valve is closed, forcing the incoming stream either to bypass the tank farm or, if no bypass is available, to stop entirely. After sufficient inventory has been withdrawn and free capacity becomes available, the inlet valve reopens and the flow resumes. These repeated switching events introduce frequent discontinuities in the inlet flow that are governed by the storage state rather than by upstream production conditions.
       2 However, storage saturation is not the only mechanism affecting flow continuity. Tank farms must also accumulate sufficient residual inventory to satisfy scheduled shipment plans and, when required, reserve inventory for the next planning period (see the A–B–C–D planning algorithm). Once these inventory targets have been achieved, the inlet flow may be restricted even though physical storage capacity is still available. Consequently, the inlet flow is influenced by two distinct classes of events that operate on different time scales: relatively high-frequency operational switching caused by storage capacity constraints and relatively low-frequency planning events driven by production and shipment schedules. Together, these mechanisms make the behavior of tank farms strongly state-dependent and difficult to represent using conventional continuous optimization models.
       In practice, tank farms form the core of refinery logistics, synchronizing production units, storage facilities, pipelines, blending operations, and shipment execution across the entire refinery.

Flowing vs Accumulative Tank Farms

       Tank farms in refinery systems typically operate in two distinct modes: flowing and accumulative, and this distinction is a major source of modeling complexity.
       Flowing tank farms behave as rate-driven buffering nodes with negligible inventory accumulation, where state dependence is minimal. They mainly dampen short-term fluctuations between units and downstream consumers, and are relatively close to continuous-flow behavior in simulation.
       Accumulative tank farms are state-driven storage systems where inventory evolution determines future routing, blending, and shipment decisions. They accumulate residuals over time and release them in discrete operations driven by shipment schedules, blending constraints, and operational rules. This creates path dependency: current flows depend on both past residual states and future delivery commitments.
       Flowing systems are continuous-time processes, while accumulative systems introduce discrete state evolution.
       The coexistence of both modes combines continuous transport dynamics with discrete storage operations.
       Choosing between these abstraction levels is one of the central problems in tank farm simulation, since it directly affects both computational performance and simulation accuracy.

Storage Constraints and Feasibility Region Collapse

       When multiple tanks approach their capacity limits, incoming flows become constrained as the storage system can no longer accept additional product. Conversely, when tank inventories are low, outgoing flows become constrained because the required product volumes are no longer available for withdrawal or shipment. Consequently, tank farms dynamically regulate both incoming and outgoing flows, making refinery throughput directly dependent on the current storage state.
       Thus, tank farms act as boundary-defining elements of the system state space. They do not only store material—they actively determine whether the refinery system can continue operating under given conditions.

Shipment Scheduling as a Discrete Optimization Problem

       Shipment operations introduce a fundamentally discrete layer on top of continuous refinery flows. While production and transfer rates can often be modeled continuously, shipment decisions are event-based: a tank is loaded, certification completed, and oil and gas product flows are dispatched according to a schedule to the loading rack (if it's has a filling train with wagons!). Shipment scheduling is therefore tightly integrated with refinery scheduling, production planning, and storage availability.
       Furthermore, shipments are frequently limited to designated working hours, with no loading operations during weekends or public holidays. These calendar-based constraints add another layer of time-dependent scheduling restrictions, linking storage availability directly to refinery production planning. In optimization terms, this creates a combinatorial problem layered on top of the material balance network. As a result, shipment planning becomes one of the main sources of nonlinearity in refinery simulation, tightly linking logistics execution with upstream production and tank farm state.
In refinery optimization, the objective is not only to reach the desired final inventory but to follow a feasible trajectory that satisfies all operational constraints throughout the planning horizon.

Direct Flow vs Storage Routing Logic

       Refinery systems must continuously choose between direct transfer and storage-based routing, and this choice is a major source of simulation complexity.
       Direct flow moves oil and gas flows immediately between units under pipeline and process constraints, with minimal state dependency. Storage routing, however, introduces tank farms as intermediate decision points where material is held, redistributed, and later allocated to blending or shipment.
       The key difficulty is that routing is not fixed. It depends on real-time residual levels, capacity limits, blending requirements, and downstream demand timing. The same stream may bypass storage in one scenario and be routed through tanks in another, depending on system state. For example, when a flow-through tank farm is located at the refinery outlet, the product may bypass storage entirely and be transferred directly to a downstream refinery or pipeline. This direct-flow mode increases shipment capacity and allows product certification to be performed during pipeline transportation, eliminating the need for intermediate storage. Under different operating conditions, however, the same stream may instead be routed through the tank farm to accumulate inventory, balance production and shipment schedules, or provide operational flexibility. Consequently, the routing of a given stream is not determined by a fixed pipeline configuration but by the current operational state of the refinery, including storage availability, shipment requirements, and logistics constraints. Errors in routing logic can lead to infeasibility—such as overfilled tanks, missed shipments, or broken blending constraints—even when overall mass balance is preserved.

Why Tank Farms Transform LP Into Hybrid Problem?

       Most refinery optimization models assume that oil and gas flows can be redistributed smoothly across the system as long as mass balance and capacity constraints are satisfied. Tank farms invalidate this assumption by introducing state-dependent constraints and discrete operational decisions. Every tank introduces additional binary decisions associated with filling, withdrawal, routing, and availability. Consequently, computational complexity grows combinatorially with the number of tanks. Modern refinery optimization therefore combines continuous process optimization with discrete logistics optimization, making tank farms one of the most computationally demanding components of refinery digital twin systems.
       Tank farms are the most common example of this behavior, but they are not the only ones. Loading racks can exhibit similar dynamics, as they may contain significant residual volumes and are strongly dependent on the availability and scheduling of rail tank cars. This introduces additional constraints and variability in shipment operations, which can substantially affect the feasibility of optimization plans and further increase the coupling between logistics, storage, and production decisions.
       It should be noted that tank farms can, in principle, be represented in linear optimization models. However, modeling the operational states of individual tanks requires the introduction of binary or integer variables, transforming the problem into a mixed-integer linear programming (MILP) formulation. While the model remains largely linear, the number of discrete variables grows rapidly with the number of tanks, causing solution times to increase dramatically. Since modern refineries typically operate hundreds of tanks, solving such models within operational time limits often becomes impractical. As a result, detailed tank farm behavior is commonly simplified or excluded from refinery optimization models, with storage represented only by aggregated inventory constraints and average output speed.

Example Model: Impact of Tank Farms on Refinery Operation

Jump to Interactive Model
       Compare four different approaches to modeling refinery tank farms under identical operating conditions. This simulation demonstrates how the same refinery behaves when storage is represented with different levels of detail—from a full digital twin to simplified approximations.

       The comparison includes:
       Case 1 – Full Tank Farm Digital Twin. Simulates a tank farm consisting of two storage tanks with a total capacity of 10,200 t, both initially 50% full. One tank starts in the Filling state and the other in the Shipment state. A 24-hour product certification period is applied, while all routing, shipment operations, and operational constraints are modeled exactly as they occur in a real refinery.
       Case 2 – Direct Flow Approximation. Bypasses tank farms completely. Products are transferred directly between process units and shipments without intermediate storage, buffering, inventory accumulation, or time delay. Consequently, the inlet and outlet flow rates are always identical, while shipment is controlled using a constant equivalent withdrawal rate equal to the average withdrawal rate over the simulation period.
       Case 3 – Equivalent Tank Model with Certification. Replaces the entire tank farm with a single equivalent storage tank having the same 10,200 t capacity and an initial 50% inventory. A 24-hour product certification period is preserved, while individual tank behavior and routing decisions are aggregated into a single storage node.
       Case 4 – Equivalent Tank Model without Certification. Replaces the entire tank farm with a single equivalent storage tank having the same 10,200 t capacity and an initial 50% inventory. Product certification is disabled, allowing material to become immediately available for shipment while other storage-related operational constraints are simplified.

       The primary performance indicator is the coefficient of variation (CV) of the tank farm inlet flow, which quantifies how storage-related constraints propagate upstream and destabilize the incoming process flow. A higher coefficient of variation indicates stronger flow interruptions and a greater influence of the tank farm on overall refinery operation. Effectively, the CV measures the extent to which the internal state of the tank farm—including tank utilization, inventory distribution, and storage capacity limitations—disturbs the operation of upstream process units and storage facilities by introducing fluctuations into the incoming flow. Additional performance metrics include outlet flow dynamics, which characterize downstream flow stability, together with cumulative shipment volume. This metric is used to calibrate the simplified models by selecting an equivalent withdrawal rate that matches the total shipment of the reference digital twin over the simulation period.

       It should be noted that even the full digital twin is simplified. The model considers only inlet flow interruptions caused by unavailable storage capacity and does not include planning-driven restrictions introduced to reserve inventory for future shipments. Therefore, the presented results isolate the impact of storage capacity alone.

       Unlike the full digital twin, which directly reproduces the physical behavior of the refinery, all simplified models require calibration. Their equivalent withdrawal rate must be determined so that the cumulative shipment volume over the simulation period is identical to that of the digital twin. This calibration establishes a common basis for comparison and ensures that the observed differences arise from the storage representation itself rather than from unequal shipment capacity.

       These results demonstrate that the suitability of each tank farm modeling approach is primarily determined by the balance between incoming production flow and outgoing shipment capacity. As this imbalance increases, explicitly modeling storage dynamics becomes increasingly important.

Scenario 1 – Inlet Flow Significantly Lower than Shipment Flow (in 50 t/h, out 150 t/h).
When the incoming flow is substantially lower than the shipment rate, the digital twin maintains at least one free storage tank almost continuously. Consequently, the inlet valve rarely closes, resulting in a low inlet flow coefficient of variation. Under these conditions, Cases 1 and 2 produce nearly identical results, whereas Cases 3 and 4 overestimate flow variability by about 50%, introducing artificial disturbances to upstream process units and storage facilities.

Scenario 2 – Inlet Flow Approximately Equal to Shipment Flow (in 150 t/h, out 150 t/h).
When the incoming flow approaches the shipment rate, the availability of free storage tanks becomes an important operational constraint. The digital twin (Case 1) captures occasional interruptions of the incoming flow caused by temporary shortages of available storage, resulting in an inlet flow coefficient of variation of approximately 12%. The direct-flow approximation (Case 2) completely neglects this mechanism and therefore predicts a constant inlet flow (CV = 0%). Conversely, the equivalent-tank models (Cases 3 and 4) amplify the effect, increasing the coefficient of variation to approximately 50%. These results indicate that, under balanced operating conditions, the direct-flow model underestimates the influence of the tank farm, whereas the equivalent-tank representation substantially overestimates it.

Scenario 3 – Inlet Flow Significantly Higher than Shipment Flow (in 150 t/h, out 50 t/h).
When the incoming flow substantially exceeds the shipment rate, storage capacity becomes the dominant constraint governing refinery operation. Under these conditions, the detailed internal configuration of the tank farm has little influence on upstream flow behavior, and the digital twin (Case 1) is closely reproduced by the equivalent-tank models (Cases 3 and 4), all exhibiting an inlet flow coefficient of variation of approximately 35%. The direct-flow approximation (Case 2) remains incapable of capturing this behavior, consistently predicting CV = 0% because storage limitations are ignored.
A working version of this model is also available on AnyLogic Cloud
Petroleum Refining Library free to try version can be download here
General Conclusions:
  1. The appropriate level of tank farm abstraction is primarily determined by the relationship between the incoming process flow and the outgoing shipment flow. No single modeling approach provides the highest accuracy across all operating conditions.
  2. The direct-flow approximation is suitable only when shipment capacity significantly exceeds the incoming flow. As storage constraints begin to appear, this approach systematically underestimates the influence of the tank farm on upstream refinery operation.
  3. Equivalent-tank models accurately reproduce refinery behavior only when storage capacity is the dominant operational constraint. Under balanced operating conditions, however, they significantly overestimate upstream flow disturbances caused by the tank farm.
  4. For simplified storage representations, explicit tank passportization can generally be omitted without loss of accuracy.
  5. All simplified models require calibration of the equivalent withdrawal rate. Matching the cumulative shipment volume of the reference digital twin is essential to ensure that differences in the results are caused by the storage representation itself rather than by unequal shipment capacity.

Conclusion: Tank Farms as the Core Source of Refinery Complexity

       Tank farms are not simply storage facilities. They are hybrid decision nodes that synchronize production, logistics, quality control, and shipment execution. Their representation therefore determines not only simulation accuracy but also the practical applicability of refinery optimization. No single abstraction level is universally applicable: the appropriate modeling approach depends on the balance between production and shipment flows. Selecting the appropriate level of tank farm abstraction is therefore one of the most important decisions in refinery simulation, digital twin development, and production planning.

FAQ

1. Why are tank farms so important in refinery simulation?
Tank farms define how material is stored, buffered, and redistributed. They directly affect whether production and shipment plans are feasible solution space, not just optimal. Without them, simulation models miss critical operational constraints.

2. What is the main difference between flowing and accumulative tank farms?
Flowing tank farms behave like near-continuous buffers with minimal storage time, while accumulative tank farms store residual over time and release it in discrete operations driven by demand, blending, or scheduling constraints.

3. Why do tank farms make optimization more difficult?
They introduce discrete decisions (storage allocation, routing, shipment timing) on top of continuous flow dynamics. This structure breaks assumptions used in linear and smooth nonlinear optimization models.

4. How do tank farms affect material balance?
They preserve global mass balance but introduce local constraints on where and when material can be stored or moved. This changes the feasible set of the entire system dynamically.

5. What role do tank farms play in blending?
Tank farms are where blending is physically realized. Product quality depends on how streams are distributed across tanks, making residual structure directly tied to specification compliance.

6. Why can two identical inventories lead to different outcomes?
Because distribution across tanks matters. Even if total volume is the same, constraints like capacity limits, product segregation, and routing rules can lead to different feasible operations.

7. How do tank farms interact with shipment planning?
Shipments depend on available batches, tank compatibility, and timing constraints. Even sufficient total residual does not guarantee shipment feasibility if material is not properly allocated.

8. Can refinery models ignore tank farms for simplification?
Only in very abstract models. In realistic digital twin systems or optimization tools, excluding tank farms leads to infeasible or overly optimistic results.

9. How are tank farms represented in digital twin systems like AnyLogic?
They are modeled as stateful storage nodes within a material flow network, with constraints on capacity, flows, blending logic, and shipment scheduling.

10. What makes tank farms a bottleneck in refinery systems?
They combine storage limits, discrete logistics decisions, and quality constraints. This combination makes them the primary source of infeasibility and scheduling complexity in refinery operations

11. What is tank farm simulation?
Tank farm simulation is the process of modeling how refinery storage tanks receive, store, blend, route, and dispatch petroleum products under real operational constraints. Unlike simplified inventory models, it represents storage capacity, product segregation, routing logic, shipment scheduling, and certification processes. In refinery digital twins, tank farm simulation enables engineers to evaluate how storage behavior influences production stability, logistics, and overall refinery performance.

12. Why is tank farm simulation important for refinery production planning?
Tank farm simulation is essential for refinery production planning because production schedules are feasible only when sufficient storage and shipment capacity are available. Storage constraints, inventory distribution, and shipment timing directly affect whether refinery products can be transferred, blended, certified, or shipped on time. By accurately representing these interactions, tank farm simulation helps optimize refinery logistics, improve production planning, and prevent operational bottlenecks that cannot be identified using simplified storage models alone.