What is Petroleum Refining Library?

       Oil and gas processing facilities are complex systems involving feedstock reception, processing, storage, and product shipment. In the era of digital transformation, digital twins and simulation modeling have become powerful tools for supporting operational and planning decisions in the oil and gas industry. The Petroleum Refining Library (PRL) for AnyLogic is a process simulator designed to facilitate the development of realistic digital twins of oil and gas facilities.

Petroleum Refining Library

is a process simulator for AnyLogic focused on operational and production management

Refinery Simulation and Digital Twin Architecture

       Modern refinery simulation requires more than standalone process models. A comprehensive digital twin refinery combines process units, tank farms, pipelines, utilities, production planning, and logistics into a single simulation environment. The Petroleum Refining Library extends AnyLogic with domain-specific components that simplify the development of integrated refinery digital twins while preserving flexibility for project-specific customization.
       Oil and gas processing facilities are complex systems involving feedstock reception, processing, storage, and product shipment. In the era of digital transformation, digital twins and simulation modeling have become powerful tools for supporting operational and planning decisions in the oil and gas industry. The Petroleum Refining Library (PRL) for AnyLogic is a process simulator designed to facilitate the development of realistic digital twins of oil and gas facilities.
Petroleum Refining Library is a process simulator for AnyLogic. PRL provides a comprehensive framework for building digital twins and solving a wide range of operational and planning tasks:
  1. Feedstock distribution. The library supports the modeling of crude oil, natural gas, condensate, and other feedstock flows. It enables engineers to analyze different routing strategies and distribute feedstocks between process units while considering capacity limitations and operating constraints. Learn more about crude oil supply chain simulation and refinery feedstock transportation from production fields to processing units.
  2. Production planning. Efficient production planning depends on reliable feedstock allocation across multiple process units and storage facilities. Simulation makes it possible to evaluate different production schedules, analyze the impact of changing feedstock availability, and optimize material flows throughout the refinery. This helps improve resource utilization while maintaining production targets and operational flexibility. PRL coordinates refinery operations through a request-based production planning mechanism that synchronizes process units, storage systems, and logistics operations.
  3. Process unit management. The library enables detailed simulation of processing units and their operating modes. Engineers can model equipment performance, switching between technological schemes, maintenance activities, and interactions between interconnected units. As a process simulator, PRL helps evaluate the impact of operational decisions before implementing them in real facilities.
  4. Tank farm simulation. Is an essential part of refinery logistics because storage systems connect production units with transportation and product distribution. Accurate modeling of flow dynamics, filling and shipment operations, planning modes, blending, additives, and storage constraints allows engineers to evaluate flow dynamics, improve product availability, and optimize refinery logistics under changing operating conditions for each tank. Learn more about refinery tank farm simulation, including accumulative tank farms, shipment planning, tank repairs, passportization, and inventory management.
  5. Dynamic tank reallocation. Allows refinery simulation models to temporarily assign idle tanks to storage areas with capacity shortages. By dynamically balancing storage resources, engineers can optimize tank utilization, maintain production continuity, and evaluate alternative operating scenarios within a refinery digital twin.
  6. Reservoir park control. Modern refinery digital twins require intelligent coordination of storage operations, including tank allocation, filling priorities, passportization, product segregation, and shipment scheduling. PRL implements a request-based control mechanism that synchronizes reservoir parks with process units and logistics operations, ensuring stable refinery performance under changing operating conditions. Learn how reservoir parks are controlled in refinery digital twins.
  7. Shipment planning. PRL allows users to model product withdrawal requests and transportation operations. Various shipment priorities and loading strategies can be evaluated to ensure that contractual obligations and production targets are satisfied.
  8. Repair simulation. PRL allows users to model scheduled maintenance and repair operations for storage tanks and processing units. The library supports both accumulative and flowing systems while preserving production plans, shipment schedules, and mass balance.
  9. Optimization schemes. The library provides mechanisms for integrating optimization algorithms with simulation models. Users can perform bottleneck analysis, evaluate alternative operating strategies, and improve facility performance using a process simulator integrated with advanced planning workflows.
  10. Operational Decision-Making in Oil and Gas Systems. Simulation becomes most valuable when it supports operational decision-making. Engineers can evaluate production scenarios, identify bottlenecks, optimize storage utilization, and compare alternative operating strategies before implementing them in real facilities. This enables more informed decisions for refinery operations, maintenance planning, and logistics management while reducing operational risks.
       Combined with external databases and enterprise information systems, these capabilities enable the development of realistic digital twins that support oil and condensate deliveries, production planning, storage management, shipment scheduling, process optimization, and scenario analysis. As a result, Petroleum Refining Library helps engineers and decision-makers improve operational efficiency and make more effective strategic decisions.
       Petroleum Refining Library is fully integrated into the AnyLogic simulation environment and provides a comprehensive set of components for modeling oil and gas processing facilities, including process units, tank farms, sources, and blending and splitting nodes. Flexible settings and parameters allow engineers to accurately represent real-world assets.

Applications of Petroleum Refining Library

Refinery Production Planning
Tank Farm Optimization
Pipeline Simulation
Digital Twin Development
Supply Chain Simulation

Why Use a Specialized Petroleum Refining Library?

       Although AnyLogic provides powerful general-purpose simulation capabilities, developing refinery models from scratch often requires significant engineering effort. A specialized Petroleum Refining Library provides reusable industry-specific components that accelerate model development, improve consistency, and simplify the implementation of complex refinery logic, including process units, tank farms, transportation systems, and production planning workflows.
       In addition, Petroleum Refining Library includes a large collection of reusable Java class templates that provide advanced modeling capabilities and significantly simplify the development, customization, and maintenance of large-scale AnyLogic models. These utilities cover many common tasks encountered in industrial simulation projects and allow engineers to focus on process logic instead of implementing supporting infrastructure from scratch.
  • Control and model management.The library contains classes for processing control requests and model commands. They support object identification, state management, serialization, and replay mechanisms, enabling the creation of controllable and reproducible digital twins.
  • Data export and reporting. Shared export utilities provide convenient mechanisms for collecting and writing structured simulation results to Excel and other external formats. This simplifies reporting and integration with corporate information systems.
  • Maintenance and repair scheduling. Specialized classes support equipment repair planning under operational constraints (for RpAccumulative and RpFlowing). They efficiently track maintenance intervals and dynamically apply schedule changes during simulation, making it possible to represent realistic maintenance strategies.
  • Statistical analysis tools. The library includes a wide range of statistical classes for collecting and processing information about material flows, equipment utilization, loading levels, inventories, and other performance indicators. These tools provide detailed insight into system behavior and simplify model analysis.
  • Centralized model constants. Configuration classes provide centralized access to model parameters and constants loaded from databases or external sources. This approach improves maintainability and facilitates scenario management.
  • Plant synchronization mechanisms. The library contains utilities for coordinating operating modes between interconnected facilities and process units. Such mechanisms are especially useful for building integrated supply chain and cluster-level models.
  • Extensible Java framework. Beyond these examples, the library contains numerous additional Java utilities and templates designed to accelerate the development of industrial-scale oil and gas models. These components provide a solid software foundation for creating flexible, maintainable, and highly customized digital twins in AnyLogic.
       As a result, Petroleum Refining Library not only provides domain-specific simulation blocks, but also delivers an extensive software framework that helps engineers develop sophisticated oil and gas models faster and with significantly less programming effort.
       Petroleum Refining Library is intended for engineers, researchers, and developers working on digital twins for oil and gas facilities. It is used by refineries, gas processing plants, universities, research organizations, and AnyLogic users developing advanced process and production models. With Petroleum Refining Library, engineers can concentrate on solving real industrial challenges instead of spending time building simulation infrastructure from the ground up.

       To demonstrate the capabilities of the library, let us consider a simplified gas condensate processing plant. A condensate stabilization unit operates in two modes — stabilization and deethanization — producing several products that are accumulated in dedicated tank farms before shipment. Regardless of the park type, their operation relies on common reservoir park control principles. Because the LPG storage capacity is limited, the operating mode must periodically switch when storage is full or production targets are achieved. The model records product flows and enables engineers to evaluate production plans and analyze facility utilization. Let's do it with Petroleum Refining Library!
       The model of this gas condensate processing plant is implemented in AnyLogic using the Petroleum Refining Library.
Feed sources simulate unstable gas condensate inflow and support different planning modes. They are connected to the condensate stabilization plant, which flexibly defines product separation and output streams.
The stabilization unit is connected to tank farms, which provide flexible configuration of product withdrawal priorities. In this example, only Priority A is used, ensuring that tank farms are filled to meet the current month's shipment targets. The product dispatch nodes dynamically monitor plan execution and support different withdrawal strategies, including maximum-rate operation, uniform withdrawal, and daily scheduled withdrawal.
       After the simulation starts, the feed sources begin sending unstable gas condensate to the stabilization unit according to the specified production plan. The feed then enters the stabilization plant, which consists of two process lines. At the moment, one line is operating in stabilization mode, while the other is operating in deethanization mode. At certain periods, both lines switch to deethanization mode simultaneously, as shown now. This behavior is caused by the limited capacity of the NGL receiving tank farm, which periodically becomes completely full. When both tanks are filled and no additional NGL can be accepted, the plant automatically switches to deethanization mode. If we accelerate the simulation, we can see that as storage capacity becomes available again, one of the process lines returns to stabilization mode, while the other continues operating in deethanization mode.
In addition to the NGL reservoir park, the model includes several other parks. However, due to their large capacities, they do not significantly affect the operation of the process unit. As time progresses, production targets for all product streams are successfully achieved. At the same time, the product dispatch nodes gradually approach one hundred percent completion of the scheduled shipment targets.
       This example demonstrates how the Petroleum Refining Library for AnyLogic can be used to model real-world oil refining and gas condensate processing facilities with a high level of detail.

Last updated on 23.06.2026