Simulation of Feedstock Deliveries from Oil and Gas Fields

       Refineries and refinery and gas processing facilities receive hydrocarbon feedstocks, including crude oil, unstable gas condensate, natural gas, and other streams, from multiple sources such as oil and gas fields, other processing plants, third-party suppliers, and LNG terminals. Depending on the configuration of the facility, feedstock deliveries may be performed via pipelines, rail transportation, marine terminals, or a combination of these modes, forming a complex petroleum supply chain. Incoming feedstock streams may differ in volume, composition, and processing priorities. In addition, crude oil blending and feedstock blending can take place either upstream at production sites or within the refinery feedstock reception system itself.
       Therefore, when developing Digital Twin solutions for refinery planning and refinery feedstock management, it is essential to accurately reproduce not only the processing units but also the real-world feedstock supply configuration and material flow structure. This capability is particularly important for crude oil supply chain simulation, condensate supply simulation, and other oil and gas simulation applications.

Challenges in modeling refinery feedstock deliveries

  • Support for different planning horizont
    Crude oil, natural gas, and condensate delivery plans may be defined with different time resolutions, such as daily or monthly intervals. In addition, discrete planning data must be automatically loaded from external databases and converted into continuous material flows suitable for crude oil scheduling and refinery feedstock planning.
  • Flow smoothing between adjacent planning periods
    When monthly plans are used, smooth transitions between consecutive periods must be ensured without violating the total planned delivery volumes.
  • Support for multiple feedstock sources and blending schemes
    Feedstocks may originate from several sources and can be blended either upstream before reaching the refinery or within the feedstock reception system itself. Depending on the process configuration, material streams may be treated as either independent or combined, which adds complexity to crude oil blending and feedstock blending operations.
  • Consideration of capacity constraints and feedstock priorities
    The model must account for limitations of refinery reception and processing units and ensure preferential utilization of feedstock streams from the most important sources.
       Addressing these challenges requires a specialized simulation library capable of accurately representing refinery feedstock planning, blending operations, and priority management while considering process constraints. Such capabilities are essential for crude oil supply chain simulation, refinery supply chain management, and Digital Twin applications.

Why not Use AnyLogic Fluid Library blocks?

       There are many simulation environments available for building industrial models, including both discrete-event and continuous simulation platforms. One of the most widely used is AnyLogic, which provides the Fluid Library for modeling continuous material flows such as liquids, gases, slurries, and bulk materials.
       The Fluid Source block from Fluid library palette provided by the AnyLogic Fluid Library does not include built-in support for loading feedstock delivery plans from databases. However, generic fluid components are designed for general-purpose applications and do not contain refinery-specific functionality required for realistic feedstock supply chain modeling.
       In contrast, the Petroleum Refining Library (PRL) that is based on Anylogic Fluid Library provides specialized component Source that significantly simplify the development of Digital Twin solutions for refinery feedstock reception systems. Source supports refinery feedstock planning, crude oil scheduling, and crude oil supply chain simulation, making the library particularly suitable for refinery planning and refinery supply chain management applications.

Solution based on Petroleum Refining Library

       Source component from Petroleum Refining Library for modeling deliveries of crude oil, condensate, natural gas, and other hydrocarbon streams. Its key capabilities include:
  • Support for daily and monthly delivery plans;
  • Automatic loading of planning data from databases;
  • Conversion of discrete plans into continuous material flows;
  • Flow smoothing between adjacent planning periods;
  • Modeling of multiple feedstock sources;
  • Flexible crude oil blending configurations;
  • Feedstock prioritization and capacity constraints;
  • Support for Digital Twin applications.
       These capabilities make Source component well suited for refinery feedstock planning, crude oil scheduling, crude oil supply chain simulation, condensate supply simulation, and refinery supply chain management applications.

Example of refinery feedstock planning and blending

       Consider a refinery receiving crude oil from several oil fields:
       - three light crude oil fields (group 1);
       - one medium crude oil field (group 2);
       - three heavy crude oil fields (group 3).
       Production plans are defined for each field. Monthly plans are used for the light and heavy crude oil fields, while daily plans are specified for the medium crude oil field. In the Petroleum Refining Library Source component, this behavior is controlled by the dailyPlanningMode property (label: Update period), which loading production plans directly from the main database table when the simulation starts.
       This approach enables realistic refinery feedstock planning by converting discrete production plans into continuous material flows. As a result, the model can be used for crude oil supply chain simulation, crude oil scheduling, and Digital Twin applications in refinery planning and refinery feedstock management.
       Each Source contains a group of oil fields defined in the database. In the example considered, the light crude oil streams from the three fields in Group 1 (oil fields 1, 2, 3) are combined into a single stream immediately after leaving the fields. In contrast, the heavy crude oil streams from the three fields in Group 3 (oil fields 4, 5, 6) are transported to the refinery through three independent pipelines and are blended only before entering the processing units.
       This approach provides flexible configuration of crude oil blending and feedstock blending schemes and enables realistic representation of the refinery feedstock reception system. These capabilities support Digital Twin applications and enable realistic refinery planning and supply chain optimization studies. The representation of outgoing flows is determined by the number of entries in the outputFlows field (label R: Output flows (FluidEnter[])). When a single output is defined, the Source automatically aggregates all field-level streams into one combined outlet flow. When multiple outputs are specified, each stream is represented separately and routed independently. In all cases, the number of outgoing flows in a Source must be either equal to one or correspond to the number of oil fields included in the Source, ensuring consistency between field-level structure and flow representation.

Modeling flow smoothing

       Let us examine the smoothing mechanism. The chart shows the example of flow rate of crude oil supplied from oil and gas field 1 in group 1. During the last six days of the month, the flow rate gradually transitions to the planned value of the next month, preventing abrupt changes at period boundaries. This behavior is implemented via the enableFlowSmoothing parameter (label: flow smoothing), which controls the activation of gradual interpolation between the current and next period flow values, ensuring a smooth transition instead of stepwise jumps.
       Despite these temporary changes in instantaneous flow rates, the total monthly delivery volume remains fully consistent with the values specified in the database. This capability improves the accuracy of Digital Twin models and provides a more realistic representation of feedstock reception processes for refinery planning, production planning, and supply chain optimization.
6-day smoothing at 6-hour intervals
       When the throughput of primary processing units becomes constrained, the Petroleum Refining Library allows priorities to be assigned to individual feedstock sources. For light crude oil streams, prioritization is implemented by adjusting the maximum flow rates. In the example considered, capacity limitations can be applied selectively to Group 1, Group 2, or Group 3 oil fields. This functionality is implemented via the method setElementSpeedLimit(sourceId, speedLimit), which sets an upper bound on the allowable flow rate for a selected source element, thereby enabling dynamic control of feedstock prioritization under capacity constraints. This approach makes it possible to maximize the utilization of the most important feedstock sources and evaluate different refinery loading strategies.
       Such functionality is particularly valuable for refinery feedstock management, refinery planning, and crude oil scheduling. It also supports scenario analysis and enables more realistic crude oil supply chain simulation and refinery supply chain management studies.

Priority-based feedstock blending

       A more flexible feedstock prioritization mechanism is implemented in the lower part of the model. The MixerLight component of the Petroleum Refining Library performs priority-based feedstock blending. This functionality is enabled via the flowLimitMergeEnabled parameter (label: Enable fixed-limit merge), which activates constrained merging logic for incoming streams, allowing the mixer to enforce fixed flow limits while combining feedstocks according to defined priorities. In the fixed-limit merge mode, feedstock is accepted sequentially according to source priority.
       In the example considered, the maximum available volume is first supplied from Field 6. If this volume is insufficient, the deficit is compensated by Field 5 and, if necessary, by Field 4. Such an approach makes it possible to evaluate different feedstock acceptance strategies, analyze the utilization of primary processing units, and verify the feasibility of production plans under various supply scenarios.
As a result, the Petroleum Refining Library enables the development of Digital Twin solutions for feedstock supply systems that accurately reproduce real-world blending schemes, refinery capacity constraints, and feedstock prioritization policies. These capabilities support refinery feedstock planning, crude oil supply chain simulation, refinery supply chain management, and scenario analysis applications.
Important: This is not a video demonstration. It is a fully interactive digital twin running in AnyLogic Cloud. Feel free to experiment with the model and evaluating different operating scenarios in real time.
       Petroleum Refining Library enables the development of digital twins for feedstock reception systems and refinery supply chains. Such models support refinery planning, production planning, what-if analysis, and supply chain optimization.
A working version of this model is also available on AnyLogic Cloud
Watch the full model walkthrough on our YouTube channel

Petroleum Refining Library free to try version can be download here

FAQ

1 What is crude oil supply chain simulation?
Crude oil supply chain simulation is a digital modeling approach used to analyze and optimize the movement of feedstock from oil and gas production facilities to refineries. It combines production profiles, pipeline networks, tank farms, and refinery processing constraints into a single dynamic model. A simulation model helps companies evaluate supply reliability, identify bottlenecks, test operational scenarios, and improve feedstock management decisions.

2 Why is crude oil supply chain simulation important for refineries?
Refineries depend on a continuous and reliable supply of feedstock with specific quality and quantity requirements. Real supply chains include many dynamic constraints:
  • variable crude oil production rates;
  • pipeline capacity limitations;
  • tank farm operating rules;
  • crude quality variations;
  • refinery processing restrictions;
  • shipment and delivery schedules.
Crude oil supply chain simulation allows engineers to evaluate these interactions before implementing operational changes in the real system.

3 How is refinery feedstock simulation different from traditional supply chain modeling?
Traditional supply chain models usually focus on logistics planning, transportation routes, and inventory levels.
Refinery feedstock simulation additionally considers the physical behavior of continuous material flows:
  • pipeline flow restrictions;
  • tank filling and draining processes;
  • minimum and maximum operating levels;
  • crude blending requirements;
  • refinery processing capacities;
  • production dependencies.
This allows creation of a realistic digital twin of the entire crude oil supply chain.

4 Can the model simulate crude oil production variability?
Yes. The Petroleum Refining Library-based digital twin supports variable production profiles for different feedstock sources, including:
  • crude oil production;
  • natural gas production;
  • unstable gas condensate production.
Production plans can be loaded from external databases and converted into dynamic flow profiles. This enables simulation of realistic upstream production behavior.

5 Can unstable gas condensate production be included in crude oil supply chain simulation?
Yes. In many oil and gas operations, unstable gas condensate is produced together with natural gas. Therefore, limiting condensate acceptance or reducing processing capacity can directly affect gas production operations.
A realistic supply chain model should consider these dependencies between upstream production and downstream processing facilities.

6 What are the limitations of the AnyLogic Fluid Library for refinery feedstock modeling?
The AnyLogic Fluid Library provides general-purpose components for continuous flow simulation. However, generic fluid components do not include refinery-specific functionality required for complex feedstock supply chains.
For example, the standard Fluid Source block does not provide built-in support for:
  • loading feedstock delivery plans from databases;
  • production profile management;
  • flow smoothing algorithms;
  • source grouping;
  • priority-based crude oil blending;
  • refinery-specific feedstock allocation rules.
Domain-specific components are required to accurately represent refinery supply operations.

7 How does PRL improve crude oil supply chain simulation?
The Petroleum Refining Library (PRL) extends general simulation capabilities with refinery-specific components and logic.
Petroleum Refining Library provides functionality for:
  • database-driven feedstock plans;
  • dynamic source modeling;
  • crude oil and feedstock blending;
  • pipeline and flow constraints;
  • tank farm operations;
  • refinery production integration;
  • scenario analysis and optimization.
This enables engineers to build realistic refinery digital twins rather than simplified logistics models.

8 Can the simulation include tank farms and storage operations?
Yes. Tank farms are a critical part of refinery supply chains because they decouple upstream production from refinery consumption.
The model can represent:
  • tank capacities;
  • minimum and maximum operating levels;
  • accumulation and storage rules;
  • passportization operations;
  • shipment schedules;
  • blending operations;
  • inventory availability.
This allows evaluation of storage constraints and their impact on refinery operations.

Can crude oil supply chain simulation be used for production planning?
Yes. A digital twin can be used together with production planning and optimization methods to evaluate different operating scenarios.
Typical applications include:
  • evaluating alternative crude supply strategies;
  • analyzing production interruptions;
  • optimizing tank farm utilization;
  • assessing refinery capacity constraints;
  • supporting operational decision-making.

What scenarios can be analyzed using a crude oil supply chain digital twin?
Typical simulation scenarios include:
  • changes in crude oil production rates;
  • pipeline capacity restrictions;
  • equipment maintenance events;
  • refinery throughput changes;
  • alternative crude supply strategies;
  • storage capacity expansion;
  • changes in shipment schedules.
The digital twin allows engineers to compare different scenarios without affecting real operations.

Can crude oil supply chain simulation be integrated with optimization models?
Yes. Simulation and optimization complement each other.
Simulation evaluates the dynamic behavior of the system, while optimization algorithms can determine improved operating decisions considering:
  • supply constraints;
  • refinery capacity;
  • product demand;
  • storage availability;
  • operational priorities.

Who uses crude oil supply chain simulation?
Typical users include:
  • oil and gas companies;
  • refinery operators;
  • engineering companies;
  • digital transformation teams;
  • production planning departments;
  • supply chain optimization specialists.
The technology is used to improve operational reliability, evaluate investments, and support complex decision-making.