AnyLogic
Expand
Font size

Pipeline

Transports fluid from one point to another. Has a finite capacity. Optionally can contain some initial fluid located at the input end.

Once the pipeline gets filled, it stays filled forever, gaps are not allowed in pipelines (if gaps or condensed sections are needed, consider using BulkConveyor). All fluid in the pipeline moves at the same rate, therefore, when the pipeline is full, its input rate is always equal to the output rate. While the pipeline is not full, its input rate is only limited by the pipeline own rate (if required, set the Limited rate option and define the upper limit for the rate in the parameter Maximum rate).

The specified rate cannot be lower than the value of Utils.RATE_TOLERANCE constant, i.e. 1.0e-9. If rate value falls below this value after recalculation, it will be snapped to 0.

Pipeline transfers batches in FIFO order. You can specify the batch of the fluid initially contained in the pipeline.

The Pipeline block allows you to define actions associated with the pipeline getting completely filled, and with new batches appearing at the input or at the output.

Demo model: Pipeline Open the model page in AnyLogic Cloud. There you can run the model or download it (by clicking Model source files).

Parameters

Capacity
The maximum amount the pipeline can contain. This value cannot be less than the value of Utils.TOLERANCE.
Syntax: double capacity
Set new value at runtime: set_capacity(new value)
Initial amount
The amount initially contained in the pipeline. This value cannot be less than the value of Utils.TOLERANCE.
Syntax: double initialAmount
Set new value at runtime: set_initialAmount(new value)
Limited rate
If the option is selected (the value is equal to true), you are able to specify a custom upper limit of the rate the pipeline can operate at.
Syntax: boolean limitRate
Maximum rate
[Visible and applies only if the Limited rate option is set]
Custom upper limit of the pipeline transfer rate. The default value is 10 cubic meters per second.
Syntax: double maxRate
Set new value at runtime: set_maxRate(new value)
Custom priority
If the option is set (the value equals true), the priority of the pipeline outflow will be defined by the Output flow priority parameter below, otherwise it equals 1. Priority affects the LP solver when it tries to maximize the flow through the system.
Syntax: boolean customPriority
Set new value at runtime: set_customPriority(true) or set_customPriority(true)
Output flow priority
[Visible and applies only if the Custom priority option is set]
Custom priority of the pipeline outflow in the overall flowchart. Must be a positive integer.
Syntax: int priorityOutCustom
Set new value at runtime: set_priorityOutCustom(new value)
Custom initial batch
If set, the fluid initially contained in the pipeline will be of type Initial batch. If not, it will be BatchTypes.DEFAULT_BATCH.
Syntax: boolean customInitialBatch
Set new value on startup: set_customInitialBatch(new value)
Initial batch
[Visible and applies only if the Custom initial batch option is set]
Defines the batch initially contained in the pipeline.
Syntax: Object initialBatch
Set new value on startup: set_initialBatch(new value)
Custom batch color
If set, the initial batch color is defined by the Batch color parameter below, otherwise the standard color mapping applies.
Syntax: boolean customInitialBatchColor
Set new value on startup: set_customInitialBatchColor(new value)
Batch color
[Visible and applies only if the Custom batch color option is set]
Defines the color of the initial batch.
Type of the value: Color
Local variable: Object batch — the initial batch

Animation

Pipe
Here you can specify the name of a Pipe space markup shape used to animate the pipe defined by this Pipeline block (both in 2D and 3D animation).
Syntax: Pipe pipe
Show batches in flowchart
If set, the block icon will display the current batch color.
Syntax: boolean showBatchesInFlowchart

Actions

On full
Action executed when the pipeline gets full; this may happen only once during the pipeline lifecycle. Is not executed if the pipeline is initially full.
On new batch at input
Action executed when a new batch appears at the input. It will not necessarily start flowing into the block.
Local variable: Object batch — the batch
On new batch at output
Action executed when a new batch reaches the pipeline output.
Local variable: Object batch — the batch
On rate change
Action executed when any of the flow rates (input or output) changes.
Changing something in the action may result in another immediate rate change and immediately following another call of On rate change, so the user can possibly create a livelock.
Local variables:
double inrate — the current input rate
double outrate — the current output rate

Functions

Fluid amount
Function Description
double amount() Returns the amount currently contained in the pipeline (total of all batches). If the amount is less than the value of Utils.TOLERANCE, returns 0.
double amount(AmountUnits units) Returns the amount of fluid (in given units) currently contained in the pipeline (total of all batches). If the amount is less than the value of Utils.TOLERANCE, returns 0.
double amountPassedIn() Returns the total amount passed through the input port of the pipeline since the start of the simulation.
double amountPassedIn(AmountUnits units) Returns the total amount of fluid (in given units) passed through the input port of the pipeline since the start of the simulation.
double amountPassedOut() Returns the total amount passed through the output port of the pipeline since the start of the simulation.
double amountPassedOut(AmountUnits units) Returns the total amount of fluid (in given units) passed through the out port of the pipeline since the start of the simulation.
boolean isFull() Tests if the pipeline is full, i.e. the amount equals the pipeline capacity. Returns true if the pipeline is full, and false otherwise.
boolean isEmpty() Tests if the pipeline is empty. Returns true if the pipeline is empty, and false otherwise.
There can still be a zero-size batch in an empty pipeline in case it has appeared at the input, but has not actually started flowing in.
Utilization
Function Description
double utilization() Returns the currently utilized fraction of the pipeline bandwidth, namely the current input rate / maximum input rate. If the current maximum rate is not limited or equals 0, returns 0.
double utilizationTotal() Returns the average utilization of the pipeline bandwidth throughout the total operating time, namely, the amount passed through the pipeline input divided by the maximum amount that could pass, subject to the (possibly changing) maximum rate. If the rate has been set to unlimited even once, the function will return zero.
Flow rate
Function Description
double averageRateIn() Returns the average rate through the input of the pipeline throughout the total operating time in cubic meters per second.
double currentRate() Returns the current flow rate of fluid at the pipeline input. (The flow rate at the output is either zero if the pipeline is not full, or the same as at the input.)
double currentRate(FlowRateUnits units) Returns the current flow rate (in given units) of fluid at the pipeline input. (The flow rate at the output is either zero if the pipeline is not full, or the same as at the input.)
Batches
Function Description
int numberOfBatches() Returns the number of batches currently present in the pipeline, including possible zero-length batches.
Object getBatch(int index) Returns the batch with the specified index. Batch with index 0 is the closest to the pipeline output, batch with the index numberOfBatches()-1 is the last batch at the input.
double getBatchSize(int index) Returns the size of the batch with the specified index. Batch with index 0 is the closest to the pipeline output, batch with the index numberOfBatches() - 1 is the last batch at the input.
double getBatchSize(int index, AmountUnits units) Returns the size of the batch (in given units) with the specified index.
double getBatchOffset(int index) Returns the sum of sizes of all batches closer to the pipeline input than the batch with a given index. Intended use is custom animation.
Resetting statistics
Function Description
void resetStats() Resets statistics collected for this block, including the statistics collected for its ports.

Ports

in
The input port.
out
The output port.
How can we improve this article?