Tank Farm Operating Strategy in Refineries

Why Tank Farms Determine Refinery Operating Strategy?

       This article explains a tank farm simulation model for refinery digital twin systems used in production planning and storage-constrained optimization.
       In refinery operations, the tank farm located upstream of a processing unit (Plant) is not just a passive storage buffer. It acts as a primary control layer that defines how and when oil and gas flows can be delivered to the unit, effectively shaping the operating strategy of the entire production system. This concept is a core part of tank farm simulation in refinery digital twin models, widely used in oil and gas production planning, logistics optimization, and petroleum refining systems engineering.
       In practice, the available throughput of a process unit is rarely determined solely by its technical capacity. Instead, it is constrained by the residuals in the upstream tank farm or by the throughput capacity and load level of the upstream processing Plant feeding it. Thus, the residuals level of tanks directly influences whether the unit can operate in a stable regime, must reduce throughput, or is forced into a constrained operating mode.
       Modern refinery digital twin models treat the tank farm as a dynamic system with discrete load states (minimum, low, medium, high, and maximum). Each state corresponds to a specific set of operational priorities and control functions. When storage levels are low, the primary objective is to maintain the minimum stable operating rate of downstream process units (typically around 60% of their maximum throughput) while preventing unit shutdowns. As storage levels increase, the operational focus shifts toward maximizing discharge rates and avoiding tank overfilling. Outgoing flows are constrained by the maximum throughput of downstream receiving units. If the available discharge capacity becomes insufficient, incoming tank flows are automatically reduced or completely suspended to prevent storage capacity violations.
Flow distribution should not be subordinate to the optimization of refinery product selection (i.e., determining the most economically advantageous product slate that can be produced from the incoming feedstock); on the contrary, the optimization problem must be solved under the constraints defined by the selected scheme for receiving, storing, and distributing oil and gas flows

Flow distribution constrains optimization, not vice versa!
Understanding this principle is critical for developing physically realistic refinery simulation models. A more detailed explanation is provided here.
       In this context, the tank farm effectively acts as a boundary condition generator for the refinery optimization problem. It defines the admissible space of production decisions and ensures that any scheduling or optimization logic remains physically feasible under real operational constraints. This approach is fundamental in refinery process optimization, storage constraint modeling, and digital twin-based production scheduling systems. This is a key principle in industrial digital twin simulation, tank farm modeling, and upstream oil and gas logistics optimization. This model is used in:
        - refinery production scheduling systems
        - crude oil logistics simulation
        - tank farm optimization in digital twins
        - AnyLogic-based petroleum refining models
        - industrial flow control systems

Why Production Planning Cannot Ignore Storage Constraints?

       Traditional production planning in refinery systems often assumes that process units can operate close to their nominal capacity, while feedstock availability is treated as an external input. In real operations, this assumption fails because feed availability is mediated by upstream tank farm conditions, which introduce strong physical and operational constraints.
       The tank farm introduces a coupling between supply logistics and process demand. Even if crude oil or intermediate feedstock is available in the system, it cannot be processed unless it is physically present in the upstream storage within acceptable operational limits. This creates a situation where production scheduling must be continuously reconciled with tank utilization levels. From a digital twin view, production planning is not independent—it is continuously constrained by tank farm state, which defines what schedules are physically feasible.
At low levels, production is constrained by minimum safe reserves, making high-throughput plans infeasible and enforcing stable, continuous operation. At high levels, the priority shifts to preventing overflow, forcing discharge-oriented operation that overrides efficiency optimization. At medium levels, the system operates in a balanced regime where optimization is possible but still bounded by storage dynamics.

Why Tank Farm Load Levels Are Not Constant?

       The load level of a tank farm is inherently dynamic and continuously changing over time. This variability is primarily driven by the imbalance between incoming and outgoing oil and gas flows, which are both highly non-uniform in real refinery systems.
       The incoming flow is never stable. It is inherently affected by the irregular nature of upstream crude oil and gas production itself, which fluctuates due to tank behavior, well performance variability, and production constraints. In addition, it is influenced by frequent changes in operating modes of upstream processing units, shutdowns, maintenance activities, and transitions between different production schedules. All of these factors directly affect the feed rate entering the tank farm. At the same time, the outgoing flow is also highly variable. Downstream processing units operate under their own constraints, including multiple operating modes with different minimum and maximum throughput levels. In addition, these units are periodically shut down for maintenance or switched between operating regimes, which further contributes to fluctuations in withdrawal rates.
       As a result, the tank farm continuously absorbs the mismatch between unstable supply and unstable demand, acting as a buffer that smooths system-wide variability but itself experiences constantly changing load conditions.

Five Tank Farm Load Levels

       In refinery digital twin models, the operating state of a tank farm is not treated as a continuous variable alone, but is discretized into distinct load levels. Each level represents a specific operational regime with its own constraints and control priorities. These five load states form the foundation for dynamic control logic in refinery digital twins, enabling the system to translate continuous residuals dynamics into discrete operational decisions that directly influence plant throughput and stability.
       In tank farm simulation models for petroleum refining and oil and gas systems, operating states are typically discretized into tank load levels for use in production scheduling and refinery optimization algorithms.
This discrete state representation is widely used in refinery digital twin simulation, tank farm optimization models, production scheduling systems, and oil and gas logistics planning tools.

Operating Strategy for Minimum Storage

       When tank farm levels are near minimum, the digital twin must prioritizes operational continuity over optimization. The main rule is to maintain at least the minimum stable load of the downstream Plant (typically 50–60% of nominal capacity), even if incoming flow is insufficient.
       If inflow is sufficient, the system keeps outflow slightly below inflow, allowing gradual replenishment of storage levels. If inflow is insufficient, a protective mode is activated: the digital twin prioritizes maintaining the minimum required unit load. Once the tank farm inventory is fully depleted, feed to the downstream process unit is temporarily interrupted until sufficient inflow becomes available.
       In this regime, production optimization is overridden by hard operational constraints. The tank farm effectively acts as a stability buffer, ensuring continuous plant operation under limited feed conditions.

Operating Strategy Around Normal Storage

       When the tank farm operates around medium (normal) storage levels, the digital twin reaches its most flexible and balanced regime. In this zone, neither depletion risk nor overflow risk dominates, allowing the control logic to shift toward efficiency and optimization.
       Here, the outgoing flow from the tank farm is primarily aligned with the optimal operating mode of the downstream unit. Production planning algorithms can select the most economically or operationally favorable configuration, since storage constraints do not impose immediate restrictions.
       Such variability is a central challenge in crude oil supply chain simulation, refinery logistics modeling, and dynamic production planning systems.
       At the same time, the system still maintains continuous monitoring of inflow and tank utilization dynamics. If storage begins to drift toward lower or higher thresholds, control logic gradually transitions toward minimum or maximum storage strategies to maintain stability.
       The medium regime is typically used in optimization-based refinery production scheduling, tank farm balancing algorithms, and process simulation workflows.
       In digital twin implementations, this regime is where optimization models are most effective. However, even in this state, storage remains a governing boundary condition: it defines the feasible space within which optimization operates, rather than being a passive result of production decisions.

Operating Strategy for Maximum Storage

       When the tank farm approaches maximum load levels, the digital twin enters a critical regime where storage capacity becomes the dominant constraint. The primary objective shifts from optimization to preventing overfill and maintaining safe operational margins. This control structure is commonly implemented in industrial digital twin platforms, refinery flow control systems, and AnyLogic-based petroleum simulation models.
       In this state, outgoing flow from the tank farm is maximized within the physical and technological limits of the downstream unit, which is understood as the availability of multiple operating modes, each defined by its own minimum and maximum throughput range. In practice, the least economically valuable operating modes—those that do not produce high-value products—are typically characterized by higher allowable maximum load, and therefore are preferentially used to increase overall discharge capacity. If possible, the system selects operating modes that allow higher throughput, even if they are suboptimal from an economic perspective. The priority is to reduce tank levels and avoid breaching maximum storage constraints.
       This regime represents the strongest form of constraint-driven operation. Unlike medium or minimum storage conditions, there is almost no room for optimization decisions. All control actions are subordinated to physical storage limits planning and safety requirements.
       Maximum storage conditions are critical in refinery safety constraints, oil storage optimization, and real-time digital twin control systems for tank farms.
       In digital twin implementations, this state is typically associated with emergency or high-priority operational rules that override standard production planning. The system behaves in a reactive manner, focusing entirely on restoring acceptable storage levels rather than optimizing performance.

Preventing Sawtooth Flow Oscillations

       A control strategy that resumes normal operation immediately after leaving the MIN or MAX storage state produces unstable behavior. Near the MIN threshold, discharge may restart only to stop again moments later as inventory immediately returns to the minimum level. Near the MAX threshold, inflow may repeatedly start and stop as a small amount of freed capacity is quickly consumed. This results in unrealistic sawtooth flow oscillations that are not observed in real refinery operation.
       To eliminate this effect, refinery digital twin models introduce hysteresis around the storage limits. Instead of resuming normal operation immediately, inflow or outflow is restored only after the tank level moves 5–10% away from the limiting threshold. This recovery zone ensures a stable operating period before another state transition can occur, reducing unnecessary switching and producing smooth, physically realistic flow behavior.

Petroleum Refining Library Implementation

       In the Petroleum Refining Library, this logic is implemented through a dedicated control class (RpPlantFlowSmoothing) that operationalizes the tank farm state model and links it directly to downstream plant behavior. This implementation is a core component of the Petroleum Refining Library (PRL) for AnyLogic, used in refinery digital twin simulation, tank farm modeling, and production optimization workflows.
       The class is built around a discrete storage state representation (MIN, LOW, MEDIUM, HIGH, MAX), where each state defines a corresponding set of flow constraints and control actions. Instead of treating flow limits as static parameters, the class dynamically derives them from the current tank utilization regime.
       Its core function is to translate continuous storage levels into state-dependent operational rules. Each state defines allowable inflow and outflow boundaries for both the tank farm and the connected processing unit, ensuring that plant throughput is always consistent with physical storage conditions.
       Instantiation of the RpPlantFlowSmoothing class is performed manually by the user. During construction, the constructor receives references to the tank farm, the downstream plant, and the connecting FluidExit streams. For example:
RpPlantFlowSmoothing rpPlantFlowSmoothing =
    new RpPlantFlowSmoothing(rpflowingBeforePlant, plant, plantFluidEnterFromRp);
       In addition, within the Petroleum Refining Library components, the result of the getRpAllowedOutflow() method is used inside the flowing tank farm onFlowCorrection() event .
Furthermore, in the plant located downstream of the tank farm, the updatePlantState() method of the RpPlantFlowSmoothing class must be invoked. This call should be bound to the plant events onLineParameterChanged() (Label: On change line parameters) and onInputSpeedChange() (Label: On input speed change).
       In this way, RpPlantFlowSmoothing class acts as a state-transition control layer, mapping tank farm dynamics into enforceable constraints on plant operation and providing a unified mechanism for coordinating storage behavior with production flows in the digital twin model.

Conclusion

       Tank farm operating strategy is a core control mechanism in refinery systems that determines how processing units operate under physical constraints. This hierarchy is fundamental in oil and gas refinery simulation, digital twin-based production planning, and storage-constrained optimization systems. Storage levels define not only feed availability but also the feasible operating modes of downstream units, effectively coupling inventory state with production control.
       Across all operating regimes—from minimum to maximum storage—the system continuously converts inventory conditions into throughput limits. This creates a hierarchical structure in which feasibility is enforced through storage constraints, ensuring that all operational decisions remain physically consistent. See how inventories influence the feasible product slate.
       These principles are widely applied in industrial process simulation, refinery logistics optimization, and AnyLogic-based digital twin modeling of petroleum systems.
       In digital twin models, this representation captures realistic refinery behavior driven by tank farm simulation, production planning constraints, and oil and gas logistics dynamics.

FAQ

1. Why is the tank farm critical in refinery production planning?
The tank farm acts as a physical feasibility layer between upstream supply and downstream process units. Even if crude oil or intermediate products are available in the system, production cannot proceed unless storage conditions allow it. Therefore, tank utilization directly defines whether a production schedule is feasible or not.

2. Is production optimization more important than tank farm constraints?
No. In real refinery systems, storage constraints have higher priority than optimization logic. Any production plan must first satisfy tank feasibility conditions (minimum reserves, maximum capacity limits). Optimization is only applied within this physically feasible envelope.

3. Why are tank farm load levels modeled as discrete states?
  • Tank farm behavior is highly nonlinear and unstable due to fluctuating inflows and outflows. To simplify control logic in digital twin models, the system is represented as discrete tank states: MIN, LOW, MEDIUM, HIGH, MAX
Each state defines a different operational regime and control strategy.

4. How do low tank levels affect refinery throughput?
At low storage levels, the system prioritizes operational continuity over efficiency. The downstream unit is forced to maintain minimum stable load, even if incoming flow is insufficient. This prevents shutdown but reduces optimization flexibility.

5. What happens when tank levels are near maximum capacity?
When storage approaches maximum limits, the system switches to a discharge-first strategy. Outgoing flows are maximized within unit constraints to prevent overfilling. In this regime, economic optimization is secondary to safety and storage control.

6. Can production planning ignore tank farm conditions?
No. Production planning must always be continuously reconciled with tank utilization levels. Any schedule that violates storage constraints is physically infeasible and therefore invalid, regardless of economic advantage.

7. How does a digital twin use tank farm state information?
In refinery digital twin models, tank farm state is used as a control input for scheduling and throughput decisions. The system dynamically adjusts plant operating modes based on storage level transitions between MIN, LOW, MEDIUM, HIGH, and MAX.

8. Why is the tank farm considered a boundary condition generator?
Because it defines the feasible solution space for optimization problems. Instead of optimizing freely, production planning must operate within constraints imposed by storage availability and tank dynamics.

9. How does Petroleum Refining Library implement tank farm operating logic?
In the Petroleum Refining Library (PRL), tank farm behavior is implemented through a dedicated control layer (e.g., flow smoothing and state management classes). These components:
  • convert continuous tank levels into discrete states
  • enforce inflow/outflow constraints
  • coordinate tank behavior with downstream plant operation
10. What is the role of RpPlantFlowSmoothing in Petroleum Refining Library?
This class acts as a state-transition control layer. It maps tank utilization levels into operational rules, dynamically adjusting allowable flows and ensuring that plant throughput remains consistent with storage constraints.

11. Why is medium storage considered the optimal operating regime?
At medium levels, neither depletion risk nor overflow risk dominates. This allows:
  • maximum flexibility for optimization
  • stable plant operation
  • full use of scheduling and planning algorithms
12. What happens if inflow and outflow are highly unstable?
The tank farm acts as a buffer system, absorbing mismatches between supply and demand. However, this buffering capability is limited by physical storage boundaries, which continuously force transitions between operational states.