AnyLogic
Expand
Font size

ProcessTank

The ProcessTank blocks accumulates fluid up to the Capacity level, optionally delays (that is, processes) it for a given amount of time, and lets it flow out. The Capacity is a dynamic property and is re-evaluated at the beginning of each cycle: for the first time at the start of simulation, and then each time the fluid has completely flowed out. However, you can update Capacity at any time by calling the updateCapacity() function. The capacity of the tank can be infinite.

The input rates are not limited, the output rate can optionally be limited. The specified rate cannot be lower than the value of Utils.RATE_TOLERANCE constant, that is, 1.0e-9. If the rate value falls below this value after recalculation, it will be snapped to 0.

The output batch can be chosen to be the same as the original input batch, set to the default batch, or to a custom batch.

The ProcessTank block allows you to specify actions executed when the tank becomes full, when the delay is finished and the fluid is ready to flow out, and when it has completely flowed out and the tank is empty.

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

Properties

Capacity
The total amount of fluid to be accumulated in the tank before the processing (delay) starts. Infinite capacity can be set by typing infinity in the edit box.
Type: double
Delay time
The processing time: the time the fluid must stay in the tank after it reaches the Capacity level and before it can start flowing out. The delay time is evaluated at the time the capacity is reached or at the call of the forceProcessing() function.
Type: double
Local variable: Object batch — the batch in the tank
Limited output rate
If the option is selected (true), you can specify a custom upper limit of the tank outflow rate.
Name: limitRateOut
Type: boolean
Set new value at runtime: set_limitRateOut(new value)
Maximum output rate
[Visible and applies only if the Limited output rate option is set]
The custom upper limit of the tank outflow rate.
Name: maxRateOut
Type: double
Default value: 1 — cubic meters / s
Set new value at runtime: set_maxRateOut(new value)
Output batch is
Defines the output batch of the tank. Choose one of the following options:
Same as the original batch — The output batch is the same batch that has flowed into the tank.
Default — The output batch is set to the default batch BatchTypes.DEFAULT_BATCH.
Custom — The output batch is defined by the Output batch property.
Name: modeOutputBatch
Type: OutputBatchMode
Set new value at runtime: set_modeOutputBatch(new value)
Valid values:
ProcessTank.OUTPUT_BATCH_IN1 — Same as the original batch
ProcessTank.OUTPUT_BATCH_DEFAULT — Default
ProcessTank.OUTPUT_BATCH_CUSTOM — Custom
Output batch
[Visible and applies only if Output batch is: Custom]
Defines the output batch. Allows accessing the input batch, so the output batch may depend on the input batch.
Type: Object
Local variable: Object originalBatch — the input batch
Custom batch color
[Visible and applies only if Output batch is: Custom]
If set, the batch color is defined by the Batch color property, otherwise the standard color mapping applies.
Name: customOutputBatchColor
Type: boolean
Set new value at runtime: set_customOutputBatchColor(new value)
Batch color
[Visible and applies only if Custom batch color is selected]
Defines the color of the output batch.
Type: Color
Local variable: Object batch — the batch

Animation

Storage tank
The Storage Tank space markup element that is used to animate this process tank.
Name: storageTank
Type: StorageTank
Set new value at runtime: set_storageTank(new value)
Show batches in flowchart
If set, the block icon will display the current batch color.
Name: showBatchesInFlowchart
Type: boolean
Set new value at runtime: set_showBatchesInFlowchart(new value)

Actions

Actions
On full
The action executed when fluid has reached the Capacity level and the input of the tank gets closed.
On ready
The action executed when fluid has spent the required time in the tank (if any), just before it is allowed to flow out.
On empty
The action executed when fluid has completely flowed out of the tank, just before the new cycle starts.
On rate change
The 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 tank (total of all batches). If the value 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 tank (total of all batches). If the value is less than the value of Utils.TOLERANCE, returns 0.

units — the amount units
double amountPassedIn() Returns the total amount of fluid that has passed through the input port of the tank since the start of the simulation.
double amountPassedIn(AmountUnits units) Returns the total amount of fluid (in given units) that has passed through the input port of the tank since the start of the simulation.

units — the amount units
double amountPassedOut() Returns the total amount of fluid that has passed through the output port of the tank since the start of the simulation.
double amountPassedOut(AmountUnits units) Returns the total amount of fluid (in given units) passed through the output port of the tank since the start of the simulation.
Status and capacity
Function Description
boolean isEmpty() Tests if the tank is empty. Returns true if the tank is empty and false otherwise.
There can still be a zero-size batch in an empty tank in case it has appeared at the input, but has not actually started flowing in.
boolean isEmptying() Tests if fluid has been processed: the output is open, the input is closed, and the tank is still not empty.
boolean isFilling() Tests if the tank currently being filled: the input is open, the output is closed, and the amount is below the required capacity.
boolean isProcessing() Tests if fluid is currently being processed: the input and output are closed, and the processing delay is being executed.
void forceProcessing() If called while in the filling phase on a partially filled but non-empty tank, closes the input and immediately starts processing regardless of the amount of fluid in the tank. Does not affect the capacity or processing time. Calls the On full action as if the tank was filled. If called during the processing or emptying phase, or if the tank is empty, does nothing.
boolean updateCapacity() Forces the block to update the tank’s capacity, that is, to re-evaluate the dynamic Capacity property. Normally, the capacity is re-evaluated at the time the fluid has completely flowed out. By calling this function, you can update the tank’s capacity any time. The new capacity, however, should not be less than the current amount of fluid in the tank.
Remaining time
Function Description
double remainingTime() If the fluid is currently delayed (being “processed”), returns the remaining delay time in seconds. At other times, returns 0.
double remainingTime(TimeUnits units) If the fluid is currently delayed (being “processed”), returns the remaining delay time in the given time units. At other times, returns 0. For example, remainingTime(MINUTE) returns remaining delay time in minutes.

units — the time units
Flow rate
Function Description
double currentRateIn() Returns the current flow rate of fluid that goes in.
double currentRateIn(FlowRateUnits units) Returns the current flow rate (in given units) of fluid at the tank input.

units — the flow rate units
double currentRateOut() Returns the current flow rate of fluid that goes out.
double currentRateOut(FlowRateUnits units) Returns the current flow rate (in the given rate units) of fluid that goes out.

units — the flow rate units
Batches
Function Description
int numberOfBatches() Returns the number of batches currently present in the tank, including possible zero-length batches.
Object getBatch(int index) Returns the batch with the specified index. The batch with index 0 is the closest to the tank output, the batch with the index numberOfBatches() - 1 is the last batch closest to the tank input.

index — the index of the desired batch
double getBatchSize(int index) Returns the size of the batch with the specified index. The batch with index 0 is the closest to the tank output, thew batch with the index numberOfBatches() - 1 is the last batch closest to the tank input.

index — the index of the desired batch
double getBatchSize(int index, AmountUnits units) Returns the size of the batch (in given units) with the specified index. The batch with index 0 is the closest to the tank output, the batch with the index numberOfBatches() - 1 is the last batch closest to the tank input.

index — the index of the desired batch
units — the amount units
Color getBatchColor(int index) Returns the current color of the batch with the specified index. If the color of the output batch differs from the one of the input batch, the current color is linearly interpolated during processing with respect to the processing progress. To get the original color of the batch, call <ProcessTank block name>.tank.getBatchColor().

index — the index of the desired batch
double updateOutputBatch() Forces immediate recalculation of the output batch and its color according to the current property settings.
double getBatchOffset(int index) Returns the sum of sizes of all batches under (closer to output) than the batch with a given index. Intended use is custom animation.

index — the batch used to calculate the offset
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?