Dynamic modelling using FORTRAN IV

Dynamic modelling using FORTRAN IV

Compur. & Ed~satvv~ Vol. 1. pp. 55-76. DYNAMIC Pergamon Press. 1977. Printed m Great Britain. MODELLING USING JAY MARTIN Department of Chemistr...

1MB Sizes 3 Downloads 142 Views

Compur. & Ed~satvv~ Vol. 1. pp. 55-76.

DYNAMIC

Pergamon

Press. 1977. Printed m Great Britain.

MODELLING

USING

JAY MARTIN Department

of Chemistry,

Bryn Mawr (Received

FORTRAN

IV

ANDERSON College,

Bryn Mawr,

PA 19010, U.S.A.

12 May 1975)

Abstract-A recipe is presented for transcribing System Dynamics models or programs written in DYNAMO into FORTRAN IV. The several small- and medium-size System Dynamic models which have received popular and widespread attention can therefore be presented in a language which is more widely available. In addition, the use of FORTRAN permits the construction and saving of object or load modules from the source programs. which may be useful in repetitive classroom exercises. The FORTRAN programmer takes upon himself much of the effort which the DYNAMO processor assumed, but allows himself the use of the FORTRAN library of functions, and more flexible input-output. Four examples are presented: the first shows the construction of delays in FORTRAN (a DYNAMO macro); the second and third, models for “The Tragedy of the Commons” and a simple predator-prey system, have found use in undergraduate teaching; the fourth is a transcription of the World Model of Prof. J. W. Forrester.

INTRODUCTION By “Dynamic modelling,” we mean the construction of formal models of systems whose behavior in time is followed by computer simulation. Specifically, we refer to the techniques of System Dynamics, as pioneered and developed by M. I. T. Professor Jay W. Forrester [l, 21. System Dynamics is a general theory of system structure which is based 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 the first element 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 (l-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 [3] 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 on its practice, but rather to focus on the third of the preceding four elements: the computer simulation of System Dynamics models. In recent years a number of System Dynamics models have emerged, including Forrester’s [4] and Meadows’ [S] World models, and the several environmental models described in Toward Global Equilibrium [3]. These models are cast in the computer language DYNAMO [6], 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 provides printed and plotted output. 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 36Q/67, it is an expensive proprietary product. Second, it is available only in a few computational environments. Finally, 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. In order to overcome these shortcomings, a recipe is provided for translating System Dynamics models or existing DYNAMO programs into FORTRAN. In following this recipe, 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. We shall not elaborate on the principles of System Dynamics here: the reader is referred to references Cl] and [2] for these topics. The particular recipe presented here is cast in IBM FORTRAN IV(G1) but can easily be modified for other dialects. The recipe treats only a subset of DYNAMO, but a subset wide enough to accommodate, for example, the WORLD models.

r*.r. I:? -a

55

56

J&l MARFIN ANIXRSON

The emphasis is on rrcipe: a method for formulating System Dynamics models in FORTRAN. but not a program nor a compiler nor a processor for so doing. The recipe admits some latitude. both in the USC of particular ingredients and in the embellishments possible in a well-equipped kitchen. Four brief examples of the recipe are offered: the first is the construction of a delay; two have already been presented in the context of the undergraduate classroom [7]. The tirst is a model for “The Tragedy of the Commons”; [8.9] the second is a simple predator-prey model which illustrates one of the concepts in Tl1c1Silcrrt Sp~ir~/ [IO]. The final example is Forrestcr’s World model c41. REC‘IPt

THE

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 coarser&rid 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. Initialiration. Auxiliaries and Rates. Outputs. and Levels. The logical flow of the modelling program is accomplished in the last five parts of the structure. 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.

These sections

may bc thought

of as essentially

instructions

to the FORTRAN

compiler.

This section reads control information for the simulation. as well as values. Information plotter subroutine is also read at this point. Parameters of the model may be printed clarify and annotate the subsequent output.

This section provides values of all levels. Au\-iliuries

ad

for starting

the simulation

clock. some housekeeping.

and setting

for the to help

initial

rutcs

this section the computation of auxiliaries calculated auxiliaries or rates. is carried out. III

and rates from existing

levels, and from previously

Results of the simulation can be printed line by lint 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 Appendix I. Clearly the FORTRAN programmer with more sophisticated graphical devices will wish to call upon these in writing output. As a simple example. the predator-prey model given as an example has output written to intermediate disk storage. This output is subsequently processed by a graphics routine. providing both plots of variables versus time and plots of variables versus each other.

The integration is completed, and the clock and levels are updated. The details of the seven-step “recipe” are given in Appendix I. A flow diagram Fig. I. REQIJIRED

is shown

in

SUBROUTINES

The recipe described briefly above and in detail in the Appendix requires additional subroutines to ease in writing DYNAMO-like programs. A limited subset of those provided for DYNAMO

Dynamic

modelling

using FORTRAN

Initialization

57

IV

Yes 1

4 Auxiliaries and rates 4 output No

i Levels

Fig.

1.

Flow diagram

for “recipe” for dynamic

modelling.

users might include CLIP, NOISE, RAMP, STEP, SWITCH, TABLE, and TABHL, as well as a simulation-plotter subroutine (SIMPLT). The Appendix includes source listings for the above. It must be stressed that delays, which appear frequently in System Dynamics models, are not simply functions or subroutines, but “macros.” Delays require integration, and therefore the programming of a delay requires insertion of FORTRAN source statements into several of the seven sections of the modelling program. One example is exhibited in Appendix 3. OUTPUT The output of the program comprises three parts: a summary of parameters used in the model, a printed table, and a plot of various rates, levels, or auxiliaries as a function of time. The programmer may choose not to form a printed table or not to form a plot if he wishes, or to present the output in some other way. In the examples which follow, primary emphasis is placed upon the simple but crude print-plots, which should be within reach of all computer systems. In addition, output from the predator-prey model is written to intermediate disc storage and subsequently processed by a library of programs written for either the CalComp or compatible plotters. The plots shown here were formed by the TSP-212 plotter system from Time Share Peripherals. Bethel, Connecticut. It should be apparent that, by using a FORTRAN recipe. dynamic models may use the range from the simplest to the most sophisticated graphical output routines. EXAMPLES There is little need to comment on the models which are here shown transcribed into FORTRAN IV(Gl), for each is adequately described in the literature. Source listings are found in Appendix 4. APPENDIX

1. DETAILED

EXPLANATION

OF THE “RECIPE”

The main program includes seven sections. These sections are Specifications, Functions, Inputs, Initialization, Auxiliaries & Rates, Outputs, and Levels. This seven-part structure corresponds to DYNAMO’s ability to order modelling equations. Following this order is part of the necessary labor of writing modelling programs in FORTRAN IV. In each section, statements are of three types: mandatory, type-required, and optional. A “mandatory” statement is one which appears as written in every modelling program conforming to the recipe. These statements control the logic and flow of the program. “Type-required” statements are those which appear in some form in every modelling program conforming to the recipe, but whose specific form will vary from program to program. “Optional” statements are those peculiar to the individual model and program. The mandatory input parameters include: NAME NUPL NUPR

up to 72 alphameric characters which provide a title for the model. the number of time-units between each line of plotted output. the number of time-units between each line of printed output (tabular output).

.IA> MAKTI~; AxtxxSOh

58

NU NCPU

Plotter

the number of time-units in the simulation. the number of iterations of the integration loop performed in each time-unit. A large value for NCPU means a fine-grid integration. and a longer running time. The usual DYNAMO constant, DT. is the reciprocal of the variable NCPU. parameters

are described

in the section on the simulation-plotter

subroutine

SIMPLT

Sectiorl 1. Spccijicntions

Any FORTRAN IV program modelling program :

begins with specification

statements.

Two are mandatory

for the

DIMENSION NAME (18) LOGICAL RPLOT/‘.TRUE../ Subsequently, the programmer required statement:

must DIMENSION DIMENSION

any variable

pvariable

which is to be plotted

in a type-

(51),...

The only variables which must be DIMENSIONed are NAME (mandatory). the several (up to 5) plot variables, and any TABLE-function entries. The transcription of the World model shows how TABLE-functions are constructed: a dimensioned vector is constructed either in a specification or an input statement; the TABLE and TABHL function then interpolates between the entries of this vector. In the Specification Section, the model might require some REAL, INTEGER, or LOGICAL specifications; the section concludes with the mandatory COMMON and type-required NAMELIST* statements: COMMON T,pvariable.. NAMELIST;‘PARMS/parameters.... The time variable, T, and each variable to be plotted, are placed in COMMON storage. The order in which the variables to be plotted are placed in COMMON must be borne in mind by the programmer, for the plotter subroutine SIMPLT refers to them in that specific order. Sectiofl 2. Functions

One-line

arithmetic

statement

functions

used in the model are inserted

here. None are mandatory.

Section 3. Inputs

The structure of the program establishes the running conditions once for each loading of the program. These conditions include the mandatory parameters NAME. NUPL. NUPR. NU. NCPU. and the plotting parameters. The (optional) model parameters are subsequently read by the program. and may be changed in subsequent simulations of the model at the same execution of the program. The mandatory input section, using the list-directed input feature in FORTRAN IV(G1). looks like this: READ (5,lOOl) NAME 1001 FORMAT (18A4) READ (5,*) NUPL.NUPR,NU.NCPU NOCAL=NU*NCPU NUPT=NUPL*NCPU NUPR=NUPR*NCPU DT=I./FLOAT(NCPU) NCASE=O Constants or table-function entries which were not established in the Specification Section by a REAL or INTEGER specification statement may be established here with an arithmetic statement. The program loops for each simulation of the model to the following mandatory statements. In this recipe. READ and WRITE using NAMELIST, a feature of IBM FORTRAN IV(G and H), has been used, since the NAMELIST feature gives the closest approximation to DYNAMO’s input, and is particularly easy to use. On other systems, formatted or list-directed input or output may be used instead. *As is explained in the Input Section. the FORTRAN IV(GI) NAMELIST feature was chosen SO that input looks like DYNAMO input. In FORTRAN systems not having this feature, more conventional formatted input

will be required.

and the NAME-LIST

statement

will not appear

in the specification

section.

Dynamic

modelling

using FORTRAN

IV

59

1

READ (5,PARMS,END=lOO) NCASE-NCASE + 1 WRITE (6,1003) NAME, NCASE 1003 FORMAT (‘l’, 18A4/‘CASE’, 12/) WRITE (6,PARMS) Parameters for each particular simulation of the model are read and written here, using NAMELIST. Notice that the READ using NAMELIST functions much like the DYNAMO input functions CP and TP, that is, a permanent value of a constant or table is read and will be retained for all future simulations of the model unless changed in a subsequent READ using NAMELIST. Section 4. Initialization All modelling

programs

conforming

to the recipie require the statement

NT=0 to start the simulation clock. Many modelling programs will initialize variables, especially levels at this point also. If tabular printed output is desired, a table-heading for the printed output is written; this statement (type-required) begins the “page-turning” loop. Page-turning is provided for printers with carriage control to place the output attractively on each page. A convenient table might include up to ten columns ten characters (digits) wide, separated by two columns. The FORMAT for the table-heading which is statement 1004 should be planned for the table entries which will be written subsequently. 2 1004

NPL is a counter

WRITE (6,1004) FORMAT (‘1 TIME’, specifications.. NPL=O

which counts lines of plotted

Section 5. Auxiliaries The only mandatory

output

.)

saved.

and rates statement 5

in this section is the time-keeping

statement

T=FLOAT(NT)/FLOAT(NCPU)

With the statement written as shown above, time starts at zero. In the transcription of the World model, time starts at 1900, and this statement is changed to reflect a different origin for time. All other rate and auxiliary equations depend on the peculiarities of the model. Such equations are gathered in this section in a logically computible order. There can be no simultaneous equations. The FORTRAN programmer is responsible for the logical succession of equations in this section himself. Section 6. Outputs The program logic requires that outputs Two type-required statements are

be written

before

the integration

loop is completed.

1005 FORMAT(lX,FS.O,specifications.. .) IF (MOD(NT.NUPR).EQ.O) WRITE (6,1005) T.variables FORMAT 1005 must correspond exactly with the table-header FORMAT 1004. None of these statements is written if no tabular printed output is desired. The following mandatory statements control the saving of information for the plotter subroutine: IF (MOD(NT,NUPT).EQ.O) NPL=NPL + I

GO TO 20

Then follow as many type-required statements as there are variables to be plotted. Information is saved for the plotter by transferring the value of a variable at the current time in the simulation into an element of an array. Each quantity to be plotted thus has two variable-names associated with it: one, DIMENSIONed (51) for saving information for the plotter, and the other, unDIMENSIONed, which runs throughout the computation. Here they are equated: pvariable(NPL)

= variable

JA\ MAKTIK Amt.lm~h

60 After 51 lines of plotter passed to the plotter:

information.

enough

to fill one page. have been accumulated,

IF (NPL.GE.51)

This section

completes

the integrations 20

The next are type-required

and closes all loops. The first statement 60

one for each level, to complete

closes with these mandatory

40

100 -where

#pvariables

is mandatory:

TO 40

level = level + DT*(cxpression Finally, the program

is

GO TO 40

IF (NTGENOCAL) statements.

control

the integrations:

with rates)

statcmcnts:

NT=NT+ I GOT05 CALL SIMPLT( #pvariables,NUPL,NPL,NAME.RPLOT) RPLOT=.FALSE. IF (NT-NOCAL) ‘.I.1 STOP END

is an integer constant

equal to the number

of variables

to be plotted.

In the outline which follows, mandatory statements are shown in Roman type. type-required statements in italics, and optional statements are indicated by ellipses. The examples, as this summary, are broken into seven sections by comment statements. C

...

c 1.

SPECIFICATIONS DIMENSIONNAME(18) LOGICALRPLOT /.TFUJE./ DIMENSION pvariable(Sl),... DIMENSION table-function(N), COh4&3N T, pvariable,

...

NAMELIST /PARMS/ constants C c 2.

FUNCTIONS ...

C C 3.

INPUTS READ (5,lOOl)NAME

1001

FORMAT (18A4) READ (5,x) NUPL,NUPR,NU,NCPU NOCAL=NIJ*NCPU NUPT=NUPL*NCPU NUPR=NUPR*NCPU DT=l./FLOAT(NCPU) NCASE=O ...

.. .

& table-function-names

Dynamic modelling usingFORTRAN

IV

61

READ (5,P~,~~lOO)

1

NCASE=NCASE+l WRITE (6JOO3) NAME,NCASE FORT

1003

('l',lSA&" CASE ',12/)

WRITE (6,PARMS) C c

4.

INITIALIZATION NT=0 ...

2

WRITE (6,1004:)

1004

FOFMAT ('lTIbffE',specifications) NPL=O

C c.

5.

5

.*. c c

6.

1005

OUTPUTS FORMAT (lX,F5.0,specificationa) IF (maNT,NUPR).EQ.O) WRITE (6,1005)T,varfables IF (~~NT,NU~).~.O)

GO TO 20

NPL=NPL+l pvariable(NPLI=variabZe

IF (NPL.GE.51)GO TO 40 c c

7.

20

IF (NT.GE.NOCAL) GO n, 40 leve l=teve ZfDT*(rat%

exvressinn

f

NT=NT+l GO TO 5 40

CALL S~LT(~~~able6,~L,NPL,~,~~T) RPLOT=.FAISE. IF (NT-NOW,) 2,1,1

100

STOP END

Suhroufinr

SIMPLT

This subroutine forms the printer-plots of variables vs. time. It is designed for use with the main program, but could be used independently as well Input data is required by the subroutine; the data desk for a simulation model must pay careful attention to the data required by MAIN and that required by SIMPLT. A FORTRAN source listing for subroutine SIMPLT is found in the next Appendix.

JAY MARTIN ANDEKSON

62

The subroutine receives from COMMON storage, are found in the call:

information from the list of arguments in the call to the subroutine. and by reading cards from the data deck. Five pieces of information CALL

SIMPLT

(NV.NUPL,NPL,TIME,RPLOT)

where is an integer constant specifying the number of variables to be plotted; is calculated in MAIN and indicates the number of time-units between each line of plot; is calculated in MAIN and indicates the number of lines of plot, up to a full page of 51 lines, are ready at this call: is read in MAIN and is the title of the mbdel or simulation; is set in MAIN; it is a logical variable which tells whether or not SIMPLT has been called before, and therefore whether or not cards should be read by SIMPLT at this call.

NV NUPL NPL NAME RPLOT

Note that the constant NV is all that must be evaluated and supplied by the programmer in writing the call to SIMPLT in the MAIN program. The version of SIMPLT given in this paper allows for NV from 1 to 5. In addition to the explicitly passed information described above. the subroutine receives implicit information through COMMON: time. T. and the values of the various variables to be plotted. The variables, up to five, dimensioned (51). are stored in a specific order in COMMON in MAIN. and must be referred to in the same order in SIMPLT. Finally, SIMPLT receives information by reading from cards information for scaling and marking the plots. For each variable. in the order in which they are stored in COMMON. the programmer provides: BOTTOM TOP NSYM NWORD

the lower limit for the variable on the plot the upper limit for the variable on the plot a single letter to be used as a symbol for plotting the variable a four-letter word to identify the variable on the plot.

Since the axis of a plot is divided into five segments, it is convenient if the difference (TOPBOTTOM) is nicely divisible by five. The standard scale markings used in this version of SIMPLT are not those used by DYNAMO. but conform more closely to usual scientific notation: T G M K 1 Structure

IO” IO’ IO’ IO3 IO-

teragigamegakilo(unit)

or cards

I 2 3 4 5 6....

10-j 10-h IO-”

P

lo-‘2

millimicronanopico-

of‘ the datu deck

By following the foregoing descriptions is arranged in the following ‘order: Card

w u N

of MAIN and SIMPLT.

it should

Variable(s)

FORMAT

18A4 list-directed using NAMELIST

NAME NUPL,NUPR,NU,NCPU Parameters for first simulation Parameters for plot Parameters for second simulation Parameters for third.. simulations APPENDIX

be clear that the data

2G10.4,Al.A4 using NAMELIST using NAMELIST

2. SUBPROGRAMS

Seven FUNCTION subprograms have been written functions used in constructing DYNAMO programs.

in FORTRAN

IV to supply

some of the

63

Dynamic modelling using FORTRAN IV

STEP(STH,STT). The STEP function yields a single step of height STH beginning at time STT. RAMP(RPSL,RPT). The RAMP function yields a linear ramp of slope RPSL beginning at time RPT. CLIP(P,Q,CRIT,REF). The CLIP function yields P if CRIT 2 REF; the function yields Q if CRIT < REF. SWITCH(P,Q,CRIT). The SWITCH function yields P if CRIT is zero (if the switch is off); if CRIT is nonzero (the switch is on), the function yields Q. NOISE($). The NOISE function gives a random number between -0.5 and +0.5. The argument $ is a dummy argument and is unused by the function. In the version shown below. the random number generator is drawn from the IBM Scientific Subroutine Package, and the “seed” for the random number generator is taken from an internal clock on the IBM 370/168 system used by the author. Suitable modifications would be required for other installations, TABLE and TABHL(TNAME,TV,TVMIN,TVMAX,DTV). The table function uses the vector TNAME, whose dimension must be exactly (TVMAX-TVMIN)/DTV + 1, and performs a linear interpolation between the limits TVMIN and TVMAX using the variable TV in order to select the appropriate value of the function. FORTRAN does no checking to be sure that the dimension of the vector TNAME matches the arguments TVMIN, TVMAX, and DTV, as does DYNAMO. Consequently, curious, irregular, unrepeatable errors might occur if this consistency is not checked by the programmer. The FORTRAN versions of the table function routines shown below provide limited checking on the.validity of the variable TV in the function TABLE, as does DYNAMO. A message will be issued if TV is not within the range from TVMIN to TVMAX. Otherwise, TABLE and TABHL perform identical functions. SIMPLT, the simulation plotter subroutine already described is also included here. Following are source listings for these subprograms.

FUF,CTION CLIP(P~Q~CHITVREF) LLIP=P IF (CRIT.LT.HEFl CLIP=G KCTCHN t ND

C C C C

C

FEAL FWCTIQN ~IOISE(S) FlJr CTILh PIChs UP RANDOM CLOCK ROUTINE. kPOr.OS IS RAn’tlOn WMRER GENfHATOR LOGICAL EIQT~R/.THUE./ PICK LIP SEE0 rhOM CLOCK IF (ENTElil 1RX=KROb:OS(4) CALL RANDU~lhx,lRYtH) PASSES Ntti SQL, TO NEXT IRX=IRY f.OISE=R-0.5 FklER=.FALSt_, RETURiC LNL

tllhiCTIOrd lcl~~orr

r.!UMFd R GENERATOR Ir.1 Sysh.FORTLTB ROUTI~.!E RAbiOU IS 0F:L.Y

E&TRY

R~l+(FPSL~HPT) 1

F ACP=O, IF (T.GE.HPT) h~TWN LNL

RAMP=HPSL*(T-RPTt

FUNCTION STLP(.STtilSTT) COMPON T STEI’=O. 1F (T.GE,STT) SlEP=STH hETURN END

Ch

OF

FIkST

PA~~JII

sEE~I IF;

EEUTPY

FROr

SYS7eSSPLIb

IWTERNAL

CLOCK.

64

JAY MARTIN ANDERSON

FCPCTICh TABLE. (TI~~~IME~TV,T\,PIIU.T\~P~AX,~I~VJ cO,“vOr: T I~J~FkSItik TI>APF(l) kc-41 ~li9tt~SI~r~ OF TAHLE TlvAf@~ r US1 Bf. IF; CALLI~C PkObRhM, c IF (TV.LT.TvTIr,) WHITL (6.10) 1 IF (TV.GT.TV~,GY) WRITE (6.11) T TA~~LL=TPBHL~T~~A~:L~TV~TV~~IF!,~V~AX,~TV) RET IIH h 10 FORIMAT ( ’ GAHNIhG: BELcU Eli0 OF A TABLE Al TIMr = '*GlOr't) FOhPAT (’ ~‘AH~~I~~:I;:ABOVE Lr,itlOF TAGLL AT TIME = ',GlO.‘ll 11 Eu 22

1 C

LOGICAL. YLAHTCALL ‘/,IV/‘I’/,IH/‘-t/ OATA Itc/* tATA LE:TTCp /*T*.‘G’.‘~~r*h~*‘l*~*~~‘~*l~~~~~,~~’P~/ IF (CAL_L) I-LAO ~~~~~~~~(ROTTOM~I~~TCP~I~~NSYM~I~~N~~R~(I~~I=~~NV~ hHITk_ (611QfJl) reAME TfiE FOLLOWING tRocE.DUNt N~~PMAL.IZLS FCjjLE ENTRIES

t,O 20 rkltrdv X=AES(TctPfr )I

5

6

lfl

15 20

35

IF IABS(BOTTO~~~N)).GT.X) X=AHS~DOTTOM(N)I FACTOR=l. IhlCE.X=O IF (X-1.) 516,~ X=X*1000, Ir4Y!EX=IrdxX+l FACTOR=FACTtiR*lOOOe IF (~X.LT.l.).Ar~D.lINCEX.LT,~))GO To 5 c-0 TO 10 IF ((X.LT.1000,),OR.(IMu~X.L~.-~)) GO TO INDEX=INDEX-1 FACTOH=FACTUR/lOOO. x=X/1000. 60 TO 6 IN~EX=IldDEX+S LSCALE=LETTER ( Il4DEX) DO 15 1~1.6 SCALE~I~=~~OTT~~~N~+(I-T~~(TOPO~ROTTOM~N~~~~*~*FACTOR kiRITE fhv1002) ~SCALE(I)*I=~~~).LSCAL~~NSY~~N)*~’WORD(NJ co 50 N=l*NPL Y=T+lN-Nf’L)*NuPL YEAC=.FALSE. IF fAMODlY,10.).EQ.O.~ YEAR=.TRUE. 00 35 hL=l,lol L IF’E (NLI=IR 1F (YEAR) LINElNL)=IH cob TINUE DO 36 I=lv6

1U

Tc! FACTORS

OF

lOU0

l_IrGE~~I-1)*20+1~=IV DO 90 I=lthV

36

IF~DEX=~V~~rll-~OTT~M~I~l*~~OO/~TOP(I~-BOTl~~~It~)+~ IF ~I~DEX.Gt,l.ANO.INOEX.~~,lOl) LINE(INOEx~=NSYM(I)

C0~uT1hilJE

40

IF (YEAR) GO TO WRITE (6,lOOr))

45

~l_INElI~~I=lrlOl)

GO TO 50 LNHITE (6~1005) Y,~LINE(I),I=~~~O~)

45 50

CONTINIIE: RETURN FORMAT FOPMAT FORPAT FORMAT FOREAT

1000 1001 1002 1004 1005

~2GlO.~,Al,A'+l

l'l*vSX,18A'+/) (3X,C7,2~5(13X*F7,2),2X.A~,2X.A1,2X,A~) (7X,lOlAl)

(2X,F5,0,101Al)

END APPENDIX

3. EXAMPLE:THIRD

ORDER

INFORMATION

DELAY

The DYNAMO processor can expand the necessary instructions for macros, that is. for functions which require integration. such as delays, into one’s program. However, it is necessary for the FORTRAN programmer to insert statements into at least four sections of the simulation program. The third-order delay, called in DYNAMO DLINF3, is a cascade of three first-order information delays (each called in DYNAMO SMOOTH). This structure, in the usual notation of System Dynamics, is shown in Fig. 2.

Fig. 2. DYNAMO

flow diagram for the third-order information delay. The symbols those from Forrester’s [l, 21 and Pugh’s [6] work.

used are

The insertions described below will simulate the third order information delay. The program whose source listing follows simulates both a first- and third-order delay of a step function.

Sections

1 (sprcijcations)

The time constant

and 3 (inputs)

of the delay must be .defined in one of three ways:

$T = value DATA $T/value/ NAMELIST/PARMS/ . . . . OT,... READ (S,PARMS,END = 100)

(arithmetic statement) (specification statement) (specification

and input statements)

Section 4 (initialization) it is The initial values of the three levels $11, RI2. and $13 must be defined. In DYNAMO customary to define these as either zero or one-third of the initial value of the level LEVEL which precedes the delay. The FORTRAN programmer can follow either of these or other initial value assumptions. $11 = value $12 = value $13 = value

66

JAY MARTIN ANDERSON

Time

Fig. 3.

output,

redrawn from computer-generated third-order delay in the stepped

print-plot. level.

showing

the first- and

Section 5 (mtes arld auxiliaries) The rates of transfer from the internal levels $11. $12, and $13 are defined, using the time constant of ST. The effective time constant for each transfer is $T/3: SRI = (LEVEL~SIl)*3/ST SR2 = ($IllSI2)*3/ST SR3 = ($12-~$Il)*3/ST Srctiofr 7 (let&) The internal

levels are calculated

at the end of the integration

loop:

S11 = $11 + DT*$Rl SI2 = $12 + DT*SRZ S13 = $13 + DT*SR3 We have here marked the rates, levels, and constants which stand within the structure of the third-order information delay with the initial character S for convenience. but not out of necessity. The sample program which follows conforms to the recipe which we have been describing. and illustrates the construction of the delays. At time T = IO, the level rises suddenly from 0 to 300. %I is a first-order information delay (SMOOTH) of the initial level. and SI3 is a third-order information delay (DLINF3) of the level. Graphical output is shown in Fig. 3. C

C C C

PEMOKSTRATIO~ PHOGRAV FOR INFORMATIOI~ DELAYS IS STEP FUNCTIOta AT T=10 p.0 DELAY, LEVELOTHER DELAYS ARE FIRST SMOOTd ANO DLINF3

SECTION 1. OIMENSION

AriO

SPECIFICATIONS NAME (18)

TIIIRO

OR0L.l:.

STATEMENTS

RPLOT/.TRut./ OIMLNSION P0(51)1P1(51)1P3(51) COWMON T1POvPl.P3 REAL LELEL NAMELIST /PURPs/ $1 ARITHMETIC STATEWENT SLCTION 2. THERE ARE NONE IrJ THIS MO0EL

LOGICAL

C C C

c.

SE.CTION READ

IP’PUTS 3. (5,lOOl) ~AWF

FU~KTIO~S

AS

11~ OYb4AlViO

p.ACROs

Dynamic modelling using FORTRAN 1001

1

1003

FORMAT (lAA4) REAO (5**) NUPL,~\;PR,~‘U~NCPU NOCAL=NU*NCPlJ NUPT=NUPL*MCPb NUPH=hUPR*NCPU DTd./FLOAT(NCPU) NCASt_=O REAO (~,PARMS~ENO=~~O) NCASE=h!CASE+l WRITE. (6.10031 NA~~LvhtASE*NCFU FORMAT (‘1’*18A4/’ CAS:C. ‘112/’ WRITE (t ,pARMSl

NCPU

IV

67

‘913//I

C C

SECTION 41 INITIALIZATION hT=O JI=O. LEvEL=O, s11=0. S12=0. 512=0. SI3=0. WHITE (6,1004) 2 FORI’IAT (‘~TIME’~~XI’LTVEL~ 1004 1 ‘a129 3RO’ *3Xv’SI3, NPL=O

k

0’.3X,‘SI*

ALIXILIARICS T=FLOAT(NT)/FLOAT(~CP~JI SR=(LEVEL-SI)/ST SR1=(LEbLL-SX1)*3./ST Sk2=(SIl-SI2)*3./$1 SR3=(SI2-S13)*3./§T

AND

SECTION 51

5

RATES

C OUTPUTS C SECTION 6. FORMAT (12~F5.0*2XtFB,2*2X1F8.2r32.F8.2,2y,F8.2~2~,F8.21 1005 IF ~MOD~NTtNUPR~.~b.Ol WRITE (6,1005) IF (YOD~NTINUPT).~.L,O) GO TO 20 NPL=NPL+l POtkPL)=LEVEL PltkFL)=t~ P3tNPLlzS.13

IF C C 20

SECTION

(NPL.GE.51)

GO

LEVELS

7e

TO

ANG

40 CONCLUSION

IF lNT.GE,NOCAL) GO TO 40 IF (T.GE.lO.) LEVEL=300. SIsSI+OT*SR SIl=SI1+OT*SRI

$12=012+OT*SR2 513=513+DT*SR3 NT=NT+l GO To 5 YO

CALL SIMPLT(~*NUPL*NPL*NAME*RPLOT) RPLOT=eFALSE.

100

STOP EN0

IF (NT-NOtAL) 2e1.1

Input

data to the preceding

lST*13X,‘SIl,

3RD’)

program:

DWXSlRATION OF INFORMATION DELBYS 11502 &PAFW $T=lO. ,kEND 0.

300.

ONONE

0.

300.

I IST

0.

300.

33RD

T,LFVEL,SI~bI1~~121SI3

3RL’13h1

JAY MARTIN ANDFRSON

hS

Output from precedingprogram:

DEMDNSTRATIONOF INFORMATIONDELAYS CASE 1 NCPU 2

kPAF2.s

$T= 1O.OOOQWO &END

28 TI

ME

1m/ELI

0

r.

0.0

1.

0.0

2. 3. 4. 5. 6. 7.

0.0 0.0 0.0 0.0 0.0 0.0

es

0.0

9. In. 11. 12. 13. 14. 15. 16. 17, lp.. 19. 2c* 21, 22. 73. 24, 25, 26. 27. 28. ?9. 30. 31. 32, 33. 34. 35; 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50.

0.0

0.0 3no.00 3ooIoo 300.00 3ao.00 3oo;oo 300.00 30B.00 3co.00 3ll0.00 300.00 300.00 300.00 3ooIoo 300.00 300.00 300,oo 300,UO 300.00 3oo;oo 300,OO 300,oo 300.00 300.00 300,OO 300.00 300.00 3c0,oo 300.00 300*00 300.00 300.00 300.00 300.00 300.00 300.00 3r)O.OO 300.00 300.00 300.00 300.00

$1, IST 0.0 0.0 0.c 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 15.00 42.79 67.87 90.50 110.93 129.36 146,OU 161.01 174.56 186;iV 197.83 207.79

216176 224.90 232.22 238;83 244.79 250.17 255.03 259.42 263.37 266;iJ4 270.17 273.08 275;7o 278.07 280.22 282.14 283.88 285.45 286.87 288.15 289.311 29O;i5 291.29 292.14 292.90 293.59 294.22 294.78

.x11. 3Rr 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 45.00 115.76 166.89 203.83 230;51 249.80 263.73 273.79 281.07 286:32 290.12 292.86 294.84 296.27 297.31 298.05 298.59 298.98 299I27

299.47 299.62 299.72 299.80 299.85 299.89 299.92 299.94 299.96 299.97 299.98 299.98 299.99 299.99 299.99 300,oo 300.00 300.00 300.00 3oo;oo 300.00

$12, 31ir $13~ 3R.n 0.C 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.C 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.6 0.0 0.0 18.22 1;01 49.44 7.98 85.02 22.13 120.16 42.26 h6.36 152.34 92141 180;52 204.42 118.73 224.26 240745 253.49 263.87 272.08 278.51 283;52 287.41 290.41 292.71 294.47 295.82 296.84 297;62 298.21 298;66 290199 299.24 299.43

299.58 299.b8 299.76 299.82 299.67 299.90 299.93 299.95 299.96 299;97 299.96 299.78 299.99

144.07 167:60 198.85 207.61 223.88 237.76 249.47 259.23 267.29 273.89 279.25 283.58 287.06 289.84 292.04 293.79 295;17 296.25 297.10 297.76 298.27 298.67 298.9e. 299.22 299.411 299;Si 299.65 299.73 299.80 299;84 299.88

299.91

Dynamic

Fig. 4. Graphical

output.

modelling

using FORTRAN

redrawn from computer-generated print-plot, of “The Tragedy of the Commons.”

APPENDIX

4. OTHER

69

IV

showing

the simulation

EXAMPLES

The remaining three examples have been taken from System Dynamics models which, in two cases, address simple and popularly available concepts, and, in the third case, the well-known World modelfing efforts of Forrester and Meadows. The model for “The Tragedy of the Commons” [9] was written as a classroom exercise at Bryn Mawr College, and has been used with undergraduates and alumnae/i of the College on several other occasions.

Predator

:-

Fig. 5. Graphical

output,

redrawn

from computer-generated print-plot, of the predator-prey model.

showing

the simulation

JAY MARTIN ANDERSON

70 12

r

I

I

0412

20

Pest Fig. 6. Graphical output generated by computer and drawn on a TSP plotter. showing the simulation of the predator-prey model. Time increases along the trajectory as it system moves from the upper right to its equilibrium point.

The model for the predator-prey relationship 171, in which the prey is also a “pest.” subject to pesticide applications, is an extension of a common description of two-species interactions discussed in many elementary ecology texts. A detailed description of the model. using DYNAMO, is available from the author. Here we exhibit the FORTRAN transcription, together with sample output. In addition, this program includes the embellishment of writing results to intermediate storage for subsequent processing by other plotter programs. The statements inserted which accomplish this are marked by Comments. This information, stored on magnetic disk. is processed by a graphics program in a subsequent job to produce continuous-line plots on a TSP-212 plotter in time-sharing

Fig. 7. Graphical output, redrawn from computer-generated print-plot. showmg the simulation of Forrester’s World Model (WORLD2). The variables plotted are NRFR. natural resources fraction remaining; POP. population; CAP, capital; POLR, pollution ratio (relative to 1970); QL. quality of life. The scales are the same as in V+~r,rldDJanurnic.s [41].

Dynamic modelling using FORTRAN IV

71

mode. We show not only a plot of the population of both species vs. time, but the plot of predator species population vs. prey species population. Print-plot output from Tragedy of the Commons, predatorprey, and World models is shown in Figures 4. 5. and 7; the plot of predator vs. prey population, unavailable in DYNAMO but constructed as explained above using the FORTRAN recipie, is shown in Fig. 6.

C C i

C

A MODEL FOR ‘THE TRAGEDY OF THE COMMONS’ FORTRAN IV(Gl) VERSION is.& li7s IEEE TRANS ON SYS MAN CYBERN~ M. ANDERSON* SEPTEMBER 197’4 J.

E

1.

SMC-4,103

SPECIFICATIONS DIMENSION

NAfiEtlG) OIRENSION PCOM~SlltPCAP(51~ COMMON TtPCORrPCAP REAL LIPIITtITtLC LOGICAL RPLOT /.TRUE,/ NAVELIST /PARflS/ COMItCCR*LIMfT,IT~LC1COR,CCOSTtEXCSW C

c C

2.

THERE

1001

1

1003 c

4.

FUNCTIONS ARE NONE

INPUTS READ (5,lOOl) NAME FORMAT (16AS) READ (5**1 NUPL~NIJPR~NU~NCPU NOCAL=NU*NCPU NUPT=NUPL*NCPU NlJPR=NUPR*NCPU DT=lr/FLOAT~NCPU) NCASE=O READ (5,PARMStENklOO) NCASE=NCASE+l WRITE (6t1003) NAME~NCASE~NCPU FORVAT ('1',18A4/' CASE ‘tI2/’ WRITE fL*PARMS) INITIALIZATION NT=0

NCPU

‘*12/)

COMcCOflI 2 C

CAp=lO. iJpi=o NOTE -DO

z 5

5.

C C C

6. NO

NOT

WRITE

TABLE

90

100

7,

IF

AUXILIARIES AND RATES T=FLOAT(NT)/FLOAT(b&PU) RT=2r5*COF!I/~COMI-COM+l.) CRR=COR/RT CUR=AMIN~~AMIN~~CAP*CCR~LIRIT~,C~~.!~ CDR=CAP/LC OUT=AMIl!!l(CAP~CUR/CCR)/COR EXCOST~SWITCH~O.~CCOST*(COMI-COM),EXCSW) PROF=OUT-EXCOST CIR=AMAXIfO.~PKOF~/It OUTPUTS TABLE ENTRIES WRITTEN (MOD(NT,NUPT).Nt.O) NPL=NPL+l PCOM(NPL)rCOM PCAP(NpL)=CAP IF (NPL.GE.51) GO TO

GO

IF

: 20

HEADER

LEVELS AhlO ~NT~GE,NOCALl

IF

40

FINISCI GO

TO

CAP=CAP+OT*tCIR-COR) CUM=COM+DT*(CRR-CLlHI NT=NT+l GO To 5 CALL SIMPLT(~~~UPL*NPL*NA~E~RPLOTI RPLOT=.FALSEI IF (NT-NOCAL) 2tl.l STOP END

40

TO

20

k0

TABLE

IS

DESIRLD

72

.IAY MARTIK

ANDFRSON

Input data to precedingprogram: TRAGEDYOF THE COMh0NS 10

50 4

&PAFU&S COMI=100.,CCR=.75,LIMIT=100.,IT=10.,LC=20.,COR=1., CCOST=.Ol,EXCSW=O.,&END 0.

loo.

c

0.

100.

$cAp

COM

Output of precedingprogram:

TRAGEDYOF THE COMM)NS CASE 1 NCPU 4 LPARMS COMI=lOO., CCR:.75, LIMIT=lOO., IT=lO.,LC=20.,COR=l., CCOST=.Ol, EXCSW=O. 6EHD

C C C C C C C C

z

C

ThE SILLFIT sPRIrd6 A PRFDATOR-PREY KODEL IN WHICH THF FktY IS A PEST, Suf.JECT TO PESTICIDE. PRfeSENTLD AT CCUC/59 COMFFREhCk ON COP:PUTFSS IN THE vF.iJEKGRACUATC WASHI~GTON STATE t~p.lV.. pLILLr,Ar!r ~.'ASIJ~JUNL* 1974. CURRICULA (FIFTH), FORTRAN IV(Gl) ThA~~SCHIPTIONv SEPTEP'F~R, 1974. J,F.A~.I LRSCN 1.

SPECIFICATIOhS DIriENSIC:N MAML(lB~.pPY(Sl).Pp?(51) LOGICAL RI'LO'I /,TI?LJE./ COr4McJI~l?rPPl*PP2 NAvELIS /PARKS/ PP:Ax,PLIIPPI DATA RA,CArOArDRtCbvIJll /2+~1.11..1.~1,~1./ DATA rlELIr/-999999./

FuNCTXONS 3 TkRC: ARE hOlF

r

c

IWUTS READ (S*lf'Oll hAht 1601 FDRF.AT (lPA'+j kEAn (5.t) NU~L,~~'FR,F'~,NCPU NOcAL=rl(ieNCPU NupT=vuPL+r~'cPU IJUPR=I;,(Jf'R*FICPI DT=l./FLOPT(NCPU) lucASE=O 1 READ (5,PARf"lSvCNLf=100) C Tt.1.S STATEKEhlT kAHkS LNG OF I)lSC IIATASLT FOH IF (hCASC.GT.0) kFITF (8vRC)B) OELl~i~DELIk!,~ELIP NCASL=NCASE+~ WRITE (6g1003) NArt+R!rASE FORMAT (*1'~10A~/~ CASC 1.12) 1003 WHITE (h,pARrlS) C '(. ~N~TIAcIzAT~O~~ NT=0 Pl=PlI P2ZP;rI 2 NPL=U

C

3,

c

c

F.

AUXILIARIFS

AND

FATES

LATFR

PLCTTIrG

Dynamic

modelling

using FORTRAN

ANU

PoPULATIOGS

IV

T=FLOATINT)/FLOATIIKPU)

5

Bl=Pl*Ba Cl=Pl*Pl*CA Dl=Pl*P2*DA t32=P2*Pl*RR C2=P2*P2*CF 02=P2*@ti PEST=AWX~(O~~(P~-~MAX~/DT) C

c

OUTPUTS 6, THIS STATtRtF*T WRITES TIvE SuBSEbULNT PLOTTING, WRITL (8v888) TvPlvP2 FORMAT (3G12.4) BAR IF (MOD(NT~NUPT).r!E.OI NPL=NPL+l PPl (NPL) =f'l C C

PP2(NPLt=PP IF (NPL.GE.511 ;

20

fJISC

DATASfT

FOh

30

40

IF lNT.GE.NOCAL) GO TO Pl=Pl+DT+(Bl-Cl-Dl-PEST) P2=P2+OT*(B2-C2+21 NT=NT+l GO To 5 CALL SIMPLT RPLOT=.FALSE. IF (NT-NOCAL) STOP END

data

to

preceding

SILENT SPRING 1 0 20 4 &PARMS 0. 0.

TO

TO

TO

LEVELS

7.

Input

GO

GO

T&o

(2qNUPLvNPL*NAME*RPLOT) 211~1

program:

PREDATOR

PREY MODEL

PMAX = IOO., PI1 = l., P2I = l., P2I = 1.. &END

1PEST ZPRED

2.5 2.5

Output

40

from preceding

program:

SILENT SPRING PREDATOR-PREY CASE 1 &PARMS PMAX = IOO., PI1 = 2., P21 = 1. &END

MODEL

Note: in addition to the printer-plot output from subroutine SIMPLT which follows, Fig. 3 shows plotted output subsequently made from the information stored on intermediate disk storage and plotted using software for the TSP-212 plotter (Time Share Peripherals, Bethel, Connecticut).

c C C IC

C

i. (,kLlJ? FkUV ;,lOHLU Fc hTRAN I\,

DYFIAI”IcS* tiY ,I.U.FORR~STE~. (f_) (Gl 1 THANSC~~PTION~ J.P,.AwtRSOr’,

VRyGHT-ALLEI, ?EPl lY74

PHtSS.

S~ECIFIC/~TIONS UI?,.trGSICN Nlr.E~~P~rPP~51~~t'rIHfFilt,PCIl51~,t'PO~(S1),~'QL(51) Lf’GIC!\L PFLUT/.ThUL./ cC:‘Mi~r; T~F’F~P:~T~,P~I,PPCL,PQL RE.\L “R,r!14LlR~:‘.RUNl ,IJI:Fi?,rldFH.P’SL,i bMM,P,RI.NRUE:,LA Tif3LE EivTRIES FOP T/,pl_L I OOKUP FI’bcTI0ti.S RE:,L ~~‘r’~l~6~/1.Ztl.r~M5~~75~.7..7/~r~~F~T~~~/G.~.~~~.~,.~5,1./, 1 ~~i~rll~,T~1~~~3.rl.~,1.,.R1.7r.6r.531.53,.~,,~,.5~.~~, 2 ~~Pi~~l7l/.Y2~1.3,2.,3.2r4.Alh.e,g.2/, j C~FAT(y)/30.,3..~.tl.4r1.1.7,.6,.5r.5/. + DcCI~IT~C),P~CFT(~).BR~~T~~~/O.,~.,~.~,~.Y,~./, 1.

3 6 / J

~iP9Tt7)/1.O2..9,.7,.4,.2~,.15,.~/, fCFT~51/7.4~1...h..4..3..~/.5r~..,1.'t~1.7~1.9~2.0~,~.2/, C1PTl61/.1~1.,1.pr2.'+~2.~~3./,~-t.~T~7)/1.O2,.9,.~~,.3~,.~~.~,.Os/, Pf~LC~~T(6)/.u~,l.,J,,~.4,7.4,~,/,

Y

P~L~TT~71/.6r2.5~~..~~.11*5~1~.~,~0./ltF~FR~~~t/~.~.6,.~,.1~~.~/.

1971

74

JAY MARTIN ANDERWN

p,IncAL=:I:I:*r

CPLI

r~tf’T=;!IJPt*f,.CpLl C’HZ III P*r.ct’L’ OT=~./FL@AT(~~~CPUI lil.

r;cflst=o

xc,t) (~,PAR~~.LFJL;=~~oJ

1

raCASL=‘lCASE+l bt?ITt (t *IO031 FoRrAf (*I**lfl114/* WFrTE (b,FARrlS)

lV??

c c

1,.

c

c

I~~ITI~LIZATIO~J Is,T = U P=I .6SE4 I\IE=PIfII CI=U,‘+EY POL=0.2EY CIAF=U.Z NP!_=O

2

5

NAr’t*i.CASE C,\st

4.

AUXILIARIES T=l?OO.+FI

A!‘& RA IEP OAT(IIT)/FLOATfNCPU)

**x2/)

Dynamic modelling usingFORTRAN

75

IV

C

c

C

OllTPUTS IF (hO~(NT,NUPT),F.L.O) GO TO NPL=ibPL+l PP(NPL)=P PidR(>qi'L)=F RFH PcI(rdPL)=cI PI’OL ( !dPL f ZPOLK PQL( IiPL) =GLS*QLM*GLC*OLF*OLP rrcTE THAT A LYNARO ‘SUPPLEMENTARY’ IF (kPL.Gr.51) GO TO 40

6.

20

APPEARS

OkLY

I&

THE

OUTPUT

r

2: 7, 20

LEVLLS E FINISH If (tqT.GE.NOCAL) CG TCr 40 P=p+uT* (RR-UR I NP=Nti-UT*NRUR CIdItDT*(CIG-CID) PtiL=POL+DT* ( POLG-PC~LA) CIAF=CIAF+DT*(CFIFR*CIER-CIAF)/CTBFT NT=NTtl GO TO S

39 40

100

CALL SXf’pLT HPLOT=.FALSE. IF (NT-NOCAL) STOP E&r?

(5qNUPL*NPL*NAME*RPLOT) 2,l.l

Input data for the preceding program: WORLD2 BY JWF 4 0 200 5 QPARMS NRUMl=l., POLNl-l., DRCMT=.9,1.,1.2,1.5,1.9,3., BRCMT=1.05,1.,. 9,.7,.6,.55, CIGM1=.05,BRNl=.O'+, FCl=l., DRN1=.026, NRI=S.Ell, CIDN1=.025, YEAR=1974., QEND 0.

1.

E+lOP POP

0.

1.

RNRFR

0.

2.5

E+lO$ CAP

0.

50.

*POLR

0.

5.

Q QL

Output from the preceding program: WORLD2 BY JWF CASE

1

GPARMS NRUNl=l., POLNl=l., DRCMT=.S, l., 1.2, 1.5, 1.9, 3., BRCMT=1.05, 1.0, .9, .7, .6, .55, CIGNl=.SE-01, BRN1=.4E-01, FCl=l, DRN1=.26E-01, NRI=.9E+12, CIDN1=.25&01, &END

YEAR=1974.

SECTION

76

JAY MARTI& ANIXRSON

REFERENCES I. Forrester J. W., Industrial Dyrumics. MIT Press, Cambridge. Mass. (1961). 2. Forrester J. W., Prirwiplrs of Systerm. Wright Allen Press. Cambridge. Mass. (196X). 3. See, for example. Forrester J. W., In n)w~rd Glohtrl ~quilihriw~~: Collected Ptrpcvs. (Edited by D. L. Meadows and D. H. Meadows). Wright-Allen Press, Cambridge. Mass. (1973): first published in fic/ino/. Rec. 73, 3 (1971). 4. Forrester J. W.. World Dyrwmics. Wright-Allen Press, Cambridge, Mass. (1971). 5. Meadows D. H., Meadows D. L.. Randers J. and Behrens 111 W. W. T/I<, L~ru~r.s 10 Gu)wth. Universe Books, New York (1972). 6. Pugh A. L.. III, DYNAMO II L’sc~rs’ Mu,~uLI/. 2nd Ed. MIT Press, Cambridge. Ma$s. (1973). 7. Anderson J. M.. Computer simulation in the dynamics of environmental systems. in Pro~~wdiqqs o/’ I/W Fifih Conf&~~c~ OH Cor?lputr~s irs I/IV C’~,d~,~~/~utl~r[it~ Currimlu. Washington State Llniversity. Pullman. Wash. (1974). 8. Hardin G.. The tragedy of the commons. Sr~rnce 162. 1243 (1968). 9. Anderson J. M.. IEEE 7icrrt.s. S!j.sl.. Mu/l. C&rtwr. SMC-4. IO? (197-1). IO. Carson R., The Silerlr Spring. Houghton-Mifflin. New York (1962).