Stock Block
Accumulates incoming and outgoing flows over time. Represents a level or state in a system.
Open Stock in BlockWerk →Description
The Stock block is the core accumulator in a System Dynamics model. It represents a state variable that changes over time based on the net flow. It acts like a reservoir or tank that stores a quantity.
Mathematical Model
Level(t) = Level(t0) + ∫(Inflow - Outflow) dt
The stock is computed as the integral of the net flow:
$$Level(t) = Level(t_0) + \int_{t_0}^{t} (Inflow(\tau) - Outflow(\tau)) d\tau$$
In discrete time, using the Euler method: $$Level_{n} = Level_{n-1} + (NetFlow \times \Delta t)$$
Parameters
initialValue
The starting amount in the stock at the beginning of the simulation.
- Default: 0
- Tooltip: Starting value of the stock at t=0
lowerLimit
The minimum physical limit of the stock. The value will not drop below this level (saturation).
- Default: -1,000,000
- Tooltip: Minimum possible value for the stock
upperLimit
The maximum physical limit of the stock. The value will not exceed this level (saturation).
- Default: 1,000,000
- Tooltip: Maximum possible value for the stock
Ports
flow_in (Input)
The net rate of change. Usually connected to a Flow block or a subtraction of multiple flows.
reset (Input, Optional)
When this port receives a value greater than 0, the stock is immediately reset to its initialValue.
value (Output)
The current level or state of the stock.
See Also
- Flow: Used to define the rate of change for a Stock.
- Integrator: The standard continuous-time counterpart.
- Converter: Used for intermediate calculations.