sd System Dynamics Components
Stock-and-flow system dynamics on the shared kernel. Stocks accumulate, flows move quantity between stocks at expression-defined rates, and auxiliaries hold intermediate equations. Continuous dynamics are advanced by the kernel as scheduled integration micro-steps (see the model's time.integration settings), so they interleave deterministically with discrete events.
Generated from spec/libraries/sd.library.json · library version 0.1.0 · OSDL 0.1
sd.stock StockStock & Flow#
An accumulation (level). Its value integrates the difference between connected inflows and outflows. Wire flow.out → stock.in for inflows and stock.out → flow.in for outflows. The current level is observable and referenceable as <id>.value.
Ports
| Port | Direction | Description |
in |
in multiple |
Inflows accumulate into this stock. |
out |
out multiple |
Outflows drain from this stock. |
Parameters
| Param | Type | Description |
initialrequired |
numericValue |
Level at simulation start. |
min |
scalarValue |
Lower clamp on the level. |
max |
scalarValue |
Upper clamp on the level. |
nonNegative |
boolean |
Shorthand for min: 0. default false |
Observable state
| State | Type | Description |
value |
number |
The current level. |
sd.flow FlowStock & Flow#
Moves quantity between stocks at rate (per model time unit), re-evaluated every integration step. An unconnected in draws from an unlimited source (cloud); an unconnected out drains to an unlimited sink. A negative rate reverses direction.
Ports
| Port | Direction | Description |
in |
in |
Connect from the upstream stock's out port; leave unconnected for a source (cloud). |
out |
out |
Connect to the downstream stock's in port; leave unconnected for a sink (cloud). |
Parameters
| Param | Type | Description |
raterequired |
numericValue |
Quantity moved per model time unit; typically an expression over stocks, auxiliaries, parameters, and other components' state. |
Observable state
| State | Type | Description |
rate |
number |
The most recently evaluated rate. |
sd.auxiliary AuxiliaryStock & Flow#
A named intermediate value, re-evaluated every integration step and whenever read. Auxiliaries have no ports; other components reference them in expressions as <id>.value. Useful for breaking complex equations apart and for bridging paradigms (e.g. deriving a server capacity from a stock level).
Parameters
| Param | Type | Description |
valuerequired |
numericValue |
The auxiliary's equation: a constant, parameter reference, expression, or distribution. |
Observable state
| State | Type | Description |
value |
number |
The most recently evaluated value. |