Refinery Maintenance Simulation: Modeling Shutdowns and Repairs in Digital Twins

Maintenance Is Part of the Simulation Model

       In many simulation models, maintenance is treated as an external event that simply makes equipment unavailable. While this assumption may be sufficient for discrete manufacturing, it does not reflect how petroleum refineries operate. Because a refinery is a continuous material flow network, taking a single asset out of service affects the operation of the entire facility rather than only the equipment itself. The resulting response depends on the refinery topology, equipment configuration, and the placement of buffer facilities, such as tank farms (accumulative or flowing).
Maintenance simulation is the process of modeling scheduled shutdowns and equipment availability within a refinery digital twin to evaluate their impact on production, material flows, storage utilization, and refinery performance.
       For this reason, maintenance must be modeled as part of the production process rather than as an external event. In a refinery digital twin, a scheduled shutdown changes the operating state and asset availability of a process unit line or storage accumulative or flowing tank, after which the simulation automatically reconfigures material flows and production constraints throughout the refinery.
The objective is not simply to represent equipment downtime, but to simulate how the refinery continues operating under maintenance conditions while preserving material balance and adapting the production network to the new operating scenario.

Maintenance Changes the Network, Not Just the Equipment

       In many simulation models, maintenance is represented by changing the state of an equipment object from Operating to Unavailable. While this approach correctly models equipment availability, it does not capture how a refinery responds to the loss of that asset.
       In a refinery, taking a single process unit line or storage tank out of service changes the behavior of the entire production network. Material flows are redistributed, storage operations are reconfigured, production capacities change, and optimization constraints are automatically updated. As a result, the impact of maintenance extends far beyond the equipment undergoing repair.
For this reason, maintenance in a refinery should be modeled as a network event rather than an equipment event. The objective of a refinery digital twin is not to simulate the repair itself, but to predict how the production system adapts to temporary changes in asset availability while maintaining feasible material flows, material balance, and continuous refinery operation.

Why Generic Simulation Fails

       Many simulation models represent maintenance by simply changing the state of an equipment object from Operating to Unavailable. While this correctly models equipment availability, it assumes that the rest of the production system remains unchanged.
       For many industries this simplification is acceptable. Petroleum refineries, however, operate as continuous material flow networks in which every process unit, storage tank, and pipeline is interconnected. Removing a single asset from service changes the operating conditions of the entire refinery. A refinery digital twin therefore treats maintenance as a network-wide operational event rather than an isolated equipment failure. Instead of only disabling equipment, it automatically updates material routing, storage behavior, production constraints, and optimization variables to produce a new feasible operating scenario.
       The fundamental difference is that generic simulation models equipment behavior, whereas a refinery digital twin models how the entire production network adapts to equipment unavailability. This capability is essential for evaluating maintenance scenarios, production losses, storage requirements, and feasible operating plans before a shutdown begins.

Modeling Scheduled Shutdowns

       In a refinery digital twin, maintenance is modeled through scheduled shutdowns of process unit lines and storage tanks. Each maintenance event is defined by the affected asset together with its start and end dates.

Process Unit Maintenance

       For process units, maintenance is performed at the line level rather than at the unit level. Since process unit lines often differ in capacity, operating constraints, and processing characteristics, maintenance is always assigned to a specific line. During the scheduled maintenance period, the selected line enters the Repair state and becomes unavailable for production.

Tank Farm Maintenance

       Storage tanks (for accumulative and flowing parks) follow a different maintenance logic. Before a tank can enter maintenance, its remaining inventory must be transferred to other available tanks. If sufficient storage capacity is unavailable, the maintenance cannot begin and is postponed until the required capacity becomes available.
       Unlike process unit lines, storage tanks within the same tank farm are typically similar in size and operating characteristics. Consequently, maintenance can be scheduled at the tank farm level, allowing the digital twin to automatically select the most appropriate tank—usually the one requiring the smallest inventory transfer. In practice, the resulting reduction in available storage capacity is generally more important than the identity of the specific tank taken out of service.

Transient Startup and Shutdown

       For long-term planning, shutdown and restart are often assumed to occur instantaneously. In reality, however, process units require transient startup and shutdown periods during which operating conditions and product quality may temporarily deviate from normal operation. This is particularly important for products with stringent quality requirements, such as aviation fuels, where startup may generate off-spec product.
       To capture these effects, many refinery digital twins support configurable transient operating modes that simulate startup and stabilization periods, improving the realism of maintenance and production planning scenarios.

Maintenance State

       Once maintenance begins, the affected asset simply becomes unavailable for material flow until the scheduled shutdown is completed.

Automatic Material Flow Reconfiguration

       When a refinery asset enters maintenance, the objective is not simply to remove it from the model, but to preserve continuous refinery operation under the new constraints. The digital twin therefore updates asset availability and treats the unavailable asset as if it no longer exists in the material flow network.
       For process unit lines, feedstock is redistributed among the remaining available lines. Depending on the process topology, material may be rerouted through alternative processing paths, diverted to storage, or the upstream feed rate may be reduced when no feasible route remains.
       Tank maintenance is handled in the same way. Once a tank (accumulate or flowing) is taken out of service, the simulation automatically adjusts storage operations and material routing according to the configuration of the specific tank farm.
       The reconfiguration strategy is not predefined by the maintenance model. Instead, it emerges naturally from the refinery topology, operating constraints, and control logic implemented in the digital twin. As a result, every scheduled shutdown is simulated as a change in the material flow network rather than as an isolated equipment event.

Integration with Production Optimization

       Maintenance directly changes the production capabilities of a refinery. As process unit lines become unavailable, their operating constraints must also be removed from the optimization problem.
       In the digital twin, each process unit line is associated with a binary availability variable indicating whether the line is operational or under maintenance. During a scheduled shutdown, this variable is automatically updated, preventing material from being assigned to unavailable equipment and immediately changing the feasible operating region of the optimization problem.
       The optimizer then redistributes feedstock across the remaining available process units while satisfying capacity limits, material balance equations, storage constraints, and product quality requirements. If the remaining capacity is insufficient, production may be rerouted, temporarily buffered in tank farms, or reduced until maintenance is completed.
       Because maintenance is integrated directly into the simulation, every optimization run automatically reflects the current operating state of the refinery without requiring manual changes to the mathematical model. This enables engineers to evaluate maintenance scenarios, estimate production losses, identify bottlenecks, and compare alternative shutdown plans before maintenance begins.

Maintenance Scheduling

       A refinery digital twin does not generate maintenance schedules. Instead, it uses the approved maintenance plan as an input to the simulation. Each maintenance event is defined by the affected asset and its start and end dates. For process units, the schedule also specifies the line to be taken out of service. During the defined period, the corresponding asset automatically enters the Repair state and its availability status is updated accordingly. This separation of responsibilities allows maintenance planning and production simulation to remain independent. Maintenance schedules may originate from enterprise planning systems, engineering decisions, or predictive maintenance models, while the digital twin evaluates their impact on refinery operations, flows, storage utilization, and production performance.

Example: Simulating a Scheduled Shutdown

Scenario:
        - 4 parallel CDU lines;
        - 1 CDU line under scheduled maintenance;
        - Downstream Vacuum Unit operating near capacity;
        - Intermediate crude storage available.

       Once maintenance begins, the selected CDU line enters the Repair state and becomes unavailable. The digital twin immediately updates equipment availability and recalculates material flows throughout the refinery.
       Crude oil is automatically redistributed among the remaining CDU lines. If their combined capacity is insufficient, part of the incoming crude is temporarily buffered in the tank farm, while downstream process units receive reduced feed. The optimization model simultaneously updates equipment availability constraints and determines a new feasible operating plan that satisfies material balance, processing capacities, and storage limitations.
       If the maintenance schedule also includes a storage tank, its inventory is first transferred to other available tanks. When sufficient storage capacity is unavailable, the maintenance is postponed until the required conditions are met. This simulation enables engineers to evaluate not only the direct loss of processing capacity, but also the cascading impact of maintenance on material routing, storage utilization, downstream units, and overall refinery throughput before the shutdown begins.

Conclusion

       Maintenance is an integral part of refinery operations, not an external event. Every scheduled shutdown changes the set of available assets, modifies production capacities, and reconfigures material flows throughout the refinery.
       A refinery digital twin must therefore simulate maintenance as a change in the operating state of process unit lines and storage tanks while automatically adapting the material flow network to the new operating conditions. This allows engineers to evaluate production plans under realistic maintenance scenarios without violating material balance or manually rebuilding the process model.
       Ultimately, the goal of maintenance simulation is not to model equipment downtime, but to predict how a refinery continues operating while individual assets become temporarily unavailable..

FAQ

1 How are maintenance shutdowns modeled in refinery digital twins?
Maintenance is modeled by temporarily changing the operating state of refinery assets, such as process unit lines or storage tanks. During the scheduled maintenance period, these assets become unavailable for material flow, and the digital twin automatically recalculates production capacities, material routing, and operating constraints.

2 Why is maintenance modeled at the line level instead of the process unit level?
Process unit lines often have different capacities, operating limits, and processing characteristics. Scheduling maintenance at the line level allows the digital twin to accurately represent the production impact of shutting down a specific line while keeping the remaining lines in operation.

3 How is storage tank maintenance simulated?
Before a storage tank can enter maintenance, its inventory must be transferred to other available tanks whenever sufficient capacity exists. If the transfer cannot be completed, the maintenance is postponed. In many cases, the digital twin can automatically select the most suitable tank for maintenance based on the current operating conditions.

4 How does maintenance affect material flows?
Rather than simply removing equipment from service, a refinery digital twin automatically reconfigures the material flow network. Depending on the refinery configuration, material may be redistributed to other process units, redirected to storage, routed through alternative flow paths, or upstream production may be reduced.

5 Does a refinery digital twin generate maintenance schedules?
No. Maintenance schedules are typically created by maintenance planning systems or engineering teams. The digital twin uses the approved schedule as an input and evaluates its impact on production, storage utilization, logistics, and material flows.

6 How is maintenance integrated with production optimization?
During maintenance, unavailable process unit lines are automatically excluded from the optimization problem through availability constraints. The optimization model then recalculates feed distribution, production capacities, and material routing using the remaining available assets.

7 Can refinery digital twins model startup and shutdown transitions?
Yes. While many models assume instantaneous shutdown and restart for long-term planning, advanced refinery digital twins can simulate transient startup and stabilization periods, including the production of off-spec material, providing more realistic maintenance scenarios.

8 Why is maintenance simulation more complex in refineries than in other industries?
Unlike discrete manufacturing, a refinery is a continuous material flow network. Taking a single process unit line or storage tank out of service can affect production capacities, storage operations, logistics, and downstream processing. As a result, maintenance must be simulated as a change in the entire material flow network rather than as isolated equipment downtime.