AnyLogic
Expand
Font size

ProcessTank

Accumulates the fluid up to the Capacity level, optionally delays (e.g. processes) it for a given amount of time, and lets it flow out. The Capacity is a dynamic parameter and is re-evaluated at the beginning of each cycle, i.e. 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 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, i.e. 1.0e-9. If 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).

Parameters

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 property’s field.
Value type: double
Delay time
The time the fluid must stay in the tank after it reaches the Capacity level and before it can start flowing out.
Syntax: double delayTime
Set new value at runtime: set_delayTime(new value)
Limited output rate
If the option is selected (true), you are able to specify a custom upper limit of the tank outflow rate.
Syntax: boolean limitRateOut
Set new value at runtime: set_limitRateOut(new value)
Maximum output rate
[Visible and applies only if the Limited output rate option is set]
Custom upper limit of the tank outflow rate. The default value is 1 cubic meter per second.
Syntax: double maxRateOut
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 parameter below.
Get value: modeOutputBatch
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 the Output batch is: Custom]
Defines the output batch. Here you can access the input batch, so the output batch may depend on the input batch.
Value type: Object
Local variable: Object originalbatch — the input batch
Custom batch color
[Visible and applies only if the Output batch is: Custom]
If set, the batch color is defined by the Batch color parameter below, otherwise the standard color mapping applies.
Syntax: boolean customOutputBatchColor
Set new value at runtime: set_customOutputBatchColor(new value)
Batch color
[Visible and applies only if the Custom batch color option is selected]
Defines the color of the output batch.
Value type: Color
Local variable: Object batch — the batch

Animation

Animation
Storage tank
Here you specify the space markup element Storage Tank that is used to animate this process tank.
Syntax: StorageTank 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.
Syntax: boolean showBatchesInFlowchart
Set new value at runtime: set_showBatchesInFlowchart(new value)

Actions

Actions
On full
Action executed when the fluid has reached the Capacity level and the input of the tank gets closed.
On ready
Action executed when the fluid has spent the required time in the tank (if any), just before it is allowed to flow out.
On empty
Action executed when the fluid has completely flowed out of the tank, just before the new cycle starts.
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 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.
double amountPassedIn() Returns the total amount 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) passed through the input port of the tank since the start of the simulation.
double amountPassedOut() Returns the total amount 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 the fluid has been processed, the output is open, input is closed and the tank is still not empty.
boolean isFilling() Tests if the tank currently being filled, i.e. input is open, the output is closed and the amount is below the required capacity
boolean isProcessing() Tests if the fluid is currently being processed, i.e. the input and output are closed and the processing delay is being executed.
void forceProcessing() If called while in the filling up phase on a partially filled but not empty tank, closes 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 up. If called during processing or emptying phases, or if the tank is empty, does nothing.
boolean updateCapacity() Forces the block to update the tank’s capacity i.e. to re-evaluate the dynamic Capacity parameter. 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.
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.
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.
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. Batch with index 0 is the closest to the tank output, batch with the index numberOfBatches() - 1 is the last batch closest to the tank input.
double getBatchSize(int index) Returns the size of the batch with the specified index. Batch with index 0 is the closest to the tank output, batch with the index numberOfBatches() - 1 is the last batch closest to the tank input.
double getBatchSize(int index, AmountUnits units) Returns the size of the batch (in given units) with the specified index. Batch with index 0 is the closest to the tank output, batch with the index numberOfBatches() - 1 is the last batch closest to the tank input.
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().
double updateOutputBatch() Forces immediate recalculation of the output batch and its color according to the current parameters 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.
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?