.BusinessSimulation.Functions.constrainedRate

Information

This information is part of the Business Simulation Library (BSL). Please support this work and ► donate.

The real output actualRate is determined by checking whether the real input indicatedRate is complying with the restrictions signaled by a connected stock in form of the boolean flags stopInflow and stopOutflow. If the rate is found to violate either flag 0 is returned, in all other cases the indicated rate is returned unchanged.

Syntax

Functions.constrainedRate(indicatedRate, stopInflow, stopOutflow)

Examples


Functions.constrainedRate(-5.0, stopInflow = true, stopOutflow = false); //  0.0
Functions.constrainedRate( 5.0, stopInflow = true, stopOutflow = false); // 5.0
Functions.constrainedRate(-5.0, stopInflow = false, stopOutflow = true); // -5.0
Functions.constrainedRate( 5.0, stopInflow = false, stopOutflow = true); // 0.0

Notes

Rates are usually set by flow components and have to observe the flow-restrictions with regard to a connected stock component. By Modelica conventions a negative rate for the flow indicates an inflow with regard to the connected stock, while a positive rate indicates an outflow for the stock.

Thus, in the first example above the indicated negative rate for a →FlowPort would mean an outflow from the flow component and an inflow with regard to the connected →StockPort. Observing the flow restriction signaled by the stock the acutal rate is set to zero.

See also

constrainedRateBoolean

Interface

function constrainedRate
  extends BusinessSimulation.Icons.Function;
  input Real indicatedRate "Proposed rate for port of flow element";
  input Boolean stopInflow "Signal from connected stock";
  input Boolean stopOutflow "Signal from connected stock";
  output Real actualRate "The rate to use";
end constrainedRate;

Revisions


Generated at 2024-04-28T18:16:21Z by OpenModelicaOpenModelica 1.22.3 using GenerateDoc.mos