Chapter 3

Two implementations of the hawk-dove-law-abider macro model (page 32–43)

To run this DYNAMO code you will need a copy of DYNAMO software, e.g. Professional DYNAMO

To use the code, either save the code in this section as text in a file with the extension .dyn, using your web browser or load it from here, and run DYNAMO on it.

 
L dove.k=dove.j+dt*ddove.jk
L hawk.k=hawk.j+dt*(-ddove.jk-dlawa.jk)
L lawa.k=lawa.j+dt*dlawa.jk
R ddove.kl=yieldd.k-dove.k*yields.k
R dlawa.kl=yieldl.k-lawa.k*yields.k
A yieldd.k=(dove.k*rdd+hawk.k*rdh+lawa.k*rdl)*dove.k
A yieldh.k=(dove.k*rhd+hawk.k*rhh+lawa.k*rhl)*hawk.k
A yieldl.k=(dove.k*rld+hawk.k*rlh+lawa.k*rll)*lawa.k
A yields.k=yieldd.k+yieldh.k+yieldl.k
N rhh=(poss-coha)/2
N rhd=poss
N rhl=(rhh+poss)/2
C rdh=0
N rdd=poss/2-codo
N rdl=rdd/2
N rlh=rhh/2
N rld=(rdd+poss)/2
N rll=poss/2
N dove=idove
N hawk=ihawk
N lawa=ilawa
C poss=10
C codo=3
C coha=20
C idove=0.05
C ihawk=0.9
C ilawa=0.05
N time=0
C length=140
C dt=0.05
 

Alternatively, use the STELLA file (which is only machine readable) and run STELLA on it.

An implementation of Forrester's WORLD2 model (page 45–53)

To run this DYNAMO code you will need a copy of DYNAMO software, e.g. Professional DYNAMO

To use the code, either save the code in this section as text in a file with the extension .dyn, using your web browser or load it from here, and run DYNAMO on it.

 
NOTE WORLD DYNAMICS
NOTE
L p.k=p.j+dt*(br.jk - dr.jk)
N p=pi
C pi=1.65e9
R br.kl=p.k*clip(brn,brn1,swt1,time.k)*brfm.k*brmm.k*brcm.k*brpm.k
C brn=0.04
C brn1=0.04
C swt1=1970
A brmm.k=tabhl(brmmt,msl.k,0,5,1)
T brmmt=1.2/1/0.85/0.75/0.7/0.7
A msl.k=ecir.k/ecirn
C ecirn=1
A ecir.k=cir.k*(1-ciaf.k)*nrem.k/(1-ciafn)
A nrem.k=table(nremt,nrfr.k,0,1,0.25)
T nremt=0/0.15/0.5/0.85/1
A nrfr.k=nr.k/nri
L nr.k=nr.j-dt*nrur.jk
N nr=nri
C nri=900e9
R nrur.kl=p.k*clip(nrun,nrun1,swt2,time.k)*nrmm.k
C nrun=1
C nrun1=1
C swt2=1970
R dr.kl=p.k*clip(drn,drn1,swt3,time.k)*drmm.k*drpm.k*drfm.k*drcm.k
C drn=0.028
C drn1=0.028
C swt3=1970
A drmm.k=tabhl(drmmt,msl.k,0,5,0.5)
T drmmt=3/1.8/1/0.8/0.7/0.06/0.53/0.5/0.5/0.5/0.5
A drpm.k=table(drpmt,polr.k,0,60,10)
T drpmt=0.92/1.3/2/3.2/4.8/6.8/9.2
A drfm.k=tabhl(drfmt,fr.k,0,2,0.25)
T drfmt=30/3/2/1.4/1/0.7/0.6/0.5/0.5
A drcm.k=table(drcmt,cr.k,0,5,1)
T drcmt=0.9/1/1.2/1.5/1.9/3
A cr.k=p.k/(la*pdn)
C la=135e6
C pdn=26.5
A brcm.k=table(brcmt,cr.k,0,5,1)
T brcmt=1.05/1/0.9/0.7/0.6/0.55
A brfm.k=tabhl(brfmt,fr.k,0,4,1)
T brfmt=0/1/1.6/1.9/2
A brpm.k=table(brpmt,polr.k,0,60,10)
T brpmt=1.02/0.9/0.7/0.4/0.25/0.15/0.1
A fr.k=fpci.k*fcm.k*fpm.k*clip(fc,fc1,swt7,time.k)/fn
C fc=1
C fc1=1
C fn=1
C swt7=1970
A fcm.k=table(fcmt,cr.k,0,5,1)
T fcmt=2.4/1/0.6/0.4/0.3/0.2
A fpci.k=tabhl(fpcit,cira.k,0,6,1)
T fpcit=0.5/1/1.4/1.7/1.9/2.05/2.2
A cira.k=cir.k*ciaf.k/ciafn
C ciafn=0.3
A cir.k=ci.k/p.k
L ci.k=ci.j+dt*(cig.jk - cid.jk)
N ci=cii
C cii=0.4e9
R cig.kl=p.k*cim.k*clip(cign,cign1,swt4,time.k)
C cign=0.05
C cign1=0.05
C swt4=1970
A cim.k=tabhl(cimt,msl.k,0,5,1)
T cimt=0.1/1/1.8/2.4/2.8/3
R cid.kl=ci.k*clip(cidn,cidn1,swt5,time.k)
C cidn=0.025
C cidn1=0.025
C swt5=1970
A fpm.k=table(fpmt,polr.k,0,60,10)
T fpmt=1.02/0.9/0.65/0.35/0.2/0.1/0.05
A polr.k=pol.k/pols
C pols=3.6e9
L pol.k=pol.j+dt*(polg.jk-pola.jk)
N pol=poli
C poli=0.2e9
R polg.kl=p.k*clip(poln,poln1,swt6,time.k)*polcm.k
C poln=1
C poln1=1
C swt6=1970
A polcm.k=tabhl(polcmt,cir.k,0,5,1)
T polcmt=0.05/1/3/5.4/7.4/8
R pola.kl=pol.k/polat.k
A polat.k=table(polatt,polr.k,0,60,10)
T polatt=0.6/2.5/5/8/11.5/15.5/20
L ciaf.k=ciaf.j+dt/ciaft*(cfifr.j*ciqr.j-ciaf.j)
N ciaf=ciafi
C ciafi=0.2
C ciaft=15
A cfifr.k=tabhl(cfifrt,fr.k,0,2,0.5)
T cfifrt=1/0.6/0.3/0.15/0.1
A ql.k=qls*qlm.k*qlc.k*qlf.k*qlp.k
C qls=1
A qlm.k=tabhl(qlmt,msl.k,0,5,1)
T qlmt=0.2/1/1.7/2.3/2.7/2.9
A qlc.k=table(qlct,cr.k,0,5,0.5)
T qlct=2/1.3/1/0.75/0.55/0.45/0.38/0.3/0.25/0.22/0.2
A qlf.k=tabhl(qlft,fr.k,0,4,1)
T qlft=0/1/1.8/2.4/2.7
A qlp.k=table(qlpt,polr.k,0,60,10)
T qlpt=1.04/0.85/0.6/0.3/0.15/0.05/0.02
A nrmm.k=tabhl(nrmmt,msl.k,0,10,1)
T nrmmt=0/1/1.8/2.4/2.9/3.3/3.6/3.8/3.9/3.95/4
A ciqr.k=tabhl(ciqrt,qlm.k/qlf.k,0,2,0.5)
T ciqrt=0.7/0.8/1/1.5/2
C dt=0.1
C length=2100
N time=1900
 
Alternatively, use the STELLA file (which is only machine readable) and run STELLA on it.

This code is © Nigel Gilbert and Klaus G. Troitzsch 2005

It may be freely reproduced and incorporated into other software provided that reasonable acknowledgement of its source is given.


 

Send email to the authors Program code Sample chapter