Tank Repair Simulation for Flowing Tank Farms in Refinery Digital Twin Models

       Tank maintenance is an integral part of refinery operation and refinery production planning.During tank maintenance, one or more tank groups are temporarily removed from service, reducing the available tank farm storage capacity and affecting refinery production planning, continuous flow control, and refinery logistics. This article presents the tank maintenance simulation algorithm implemented in the Reservoir Park Flowing (RpFlowing) component of the Petroleum Refining Library for refinery process simulation and refinery digital twin models.
       For flowing tank farms, the impact is even greater. Since these facilities continuously receive and deliver material while buffering flow fluctuations between process units, reducing the number of available tank groups decreases the effective buffer storage capacity used for continuous flow stabilization.
       Therefore, refinery digital twin models intended for production planning and operational decision support must explicitly account for maintenance events. Otherwise, the model overestimates available storage capacity and may generate operational scenarios that are infeasible in practice.
       The proposed approach models the temporary removal of an equivalent tank group while preserving continuous operation and existing flow control strategies.

Maintenance Modeling Principles

       Unlike conventional tank farm models, the flowing tank farms represents as a set of equivalent tank groups rather than individual physical tanks. Each group represents multiple physical tanks with identical operating characteristics and the same equivalent storage capacity. During normal operation, all active groups maintain the same inventory level and are filled and emptied simultaneously. The tank maintenance simulation algorithm is therefore implemented by temporarily removing one equivalent tank group from service. Since all groups are mathematically identical, the choice of a specific group does not affect simulation results. Before maintenance begins, the product contained in the selected group is redistributed uniformly among the remaining active groups until the repaired group reaches its minimum non-pumpable inventory. After maintenance is completed, the reverse redistribution restores the repaired group to the common inventory level of the operating tank farm. This approach differs from maintenance simulation in accumulative tank farms, where individual tanks are prepared for repair separately, by maintaining a uniform inventory distribution across equivalent tank groups throughout the maintenance process
As a result, maintenance reduces the effective storage capacity without changing the operating logic of the flowing tank farm. The existing continuous flow control algorithms continue to operate normally using the updated available capacity.

Maintenance Simulation Algorithm

       Tank maintenance is executed according to a predefined maintenance schedule. Before maintenance starts, the algorithm first checks whether the remaining tank groups have sufficient free capacity to accommodate the inventory of the group being repaired. If this condition is not satisfied, the maintenance event is discarded.
       Otherwise, the procedure consists of three stages:
  1. Drain. The selected tank group is emptied to its minimum non-pumpable inventory, while the transferred product is uniformly redistributed among the remaining active groups.
  2. Maintenance. The group is removed from service, reducing the effective storage capacity of the flowing tank farm.
  3. Fill. After maintenance, the product is redistributed back until all active groups again reach the same inventory level.
       The inlet and outlet flows continue operating throughout the maintenance procedure, preserving continuous refinery operation. Since redistribution is performed at a significantly higher rate than the process flows, its impact on normal tank farm operation is negligible.

Integration with Flow Control

       The maintenance algorithm operates independently of the in and out flows control logic. Instead of modifying inlet or outlet flow calculations, it temporarily changes the available tank farm storage capacity. As a result, all operating modes - including Flow Correction, Steady Flow, Overflow Protection, and Pumping Down - continue functioning without modification while automatically adapting to the updated storage configuration. This approach enables realistic tank maintenance simulation without affecting the existing process control strategy.

       The general principles of maintenance simulation in refinery digital twin models are described in Refinery Maintenance Simulation: Modeling Shutdowns and Repairs in Digital Twins.

Tank Repair Algorithm in Petroleum Refining Library

       The Reservoir Park Flowing (RpFlowing) component provides provides built-in support for scheduled tank maintenance and repair simulation.
       Tank maintenance schedules are stored in the rp_tanks_repairs database table. Each record specifies the maintenance period (Date start and Date end), activation flag, and descriptive information. During simulation, the Petroleum Refining Library automatically processes these records and initiates the corresponding maintenance events according to the defined schedule.
       At the scheduled time, the algorithm verifies that sufficient storage capacity is available for inventory redistribution. If the condition is satisfied, an equivalent tank group is automatically removed from service and its inventory is redistributed among the remaining active groups. After maintenance, the reverse redistribution restores the original storage configuration. Throughout the maintenance process, the inlet and outlet flow control algorithms continue operating without modification. Maintenance therefore models the temporary reduction of available storage capacity, allowing the digital twin to reproduce the operational impact on refinery production planning of scheduled repairs without modifying the existing control algorithms.
       The current implementation supports maintenance of only one equivalent tank group at a time, reflecting standard refinery practice where repairs are performed sequentially to preserve available storage capacity and stable operation.

Conclusion

       The proposed maintenance algorithm enables realistic simulation of scheduled repairs in flowing tank farm digital twin models without interrupting continuous process operation. By temporarily removing an equivalent tank group and redistributing its inventory among the remaining groups, the model captures the reduction in available storage capacity while preserving the existing flow control strategy and material balance. This approach improves the realism of refinery digital twin simulations used for production planning, optimization, and operational decision support, allowing maintenance constraints to be evaluated together with normal process dynamics. The proposed approach can be incorporated into refinery simulation software and digital twin software used for production planning and operational decision support.

FAQ

1. Why is tank repair simulated in refinery digital twin models?
Tank repairs temporarily reduce the available storage capacity, potentially affecting flow stabilization, production planning, and refinery logistics. Simulating these events allows engineers to evaluate operational constraints, identify bottlenecks, and validate production scenarios before implementation.

2. Why does RpFlowing use equivalent tank groups instead of individual tanks?
The RpFlowing component is designed to simulate continuous flow behavior rather than individual tank operations. Representing multiple physical tanks as equivalent groups preserves the hydraulic characteristics of the tank farm while significantly reducing model complexity and improving simulation performance.

3. Does tank maintenance interrupt refinery operation?
No. The inlet and outlet flows continue operating throughout the maintenance process. The simulation reflects only the temporary reduction in available storage capacity while maintaining continuous refinery operation.

4. What happens if there is not enough free storage capacity?
Before maintenance begins, the algorithm verifies that the remaining active tank groups can accommodate the redistributed inventory. If sufficient capacity is unavailable, the maintenance operation is rejected because it would violate the physical storage constraints of the tank farm.

5. How is the tank group selected for maintenance?
All equivalent tank groups are mathematically identical and interchangeable. Therefore, the algorithm automatically selects the first available group, ensuring deterministic simulation results without affecting the hydraulic behavior of the model.

6. Does maintenance modify the flow control algorithm?
No. Maintenance and flow control are completely independent. Maintenance changes only the available storage capacity, while all operating modes—including Flow Correction, Steady Flow, Overflow Protection, and Pumping Down—continue operating without modification.

7. Why is inventory redistributed before and after maintenance?
Inventory redistribution maintains a uniform inventory level across all active tank groups. This preserves the mathematical consistency of the equivalent-tank representation while accurately reflecting the temporary loss and restoration of storage capacity.

8. Can tank maintenance be included in refinery production planning, maintenance scheduling, and what-if scenarios?
Yes. Maintenance schedules can be simulated together with normal refinery operation, allowing engineers to evaluate production plans, storage utilization, equipment availability, and operational decisions under realistic maintenance constraints.

9. Can multiple tank groups be under maintenance simultaneously?
No. The current implementation supports maintenance of only one equivalent tank group at a time, reflecting standard refinery practice where repairs are scheduled sequentially to preserve available storage capacity and stable operation.