Monthly Archives: February 2015

Colouring flow networks

I’m not sure if other System Dynamics software supports this, but I thought it could help people ‘read’ a diagram if separate flow networks in a model were coloured differently, using the same colour for all the stocks and flows within each network..   Usually, stocks and flows which are connected together indicate the storages and flows of the same ‘substance’ – often a real substance (carbon, water, people…), and sometimes a notional substance (happiness…).   So the colour would indicate the substance associated with the connected set of stocks and flows.

Here is a very experimental attempt to try this:

colouring

The model is the two-species disease model that both Sysdea and Systo will be basing their demonstrations on at the forthcoming meeting of the UK Chapter of the System Dynamics Societ (London, 26-27 March 2015).    Colouring the stocks and flows clearly shows the two separate disease systems (animals in blue, humans in pink).

Once the option to over-write the default colouring scheme for stocks and flows is selected, the whole diagram is processed automatically, using a (currently) pre-defined palette of colours.

For those interested in how this is coded up: It uses a simple recursive algorithm.   It looks at each stock node in turn.  If this is already coloured, it moves on.  If not, it colours that node with the next colour from the palette, then recursively handles each flow in turn, processing the node at the other end of it if that has not already been coloured.