Modeling Flow Quotas in Refinery Simulation

Introduction

       In refinery production planning, equipment capacity is only one of the factors limiting material transfer. Pipelines, loading facilities, and process units are frequently constrained by contractual, technological, or regulatory throughput quotas that apply over an entire day or month rather than at any particular moment. Traditional flow rate limits cannot model these constraints because they control only the instantaneous flow rate and ignore the cumulative amount of material transferred over time.        FlowQuota solves this problem by tracking the transferred mass over a configurable period and automatically stopping material transfer when the specified quota is reached. This enables refinery simulation, production planning, and digital twin models to represent aggregated technological constraints and produce more realistic refinery operations and production schedules. For a conceptual overview of flow quotas, industrial applications, and the differences between flow quotas and flow rate limits, see Flow Quotas in Refinery Simulation.

Typical Applications

       FlowQuota can be used wherever material transfer is limited by a cumulative throughput constraint rather than an instantaneous flow rate. Typical applications include:
  • Daily pipeline throughput limits to represent contractual or operational transfer restrictions.
  • Monthly production quotas for process units and refinery products.
  • Terminal and loading limits that restrict the total amount of product dispatched during a specified period.
  • Operational throughput constraints imposed by maintenance, regulations, or operating procedures.
  • Digital twin and process simulation models where cumulative production limits are required for realistic production planning and refinery logistics.
In all of these scenarios, FlowQuota ensures that material transfer automatically stops when the configured quota is reached and resumes at the beginning of the next accounting period. Additional refinery use cases, industrial examples, and engineering motivation are discussed in Flow Quotas in Refinery Simulation.

How FlowQuota Works

       FlowQuota extends the standard AnyLogic Valve by continuously measuring the cumulative mass transferred through the component during a configurable accounting period (day or month). As long as the accumulated mass remains below quotaLimit, the valve operates normally. Once the quota is reached, the valve closes automatically, blocking further material transfer. At the beginning of the next accounting period, the accumulated mass is reset, the valve reopens, and quota accounting starts again. This event-driven mechanism allows cumulative throughput constraints to be modeled without additional control logic, making FlowQuota suitable for refinery process simulation, pipeline simulation, production quotas, and other aggregated technological constraints.

Component Configuration in Petroleum Refining Library

       FlowQuota provides a small set of properties required to configure cumulative throughput control.
       The quota is specified as mass rather than volume because mass is conserved during material transfer, while volume may vary with density. This ensures consistent quota accounting across refinery processes.

Monitoring API

       FlowQuota provides several methods for monitoring quota usage and valve state during a simulation.
       These methods can be used to display operational statistics, monitor quota consumption, generate reports, or implement custom control logic based on the current quota status.

Control API

Although quota management is automatic, FlowQuota also provides methods for programmatic valve control.
       These methods allow simulation models to modify quota settings, control valve behavior, and respond to changing operating conditions during runtime.

Events

       FlowQuota provides events that allow simulation models to react to changes in the component lifecycle and valve state without continuous polling.
       The On Valve State Change event is particularly useful for coordinating upstream and downstream components. For example, an upstream controller can immediately reroute material when the quota is exhausted and resume normal operation after the quota is reset.

Dynamic Quotas

       The quota limit can be modified during a simulation using quotaLimit dynamic parameter. This allows FlowQuota to represent changing operating conditions, such as revised production plans, maintenance activities, or temporary throughput restrictions. A new quota value is not applied immediately. Instead, FlowQuota evaluates the updated limit during the next quota verification cycle. This behavior prevents unexpected valve state changes caused by instantaneous parameter updates and ensures predictable quota management throughout the simulation. This feature is particularly useful in digital twin applications where operators adjust production targets during runtime.

Integration with Petroleum Refining Library

       FlowQuota can be inserted between virtually any upstream and downstream Petroleum Refining Library components, including Source, ProductMixer, Plant, SeparatorLight, MixerLight, RpAccumulative, RpFlowing, LoadingRack, or custom AnyLogic Fluid Library components.
       When the configured quota is reached, FlowQuota closes its internal valve and triggers the On Valve State Change event. Components such as ProductMixer can subscribe to this event and reroute material to alternative destinations, while custom components can synchronize their behavior through the same event without continuous state polling or component-specific integration logic. After the quota is reset at the beginning of the next accounting period, normal material transfer can resume automatically.
       To learn how FlowQuota extends the standard AnyLogic Valve with recurring quota management and programmable throughput control, see Flow Rate Limiting in AnyLogic Using FlowQuota.

Runtime Example

       The following example illustrates how FlowQuota manages a daily throughput quota during a refinery simulation by continuously monitoring cumulative material transfer.

Configuration
quotaLimit = 10,000 t/day
Quota Duration = Day

Best Practices

       Use FlowQuota to model cumulative throughput constraints, not instantaneous flow limits.
        - assign one FlowQuota to each independent operational constraint.
        - chaining multiple FlowQuota components in series is generally unnecessary because the smallest quota becomes the effective limit.
       Ensure upstream components respond appropriately when a quota is exhausted to maintain stable refinery operations and prevent unnecessary interruptions to downstream production processes. Use the On Valve State Change event to synchronize connected components instead of continuously polling the valve state. Prefer expressing quotas as mass rather than volume to ensure consistent accounting regardless of density changes. Practical examples of valve control, quota monitoring, runtime automation, and production scenarios are presented in Flow Rate Limiting in AnyLogic Using FlowQuota.

Conclusion

       FlowQuota provides a simple and efficient way to model cumulative throughput constraints in refinery simulation, process simulation, and pipeline simulation. By tracking transferred mass over configurable accounting periods, it enables realistic representation of production quotas, pipeline throughput limits, and other aggregated technological constraints. With automatic quota management, runtime monitoring, event-driven integration, and seamless compatibility with other Petroleum Refining Library components, FlowQuota helps build refinery simulation, digital twin, and production optimization models that accurately represent real operational throughput constraints while remaining simple to configure and integrate into modern refinery planning workflows.

FAQ

1 What is the difference between FlowQuota and a standard AnyLogic Valve?
A standard Valve limits the instantaneous flow rate or can stop flow after a specified transferred amount. FlowQuota extends this functionality by introducing configurable accounting periods, automatic quota resets, runtime monitoring, events, and additional control methods for modeling recurring throughput constraints.

2 Does FlowQuota limit flow rate?
No. FlowQuota limits the cumulative transferred mass during a configurable accounting period. The instantaneous flow rate is determined by the connected process and valve settings.

3 Which accounting periods are supported?
FlowQuota supports daily and monthly quota accounting. At the beginning of each new period, the accumulated transferred mass is automatically reset.

4 Can the quota limit be changed during a simulation?
Yes. The quota can be updated programmatically using dynamic quotaLimit parameter. The new value is applied during the next quota verification cycle.

5 What happens when the quota is reached?
The internal valve closes automatically, preventing further material transfer. The valve reopens automatically after the quota is reset at the beginning of the next accounting period.

6 Can FlowQuota be integrated with custom components?
Yes. Universal integration is provided through the On Valve State Change event, allowing any component to react immediately when the valve opens or closes.

7 Can multiple FlowQuota components be connected in series?
Yes, but this is rarely useful. In most cases, the smallest quota becomes the effective limit, so a single FlowQuota should represent each independent operational constraint.

8 How does FlowQuota differ from a Shipment Node?
Although both components can stop material transfer after a specified amount has been processed, they serve different purposes. A Shipment Node is responsible for production planning. It executes shipment plans by generating material requests according to schedules and working calendars. A FlowQuota represents an operational throughput constraint. Instead of defining what should be transferred, it limits how much material can pass through a process connection during a specified accounting period.
In practice, Shipment Node determines the required transfers, while FlowQuota ensures that those transfers remain within technological throughput limits.

9 Does FlowQuota support daily and monthly quotas simultaneously?
No. Each FlowQuota instance manages a single accounting period. Use separate FlowQuota components if independent daily and monthly limits must be enforced.

10 Does FlowQuota affect upstream flow?
No. FlowQuota only controls its internal valve. Upstream components continue operating according to their own logic. If coordinated behavior is required, connected components should react to the On Valve State Change event.