Petroleum Refining Library (PRL) is an additional palette library for Anylogic. It is based on Anylogic Fluid library and helps to build a different kind of imitation models for Oil & Gas refining. Like Anylogic, PRL fully supports Java.
Base PRL features:
- building a different kind of imitation models like “digital twins” in Oil & Gas industry;
- performing an accurate “balance” calculations of incoming flows and resulting products;
- make detailed optimization flows calculations within Oil & Gas refining;
- taking into account all unique features of specific Oil & Gas companies for maximum accurate forecasting;
- setting and solving any tasks of the current processing management in Oil & Gas industry.
Base Petroleum Refining Library Agents includes the following agents:
Source is an advanced container that allows to create various types of entry flows (oil, unstable natural gas liquid, etc.). Source agents enable to set daily or monthly flow plans from the database, facilitate flow smoothing for monthly values, and provide many other functions.
The Source agent allows you to:
— set an arbitrary number of oil, gas and unstable natural gas liquid sources, as well as daily and monthly plans for the supply of hydrocarbons;
— perform «smoothing» of monthly oil, gas and condensate flows to ensure smooth transitions from one value to another;
— establish user-defined plans, as well as limit the rate of their receipt at arbitrary points in time;
— collect various statistics on the performance of sources and the extent to which they have fulfilled their plans.

Plant is an agent, that allows for the configuration of the flow-splitting process by various types of processing plants in the Oil & Gas industry (such as rectification, catalytic reforming, etc.). The Plant agent contains a wide variety of settings that enable the establishment of basic operating conditions for almost any kind Plant in Oil & Gas.
Plant agent allows user to set a lot of different kind of options, which allow to configure it with maximum accuracy for any Oil & Gas specificity.
These settings include:
Optimization algorithm for best separating the incoming flow between Plant lines. PNL contains both automatic and manual algorithms for separating incoming flow across plant lines. The automatic algorithm takes into account multiple conditions, such as minimum and maximum each line loads, lines states (whether a line is under repair), the composition of inner flows, and their effect on minimum or maximum line load, among others. Alternatively, there is a manual algorithm, where the results of separation along the lines are independently redirected by the user.
If the Plant entering flow exceeds maximum load, the “residual” flow (that is not accepted) can be withdrawn from the Plant and sent to another node of the refining. Additional requirements (for example minimum flow to valves) can be established for residual flow, which completely replicates the operation of a real processing Plant.
Plant agent also has the ability to automatically control the modes, depending on the established pumping plans. The selection of modes can be carried out by the plant automatically (in conjunction with the control agent) or manually (after the user’s click).


The key calculation element of every oil and gas processing plant are the «recipes». Recipes are the rules that relates the mass of the incoming flow to the outgoing flows of semi-products and products, as well as the flow of losses. The recipes affect the output flows values and represent the separation coefficients.
Plant agent also includes many additional fields that allow to specify any extra features of their work. For example, the «Link» field enables to set the connection option of a particular Plant line to another one. For example, if any line uses stable condensate, which may come from one of the lines of the previous Plant, this must be taken into account in the calculations. Moreover, this connection may vary over time.
RpAccumulative is advanced park agent, that contains many options, which are necessary for «cumulative» reservoir parks. This agent implements procedures of accumulation, passportization (compounding), and shipment of products. In addition, RpAccumulative contains built-in mechanisms for tracking product shipment plans
Determination of arbitrary duration of compounding and passportization of products, including taking into account weekends and holidays, shipping at an arbitrary speed and only on working days. As a rule, a shipment always implements one of three algorithms: as quickly as possible, by days (in accordance with a set schedule) or evenly throughout the month (for continuous mixing with other products). RpAccumulative and ShipmentNode agents supports all these algorithms.
The execution of plans is implemented in RpAccumulative by using the «requests» mechanism. An request is a requirement transmitted from the RpAccumulative to the Plant, containing the required mass and it’s purpose. RpAccumulative implements four types of purposes:
— additional mass to fulfill the product shipment plan (received from ShipmentNode agent),
— additional mass to fulfill the plan for the next month (creating reserves),
— additional loading of the active tank to the minimum acceptable level,
— additional user mass.
After receiving the request, Control agent analyzes their priority and set the Plant to the appropriate mode.
If there is no way to receive an additional flow at the RpAccumulative (for example, if all of the tanks are full), so the flow can be automatically sent to another processing unit.


RpFlowing is an advanced park agent, that characterized by continuous inflows and outflows that fill and unload parallel connected tank (called «maps»), RpFlowing is used for «smoothing» outgoing flow products.
Every RpFlowing can operate in two different «smoothing» flow modes.
Mode 1: The out speed (Vout(t)) at each moment is determined automatically by the out speed at the previous moment (Vout(t-1)) and the maximum out speed change per step (∆Vout). It also takes into account restrictions on the maximum (Vmax) and minimum (Vmin) values of out speed. This mode is usually used when RpFlowing is set at the end of the scheme, and the outflow goes to a pipeline. In this case, the minimum and maximum pumping speeds are determined by the performance of the pumping equipment, and the maximum speed change per simulation step is dictated by the need for the tanks to «breathe,» as well as the inadmissibility of excessive hydrodynamic effects on the receiving gas pipeline.
Mode 2: RpFlowing is located within the scheme and also performs the function of «smoothing» the outgoing flow. However, in this case, the out speed flow is entirely determined by the restrictions imposed by subsequent nodes (for example, the total capacity of the plants located behind RpFlowing).
Control is an agent that collects requests from Reservoir Parks and tracks the level of their completion. The control agent allows for effective request management because it contains various Java Interface elements that enable the setting of different rules for processing
ProductMixer is an advanced product mixing agent, that allows for the optimal mixing of input flows and product additives to create a desired product (such as petrol, kerosene, etc.). It is known that the creation of most products is accompanied by a number of requirements (such as sulfur content, saturated vapor pressure, aromatics, etc.). This agent takes these requirements into account and mixes incoming flows in an optimal way to ensure their simultaneous fulfillment


For example, It is known that automobile petrol production characterized by a number of requirements, for example: octane number (ON im), saturated vapor pressure (SVP), aromatics and many others. Each of incoming flow, that are used for petrol production, has own values of the requirement parameters. Sometimes, no single mixture variant of the incoming flows allows to meet all requirements at the same time. In this case, we can use a special balance additives, for example Methyl tert-butyl ether (MTBE). However, due to the high cost of additive, it is desirable to minimize use MTBE and to maximize result product. Take a look at the picture below. It schematically shows how Product Mixer allows to link enter, exit and residual flows and estimate the amount of product