Generates the flow; is a typical starting block of a Fluid Library flowchart.
Can work as a source with infinite capacity or as source with limited initial amount that can be refilled by calling the inject() function. This block has a desired output rate, and the actual rate may be less or equal to the specified rate. 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 Fluid Library will try to maximize the out flow of all fluid sources; therefore, the priority of FluidSource out flow is set to 1 by default. Sometimes, to resolve flow priority conflicts, you may need to customize the out flow priority by further increasing it.
The batch type generated by FluidSource can be customized. To change the batch type dynamically in the infinite capacity mode you should change the parameter Batch (call set_customBatch() ), while the parameter Custom batch should be selected. In the limited amount mode, you can specify the batch type and color as optional arguments of the inject() function.
Demo model: FluidSource
double amount() - In infinite capacity mode returns infinity. Otherwise returns the amount remaining in the block, possibly belonging to multiple batches.
double amount(AmountUnits units) - Returns infinity in infinite capacity mode. Otherwise returns the amount of fluid (in given units) remaining in the block, possibly belonging to multiple batches.
double amountPassed() - Returns the total amount of fluid passed through the output port of the pipeline since the start of the simulation.
double amountPassed(AmountUnits units) - Returns the total amount of fluid (in given units) passed through the out 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 out.
double currentRate(FlowRateUnits units) - Returns the current flow Rate (in given units) of fluid at the block output
int numberOfBatches() - Returns the number of batches currently present in the block, 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 block output.
double getBatchSize(int index) - Returns the size of the batch with the specified index.Batch with index 0 is the closest to the block output.
double getBatchSize(int index, AmountUnits units) - Returns the size of the batch (in given units) with the specified index.
Color getBatchColor(int index) - Returns the color of the batch with the specified index.
double getBatchOffset(int index) - Returns the total size of all batches located closer to output than the batch with the given index. Intended use is custom animation.
double inject(double amount, Object batch, Color color)- In limited amount mode adds a batch of the specified type and color to the output queue of the block. In infinite capacity mode does nothing.
Note: The given
amount
cannot be less than the
Utils.TOLERANCE
value.
double inject(double amount, AmountUnits units, Object batch, Color color) - In limited amount mode adds a batch (in given units) of the specified type and color to the output queue of the block. In infinite capacity mode does nothing.
Note: The given amount cannot be less than the Utils.TOLERANCE value.
double inject(double amount, Object batch)- In limited amount mode adds a batch of the specified type to the output queue of the block. The color of the batch is determined according to the parameter setting of the block. In infinite capacity mode does nothing.
Note: The given amount cannot be less than the Utils.TOLERANCE value.
double inject(double amount, AmountUnits units, Object batch) - In limited amount mode adds a batch of the specified type (in given units) to the output queue of the block. The color of the batch is determined according to the parameter setting of the block. In infinite capacity mode does nothing.
Note: The given amount cannot be less than the Utils.TOLERANCE value.
double inject(double amount) - In limited amount mode adds the specified amount to the output queue of the block. The batch and color of the amount are determined according to the parameter setting of the block. In infinite capacity mode does nothing.
Note: The given amount cannot be less than the Utils.TOLERANCE value.
double inject(double amount, AmountUnits units) - In limited amount mode adds the specified amount of fluid (in given units) to the output queue of the block. The batch and its color are determined according to the parameter setting of the block. In infinite capacity mode does nothing.
Note: The given amount cannot be less than the Utils.TOLERANCE value.