Makes a mix of fluids coming in from up to five different sources, optionally delays (e.g. processes) the completed mix for a given amount of time, and lets it flow out. The proportion of components in the mix can be defined either by giving the amount of each component, or by providing the total amount and fractions of components.
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 new mix will start to accumulate only when the previous mix has completely flowed out. Initially the tank is empty. You can change the amounts of components or the total mix amount by calling updateAmounts() function while the tank is empty.
The capacity of this tank can be infinite.
The output batch of the mix can be explicitly specified or can be left as default batch. It is calculated automatically immediately after all components of the mix have flowed into the mix tank but before the On mix completed action is executed. You can also recalculate the output batch at any given time by calling updateOutputBatch() function.
The batch of the mix can be explicitly specified or can be left as default batch.
The MixTank block allows you to specify actions executed when the mix is completed (all components has completely flowed in), when the delay is finished and when the mix has completely flowed out.
Demo model: MixTank Open the model page in AnyLogic Cloud. There you can run the model or download it (by clicking Model source files).- Mix by
-
Defines how the mix is specified:
By amounts — the user specifies amounts for each component (each input port)
By fractions — the user specifies the total amount and fractions for each component (port). Fractions are normalized.Syntax: boolean mixByAmounts
Set new value at runtime: set_mixByAmounts(new value)
Valid values:
true — By amounts
false — By fractions -
[Visible and applies only if the Fractions option is set]
The total amount of mix. This value cannot be less than the value of Utils.TOLERANCE. Infinite capacity can be set by typing infinity in the property’s field.Syntax: double totalAmount
Set new value at runtime: set_totalAmount(new value) - Amount 1
-
[Visible and applies only if the Amounts option is set]
The amount of component 1 (fluid that flows in through port in1). This value cannot be less than the value of Utils.TOLERANCE.Syntax: double amount1
Set new value at runtime: set_amount1(new value) - Amount 2
-
[Visible and applies only if the Amounts option is set]
The amount of component 2 (fluid that flows in through port in2). This value cannot be less than the value of Utils.TOLERANCE.Syntax: double amount2
Set new value at runtime: set_amount2(new value) - Amount 3
-
[Visible and applies only if the Amounts option is set]
The amount of component 3 (fluid that flows in through port in3). This value cannot be less than the value of Utils.TOLERANCE.Syntax: double amount3
Set new value at runtime: set_amount3(new value) - Amount 4
-
[Visible and applies only if the Amounts option is set]
The amount of component 4 (fluid that flows in through port in4). This value cannot be less than the value of Utils.TOLERANCE.Syntax: double amount4
Set new value at runtime: set_amount4(new value) - Amount 5
-
[Visible and applies only if the Amounts option is set]
The amount of component 5 (fluid that flows in through port in5). This value cannot be less than the value of Utils.TOLERANCE.Syntax: double amount5
Set new value at runtime: set_amount5(new value) - Fraction 1
-
[Visible and applies only if the Fractions option is set]
The relative fraction of component 1 (fluid that flows in through port in1).Syntax: double fraction1
Set new value at runtime: set_fraction1(new value) - Fraction 2
-
[Visible and applies only if the Fractions option is set]
The relative fraction of component 2 (fluid that flows in through port in2).Syntax: double fraction2
Set new value at runtime: set_fraction2(new value) - Fraction 3
-
[Visible and applies only if the Fractions option is set]
The relative fraction of component 3 (fluid that flows in through port in3).Syntax: double fraction3
Set new value at runtime: set_fraction3(new value) - Fraction 4
-
[Visible and applies only if the Fractions option is set]
The relative fraction of component 4 (fluid that flows in through port in4).Syntax: double fraction4
Set new value at runtime: set_fraction4(new value) - Fraction 5
-
[Visible and applies only if the Fractions option is set]
The relative fraction of component 5 (fluid that flows in through port in5).Syntax: double fraction5
Set new value at runtime: set_fraction5(new value) - Delay time
-
The time the mix must stay in the tank after it is completed (after all components have completely flowed in) 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. One of the following:
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_DEFAULT — Default
ProcessTank.OUTPUT_BATCH_CUSTOM — Custom -
[Visible and applies only if the Output batch is: Custom]
Defines the batch of the mix (output batch). The output batch can be evaluated based on the input batches.Value type: Object
Local variables:
Object batch1 — the batch that flowed in through port in1
Object batch2 — the batch that flowed in through port in2
Object batch3 — the batch that flowed in through port in3
Object batch4 — the batch that flowed in through port in4
Object batch5 — the batch that flowed in through port in5 - Custom batch color
-
[Visible and applies only if the Custom option is set]
If set, the batch color is defined by the Batch color parameter, otherwise the standard color mapping applies.Syntax: boolean customOutputBatchColor
Set new value at runtime: set_customOutputBatchColor(new value) -
[Visible and applies only if the Custom batch color option is set]
Defines the color of the output batch.Value type: Color
Local variable: Object batch — the batch
- 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)
- On mix completed
- Action executed when all components of the mix have completely flowed in.
- On mix ready
- Action executed when the completed mix has spent the required time in the tank (if any), just before it is allowed to flow out.
- On empty
- Action executed when the mix has completely flowed out of the tank, just before the new mix is about to start.
- On rate change
-
Action executed when any of the flow rates changes. The current rates are available as local variables in1rate .. in5rate, and outrate.
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.
- Fluid amount
-
Function Description double amount() Returns the amount of mix currently contained in the tank (the sum of all components). If the amount is less than Utils.TOLERANCE, this function returns 0. double amount(AmountUnits units) Returns the amount of mix (in the given amount units) currently contained in the tank (the sum of all components). If the amount is less than Utils.TOLERANCE, this function returns 0. double amountPassedIn(int input) Returns the amount of fluid that has passed through a given input port (1..5) from the start of the simulation. double amountPassedIn(int input, AmountUnits units) Returns the amount of fluid (in the given amount units) that has passed through a given input port (1..5) from the start of the simulation. double amountPassedOut() Returns the amount of fluid that has passed through the output port of the tank from the start of the simulation. double amountPassedOut(AmountUnits units) Returns the amount of fluid (in the given amount units) that has passed through the output port of the tank from the start of the simulation. double amountOf(int input) Returns the amount of a particular component currently contained in the tank. The component is identified by the number of input (1..5). double amountOf(int input, AmountUnits units) Returns the amount of a particular component (in the given amount units) currently contained in the tank. The component is identified by the number of input (1..5). boolean updateAmounts() If the mix is specified by amounts of the components, this function updates the component amounts. If the mix is specified by the total amount and fractions of each component, the function updates the total amount of mix, i.e. forces the mix tank to restart the mix with the new Amount 1..Amount 5 parameters, or the new Capacity (total amount) parameter respectively. The function can be called at any time, however, at the time of the call the tank must be empty. - Status and capacity
-
Function Description double capacity() Returns the maximum amount of mix that can be contained in the tank. If the amount is less than Utils.TOLERANCE, this function returns 0. boolean isEmpty() Tests if the tank is empty. boolean isEmptying() Tests if the mix has been processed, the output is open, all inputs are closed and the tank is still not empty. boolean isFilling() Tests if the tank currently being filled, i.e. at least one of the inputs is open, the output is closed and the amount is below the required capacity. boolean isProcessing() Tests if the mix is currently being processed, i.e. all the inputs and outputs are closed and the processing delay is being executed. - Remaining time
-
Function Description double remainingTime() If the mix is currently delayed (being “processed”), returns the remaining delay time in seconds. At other times, returns 0. double remainingTime(TimeUnits units) If the mix 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(int input) Returns the current flow rate at a given input port (1..5). double currentRateIn(FlowRateUnits units, int input) Returns the current flow rate (in the given rate units) at a given input port (1..5). 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() While the tank is emptying, returns 1. Otherwise returns 5 as the number of symbolic input batches in the tank, including null batches. Object getBatch(int index) While the tank is emptying, returns the object that describes the output mix. The index can only be 0 in this case. While the tank is not emptying, returns the object that describes one of the 5 input components (possibly null), where index 0 corresponds to input 5, and index 4 corresponds to input 1. Color getBatchColor(int index) While the tank is emptying, returns the color of the output mix. The index can only be 0 in this case. While filling or processing, returns the color of one of the input components, where index 0 corresponds to input 5, and index 4 corresponds to input 1. If the color of the output mix differs from the one of the input component, the current color is linearly interpolated during processing with respect to the processing progress. double getBatchSize(int index) While the tank is emptying, returns the total amount of the output mix remaining in the tank. In this case the index can only be 0. While filling or processing, returns the amount of an input component with the specified index, where index 0 corresponds to input 5, and index 4 corresponds to input 1. double getBatchSize(int index, AmountUnits units) While the tank is emptying, returns the total amount of the output mix remaining in the tank (in the given amount units). In this case the index can only be 0. While filling or processing, returns the amount of an input component with the specified index, where index 0 corresponds to input 5, and index 4 corresponds to input 1. double updateOutputBatch() Forces immediate recalculation of the output batch and its color according to the current parameters settings. double getBatchOffset(int index) While the tank is emptying, returns 0. Otherwise, returns the total amount of component filled into the tank “below” the component with the given index, where index 0 corresponds to input 5, and index 4 corresponds to input 1. Intended use is custom animation. - Resetting statistics
-
Function Description void resetStats() Resets statistics collected for this block, including the statistics collected for its ports.
- in1, in2, ... , in5
- Input ports.
- out
- The output port.
-
How can we improve this article?
-