## DYNAMO

I was surprised to see that DYNAMO hasn't been mentioned here in the past. DYNAMO (DYNAmic MOdels) was the simulation language used to code the simulations that led to the famous 1972 book The Limits to Growth from The Club of Rome. The language was designed in the late 1950s. It is clear that the language was used in several other places and evolved through several iterations, though I am not sure how extensively it was used. When Stafford Beer was creating Cybersyn for Salvador Allende he used DYNAMO to save time suggesting it was somewhat of a standard tool (this is described in Andrew Pickering's important book The Cybernetic Brain).

The language itself is essentially what you'd expect. It is declarative, programs consisting of a set of equations. The equations are zero and first-order difference equations of two kinds: level equations (accumulations) and rate equations (flows). Computation is integration over time. Levels can depend on rates and vice versa with the language automatically handling dependencies and circularities. Code looks like code looked those days: fixed columns, all caps, eight characters identifiers.

• Section 3.7 of this history of discrete event simulation languages is a succinct description of the history of the language and its main features.
• A more leisurely description of the language and the Limits to Growth model can be found in this article. Ironically, the author of the article reimplemented the model in Javascript (run it!). What was originally written in a DSL is now implemented in a general purpose language, with all the niceties handled manually.
• Finally, a nice piece on Jay Forrester who prompted the creation of SIMPLE and DYNAMO, its offspring.

## Comment viewing options

### Note that Brian Hayes who

Note that Brian Hayes who wrote the javascript implementation has a nice writeup of the process.

### Any examples of other

Any examples of other historical DSLs that have now been reimplemented, or their most famous application reimplemented, in javascript?

### META II

META II, the inspiration for OMeta.

### System Dynamics

Forrester and his System Dynamics gets a mention in a book I'm working my way through in my spare time. The book is called "Eco-Logic, Logic-Based Approaches to Ecological Modelling". It is an attempt to use AI techniques to get non-programmer types using computers to model. I'm only at the end of chapter 4, which is about a fifth of the way through it, and so far I've implemented an interpreter for an order sorted logic programming language and I'm finishing off the compiler for this language targeting Prolog. The rest of the book seems to cover the tools used to guide the user in the creation of the modelling code.

Here's a system dynamics model from chapter 3 [this is more of an example of how to write such things in Prolog and a later chapter develops a language where these things can be put in the form of equations]. Here we have two states: rabbits and grass, and we have four flows: grazing, photosynthesis, respiration, and defecation. The source_sink term is a sort of dummy state that covers the rest of the environment.

%%%
%%% Eco-Logic: Logic-Based Approaches to Ecological Modelling.
%%% Robertson et al.
%%%
%%% Chapter 3 System Dynamics example.
%%%
%%%
%%% [-'../../misc/Eco_Logic.code/chap3/system_dynamics'].
%%%

%%%
%%% previous_time(+T, -Prev)
%%%
%%% The clock time previous to T is Prev.
%%%
previous_time(T, Prev) :-
Prev is T - 1.

%%%
%%% state_variable(+S, +T, -N)
%%%
%%% The value of the state variable S at time T is N.
%%%
state_variable(S, T, N) :-
initial_time(T),
initial_value(S, N).

state_variable(S, T, N) :-
\+ initial_time(T),
previous_time(T, Tp),
state_variable(S, Tp, Np),
input_and_output_flows(S, Tp, Fi, Fo),
N is Np + Fi - Fo.

%%%
%%% sum_elements(+Lst, +Acc, -Sum)
%%%
%%% The sum of the elements of Lst plus Acc is Sum.
%%%
sum_elements([], Sum, Sum).
sum_elements([H|T], Acc0, Sum) :-
Acc1 is Acc0 + H,
sum_elements(T, Acc1, Sum).

%%%
%%% sum_elements(+Lst, -Sum)
%%%
%%% The summation of all of the elements of Lst is Sum.
%%%
sum_elements(Lst, Sum) :-
sum_elements(Lst, 0, Sum).

%%%
%%% input_and_output_flows(+S, +T, -Fi, -Fo)
%%%
%%% Fi is the sum of all inflows and Fo is the sum of all outflows
%%% for the state variable S at time T.
%%%
input_and_output_flows(S, T, Fi, Fo) :-
findall(Ni, inflow(S, T, Ni), Li),
sum_elements(Li, Fi),
findall(No, outflow(S, T, No), Lo),
sum_elements(Lo, Fo).

%%%
%%% inflow(S, T, N)
%%%
%%% There is an inflow with value N for the state variable S at time T.
%%%
inflow(S, T, N) :- flow(F, X, S, T, N).

%%%
%%% outflow(S, T, N)
%%%
%%% There is an outflow with value N for the state variable S at time T.
%%%
outflow(S, T, N) :- flow(F, S, X, T, N).

%%%
%%% flow(photosynthesis, source_sink, grass, T, N)
%%%
%%% The value of the flow of photosynthesis to grass from the external source
%%% at time T is N.
%%%
flow(photosynthesis, source_sink, grass, T, N) :-
parameter(photosynthesis, grass, P),
state_variable(grass, T, M),
N is P*M.

%%%
%%% flow(grazing, grass, rabbit, T, N)
%%%
%%% The value of the flow of grazing to grass from rabbit
%%% at time T is N.
%%%
flow(grazing, grass, rabbit, T, N) :-
parameter(grazing, rabbit, P),
state_variable(grass, T, Mg),
state_variable(rabbit, T, Mr),
N is P * Mr * Mg.

%%%
%%% flow(F, S, source_sink, T, N)
%%%
%%% The value of the flow of either respiration or defecation
%%% from the object S to the external source_sink compartment
%%% at time T is N.
%%%
flow(F, S, source_sink, T, N) :-
(F = respiration ; F = defecation),
parameter(F, S, P),
state_variable(S, T, M),
N is P * M.

%%%
%%% Here is the model.
%%%

initial_time(1).

initial_value(grass, 1000).
initial_value(rabbit, 10).

parameter(photosynthesis, grass, 0.4).
parameter(grazing, rabbit, 0.001).
parameter(respiration, grass, 0.1).
parameter(respiration, rabbit, 0.1).
parameter(defecation, rabbit, 0.1).

%%%
%%% Try this query:
%%% state_variable(rabbit, 2, N).
%%%
%%% N should be 18.0.
%%%


### The Macy Conferences

Cyberneics is more than a field of study, it is happening now to you. A good book about events on the American side of the pond is Katherine Hayles book, "How we became Post Human".

### Here you can find a little

Here you can find a little article I wrote about the people who made the Macy Conferences happen.

### My take on the Macy

My take on the Macy conference after reading your article and Hayle's book is that the process of social and cultural change is a mess. The participants end up brused and battered, and no one seems happy with the results. Wiener and von Neumann were great mathematicians but they were no match for the forces shaping society.

### It's definitely not a simple

It's definitely not a simple process... Much like running a group blog :-)