modelDelay

Partial model of a delay for CLD+ modeling

Information

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

This is a fairly elaborate class serving as a building block for delay components. Since inflows to and outflows from a stock should be modeled using the same component, the class provides machinery to either deduct outflowing material at once or after it has left the stock (at the end of the delay process).

The delayTime is given by a parameter, that is (optionally) multiplied by an exogenous input u as to enable exogenous input of delay times (e.g., delayTime = 1 and hasFactor = true) or have the time of delay be modified by other variables.

The stock value reported at the stock port portA is determined from the choices made with regard to outflowing material (deducted or not), while the flags are immediately copied from the flow port portB.

Implementation

DiagramView
ModelDiagram.png

  <...> 
protected
  parameter Real k2 = if subtractDelayedOutflow then -1 else 0 \
      "Gain of outflowing elements of stock B being delayed";
  <...>
equation
  // set stock port variables
  portA.stopInflow = portB.stopInflow;
  portA.stopOutflow = portB.stopOutflow;
  portA.stock = actualStockB.y;
  // set rate inputs
  growthRate = if portA.rate >= 0 then portA.rate else 0;
  declineRate = if portA.rate < 0 then -portA.rate else 0;
  <...>

Parameters

TypeNameDefaultDescription
TimedelayTime1Time of delay
Structural Parameters
BooleansubtractDelayedOutflowtrue= true, if a delayed outflow is to be deducted before it actually leaves the stock
BooleanhasFactorfalse= true, if coefficients are to be multiplied with input u
BooleanhasStockInfoOutputfalse= true, if information from the internal 'in process' stock is to be made accessible
Initialization
MaterialTypeIDI0Initial material in the process of flowing into the connected stock
MaterialTypeIDO0Initial material in the process of flowing into the connected stock

Connectors

TypeNameDefaultDescription
Connectors.StockPortportA
Connectors.FlowPortportB
Connectors.RealInputuFactor input
Connectors.StockInfoOutputstockInfoOutput

Contents

NameDescription
MaterialType

Revisions

  • Introduced in v2.0.0.