Bulk Conveyor

Conveys bulk or condensable matter from one point to another. Compared to pipeline, allows gaps and sections of different “density”. The inflow rate of the conveyor is not necessarily equal to the outflow. Conveyor tries to move at a certain maximum speed. When it moves, the output rate equals the “density” of the matter portion located at the conveyor output multiplied by the speed. At the same time, at the input, the inflow creates a section with density that equals inflow rate divided by the speed. If the next block is not able to accept the outflow of the conveyor, the conveyor speed adjusts to reduce the flow.

The “density” of the matter, i.e. the amount of matter per conveyor length unit, is limited. At the maximum speed, the conveyor can accept the input rate not higher than the specified value, which means the maximum density is maximum input rate divided by the maximum speed. If the actual speed is lower (due to the output rate constraints), the maximum input rate limit is proportionally reduced.

You can dynamically change speed of the conveyor, stop, and restart it. You can access the contents of the conveyor using its API. Internally, conveyor considers sections with different density as different batches, even if they can be of same batch type. The BulkConveyor 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: BulkConveyor

Parameters

Length is
Defines how the conveyor length is defined. There are two alternative options:
Specified explicitly - the length is specified in the Length field below;
Defined by conveyor belt shape - the length equals the length of the animation Bulk conveyor belt shape.
Syntax: boolean lengthDefinedByPath
Length
[Visible and applies only if the Length is is set to Specified explicitly] The length of the conveyor. Cannot be changed dynamically after initialization.
Syntax: double length
Set new value at runtime: set_length(new value)
Speed
The maximum, or desired, speed of the conveyor.
Syntax: double speed
Set new value at runtime: set_speed(new value)
Maximum input rate at speed
Maximum input rate at the default speed defined by the Speed parameter. If the actual speed gets lower than the default speed, the rate limit decreases proportionally.
Syntax: double maxInputRate
Set new value at runtime: set_maxInputRate(new value)
Initially stopped
If the option is selected, the conveyor is initially stopped. The option can be at runtime to change the conveyor's state.
Syntax: boolean stopped
Set new value at runtime: set_stopped(true or false) 
Custom priority
If the option is set (the value equals true), the priority of the conveyor outflow will be set to Output flow priority, 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 false) 
Output flow priority
[Visible and applies only if the Custom priority option is set] Custom priority of the conveyor outflow in the overall flowchart. Must be a positive integer.
Syntax: int priorityOutCustom
Set new value at runtime: set_priorityOutCustom(new value)
Animation
Bulk conveyor belt
Here you can specify the name of a Bulk conveyor belt space markup shape used to animate the conveyor defined by this BulkConveyor block (both in 2D and 3D animation).
Syntax: BulkConveyorBelt bulkConveyorBelt
Show batches in flowchart
If set, the block icon will display the batches size and color.
Syntax: boolean showBatchesInFlowchart
Actions
On new batch at input [code]
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 [code]
Action executed when a new batch reaches the conveyor output. Is not executed on density change if the batch type does not change. Is not executed on start of a gap.
Local variable: Object batch - the batch
On rate change [code]
Action executed when any of the flow rates (input or output) 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 outrate - the current output rate

Functions

double getActualSpeed() - Returns the current actual speed of the conveyor, which is less or equal to the Speed parameter.

double getActualSpeed(SpeedUnits units) - Returns the current actual Speed (in given units) of the conveyor, which is less than or equal to the Speed parameter.

stop() - Stops the conveyor (sets the stopped parameter to true, while keeping the value of the Speed parameter).

go() - Starts the conveyor (sets the stopped parameter to false, does not change the Speed parameter).

double amount() - Returns the amount of material currently on the conveyor.

double amount(AmountUnits units) - Returns the amount of material (in given units) currently on the conveyor.

double amountPassedIn() - Returns the total amount passed through the input of the conveyor since the start of the simulation.

double amountPassedIn(AmountUnits units) - Returns the total amount (in given units) passed through the in port of the conveyor since the start of the simulation.

double amountPassedOut() - Returns the total amount passed through the output of the conveyor since the start of the simulation.

double amountPassedOut(AmountUnits units) - Returns the total amount passed (in given units) through the out port of the conveyor since the start of the simulation.

double amountMin() - Returns the historical minimum of the material amount on the conveyor.

double amountMin(AmountUnits units) - Returns the historical minimum of the material amount on the conveyor in given units.

double amountMax() - Returns the historical maximum of the material amount on the conveyor.

double amountMax(AmountUnits units) - Returns the historical maximum of the material amount on the conveyor in given units.

double amountAverage() - Returns the average amount of material on the conveyor over the total operating time.

double amountAverage(AmountUnits units) - Returns the average amount of material on the conveyor over the total operating time in given units.

boolean isEmpty() - Tests if the conveyor is empty. Note that there can still be a zero-size non-gap batch in an empty conveyor in case it has appeared at the input, but has not actually started flowing in.

double utilization() - Returns the currently utilized fraction of the conveyor capacity, namely the current input rate / maximum input rate at maximum (= desired) Speed. If the current maximum rate equals 0, returns 0.

double utilizationTotal() - Returns the average utilization of the conveyor throughout the total operating time, i.e. the total amount of material that actually passed through the conveyor input / maximum total amount that could pass through, given the (possibly changing) maximum input rate. If time has ran to infinity, the instant utilization is returned.

double currentRateIn() - Returns the current inflow rate of the conveyor.

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

double currentRateOut() - Returns the current outflow rate of the conveyor.

double currentRateOut(FlowRateUnits units) - Returns the current flow rate (in given units) of fluid at the conveyor output.

double averageRateIn() - Returns the average actual rate through the input of the conveyor throughout the total operating time. If time has run to infinity, the current input rate is returned.

double averageRateIn(FlowRateUnits units) - Returns the average actual rate (in given units) through the input of the conveyor throughout the total operating time in given units. If time has ran to infinity, the current input rate is returned.

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

int numberOfBatches()- Returns the number of batches currently on the conveyor, including possible zero-length batches and gaps. Two adjacent batches with different density are treated by conveyor as different batches, even if they have the same batch type.

Object getBatch(int index) - Returns the batch (it can be a gap) with the specified index. Batch with the index 0 is the one at the conveyor output, batch with the index numberOfBatches()-1 is the last batch closest to the conveyor input. Gaps are represented by batches with type = null.

double getBatchSize(int index, AmountUnits units) - Returns the size of the batch with the specified index. Gaps have zero size.

double getBatchSize(int index) - Returns the size of the batch with the specified index. Gaps have zero size.

double getBatchLength(int index) - Returns the length (the length footprint) of the batch with the specified index.

double getBatchDensity(int index) - Returns the density (amount of matter per conveyor length unit) of the batch with the specified index. Gaps have zero density.

Ports

in
The input port.
out
The output port.