Delay

Partial model of a delay for CLD+ modeling

Diagram

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 (6)

delayTime

Value: 1

Type: Time (s)

Description: Time of delay

subtractDelayedOutflow

Value: true

Type: Boolean

Description: = true, if a delayed outflow is to be deducted before it actually leaves the stock

hasFactor

Value: false

Type: Boolean

Description: = true, if coefficients are to be multiplied with input u

hasStockInfoOutput

Value: false

Type: Boolean

Description: = true, if information from the internal 'in process' stock is to be made accessible

IDI

Value: 0

Type: MaterialType

Description: Initial material in the process of flowing into the connected stock

IDO

Value: 0

Type: MaterialType

Description: Initial material in the process of flowing into the connected stock

Connectors (7)

portA

Type: StockPort

Description: Connector for stock components

portB

Type: FlowPort

Description: Used to represent stock and flow connections

u

Type: RealInput

Description: Factor input

stockInfoOutput

Type: StockInfoOutput

Description: Output of record with stock-related information

one

Type: RealOutput

Description: Default factor

growthRate

Type: RealOutput

Description: Indicated rate of growth

declineRate

Type: RealOutput

Description: Indicated rate of decline

Components (4)

stockB

Type: FlowPortSensor

Description: Level information for an outside FlowPort

adjustedDelayTime

Type: Product_2

Description: Inputs are multiplied

parDelayTime

Type: ConstantConverterTime

Description: A constant time value is turned into a constant signal

actualStockB

Type: Add

Description: Output the sum of the two inputs

Extended by (2)

PipelineDelay

BusinessSimulation.CausalLoop

Fixed or pure delay of input flow

ExponentialDelay

BusinessSimulation.CausalLoop

Exponential delay of input flow

Revisions

  • Introduced in v2.0.0.