StochSD


StochSD is a free, open-source Continuous System Simulation package intended for small and medium-sized models in education, self-studies and research.
Technically, StochSD is based on the Insight Maker
engine with its DE-solver, function library, error checker, macro facility, etc., while the design, graphical user's interface, construction elements, result presentation, file handling, link checking, etc. are different. Also, tools for sensitivity analysis, and optimisation with or without constraints are included. In particular, StochSD includes features for stochastic modelling, post-analysis of multiple simulations, and presentation of the results in statistical form.
The design and development of StochSD were done during 2017–2022 with support from Uppsala University, Karolinska Institute, and the Swedish University of Agricultural Sciences.
StochSD was designed to fulfil the two purposes:
  • To provide an open-source CSS language based on the System Dynamics philosophy, where a system is described in terms of stocks and flows, and where pedagogic aspects, ease of use and understanding are prioritised.
  • To enable a macro model in StochSD to produce results that are fully consistent with those from a micro model of a well-defined system under study. This old consistency problem was stepwise solved between 2000 and 2010. This property is denoted Full Potential CSS modelling, see below.

    Education and self-studies

To support the use in education and self-studies, the StochSD package as well as course material to enable courses in classical CSS and Full Potential CSS modelling and simulation are provided at the StochSD website. This course material contains lectures, laboratory exercises, instructive models, and StochSD manuals, which mainly are based on material developed at Uppsala University and the Swedish University of Agricultural Sciences for courses in modelling and simulation.
StochSD is downloaded in many countries from all continents, and can also be run directly in a web browser. It is described, compared and discussed, demonstrated in educational videos, and also referred to in various languages.

Full potential CSS modelling

The Full Potential CSS concept is an extension of classical Continuous System Simulation, which provides the rules to make the results from macro-modelling consistent with those from micro-modelling.
Briefly, in addition to modelling and simulating continuous flows between stocks represented by ‘real numbers’, StochSD can also handle transitions of discrete entities by integer numbers. But in contrast to including individual entities into a CSS model, StochSD preserves the aggregated macro approach for discrete entities by transferring integer number of entities during a time-step. However, such transitions may happen irregularly over time, so stochasticity often plays a crucial role in their modelling. Therefore, StochSD contains powerful random functions to model uncertainties of different kinds, as well as devices to collect statistics during a simulation and from multiple replications of the same stochastic model. In StochSD the construction and simulation of e.g. queuing models or combined discrete and continuous models are done in a straightforward way.
The Full Potential concept also includes rules for how a stage has to be expanded into a structure of stocks and flows in order to reproduce a specific sojourn-time distribution, how attributes are to be handled, and where and how different types of uncertainty should be implemented.

Example: continuous vs. combined discrete and continuous model

A continuous prey-predator model and a combined model with continuous prey and discrete predators, as well as a replication of the combined
model are shown below.
Continuous model
Now assume that the births and deaths of the sheep are discrete random events with the expected rate d⋅X⋅Y and e⋅Y, respectively, then the number of events per time interval is Poisson distributed. The StochSD function PoFlow handles this by drawing a random number for each DT. The modifications to obtain a combined model are shown in red, below.
Combined discrete and continuous model
image:Combined-Pray-Predator-Model.png|frame|left|The combined prey-predator model with continuous prey and discrete predators, and a replication of this model.

In the replication shown, the discrete predators became extinct at around 235 time units. The continuous prey then increases logistically to an equilibrium without further stochastic variations.
Comparing a continuous prey-predator model with the combined model reveals that the continuous model, starting at the equilibrium state, will only produce two straight horizontal lines. Starting the continuous model outside the equilibrium state will make it approach the equilibrium for both species without lasting variations. Further, a phenomenon such as extinction cannot occur for a continuous model.
Creating the combined model, shown above, is straightforward. The traditional alternative of constructing a combined continuous and discrete model, with its mixture of disparate DES and CSS concepts, synchronisation of two different time-handling methods, and requiring a special combined simulation language is not an attractive option for a macro study.