Fluid Split

Splits the input stream into two different streams; the sum of output flow rates equals the input rate. 

Can work in three alternative modes:

FluidSplit is a zero-capacity block, it does not contain any amount.

The output batch of FluidSplit at both outputs is the same as the input batch. The On new batch action can be used to change the mode and/or priorities depending on the incoming batch.

Demo model: FluidSplit

Parameters

Mode
The mode of split. One of the following:
Neutral - neither of the outputs gets priority
Proportional – output rates must obey the proportion rules
Priority – one of the outputs has priority over another
Get value: mode
Set new value at runtime: set_mode(new value)
Valid values: FluidSplit.SPLITMERGE_NEUTRAL - Neutral
FluidSplit.SPLITMERGE_PROPORTIONAL
Proportional
FluidSplit.SPLITMERGE_PRIORITY
Priority
Fraction 1
[Visible and applies only if the Mode is Proportional] In proportion mode, the (relative) fraction of output 1 rate.
Syntax: double fraction1
Set new value at runtime: set_fraction1(new value) 
Fraction 2
[Visible and applies only if the Mode is Proportional] In proportion mode, the (relative) fraction of output 2 rate.
Syntax: double fraction2
Set new value at runtime: set_fraction2(new value) 
Custom priorities
[Visible and applies only if the Mode is Priority] If the option is selected (the value is equal to true), the priorities of outflows will be set to custom values, otherwise – to 0 and 1. Priorities affects the LP solver when it tries to maximize the flow through the system.
Syntax: boolean customPriorities
Change the value at runtime: set_customPriorities(true or false
Priority at output 1
[Visible and applies only if the Mode is Priority] Applies in the priority mode with custom priorities. Defines the priority of the output 1 flow of this block in the overall flowchart. Must be a nonnegative integer.
Syntax: int priorityOutput1Custom
Change the value at runtime: set_priorityOutput1Custom(new value
Priority at output 2
[Visible and applies only if the Mode is Priority] Applies in the priority mode with custom priorities. Defines the priority of the output 2 flow of this block in the overall flowchart. Must be a nonnegative integer.
Syntax: int priorityOutput2Custom
Change the value at runtime: set_priorityOutput2Custom(new value
Limited output rate
If the option is selected (the value is equal to true), you are able to specify a custom upper limit of the output rate, per output.
Syntax: boolean limitRateOut
Change the value at runtime: set_limitRateOut(true or false
Maximum output rate
[Visible and applies only if the Limited output rate option is set] Custom upper limit of the output rate, at each output. The default value is 10 cubic meters per second.
Syntax: double maxRateOut
Set new value at runtime: set_maxRateOut(new value)
Animation
Show batches in flowchart
If set, the block icon will display the current batch color.
Syntax: boolean showBatchesInFlowchart
Actions
On new batch [code]
Action executed when a new batch appears at the block input. It will not necessarily start flowing into the block. 
Local variable: Object batch - the batch
On rate change [code]
Action executed when any of the flow rates changes. Please note that 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 out1rate - the current output rate at port out1
                          double out2rate - the current output rate at port out2

Functions

double amountPassed() - Returns the total amount passed through the input port of the block since the start of the simulation.

double amountPassed(AmountUnits units) - Returns the total amount of fluid (in given units), which passed through the in port of the block since the start of the simulation.

void resetStats() - Resets statistics collected for this block, including the statistics collected for its ports.

double currentRate() - Returns the current flow rate of fluid that goes in.

double currentRate(FlowRateUnits units) - Returns the current flow rate (in given units) of fluid at the block input.

Ports

in
The input port.
out1
The upper output port, out 1.
out2
The lower output port, out 2.