Production and Shipment Planning in Refinery Simulation (part 2)

The Problem Statement

       Production and shipment planning in refinery simulation requires two distinct planning layers: production plans and shipment plans. A production plan defines how much product should be produced, while a shipment plan defines how much should be delivered within a given period. Although these plans are closely related, they are often managed independently.Production planning focuses on process-unit capabilities and feedstock availability, while shipment planning and refinery logistics depend on product residuals, storage capacity, loading operations, and shipment requirements. The simplified approach described in Part 1 treats shipment as a direct-flow system and therefore does not account for its influence on production. This article extends that approach by modeling production and shipment plans as interconnected planning layers.

Proposed Architecture

       To represent both planning layers within the same refinery simulation model, the model uses the Shipment Node from the Petroleum Refining Library for AnyLogic. The basic architecture is: Process Unit → Production Shipment Node → Tank Farm → Loading Rack → Shipment Shipment Node. The first Shipment Node tracks production against the production plan, while the second tracks shipments against the shipment plan. The second Shipment Node records the volume leaving the loading rack, allowing actual shipments to be evaluated against the shipment plan. This architecture separates the two planning layers while preserving the physical relationship between production, storage, loading, and shipment.

Basic Rule for Production and Shipment Planning in Refinery Simulation

       The basic rule depends on which planning targets are specified:
  • Only production plan: produce until the production target is reached.
  • Only shipment plan: produce the volume required to fulfill the shipment target.
  • Both plans: use the maximum of the two plans as the production target.
This rule provides a consistent link between production and shipment planning while preserving the requirements of both plans.

Database Configuration and Shipment Node Settings

       The shipment_plans table uses the group_name field to distinguish production and shipment plans for the same product. The Shipment Node loads the corresponding plan based on this designation and uses it during AnyLogic refinery simulation. tion. The Shipment Node automatically loads the relevant product plans from the database and uses them for production or shipment tracking. For the Production Shipment Node, allowOverPlanning should be enabled so that the node records production without restricting the flow when the plan is exceeded. The Shipment Shipment Node, in contrast, should stop the flow once the shipment plan is fulfilled. This allows the node to act as a control point that prevents further product dispatch once the planned shipment volume has been reached.

       Thus, the two Shipment Nodes have different roles:
       Production Shipment Node → records production without limiting the flow.
       Shipment Shipment Node → controls shipment and stops the flow when the plan is fulfilled.

Production and Shipment Planning Constraints in Refinery Simulation

       Independent production and shipment plans can become inconsistent in a refinery simulation because they are linked by the refinery material balance. Shipment availability depends not only on production, but also on product residuals, losses, additive consumption, tank farm capacity, and loading operations. Therefore, achieving the production plan does not necessarily guarantee that the shipment plan can be fulfilled, and vice versa. The simulation model must reconcile these two targets according to the physical configuration of the product flow.

Example 1: Automotive Gasoline Production

       Consider a petroleum refinery producing several grades of automotive gasoline, such as AI-92 and AI-95. These products may use the same or overlapping feedstock streams, with the required specifications achieved through blending and the addition of appropriate components and additives.
       When both plans are specified, the production target is determined by the higher requirement. For example, if the production plan is 10,000 tonnes and the shipment requirement is 8,000 tonnes after accounting for existing residuals and loading-rack volume, the production target remains 10,000 tonnes. The excess volume can remain in the tank farm as residuals for subsequent operations. When production capacity is limited, the refinery may also build residuals for the following month's shipment plan in advance. However, this mechanism must be disabled when the current production plan is explicitly set to zero, as this represents a restriction on production. This strategy is typically used when valuable feedstock components are allocated for gasoline production. If production is stopped after the plans are fulfilled, these components may remain unused or have to be returned to the process, despite having already been separated and prepared for blending.

Example 2: Wide Fraction of Light Hydrocarbons

       A different case is the production of Wide Fraction of Light Hydrocarbons (WFLH), which may include propane, butane, propane-butane mixtures, and other light hydrocarbon components. Individual components can have their own production and shipment plans before being combined into a common WFLH stream. This configuration can be modeled by splitting the unit output into separate planning flows using a Light Separator. One outlet is connected to a Shipment Node, which tracks the plan for the corresponding component before transferring it to the tank farm. The other outlet sends the remaining flow directly to the common WFLH tank farm after the component's production requirement has been met. For each planned component, the target volume is determined as the maximum of the production plan and the shipment requirement. This separates component-level plan tracking from the common WFLH flow.

Example 3: Diesel Fuel Production

       A classical refinery production and shipment configuration for diesel fuel consists of a Production Shipment Node, one or more tank farms, a loading rack, and a Shipment Shipment Node. The two nodes track separate production and shipment plans. The production target is dynamically determined from these plans and the current product residuals. Production is stopped when the higher of the two targets is reached. The production and shipment nodes have separate plans. Based on these plans and the current residuals in the system, the algorithm determines the remaining volume required to meet the shipment target. Production is then automatically stopped by event-driven logic when the larger of the two targets — the production plan or the shipment plan — has been reached. This prevents unnecessary production while ensuring that the required production and shipment volumes can be achieved.

Example 4: Multiple Shipment Directions

       A more complex configuration occurs when one product stream enters a common tank farm and is later distributed to several shipment destinations. In this case, the stream can be divided into N planning flows before the tank farm, with each flow tracking its own production plan. The flows are then combined in the common tank farm and separated again downstream according to the shipment destinations. This architecture allows production and shipment plans to be tracked independently for each direction while representing shared refinery logistics and storage operations.

Events Driving Production and Shipment Plan Execution

       Each branch contains multiple interconnected nodes, and the state of one node can affect production decisions elsewhere in the flow. The refinery simulation model therefore needs a mechanism for propagating key events between nodes and updating the relevant plans accordingly. In a classical production–tank farm–shipment configuration, the main events are:
       Production Shipment Node
        - assignment of a new production plan;
        - fulfillment of the production plan.
The node should also allow overproduction when additional volume is required to satisfy the shipment plan.
       Tank Farm
        - the tank farm becomes full and has no available storage capacity;
        - a production request issued to fulfill the shipment plan is fully satisfied.
       These events allow the model to dynamically determine whether production should continue or stop based on the current state of the entire process chain.

Conclusion

       Production and shipment planning in refinery simulation is interconnected through material balances, storage, and loading operations. Treating these plans as independent targets can therefore lead to inconsistent simulation behavior. The proposed approach coordinates the two planning layers through a common production target, product-specific configurations, and event-driven communication between model nodes. This provides a practical framework for representing coordinated production planning, shipment planning, and refinery logistics in simulation models.

FAQ

1. What is the difference between a production plan and a shipment plan?
A production plan defines the target volume to be produced, while a shipment plan defines the volume that must be delivered. In a refinery simulation model, these plans are connected through tank farms, loading racks, and product flows.

2. What happens when only a production plan is specified?
The model produces the required volume until the production plan is fulfilled.

3. What happens when only a shipment plan is specified?
The model produces the volume required to fulfill the shipment plan, taking into account available tank farm residuals and other relevant volumes.

4. How are production and shipment plans coordinated in refinery simulation?
The basic rule is to use the maximum of the two plans as the production target.

5. Why can production and shipment plans become inconsistent in refinery simulation?
The plans may not account for the same material balance. Available shipment volume depends on production, tank farm residuals, losses, additive consumption, and volumes already at loading racks.

6. How are automotive gasoline grades handled?
For products such as AI-92 and AI-95, the model can use the maximum of the production and shipment requirements to determine the target production volume and maintain the required tank farm residuals.

7. How can Wide Fraction of Light Hydrocarbons be modeled?
Individual components can be separated into dedicated planning streams, tracked through Shipment Nodes, and then combined into a common Wide Fraction of Light Hydrocarbons stream and tank farm.

8. How is diesel fuel production and shipment modeled in a refinery simulation?
A typical structure includes a production Shipment Node, tank farm, loading rack, and shipment Shipment Node. The production target is dynamically determined from the production and shipment plans.

9. How can one product stream serve multiple shipment directions?
The stream can be divided into several planning flows before entering a common tank farm and separated again downstream according to shipment destinations.