Dynamic Modelling Using FORTRAN IV Jay Martin Anderson Bryn Mawr College Introduction "Dynamic modelling," as used in this paper, means the construction of formal models of systems whose behavior in time is followed by computer simulation. Specifically,the paper will refer to the techniques of System Dynamics,as pioneered and developed by M. I. T. Professor Jay W.Forrester.System Dynamics is a general theory of system structure which rests on four essential elements: (1) The cause-and-effect links between elements of a system and the position of these elements within feedback loops are identified. (2) The model is expressed in a formal, mathematical language in which the qualitative interactions identified in (1) are made quantitative. (3) The behavior of the model is examined by computer simulation. (4) The consequences of changing system structure are evaluated by iterating on steps (1)-(3) until a viable policy or set of policies for the system under study has evolved. The integrity, if not the beauty, of System Dynamics has often been commented upon by Forrester and his students and colleagues. Our purpose here is not to debate the merits of System Dynamics as a technique or theory,nor to expound its practice, but rather to focus on step (3) of the preceding four-step program: the computer simulation of System Dynamics models. In recent years a number of System Dynamics models have reached the public eye, including Forrester's and Meadows World models, and the several environmental models described in Toward Global Equilibrium.These models are cast in the computer language DYNAMO,developed expressly for the purpose of serving the System Dynamics community. DYNAMO affords a one-to-one relationship between computer equations and System Dynamics concepts, assumes for itself the labor of arranging the equations in a computable order and providing printed or plotted output. DYNAMO is a compile-and -go processor which provides its own careful diagnostics, and is available for use in a limited number of computational environments from Pugh-Roberts Associates, 65 Rogers Street, Cambridge, Mass. 02142. In spite of its simplicity and beauty, DYNAMO falls short in classroom situations for at least two reasons. First,it is not widely available, and, in all but the versions for IBM OS/360 and IBM CP/CMS on the 360/67, it is an expensive proprietary product. Second, because it is a compile-and-go processor, there is no opportunity to form load modules for repetitive classroom use; the cost of recompiling the source program must be borne at every use. It is to these shortcomings that the present paper is addressed. A recipie is provided for translating System Dynamics models or existing DYNAMO programs into FORTRAN. In following this recipie, the FORTRAN programmer takes upon himself much of the effort that the DYNAMO processor does for the DYNAMO programmer. Nonetheless, the result is a program which is considerably more "transportable," and which can reside as a load module for frequent classroom execution. It will be assumed that the reader is familiar with the elements of System Dynamics as contained in Principles of Systems. The particular recipie presented here is cast in IBM FORTRAN IV(G1) but can easily be modified for other dialects. The recipie treats only a subset of DYNAMO, but a subset wide enough to accomodate, for example, the WORLD models. The emphasis is on recipie: a method for formulating System Dynamics models in FORTRAN, but not a program nor a compiler nor a processor for so doing. The recipie admits some latitude, both in the use of particular ingredients and in the embellishments possible in a well equipped kitchen. One example of the recipie is presented here: Forrester's World Model. Two other examples along with the technical appendices are available from the author. They are a model for "The Tragedy of the Commons" and a predator-prey model illustrating one of the concepts in The Silent Spring. These two have both been used in the undergraduate classroom. The Recipie The purpose of the dynamic modelling program is to describe the behavior in time of generalized systems. Mathematically, this behavior is the result of integration of coupled differential equations. It is presumed that rates of change are sufficiently slow that integration may be accomplished by a simple coarse-grid approximation to the area under a curve comprised of straight line segments.Rates, auxiliary variables, and levels may be calculated; up to ten such quantities may be tabulated in printed form and up to five may be plotted, although the FORTRAN programmer may easily circumvent these arbitrary limits. The main program includes seven sections. These are Specifications, Functions, Inputs, Initialization, Auxiliaries and Rates, Outputs, and Levels. This seven-part structure corresponds to DYNAMO's ability to order modelling equations. Within each part, the order of the equations must be carefully planned by the FORTRAN programmer. Specifications and Functions.These sections may be thought of as essentially instructions to the FORTRAN compiler; the remaining five sections form the logical flow of the modelling program, as shown in Figure 1. Input. This section reads control information for the simulation, as well as values of constants, table-functions,and initial values. Information for the plotter subroutine is also read at this point. Parameters of the model may be printed to help clarify and annotate the subsequent output. Initialization. This section provides for starting the simulation clock, some housekeeping, and setting initial values of all levels. Auxiliaries and Rates. In this section the computation of auxiliaries and rates from existing levels, and from previously calculated auxiliaries or rates, is carried out. Output. Results of the simulation can be printed line by line as the simulation proceeds, but information for plotting is best saved until an entire page of graphical output has been accumulated. The arbitrary limits of ten printed and five plotted variables were chosen for simplicity in constructing a page-wide line of tabular information and for clarity in reading simultaneous plots. A print-plot subroutine which forms plots on a line-printer much like those formed by DYNAMO, is described in the Appendix.Clearly the FORTRAN programmer with more sophisticated graphical devices will wish to call upon these in writing output. Levels. The integration is completed, and the clock and levels are updated. The details of the seven-step "recipie" are given in the appendix.