Production and Shipment Planning in Refinery Simulation

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. In the third part of this series, Using Java Interfaces to Build Flexible Refinery Simulation Models, we explore how Java interfaces can separate physical flow connections from flow information and provide a more flexible architecture for refinery simulation models.

Proposed Architecture

       To represent both planning layers within the same refinery simulation model, the model uses the ShipmentNode from the Petroleum Refining Library for AnyLogic. The basic architecture is:

Process Unit → Production ShipmentNode → Tank Farm → Loading Rack → Shipment ShipmentNode

       The first ShipmentNode tracks production against the production plan, while the second tracks shipments against the shipment plan. The second ShipmentNode 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. In practice, this is the most appropriate approach because it allows both production and shipment constraints to be satisfied simultaneously. 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 in the Petroleum Refining Library database uses the group_name field to distinguish production and shipment plans for the same product. The ShipmentNode loads the corresponding plan based on this designation and uses it during AnyLogic refinery simulation. tion. The ShipmentNode automatically loads the relevant product plans from the database and uses them for production or shipment tracking. For the Production ShipmentNode, allowOverPlanning should be enabled so that the node records production without restricting the flow when the plan is exceeded. This is important for two reasons. First, the refinery may produce valuable intermediate or finished products, and stopping their production could cause the accumulated material to be returned to the common process stream rather than being utilized. Second, the tank farm may represent the only available route for a product, meaning that restricting the flow at the ShipmentNode would incorrectly interrupt the physical process. The ShipmentNode, 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 ShipmentNodes have different roles:
       Production ShipmentNode → records production without limiting the flow.
       Shipment ShipmentNode → 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 no production plan is specified for the current month, the Petroleum Refining Library can look ahead to the following month’s shipment plan and increase current-month production to build the residuals required to meet future shipments. This mechanism is particularly useful when production capacity is limited and additional production must begin in advance. When an explicit production plan is specified, this look-ahead mechanism is normally disabled, and the defined production plan takes precedence.

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 SeparatorLight. One outlet is connected to a ShipmentNode, 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 ShipmentNode, one or more tank farms, a loading rack, and a Shipment ShipmentNode. 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 scenario contains multiple interconnected nodes, and the state of one node can affect production decisions elsewhere in the flow. The refinery simulation model therefore needs an additional algorithmic layer that dynamically modifies the behavior of production, storage, and shipment nodes in response to key events occurring throughout the process chain. The main events in a classical production–tank farm–shipment configuration 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 adjust production, storage, and shipment logic 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 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.