Flowing Tank Farm for Simulation in Anylogic

       RpFlowing is an AnyLogic tank farm simulation component for modeling flowing storage systems. It simulates flow smoothing, automatic outlet flow control, inventory management, and hydraulic buffer behavior in oil and gas, petroleum refining, and Digital Twin applications. Designed for continuous refinery processes, the component supports multiple operating modes that automatically adapt to changing process conditions while maintaining stable downstream flow.

       Modern refineries operate under continuously changing process conditions, making flow smoothing an essential part of refinery operation. Variations in feedstock supply, process unit performance, and operating conditions create unavoidable fluctuations in intermediate product flows that must be stabilized before reaching downstream units.
Oil refinery tank farms perform this function by acting as dynamic flow buffers rather than conventional storage facilities. Their primary objective is to maintain a stable outlet flow while keeping inventory (residuals) within safe operating limits.

       The Petroleum Refining Library (PRL) provides the Reservoir Park Flowing (RpFlowing) agent for realistic refinery simulation and tank farm simulation, digital twin, refinery production planning, refinery scheduling, and process optimization applications. Unlike storage-oriented models, RpFlowing dynamically adjusts the outlet flow according to changing inlet conditions and residuals, enabling accurate simulation of flowing tank farms for process optimization, refinery planning, and Digital Twin applications.

Why Flow Smoothing Matters?

       Flow fluctuations are an inherent part of the oil and gas industry. Large production volumes, non-uniform field production, multiple upstream feed sources, and long transportation pipelines continuously create variations in flow rates. As these fluctuations propagate through interconnected processing units, oil refinery tank farms become essential for stable refinery operations, flow smoothing, and production planning and refinery scheduling. To maintain stable downstream operation, many tank farms function as dynamic flow buffers rather than conventional storage facilities. They continuously automatic outlet flow control according to changing inlet conditions while keeping inventory within operational limits.
       The Flow Smoothing algorithm is used not only in tank farm simulation but also for smoothing production schedules from oil fields, pipelines, terminals, and other external supply sources.
For more information, refer to Flow Smoothing in Feedstock Supply and Production Planning.

Automatic Flow Control

       The Flowing tank farm acts as a hydraulic buffer tank that absorbs inlet flow fluctuations before downstream processingits. Its primary purpose is to absorb fluctuations in the incoming product flow while maintaining a stable shipment rate whenever possible. The tank farm also provides temporary storage when the inlet and outlet flow rates become unbalanced. Although a real tank farm may consist of multiple tanks operating in different states, the component models the entire facility as a single equivalent storage whose inventory represents the total product stored in all tanks. This simplified representation preserves the hydraulic behavior of the tank farm while significantly improving simulation performance.
The inventory changes continuously according to the difference between the inlet and outlet flow rates:

Inlet flow = Outlet flow — the inventory remains constant.

Inlet flow > Outlet flow — the inventory increases.

Inlet flow < Outlet flow — the inventory decreases.

       When automatically recalc shipment speed is enabled, the outlet flow is periodically adjusted to keep the inventory close to the target operating level. The outlet flow correction algorithm operates in several control modes, automatically selecting the appropriate strategy according to the current process conditions. The automatically calculated outlet flow is constrained by the configured minimum and maximum pumping capacities and by the maximum allowable flow adjustment per control step. These operational constraints prevent unrealistic hydraulic transients while preserving stable downstream operation. When automatic regulation is disabled, the tank farm operates in pumping mode, where the outlet flow is determined solely by downstream hydraulic conditions. This approach combines realistic process dynamics with high computational efficiency, making flowing tank farm suitable for large-scale refinery Digital Twin, production planning, and process optimization models.
       To achieve computational efficiency suitable for large-scale refinery Digital Twin and production planning models, flowing tank farm is based on several simplifying assumptions. The model assumes ideal mixing of an incompressible liquid within equivalent tank groups, instantaneous mixing inside each group, neglects hydraulic pressure calculations, and does not explicitly simulate pipeline transport delays. These assumptions preserve the key dynamic behavior required for flow smoothing while significantly reducing computational complexity, consistent with the simulation approach presented in Tank Farm Simulation Algorithm for Refinery Digital Twin Models (Unlimited Receiving Tank Farm Capacity Case.

Tank Farm Flowing Simulation Features

       The flowing tank farm agent provides a comprehensive set of features for realistic tank farm simulation in refinery digital twin models. It is specifically designed for continuous flow systems where the primary objective is flow smoothing rather than long-term product storage.
       Key capabilities include:
        - dynamic process control and automatic flow control – automatically adjusts outlet flow to changing inlet conditions;
        - flow smoothing – stabilizes downstream flow while maintaining material balance;
        - ideal mixing – simulates homogeneous mixing of incoming and stored products;
        - pump constraints – supports configurable minimum, maximum, and ramp-rate limits;
        - multiple streams – handles multiple inlet streams and single or multiple outlet products;
        - tank maintenance – simulates unavailable tanks and reduced storage capacity;
        - inventory control and inventory management – automatically tracks inventory and operating levels;
        - process integration – integrates with upstream and downstream refinery units;
        - digital twin ready – fully compatible with AnyLogic and the Petroleum Refining Library.
Flowing Tank Faram simulates tank farms that stabilize downstream flow by dynamically adjusting the outlet rate according to changing inlet conditions and inventory levels. It continuously maintains the inventory near the target operating level while respecting configured operating constraints.

Principles of flowing tank farm construction

       The flowing tank farm agent is configured using the rp_flowing database table, which defines the structure and operating parameters of the tank farm. Unlike individual tank modeling, configuration is performed at the tank group level, where each group of parallel tanks is replaced by a single equivalent tank with the same total storage capacity. The configuration includes:
        - group storage capacity,
        - operating levels,
        - initial inventory,
        - number of parallel group tanks.
       Each flowing tank farm also includes configurable pump limitations and flow control parameters. Unlike accumulative tank farm, where tanks alternate between filling and shipment, all active tanks in flowing tank farm operate continuously in both modes simultaneously. Incoming product is mixed with the existing inventory while the same tanks continuously supply the downstream process.
       Additional process attributes, including auxiliary streams, product losses, and other process-specific parameters, can also be loaded from the database when required. After initialization, the Petroleum Refining Library (PRL) automatically connects the tank farm to adjacent process units within the refinery model. The component supports one or more incoming streams through the inputFlows[] array (R: Input flows (FluidExit[])) and one or more outgoing streams through the outputFlows[] array (R: Output flows (FluidEnter[])), enabling seamless integration into complex refinery process networks.
Note: The letter R means required; O means optional
     While a single outlet stream is sufficient for most refinery applications, flowing tank farm also supports multiple product streams. In such configurations, the incoming feed is continuously divided between the outlets according to configurable recipe-based separation rules stored in the rp_modes_separation table. This functionality allows the component to model simplified phase separation and product routing without introducing a dedicated separation unit.
       An optional bypass flow (residualOutputFlow, FluidEnter) allows incoming product to be redirected whenever the tank farm is unable to accept additional feed. If a bypass is not configured, the inlet flow is automatically blocked once the storage capacity is fully utilized. During initialization, the component also creates maintenance schedules that control the temporary shutdown and return of individual tanks.

Operating modes of RpFlowing

Flow
Correction
Continuously adjusts outlet flow to maintain target inventory and stable downstream operation
Steady
Flow
Monitors inventory periodically while maintaining balanced inlet and outlet flow conditions
Pumping
Down
Gradually reduces outlet flow after inlet flow stops to maximize operating time
Overflow
Protection
Prevents tank overfilling by stopping or bypassing incoming flow when required.
Direct
Flow
Direct transfer of incoming flow without storage participation
The flowing tank farm can operate in the following modes:
       Flow Correction - the primary operating mode that continuously adjusts the outlet flow according to inlet conditions and inventory level. It maintains stable downstream operation during normal refinery operation. Depending on the autoAdjustOutflowSpeed parameter (label: Automatically recalc shipment speed), the outlet flow is either calculated automatically or controlled by an external source.
       Steady Flow - activated when the target inventory has been reached and inlet and outlet flows are balanced. The algorithm periodically monitors the tank farm until operating conditions change.
       Pumping Down - activated when the inlet flow is interrupted. The outlet flow is gradually reduced to the minimum sustainable rate, maximizing downstream operating time.
       Overflow Protection - activated when the maximum operating inventory is reached. Incoming flow is stopped or bypassed until the tank farm returns to a safe operating range.
       DirectFlow - transfers incoming product directly to the outlet without using tank storage or flow regulation. This mode is suitable when intermediate storage and flow smoothing are not required.
       For a detailed description of all operating modes, state transitions, and control algorithms, see the article: Flowing Tank Farm Algorithms.

Typical application areas

       Flowing tank farm is intended for oil refinery tank farms where the primary objective is flow smoothing rather than long-term storage or shipment scheduling. Typical applications include:
  • Crude tank farms supplying stable feed to atmospheric and vacuum distillation units.
  • Intermediate tank farms balancing flow between successive processing units.
  • Pipeline buffer systems used in refinery logistics and product transportation compensating for fluctuations during product transfer.
  • Stabilized condensate storage with continuous transfer to downstream facilities.
  • LPG buffer systems maintaining stable feed and product flow.
  • Blending and transfer systems requiring continuous, well-balanced outlet streams.
These applications are commonly found in refinery digital twin models, where realistic tank farm simulation is essential for accurate production planning and process optimization.
Flowing Tank Farm supports both individual tank farm models and large-scale refinery flow networks. It smooths flow fluctuations between interconnected process units while maintaining inventory within operating limits, providing realistic tank farm simulation for refinery Digital Twin and production planning applications.

Automatically recalc shipment speed parameters

       When automatically recalc shipment speed (autoAdjustOutflowSpeed) is enabled, the tank farm automatically adjusts its outlet flow to maintain a stable inventory level and smooth fluctuations in the incoming flow. The shipment speed is periodically recalculated within the configured operating limits and applied gradually to avoid abrupt hydraulic changes.

       The automatic flow controller is configured using the following parameters:

Example Model: Flowing Tank Farm Simulation in AnyLogic

       The following example demonstrates the application of the Flowing Tank Farm for modeling a refinery buffer tank farm whose primary purpose is flow smoothing rather than long-term product storage. A configuration like this is commonly used inside and at t the outlet of a refinery to smooth flow fluctuations before the product enters a pipeline.
       The model consists of a single product source supplying crude oil to the tank farm and a downstream consumer receiving the stabilized outlet flow. The inlet flow is generated with configurable random fluctuations around the specified mean value, allowing users to investigate the influence of flow variability and inlet flow fluctuations on tank farm performance. Users can adjust the mean inlet flow rate (by default μ = 500 t/h), its standard deviation (σ = ± 200 t/h), the flow update interval (t = every hour), and the maximum allowable downstream pumping rate (v =1 000 t/h, i.e. unlimited) to create different operating scenarios. The inlet flow is generated by randomly sampling flow rates from a normal (Gaussian) distribution with the specified mean value and standard deviation.
       The buffer RpFlowing consists of four parallel tank groups, each with a minimum operating inventory of 100 t and a maximum operating capacity of 12,000 t (max load = 10 000 t). The total initial inventory of the tank farm is 6,000 t, providing sufficient storage for dynamic flow balancing and smoothing throughout the simulation.
       The RpFlowing component continuously regulates the outlet flow while maintaining inventory within refinery operational constraints within the specified operating limits. Depending on the relationship between the inlet and outlet flow rates, the model automatically switches between the main operating modes, including Flow Correction, Overflow Protection, and Pumping Down. The automatic control algorithm incorporates realistic operational constraints of refinery outlet pumping equipment, including configurable minimum and maximum pumping capacities ([100; 1000] t/h) as well as a limited rate of outlet flow adjustment (± 100 t/h), ensuring physically realistic realistic process dynamics and dynamic behavior suitable for Digital Twin, production planning, and process optimization studies.
       The dashboard displays both inlet and outlet flow statistics in real time. The primary performance indicator is the flow rate standard deviation, allowing users to quantitatively evaluate the effectiveness of flow smoothing. The model clearly demonstrates how the flowing tank farm significantly reduces downstream flow variability while maintaining stable operation and safe inventory levels.
Important: This is not a video demonstration! It is a fully interactive digital twin running in AnyLogic Cloud. Feel free to experiment with the model by changing process parameters in real time.
A working version of this model is also available on AnyLogic Cloud
Watch the full model walkthrough on our YouTube channel

Petroleum Refining Library free to try version can be download here

Conclusions

Flowing tank farm provides a realistic representation of refinery tank farms whose primary purpose is flow smoothing rather than long-term storage or shipment scheduling. By dynamically adjusting the outlet flow according to changing inlet conditions, the component reproduces the behavior of continuous flow systems while maintaining inventory within refinery operational constraints within operational limits.
Integrated into the Petroleum Refining Library (PRL), flowing tank farm enables accurate tank farm simulation for Digital Twin applications, refinery production planning, and process optimization. Together with accumulative tank farm, it allows engineers to select the most appropriate tank farm model based on the actual operating philosophy of the facility, improving both simulation accuracy and model efficiency.

FAQ

1 What is a flowing tank farm?
A flowing tank farm is a storage system designed primarily for flow smoothing rather than long-term product storage. It continuously adjusts the outlet flow to compensate for fluctuations in the incoming flow while maintaining inventory within operational limits.

2 When should Flowing Tank Farm be used?
Flowing tank farm should be used when the primary objective is to stabilize downstream flow. Typical applications include crude tank farms, intermediate storage systems, pipeline buffers, stabilized condensate storage, and LPG buffer systems.

3 What is the difference between Flowing and Accumulative Tank Farm?
Flowing tank fatm dynamically regulates the outlet flow according to changing inlet conditions, making it suitable for continuous refinery processes. Accumulative Tank Farm is designed for storage-oriented operations, where inventory management and shipment scheduling are the primary objectives. Learn more here.

4 Does Flowing Tank Farm simulate individual tanks?
Yes. The component internally consists of standard Tank objects with configurable physical parameters. During normal operation, all active tanks are filled and discharged simultaneously, maintaining approximately the same inventory level.

5 Can Flowing Tank Farm simulate multiple products?
Yes. While most applications use a single outlet stream, the component also supports recipe-based separation, allowing multiple product streams to be generated from a common feedstock.

6 Can Flowing Tank Faram be used in Digital Twin applications?
Yes. Flowing Tank Farm is specifically designed for Digital Twin models of oil refineries and gas processing plants, where realistic tank farm simulation, flow smoothing, and material balance are required for production planning and operational analysis.
Petroleum Refining Library free to try version can be download here