Flow Rate Limiting in AnyLogic Using FlowQuota

Why Flow Rate Limits Alone Are Not Enough

       Flow rate limiting controls how fast material moves through an industrial process, but many refinery, pipeline, and bulk material handling systems are constrained by how much material can be transferred over a specific accounting period. Daily production targets, shipment schedules, pipeline nominations, and terminal allocations are typically defined as cumulative throughput quotas rather than maximum flow rates. For example, a pipeline limited to 100 t/h can transfer 2,400 tonnes per day if it operates continuously. If the permitted daily quota is only 2,000 tonnes, limiting the flow rate alone is insufficient. The model must continuously track the accumulated transferred volume and stop the transfer as soon as the quota is reached.
FlowQuota solves this problem by combining flow rate limiting, cumulative throughput control, quota monitoring, and automatic valve control. It tracks cumulative flow over configurable daily or monthly periods, closes the valve when the allocated quota is exhausted, and automatically resumes operation when a new quota period begins or the quota is updated.

FlowQuota: Daily and Monthly Throughput Control

       FlowQuota is a programmable AnyLogic component for implementing daily and monthly production quotas and cumulative throughput limits. It continuously tracks the cumulative transferred mass and automatically closes its internal valve when the configured quota is reached.
The valve remains closed until the next quota period begins or the quota is updated programmatically. This enables realistic simulation of production limits, shipment quotas, pipeline transfer limits, and refinery production planning. Beyond quota enforcement, FlowQuota provides a programmable API for monitoring quota utilization, controlling throughput limits, handling valve state changes and throughput control, and dynamically adjusting operating conditions during simulation.

Monitoring Throughput Utilization

       FlowQuota provides real-time monitoring of throughput utilization and valve status, making it easy to build dashboards, trigger automation logic, or monitor production progress, quota utilization, and production planning KPIs during simulation. Together, these methods provide all the information required to monitor quota utilization, track production progress, and determine how much capacity remains before the valve is automatically closed.

Controlling Flow Execution

       In addition to monitoring quota utilization, FlowQuota provide methods for controlling throughput execution during a simulation. These methods allow a model to adjust operating conditions dynamically in refinery simulation models without modifying the model structure.
       A typical application is temporarily reducing throughput because of operational constraints, such as limited pump capacity, pipeline maintenance, or terminal operating restrictions. Once normal conditions are restored, the default speed limit can be recovered with resetSpeedLimit(). Another common scenario occurs after increasing the available quota. If the valve was closed because the quota had been exhausted, calling openIfAllowed() immediately resumes flow without restarting the simulation.

Events and Dynamic Configuration

       FlowQuota can also interact with other model components through events and runtime configuration, making it suitable for event-driven refinery process automation.
       The onAfterInitialize() event provides a convenient hook for applying additional configuration immediately after the component has been initialized.
       The onValveStateChanged() callback is triggered whenever the valve changes between the open and closed states. It can be used to synchronize downstream logic, switch operating modes, or trigger custom actions when quota conditions change.
       FlowQuota also exposes the quotaLimit dynamic variable, allowing the active quota to be modified during a simulation. This enables models to represent changing production targets, shipment schedules, refinery operating plans, or pipeline nominations.

Practical Automation Examples

Refinery Production After Daily Quota Exhaustion
Consider a ProductMixer producing AI-95 gasoline in a refinery simulation model. The production plan allows a maximum of 2,000 tonnes per day.While the quota is available, the gasoline produced by the mixer flows through FlowQuota to the downstream consumer. Once the daily quota is exhausted, FlowQuota automatically closes its valve and triggers the onValveStateChanged() event. Instead of stopping the production unit, the event can switch the ProductMixer to an alternative operating mode. The incoming component streams continue to arrive, but the finished gasoline is redirected to residual storage tanks instead of being shipped to the consumer. When a new quota period begins or the quota is increased, the valve reopens and the mixer automatically resumes normal production. This approach allows operational constraints to be simulated without interrupting upstream processes.
Dynamic Production Capacity Expansion
Production capacity often changes in digital twin and long-term refinery simulation studies. For example, a plant may initially be limited to 2,000 tonnes per day, with a second production line commissioned later, increasing the available capacity to 4,000 tonnes per day. Instead of rebuilding the model or changing the process logic, the active quota can be updated by modifying the quotaLimit variable. FlowQuota immediately applies the updated throughput limit, allowing the simulation to continue with the increased production capacity. This approach is useful for evaluating expansion projects, production planning and scheduling scenarios, operational optimization, and digital twin studies.

FlowQuota for Refinery Simulation in the Petroleum Refining Library

       FlowQuota is included in the Petroleum Refining Library (PRL) and is used to model operational constraints throughout refinery logistics and production systems. Typical applications include refinery production planning, finished product shipments, pipeline transportation, tank farm operations, loading rack scheduling, and terminal logistics. The component integrates seamlessly with other PRL elements, enabling realistic simulation of refinery operations while keeping production plans and material balances consistent.

Conclusion

       FlowQuota extends the standard AnyLogic Valve by introducing cumulative quota control, real-time monitoring, and event-driven automation. It enables refinery and industrial simulation models to enforce daily or monthly throughput limits. Whether used in refinery simulation, digital twin applications, production planning, logistics optimization, pipeline simulation, or terminal operations, FlowQuota helps create more realistic and maintainable models where operational constraints are represented directly within the simulation logic.

FAQ

1. What is the difference between a flow rate limit and a flow quota?
A flow rate limit restricts the instantaneous transfer rate (for example, 500 t/h), while a flow quota limits the total amount transferred during a specified period (for example, 8,000 t/day).

2. What happens when the quota is reached?
FlowQuota automatically closes its internal valve, preventing any further transfers. The valve remains closed until a new quota period begins or the quota is increased programmatically. The quota is automatically reset when a new accounting period begins.

3. Can the quota be changed during a simulation?
Yes. The active quota can be updated through the quotaLimit dynamic variable, allowing the model to represent changing production targets or operational decisions without modifying the model structure.

4. Can FlowQuota control other model components?
Yes. The onValveStateChanged() event can trigger custom logic whenever the valve opens or closes, allowing other components to change operating modes or respond to quota conditions.

5. Can the valve be reopened manually?
Yes. Calling openIfAllowed() attempts to reopen the valve. If quota conditions permit, flow resumes immediately without restarting the simulation.

6. Which industries can use FlowQuota?
Although FlowQuota is part of the Petroleum Refining Library, it can be used in any simulation model that requires cumulative throughput limits, including production systems, refinery logistics, pipeline transportation, terminal operations, and bulk material handling.