Dynamic Tank Repair Management in Refinery Tank Farm Simulation (part 1 accumulative tank park)

       Storage tank repair is a routine but operationally critical activity in every refinery. Throughout the year, tanks are periodically taken out of service for inspection, cleaning, internal maintenance, equipment replacement, or regulatory compliance. Although these activities are planned in advance, they directly affect storage capacity, production planning, and product logistics.
Unlike process equipment, a accumulative tank cannot simply be switched to an repair state. Before maintenance begins, the remaining product must be safely transferred to other available tanks while maintaining product quality, preserving mass balance, and ensuring sufficient free storage capacity. At the same time, the refinery must continue meeting shipment schedules and supplying downstream processing units without interruption.
       These operational constraints make tank repair a complex logistics problem rather than a simple equipment status change. The maintenance process must be coordinated with residual levels, tank availability, production plans, and product movements across the entire tank farm.
       For this reason, realistic tank repair simulation requires much more than disabling a storage tank in the model. A digital twin must simulate product redistribution, validate available storage capacity, automatically select suitable tanks for maintenance, and preserve normal refinery operations throughout the repair process. This article explains how Petroleum refining Library models these operations using an event-driven repair algorithm for accumulative tank farms.
Note: The repair algorithm described in this article applies specifically to RpAccumulative tank farms. RpFlowing uses a different maintenance algorithm designed for continuous-flow storage systems, where repair logic follows different operational principles and does not require sequential product redistribution.

Why Simple Tank Deactivation Does Not Work?

       In many simulation models, tank maintenance is represented by simply changing the tank status to repair. While this approach is easy to implement, it does not reflect real refinery operations. A storage tank cannot enter maintenance while it still contains product. Before repair begins, the remaining inventory must be transferred to other available tanks with sufficient free capacity. This process must preserve mass balance, maintain product quality, and avoid disrupting production or shipment schedules.
       Ignoring these operational constraints can lead to unrealistic simulation results and inaccurate evaluation of maintenance plans. A refinery digital twin should therefore model the complete repair workflow, including product redistribution and storage capacity validation, rather than treating maintenance as a simple state change.

Real Refinery Workflow Before Tank Repair

       Before a storage tank can be taken out of service, refinery operators must ensure that the remaining product is safely transferred to other available tanks. This transfer is planned in advance and depends on available storage capacity, tank operating states, and current production and shipment schedules.
       Only after the tank has been sufficiently emptied can it be isolated and moved to the repair state. Once maintenance is completed, the tank returns to normal operation and becomes available for future filling. In most refinery operations, the transferred product is not pumped back into the repaired tank, as the storage system has already adapted to the new residual distribution. This workflow ensures uninterrupted production while maintaining residual balance and maximizing the availability of the tank farm.

Tank Repair Algorithm in Petroleum Refining Library

       PRL simulates tank repair as a controlled, event-driven process rather than a simple equipment state change. The objective of the algorithm is to prepare a storage tank for maintenance while preserving mass balance, maintaining product availability, and minimizing the impact on production and shipment operations.
       When a repair request is received, the system first determines how many tanks should be taken out of service and automatically selects the most suitable candidates for maintenance. Tanks with the lowest inventory are preferred because they require the least amount of product redistribution. Whenever possible, shipment tanks and reserve tanks are excluded from consideration to avoid disrupting refinery logistics.
       Before any maintenance begins, the algorithm evaluates whether the remaining tanks have sufficient free capacity to accommodate the product stored in the selected tank. If the available storage volume is insufficient, the repair operation is postponed until enough capacity becomes available. This prevents unrealistic situations in which a tank is removed from service without a feasible destination for its inventory.
       If the capacity check is successful, the remaining product is transferred through a sequence of pumping operations. Rather than moving the entire inventory instantaneously, PRL simulates the redistribution process between connected tanks. As each receiving tank reaches its allowable capacity, the algorithm automatically selects the next available destination and continues pumping until the repair tank reaches its minimum operating level.

Tank repair cannot start if:
  • there is insufficient free storage capacity;
  • no suitable receiving tanks are available;
  • operational constraints prevent product redistribution.
       Receiving tanks are selected dynamically according to their operating state, available capacity, and current residuals. Tanks participating in normal filling operations are prioritized, followed by tanks in passportization or shipment states. This strategy helps maintain normal tank farm operation while minimizing unnecessary product movements.
       Once the required amount of product has been removed, the selected tank is transferred to the repair state and becomes unavailable for normal operation. After maintenance is completed, the tank returns to service as an empty storage unit ready for future filling. Unlike temporary pumping operations, the redistributed product is not transferred back to the repaired tank, reflecting common refinery operating practice.
       By combining automatic tank selection, storage capacity validation, sequential product redistribution, and event-driven repair scheduling, PRL provides a realistic representation of tank maintenance within refinery digital twins.

Support for Multiple Simultaneous Repairs

       In real refinery operations, several storage tanks may be scheduled for maintenance during the same planning period. PRL supports multiple simultaneous repair requests by processing them sequentially. For each repair request, the algorithm independently selects a suitable tank, validates available storage capacity, and performs the required product redistribution before continuing with the next tank. This approach prevents storage conflicts and maintains stable tank farm operation throughout the maintenance period.

Event-Driven Repair Execution

       The repair process is fully event-driven. Product redistribution is not completed in a single simulation step but progresses through a sequence of pumping events. Each completed transfer automatically triggers the selection of the next receiving tank until the required inventory has been removed. This approach accurately represents the dynamic behavior of refinery storage systems and integrates naturally with other production and logistics events.

Why Dynamic Repair Simulation Matters?

       Accurately simulating tank repairs is essential for evaluating the operational impact of maintenance activities before they are performed in a real refinery. Unlike simplified maintenance models, dynamic repair simulation captures the interaction between storage availability, product movements, and production planning, allowing engineers to identify operational constraints and optimize maintenance schedules.

Key benefits include:
        - evaluating maintenance schedules before implementation;
        - detecting insufficient storage capacity before repairs begin;
        - minimizing production interruptions during maintenance;
        - preserving shipment schedules and product availability;
        - maintaining mass balance throughout the repair process;
        - improving the accuracy of refinery digital twins for operational planning and what-if analysis.

Benefits

Practical Example

       Consider an accumulative tank farm consisting of four storage tanks. One of the tanks, T-101, is scheduled for repair and currently contains 2,800 tonnes of gasoline. Before maintenance begins, PRL automatically evaluates whether the remaining tanks have enough available capacity to receive the product.
       Since sufficient free volume is available, the algorithm selects the most appropriate receiving tanks and starts sequential product redistribution. As each receiving tank approaches its allowable operating level, the remaining product is automatically redirected to the next available tank. This process continues until T-101 reaches its minimum operating inventory.
After the redistribution is completed, T-101 is transferred to the repair state and becomes unavailable for normal operation. Once maintenance is finished, the tank returns to service as an empty storage unit ready for future filling, while the redistributed gasoline remains in the receiving tanks. Throughout the entire process, refinery production, product quality, shipment schedules, and mass balance are preserved without interrupting normal plant operation.

Conclusion

       Storage tank repair is not an isolated maintenance activity but an integral part of refinery production planning and logistics. Before a tank can be taken out of service, the remaining product must be safely redistributed while maintaining storage capacity, shipment commitments, and uninterrupted plant operation.
       PRL addresses this challenge with an event-driven repair algorithm that combines automatic tank selection, storage capacity validation, sequential product redistribution, and intelligent receiving tank selection. Rather than representing maintenance as a simple equipment state change, the model simulates the complete operational workflow used in real refinery tank farms.
This approach enables refinery digital twins to evaluate maintenance schedules, identify storage capacity limitations, analyze the operational impact of repairs, and support more reliable production planning. As a result, maintenance activities can be simulated with the same level of realism as material flows and production processes, providing a more accurate representation of refinery operations. Unlike simplified maintenance models, PRL simulates repair as an integrated logistics process rather than an isolated equipment event.

FAQ

1 Why can't a storage tank be taken directly out of service for repair?
A storage tank usually contains product that must be transferred before maintenance can begin. Simply changing the tank status to Out of Service ignores product redistribution, storage capacity constraints, and refinery logistics, resulting in unrealistic simulation behavior.

2 How does PRL select a tank for repair?
The algorithm automatically selects the most suitable tank based on its current operating state and inventory level. Tanks with the lowest load are preferred, while shipment and reserve tanks are avoided whenever possible to minimize the impact on production.

3 What happens if there is not enough free storage capacity?
Before initiating repair, PRL validates that the remaining tanks have enough available capacity to receive the product. If sufficient capacity is not available, the repair is automatically postponed until the required storage space becomes available.

4 Does PRL simulate the product transfer process?
Yes. Product redistribution is modeled as a sequence of pumping operations between connected tanks. The algorithm automatically selects receiving tanks and continues the transfer until the repair tank reaches its minimum operating level.

5 Can multiple storage tanks be repaired at the same time?
Yes. PRL supports multiple simultaneous repair requests. Each repair is processed sequentially, ensuring that storage capacity and operational constraints are satisfied before the next repair begins.

6 Is the product transferred back after the repair is completed?
No. After maintenance, the repaired tank returns to service as an empty tank ready for future filling. The redistributed product remains in the receiving tanks, reflecting normal refinery operating practice.

7 What are the benefits of simulating tank repairs in a refinery digital twin?
Realistic tank repair simulation helps engineers evaluate maintenance schedules, verify storage capacity, assess the impact on production and shipment plans, preserve mass balance, and improve operational decision-making before implementing maintenance activities in a real refinery.

Last updated on 25.06.2026