Accumulative Tank Farm for Simulation in AnyLogic

       RpAccumulative is a AnyLogic tank farm simulation component for modeling accumulative storage systems. It simulates product accumulation, flow constraints, and dispatch logic in oil and gas logistics and refinery operations. It is designed for oil and gas logistics and refinery systems with flow constraints and dispatch logic.

       Tank Farms are a key components of oil and gas processing plants. They provide hydrocarbon filling, storage, buffering, and redistribution of flows between production units within a refinery logistics system. Depending on their position in the technological chain, tank farms operate as inlet buffers, intermediate storage nodes, or final dispatch units in refinery tank farm and petroleum terminal simulation environments.

       From a process perspective, tank farms are divided into flow-through and accumulative storage systems.This work focuses on accumulative tank farms, which support filling, storage, product certification (passportization), and shipment of production according to production scheduling and delivery plans. Runtime control of passportization and operator interactions are described in the accumulative tank farm control guide. Modeling of accumulative tank farms enables analysis of operational scenarios in petroleum refining systems under constraints of limited storage capacity. It supports evaluation of accumulation dynamics, certification delays, and shipment cycles, forming a basis for storage operations modeling, refinery logistics optimization, and storage capacity constraints analysis in complex industrial logistics systems. See Accumulative Tank Farm Performance Metrics.

       Within the Petroleum Refining Library (PRL), this functionality is implemented through the dedicated component - RpAccumulative. RpAccumulative is a tank farm simulation component designed to model accumulative storage systems with residuals dynamics, dispatch rules, and operational constraints typical for tank farm environments. RpAccumulative provides a specialized storage agent for multi-tank system dynamics in oil storage simulation and petroleum terminal simulation environments. It is used to build digital representations of refineries, oil terminals, gas processing plants, storage facilities, and other petroleum and petrochemical systems. The component is designed for tank farm simulation in AnyLogic-based discrete event models.
       RpAccumulative simulates hydrocarbon filling, storage operations, including accumulation, storage, product certification (passportization), and shipment workflows driven by production scheduling and alternative control strategies for each tank. The effectiveness of these planning strategies can be evaluated using request statistics. This enables accurate representation of storage tank farm dynamics under real operational and capacity constraints. RpAccumulative supports accounting of storage capacity constraints, analysis of hydrocarbon residual dynamics, and evaluation of operational scenarios within a refinery tank farm system. It is also applied for production plan feasibility analysis, assessment of how tank farm limitations impact overall refinery performance, and optimization of storage and dispatch strategies in complex industrial logistics systems. In RpAccumulative, a strict rule applies: one tank faram — one product.
       RpAccumulative is implemented as a reusable AnyLogic model object tank farm simulation and can be embedded into discrete-event or hybrid simulation environments.

Tank Farm simulation features

       RpAccumulative provides a comprehensive feature set for modeling accumulative tank farms in oil and gas simulation models, enabling high-fidelity representation of storage tank farm systems and refinery logistics operations.

       The component provides the following capabilities:
       - database-driven configuration of tank farms with automatic instantiation of storage tanks, including capacity constraints, allowable fill ranges, and initial conditions;
       - tank farm simulationfor Anylogic models;
       - multi-stream handling with simultaneous inbound and outbound flows in a refinery tank farm system;
       - production schedule feasibility analysis under storage capacity constraints and shipment requirements;
       - support for multiple operational modes, including production-driven operation and flow-through (direct transfer) mode;
       - bypass routing logic for feed streams when storage capacity is unavailable;
       - repair algorithms for accumulative and flowing tank farms;
       - handling of auxiliary flows, including additives, losses, and destructible streams within hydrocarbon storage systems;
       - dynamic tank reallocation between tank farms to balance storage capacity;
       - lifecycle state management of tanks, including filling, certification (passportization), shipment, and reservation states;
       - integration with shipment nodes and loading terminals, enabling automated calculation of required residual levels for production scheduling workflows;
       - support for floating or shared tanks that can temporarily belong to multiple tank farms within distributed industrial logistics systems;
RpAccumulative enables the construction of high-fidelity storage tank farm simulation models of varying complexity while preserving accurate interaction dynamics with adjacent units in complex oil and gas simulation environments

Principles of accumulative tank farms construction

       Construction of RpAccumulative is based on a user-defined tank farm configuration persisted in a database (tables objects_names, rp_accumulatives). During model initialization, the Petroleum Refining Library instantiates all storage tanks belonging to the tank farm according to this configuration. For each tank, the following parameters are defined:
        - storage capacity;
        - minimum fill level;
        - maximum fill level;
        - initial fill level;
        - initial state.
Note: A strict distinction is enforced between geometric tank capacity and the maximum allowable fill level. The maximum fill level is defined below the physical capacity to ensure compliance with operational safety constraints and process limitations in hydrocarbon storage systems.
Each tank is initialized in one of the following states: in filling - active filling mode; passportization - product certification stage; shipment - active withdrawal mode; reserve - floating tank temporarily assigned to another tank farm.
Note: Initial tank states can be programmatically modified in cases where there is a mismatch between the initial inventory levels and the configured state. For example, the “in filling” state may NOT be assigned to a tank that is already fully loaded.
       Where required, additional process attributes, including additive streams, product losses, and auxiliary flows affecting oil and gas simulation models, may be retrieved from the database. Following tank instantiation, Petroleum Refining Library automatically establishes connectivity between the tank farm and adjacent components of the process industry simulation model. A tank farm may receive one or multiple incoming streams. These sources are defined in the inputFlows[] (label R: Input flows (FluidExit[])) array. Similarly, one or more outgoing streams are defined in the outputFlows[] (label R: Output flows (FluidEnter[])) array.
       An optional bypass outlet residualOutputFlow (Label: O: Output, if busy (FluidEnter)) can be configured to receive incoming product whenever all storage tanks are unavailable for filling. This allows the inflow to continue without interruption. If no bypass outlet is specified, the inlet valve is automatically closed when the tank farm reaches its storage limit, preventing any additional product from entering the system. During the final initialization phase, the component also generates the maintenance schedule, defining the periods when individual tanks are taken out of service and subsequently returned to operation.
Note: The letter R means required; O means optional
       Although most configurations assume a single outgoing product stream, certain process schemes support simultaneous extraction of multiple products generated through phase separation of feedstock. In such cases, output distribution is governed by recipe-based allocation rules (rp_modes_separation table). This allows the tank farm to operate as a simplified separation unit within a refinery tank farm system, distributing feedstock into multiple product flows.

       An optional bypass inlet stream (residualOutputFlow, label: O: Output, if busy (FluidEnter))may be configured to redirect incoming flows when all tanks are fully occupied and intake is not possible. If no bypass stream is defined, the inlet valve is automatically closed under full-capacity conditions, resulting in suspension of incoming flow. During the final stage of initialization, maintenance schedules are generated, defining time windows for tank decommissioning and reactivation within the storage tank farm system.

Operating modes of RpAccumulative

Production planning
Accumulation and dispatch are performed in accordance with defined volumes and target end-of-period residual levels
Transfer (pumping)
Product is routed through the tank farmk without consideration of production plans. Flow handling is governed exclusively by local availability and transfer logic
Direct flow
The tank farm k is bypassed within the simulation model. Outlet flow rate is set equal to inlet flow rate, and storage and buffering behavior are disabled
Note: The current mode of RpAccumulative is defined by the parameters useForPumping (label: Use for pumping) and isDirectFlowMode (label: Direct flow).

Production planning mode

       RpAccumulative operates in a production planning mode, in which accumulation and discharge processes are governed by a priority-based request system generated by the downstream Shipment nodes. The control logic is structured into four hierarchical priority levels (menu section: Reservoir park requests):
       Priority A. Current month plan fulfillment — residuals allocation is performed to ensure execution of the current month’s shipment plan, taking into account existing residuals product levels within the tank farm.
       Priority B. Next month pre-accumulation — After satisfaction of current-period demand, additional residuals is accumulated to support planned shipments in the subsequent month.
       Priority C. Final tank top-up — When required, the last active tank is filled to the minimum operational volume necessary to enable certification (passportization) and subsequent shipment.
       Priority D. User-defined reserve volume — Remaining available storage capacity is allocated to user-defined accumulation targets.

       For runtime management of filling requests and event-driven integration, see accumulative tank farm control in refinery digital twins.
       This hierarchical prioritization ensures deterministic coordination between accumulation and discharge processes while maintaining compliance with storage constraints and operational limits of the tank farm. A detailed specification of the underlying tank control mechanisms is provided in a separate publication.

Numerical Stability Parameters

       To ensure robust operation of the accumulative tank farm, the simulation algorithm employs several internal control constants. Rather than representing physical characteristics of the process, these parameters define numerical tolerances and operational margins that improve the stability of tank state transitions and reduce unnecessary control actions.
       The internal control constants can be customized using the Constants builder. The following example overrides only one parameter, while all remaining constants retain their default value
self.constants = self.new Constants()
        .builder()
        .MIN_LOAD_OFFSET(0.07)
        .MAX_LOAD_OFFSET(0.07)
        .build();

Integration with AnyLogic simulation and other Petroleum Refining Library components

       The RpAccumulative component is designed specifically for tank farm simulation in AnyLogic-based discrete-event models. RpAccumulative is integrated with Anylogic fluid library and some other Petroleum Refining Library components, witch typically positioned downstream of the tank farm within the process chain architecture. This enables the implementation of a request-based control system.
       ShipmentNode - contains planned product delivery volumes loaded from a database. RpAccumulative interacts with one or multiple shipment nodes (priorityAShipmentNodes, label: - R: shipment nodes (ShipmentNode[])) and, based on defined production plans, determines additional residuals requirements necessary to ensure fulfillment of the production program.

ShipmentNode
       Loading Rack - is used for modeling product loading into railway tank cars. This integration (priorityALoadingRacks, label: - O: loading racks (LoadingRack[])) enables the system to account for product volumes already “at wheels”, as well as operational delays associated with train arrival, loading operations, and dispatch. Incorporation of loading rack dynamics directly influences required residuals levels within the tank farm and improves the accuracy of shipment modeling and production plan execution. The effectiveness of these planning strategies can be evaluated using request statistics.

LoadingRack
       The combined use of RpAccumulative, Shipment nodes, and Loading racks enables end-to-end modeling of product movement — from accumulation in storage tanks to final dispatch to external consumers.

Typical application areas

       RpAccumulative is applicable to the development of simulation models across a wide range of oil, gas, and petrochemical production systems. Due to its support for production planning, storage constraints, and advanced tank control logic, the component can be used to represent both individual tank farms and large-scale industrial production networks.

       Application domains include:
        - crude oil and intermediate product storage systems at oil refineries;
        - tank farms at gas processing facilities;
        - oil depots and bulk storage terminals;
        - intermediate storage systems located between processing units in refinery chains;
        - finished product storage facilities;
        - storage systems for unstable gas condensate, crude oil, and related hydrocarbon streams;
        - tank farms within petrochemical production facilities.

       Additionally, RpAccumulative can be used as tank farm simulation component for Anylogic to model interactions between multiple tank farms, evaluate production plan feasibility, and analyze the impact of storage constraints on overall refinery performance. In general, the component is applicable to any system requiring accumulation, storage, certification (passportization), and dispatch of liquid hydrocarbon products within industrial process environments.
RpAccumulative supports both individual tank modeling and large-scale tank farm systems, including distributed storage networks. The component enables interaction between multiple independent tank farms through shared “floating” tanks. This functionality enables the modeling of large integrated oil refineries, gas processing plants, and petrochemical complexes.

Example Model: Accumulative Tank Farm Simulation in AnyLogic

       The following example demonstrates the application of accumulative tank farm (RpAccumulative) for modeling two interconnected accumulative tank farms within a refinery logistics system.
       The model begins with two independent product sources, which can represent upstream process units or any other hydrocarbon suppliers. In the default configuration, both sources continuously generate a constant flow of 150 t/h. The first source supplies Crude Oil Grade 1, while the second supplies Crude Oil Grade 2. Both crude oil grades first enter the intermediate tank farm (3 tanks with a total capacity of 90,000 t), where it is accumulated, and transferred (by default 250 t/h) to the finished tank farm (5 tanks with a total capacity of 150,000 t).
       The finished tank farm performs final accumulation, optional passportization (by default 24 h), and shipment (by default 600 t/h). Unlike the intermediate tank farm, it operates using the built-in Priority A–B–C–D production planning algorithm. The system first accumulates residuals required to satisfy the current month's shipment plan 100,000 t (Priority A), then prepares additional residuals (by default 50,000 t) for the following month's plan 120,000 t (Priority B), and finally creates the minimum operational residuals (by default 22,000 t) in the last tank required for passportization (Priority C).
       The example also demonstrates user-controlled tank reallocation between the two tank farms. Using the built-in menu of each tank farm, users can place a tank into the Reserve state, making it available for assignment to another park. This allows storage capacity to be redistributed during simulation according to changing operational requirements. In this example, the total number of tanks is limited to eight.
       To illustrate maintenance planning, one tank in the intermediate tank farm is taken out of service from 13 January to 20 January, reducing available storage capacity and creating additional transfer constraints.

Interactive Runtime Control

Initial Simulation Parameters. Before starting the simulation, users can configure the initial production planning strategy directly in AnyLogic Cloud. These parameters are available only before the simulation starts and define how the finished product accumulative tank farm generates Priority B and Priority C filling requests throughout the experiment. The user can enable or disable Priority B (next-month residuals accumulation), specify the minimum residuals required for the following month's production plan, and define an additional accumulation target. For Priority C, users can activate the automatic top-up strategy and configure the minimum product quantity required in the active tank before passportization and shipment. These settings make it possible to evaluate different production planning strategies without modifying the model itself.
Runtime Model Control. During simulation, users can interactively modify key operating parameters through the built-in Model Control Panel without stopping the model. This allows different operating scenarios to be evaluated immediately while observing their impact on product accumulation, storage utilization, transfer operations, and shipment performance.

       The control panel provides runtime adjustment of:
        - crude Oil Grade 1 and crude Oil Grade 2 feed rates supplied by the source nodes;
        - shipment rates for both the intermediate and finished product accumulative tank farms;
        - passportization (certification) duration for each accumulative tank farm;
        - dynamic tank management, allowing users to remove tsnks from one accumulative tank farm, place them into the Reserve state, and assign them to another tank farm through the tank farm's built-in menu.
All changes are applied immediately during simulation, enabling rapid what-if analysis of changing production conditions, storage constraints, and shipment requirements.

Typical Simulation Scenarios

       The example model can be used to evaluate a wide range of operational and production planning scenarios for accumulative tank farms. By modifying model parameters during simulation, users can analyze how changes in operating conditions affect storage utilization, product accumulation, and shipment performance.

       Typical simulation scenarios include:
        - changing crude oil feed rates supplied by upstream production units;
        - evaluating the impact of scheduled tank maintenance on product transfer operations and storage capacity;
        - analyzing the influence of passportization duration on storage utilization;
        - testing Priority A, B, and C production planning strategies;
        - evaluating the impact of tank maintenance on product transfer operations and storage capacity;
        - dynamically reallocating tanks between accumulative tank farms;
        - identifying storage bottlenecks and overflow conditions;
        - comparing alternative operating strategies using real-time performance indicators.
       Note: The interactive model also demonstrates the shipment planning node component, which executes daily and monthly shipment plans based on refinery production schedules. Shipment Node monitors planned material transfers, coordinates product dispatch with tank inventory, and supports multiple shipment execution strategies.
       Note: All Model parameters are configured on the model experiment page. The interactive simulation uses the selected settings and does not allow parameter changes while the model is running.
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, reallocating tanks, and evaluating different operating scenarios 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

FAQ

tank What is RpAccumulative used for?
It is used for tank farm simulation and accumulative storage modeling in AnyLogic.

Is it compatible with AnyLogic?
Yes, it is designed as a reusable AnyLogic simulation component.

Can tank farms consisting of multiple tanks be modeled?
Yes. RpAccumulative supports tank farms of arbitrary configuration with individual parameters defined for each tank.

Are multiple incoming and outgoing flows supported?
Yes. The component supports simultaneous handling of multiple incoming and outgoing streams.

Can production plans be taken into account?
Yes. RpAccumulative supports production planning mode and allows implementation of custom control algorithms.

Can the component be used without production plans?
Yes. In transfer mode, product is routed through the system without consideration of shipment plans or target residuals levels.

What happens if all tanks are occupied?
Incoming flow may be redirected to a bypass pipeline. If no bypass is defined, intake is automatically suspended until storage capacity becomes available.

Is maintenance and tank downtime supported?
Yes. RpAccumulative supports maintenance scheduling and temporary exclusion of individual tanks from operation.

Can additives and product losses be modeled?
Yes. The component supports auxiliary streams, including additives, losses, and destructible flows.

Can products in railway tank cars be accounted for?
Yes. When using a loading terminal model, RpAccumulative accounts for product volumes “in transit” and adjusts required residuals levels accordingly.

Does the component integrate with shipment nodes?
Yes. RpAccumulative retrieves shipment plans and automatically determines required accumulation volumes.

Can multiple interacting tank farms be modeled?
Yes. The component supports interaction between multiple tank farms and the use of floating (shared) tanks.

Can different hydrocarbon products be modeled?
Yes. RpAccumulative supports crude oil, unstable gas condensate, intermediate streams, and finished products. However, each tank farm is limited to a single product type.

Can model parameters be loaded from a database?
Yes. Configuration data, initial residuals, maintenance schedules, shipment plans, and additional model parameters can be loaded from a database.

Can custom control algorithms be implemented?
Yes. Users are not restricted to built-in logic and can implement custom accumulation and discharge control strategies.

Can a Tank farm be temporarily excluded from the model?
Yes. Direct flow mode can be used, in which outlet flow equals inlet flow and tank farm dynamics are bypassed.
Petroleum Refining Library free to try version can be download here