Loading Rack Simulation in Oil and Gas Logistics

       Loading rack simulation models how finished petroleum products move from refinery storage into rail tank cars and other outbound transport units under real operational constraints. In a refinery digital twin, the loading rack provides the operational link between continuous product flows from processing and storage systems and discrete transportation logistics. Refinery units such as CDU, VDU, cracking, and blending operate with continuous material flows and dynamic mass balances. Outbound product evacuation, however, depends on discrete events such as train arrivals, wagon positioning, loading operations, quality certification, and train departure. Bridging this operational divide is the refinery loading rack simulation. Within the Petroleum Refining Library, the LoadingRack agent executes high-fidelity rail tank car loading simulation by providing direct accumulative tank farm integration between continuous process units and railway siding tracks. The loading rack can operate using different strategies depending on the simulation objective, required level of detail, and operating scenario. For a detailed overview of the available loading rack performance indicators, see Loading Rack Statistics for Refinery Simulation. For a detailed overview of loading rack control mechanisms, see our guide to Loading Rack Control in Refinery Simulation

What Is Loading Rack Simulation?

       Loading rack simulation represents the physical and operational processes used to load refined petroleum products from refinery storage into outbound transport units. In rail terminals, this includes siding tracks, loading gantries, loading arms, wagon positioning, product transfer, quality inspection, documentation, and train departure. In an oil and gas logistics model, the loading rack is therefore more than a simple outlet from a tank. It represents the operational interface between refinery inventory and transportation capacity.

Why Loading Rack Simulation Matters in Refinery Digital Twins

       An enterprise digital twin must evaluate downstream realization constraints alongside the global refinery material balance to prevent theoretical production targets from failing during actual refinery shipment planning. While enterprise resource planning (ERP) systems and linear programming (LP) tools assume steady-state product dispatch, real rail terminals introduce significant operational friction:
       1. Track Infrastructure and Siding Limits: A finite number of rail spurs and loading arms restricts the number of tank cars spotted and filled concurrently.
       2. Transfer Boundaries: Instantaneous pumping rates are limited by storage tank pump curves, pipeline diameters, and loading arm capacities, rather than process unit output rates.
       3. Quality Assurance and Documentation Delays: Custody transfer cannot begin without laboratory sampling, property verification, and quality passportization.
       4. Rolling Stock Dynamics: Timetable deviations, shunting locomotive constraints, and irregular train arrivals cause uneven withdrawal profiles
These logistics constraints can directly affect refinery production. When train loading is delayed, finished products remain in intermediate storage and tank inventories can approach critical limits. If storage capacity is exhausted, upstream processing units may need to reduce throughput or shut down. Loading rack simulation therefore connects downstream logistics performance with refinery production planning. Instead of treating shipment targets as static quotas, the model evaluates whether the planned product volumes can actually be evacuated through the available terminal infrastructure. The resulting loading rack performance can be monitored using the statistics described in Loading Rack Statistics for Refinery Simulation. Refinery operations involve different production and sales objectives, and loading racks primarily support product realization by handling the preparation and loading of finished petroleum products for shipment to customers and downstream logistics networks.

How Loading Rack Simulation Works

       The LoadingRack agent in Petroleum Refining Library models physical loading tracks and gantries as a hybrid simulation component that coordinates discrete train events with continuous transfers. This architecture allows a refinery digital twin to represent both transportation logistics and petroleum product flow within the same simulation model.

Relational Database Configuration
       The LoadingRack environment is initialized from embedded relational database tables, keeping refinery logistics simulation logic separate from scenario data. This approach allows train schedules, wagon configurations, product assignments, and loading infrastructure to be changed without modifying the core simulation logic:
        - loading_racks: Defines physical track assets. Contains the unique identifier (id), track gantry name initial state, and product assignments.
       - train_wagon_assignment: Configures multi-product train assemblies. Links to train_schedule by Train name and sets the individual car payload capacity (Wagon capacity (tons)), car count (Wagons count), designated product (Wagon product), and initial residuals (Init residuals (tons)).
       - wagon_initial_availability: Specifies the rolling stock pre-positioned on siding tracks at simulation startup (time = 0).
Operational Parameters and Logic Flags
The component provides parameters that can be defined directly or configured via external INI files:
       - isLoadingPriorityOverSchedule: Core dispatch priority flag. When true, spotted railcars remain on the loading track until target fill levels are achieved. When false, departures follow train_schedule strictly.
       - useWagonTurnover: Enables rail tank car turnover dynamics based on turnaround cycle periods defined in the database. Once filled, a tank car is temporarily excluded from the available rolling stock fleet in the model and reappears at the terminal as an empty car only after its turnaround cycle is complete.
       - fullWagonSetRequired: When active, prevents track occupancy until the entire planned cut of railcars is assembled on refinery sidings.
       - includeFirstTrainResiduals: When true, includes residual material inside wagons arriving at time() = 0 into initial material balance calculations.
       - wagonSupplyHours: Duration allocated for switching operations, car positioning, grounding, and loading arm connections.
       - wagonPassportizationHours: Duration required for laboratory quality inspection and document clearance.
       - wagonRemovalHours: Duration allocated for disconnecting arms, line purging, and shunting cars off the gantry.
       - repeatTrainSchedule & trainArrivalIntervalHours: Cycles the arrival timetable automatically once database records are exhausted, supporting multi-year runs without inflating tables.
       - inputFlows & outputFlows: Fluid ports connecting upstream storage tanks to downstream transport nodes across multiple simultaneous product lines.
       The loading rack can be configured to follow different operating strategies, from detailed loading control to simplified product flow and long-term schedule management.

Loading Rack Simulation StateChart: Rail Dispatch Workflow

       The complete dispatch sequence is driven by an AnyLogic loading rack statechart that coordinates the database wagon assignment workflow, spotting maneuvers, filling, and passportization and quality inspection clearances.
Statechart Execution Stages:
       sInitial / sWaiting — The siding track remains idle, awaiting scheduled train arrival; the agent validates track availability and train set completeness.
       sWagonSupply — Shunting operations: locomotive positioning, spotting railcars along the gantry, grounding, and connecting loading arms over the duration defined by wagonSupplyHours.
       sLoading — Hydraulic product loading throttled by the minimum throughput between tank farm pumps and rack arms; if certified on-spec inventory is unavailable, the train idles on the track awaiting product.
       sWagonPassportization — Quality control stage: product sampling, laboratory analysis, and commercial shipping document clearance over the duration defined by wagonPassportizationHours.
       sWagonRemoval — Shunting out: disconnecting arms, inspecting seals, and clearing the loaded train cut from the gantry over the duration defined by wagonRemovalHours.
       sWagonPumping — Line drainage, collector blowing, infrastructure reset, and track status handover back to sWaiting.
       The following architecture shows how refinery storage, rail loading operations, and shipment realization are connected in the simulation model. The LoadingRack acts as the operational interface between the Accumulative Tank Farm and the outbound ShipmentNode.

Loading Rack and Accumulative Tank Farm Integration: Managing "Mass on Wheels"

       The LoadingRack agent coordinates with storage through direct integration with the Accumulative Tank Farm. In the Petroleum Refining Library architecture, finished product tanks feed gantry loading arms, while the tank farm tracks downstream logistics constraints.
  • Priority A Integration: The tank farm registers loading tracks via priorityALoadingRacks. This reference links gantry activity to the active shipment schedule, aligning physical dispatch with Priority A fulfillment targets.
  • Accounting for "Mass on Wheels": Hydrocarbons loaded into spotted tank cars are physically drawn from storage tanks, but the product remains on site until the train completes inspection and departs. Through embedded mass on wheels simulation and accumulative tank farm integration, the library tracks staged hydrocarbons awaiting release, ensuring seamless ShipmentNode coordination without inventory misallocation.

Downstream Realization and Direct Flow Mode

       To evaluate refinery debottlenecking, digital twins must distinguish between nominal processing capacity and actual logistics realization. Petroleum Refining Library manages this division through Direct Flow Mode:
       Direct Flow Operation (isDirectFlowMode = true): The loading rack bypasses discrete shunting delays, timetable constraints, and wagon availability checks. The gantry functions as an unconstrained pipeline where flow throughput is bounded only by upstream pump limits and downstream receipt capacities.
       Post-Schedule Activation (enableDirectModeAfterSchedule = true): Once detailed records in train_schedule run out, the agent switches from discrete batch handling to steady continuous evacuation.
       Analytical Purpose: Standard discrete mode evaluates terminal bottlenecks, track contention, and shunting performance. Activating loading rack direct flow mode bypasses transport friction to establish an unconstrained refinery material balance, allowing planners to isolate core processing unit capacity from downstream realization constraints.

Conclusion

       Loading rack simulation provides the operational layer connecting refinery production, petroleum product storage, and outbound transportation logistics. By combining continuous fluid flows with discrete rail logistics, the LoadingRack agent represents train schedules, wagon positioning, loading, product certification, track constraints, and shipment realization within a refinery digital twin. Integration with the Accumulative Tank Farm enables the model to track "Mass on Wheels" and distinguish material physically loaded into railcars from product that has actually left the refinery. Direct Flow Mode further allows engineers to separate refinery production capacity from downstream logistics constraints. This makes loading rack simulation a practical tool for refinery logistics planning, tank farm optimization, terminal capacity analysis, debottlenecking, and refinery digital twin development.

FAQ

1. What is a loading rack in petroleum refining simulation?
A loading rack is an operational dispatch interface that models physical gantry installations and siding tracks to evacuate finished petroleum products from refinery storage into discrete transport units, primarily rail tank cars and trucks.

2. Why is loading rack simulation important in refinery digital twins?
It bridges continuous upstream refining processes with discrete batch logistics, preventing flow distortions and exposing critical offsite bottlenecks such as track occupancy limits, shunting delays, and storage overfills.

3. What is the difference between LoadingRack and ShipmentNode in Petroleum Refining Library?
LoadingRack simulates physical infrastructure and operations such as spotting cars, filling arms, track occupancy, and shunting times, while ShipmentNode autonomously monitors cumulative outbound mass and validates commercial contract fulfillment.

4. How are train compositions configured in the LoadingRack component?
Train assemblies are defined through embedded database tables that specify arrival cadences, track sidings, car capacities, wagon counts, product grades, and initial residuals.

5. Can a single LoadingRack handle multi-product train compositions?
Yes. The database assignment interface maps grouped wagon subsets for different products within the same train to corresponding input flow ports, enabling parallel multi-product loading on one track.

6. What operational states does the LoadingRack finite-state machine include?
The statechart executes through initial and waiting states followed by a busy sequence encompassing wagon supply, loading, wagon passportization, wagon removal, and wagon pumping.

7. How is the physical loading rate determined during the loading state?
The instantaneous flow rate is determined dynamically by the minimum capacity between the upstream tank farm pump curve and the loading rack gantry arm limits.

8. What is "Mass on Wheels" in refinery dispatch simulation?
"Mass on Wheels" represents product volume that has been pumped out of storage tanks into railcars on site but has not yet completed laboratory passportization or commercial departure, tracked to prevent inventory misallocation.

9. What happens when the connected AccumulativeTankFarm runs out of certified product?
The tank farm holds product until on-spec certification is completed and does not artificially accelerate upstream units; spotted trains pause in the loading state, accumulating demurrage until inventory is released.

10. What is Direct Flow Mode in LoadingRack simulation?
Direct Flow Mode turns the loading rack into an unconstrained hydraulic conduit, bypassing discrete timetables, shunting delays, and car turnover to evaluate raw refinery production capacity without logistics limits.