CapacityRestrictedStock

Material stock, that cannot be drained or filled beyond its capacity limits

Diagram

Information

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

This is a restricted reservoir of the system dynamics methodology, which accumulates material  (i.e., countable entities, some form of matter) transported by flow components connected to the component's StockPorts. Like a MaterialStock the CapacityRestrictedStock can never become negative—we are not collecting "antimatter"—and will prevent connected flow components from draining its value below zero. Unlike other stocks, minCapacity and maxCapacity are seen as capacity restrictions that for "physical" reasons cannot be violated—the restrictions can be given as either constant parameters (minValue, maxValue) or as variable inputs (u_min, u_max). Accordingly, the component will signal flow restrictions via its port that must be observed by connected flow components.

Implementation

The value of the stock will be set to zero if the calculated value x is less than a very small positive amount and if reinitializeStock = true is chosen in the Advanced tab:

  if reinitializeStock then
    when x < 0 then
      reinit(x, 0);
    end when;
  end if;

CapacityRestrictedStock components will prevent connected flows from draining the stock via their →StockPort connectors' Boolean flags, should the calculated state variable x be less than a very small positive amount:


  inflow.stopInflow = not x < maxCapacity - BusinessSimulation.Constants.small;
  outflow.stopInflow = inflow.stopInflow;

  inflow.stopOutflow = not x > minCapacity + BusinessSimulation.Constants.small;
  outflow.stopOutflow = inflow.stopOutflow;

Notes

  • The inflow and outflowStockPorts are only indicative; in general the reservoir may be filled or drained by flows connected to either port.

  • The capacity restrictions are also used to define an admissable range than can be monitored by an assert using useAssert = true in the Advanced tab. The switch causeError controls whether an error or a warning is to be raised.

  • The parameter init allows to select →InitializationOptions:

    • FixedValue (default) will use the parameter initialValue to determine the initial value.

    • SteadyState will introduce the equation der(x) = 0 in order to find an initial value that establishes equilibrium.
      (Note: Such a solution may not exist and to avoid trivial solution in many cases initialValue -- in this case used as a start value for numerical iteration -- should be set to a value different from zero.)

    • Free there will be no initial equation and thus the solver is free in solving the initial value problem.

See also

MaterialStockInformationLevel

Parameters (9)

init

Value: modelSettings.init

Type: InitializationOptions

Description: Provide InitializationOptions (Free, FixedValue, SteadyState)

hasStockInfoOutput

Value: false

Type: Boolean

Description: = true, if a StockInfoOutput should be added to the stock

initialValue

Value: 0

Type: OutputType

Description: Initial level (should be different from 0 to find non-trivial steady state solution)

maxValue

Value: inf

Type: OutputType

Description: Maximum admissable value

minValue

Value: zero

Type: OutputType

Description: Minimum admissable value

useAssert

Value: false

Type: Boolean

Description: = true, if leaving the admissable range is to cause an error or warning

causeError

Value: true

Type: Boolean

Description: = true, if leaving the admissable range is to cause an error instead of simply a warning

hasVariableAdmissableRange

Value: false

Type: Boolean

Description: =true, if capacity restrictions are to be given by the variable inputs u_min and u_max

reinitializeStock

Value: false

Type: Boolean

Description: = true, if the stock is to be reinitalized to guarante nonnegativity

Connectors (8)

y

Type: RealOutput

Description: Level or rate information

y1

Type: RealOutput

Description: Level or rate information

y2

Type: RealOutput

Description: Level or rate information

inflow

Type: StockPort

Description: Inflow port of the stock

outflow

Type: StockPort

Description: Outflow port of the stock

y_stockInfo

Type: StockInfoOutput

Description: Optional StockInfoOutput

u_min

Type: RealInput

Description: Variable minimum value to be monitored

u_max

Type: RealInput

Description: Maximum value input

Components (8)

modelSettings

Type: ModelSettings

Description: Setting important global variables within a model

stockInfoSensor

Type: StockInfo

Description: Collect basic stock-related information for basic stocks

rangeControl

Type: RangeAssert

Description: Use assert() to check admissable values

parMinValue

Type: ConstantConverter

Description: A constant value is turned into a constant signal

parMaxValue

Type: ConstantConverter

Description: A constant value is turned into a constant signal

theMinValue

Type: PassThrough

Description: Output is identical to input

theMaxValue

Type: PassThrough

Description: Output is identical to input

variableRangeControl

Type: VariableRangeAssert

Description: Use assert() to check admissable values