2
Syste m D ynam ics w ith M CSim A Facil itate d Sy s te m s Q uick R e fe re nce Model L isting: Sim ulation Fil e: An Exam pl e : th e SIR M ode l Th is sim pl e m odel of a dise ase e pide m ic h as th re e state variabl e s , S, I, and R , re pre s e nting th e num ber of susceptibl e , infe ctious , and re covere d (and th us im m une) pe opl e in th e popul ation. Sim ulation Fil e Com m ands <rtol >: rel . e rror tol e rance ate ach ste p <atol >: abs. error tol e rance ate ach ste p <m eth od>: 0 for non-stiff , 1 for s tiff system s Model Exe cution Cygw in: O th er Environm ents: Facil itate d Sy ste m s m ak ing sense of tough probl em s togeth er + 1 425 374-1845 © 2006 Facil itate d Syste m s Model O utput Gnuplot Th is w ork is l icensed under th e Creative Com m ons A ttribution- NonCom m e rcial - Sh are A l ik e 2.5 L ice ns e . To view a copy of th is l ice ns e , vis it or send a l e tte r to Cre ative Com m ons, 543 H ow ard Stre e t, 5th Fl oor, San Francis co, Cal ifornia, 9 4105, USA. Sus ce ptibl e pe opl e becom e ill and th us infe ctious by contacting an infe ctious pe rson. Th e num be r ge tting ill pe r day is th e productof th e total num ber of susceptibl e pe opl e, the num ber of contacts th ey h ave per day w ith infe ctious pe opl e, and th e probabil ity th ata contactre sults in dise ase . Th e probabil ity of a contactbeing w ith an infectious person is th e ratio of th e num be r of infe ctious pe opl e to the total popul ation. Th ere is no incubation period. Th e dise ase h as a fi xe d ave rage duration. Th e num be r of pe opl e recovering per day is th e num ber of infectious peopl e divided by th e ave rage duration. A stock and fl ow diagram can be use d to h e l p design a system dynam ics m odel and to com m unicate its structure to oth e rs. In th e diagram , re ctangl e s re pre s e nts tate variabl es (stock s), pipes w ith styl iz e d valve s re pre se nt ow s be tw e e n state variabl e s , and dotte d l ines re pre se ntinform ation fl ow s. Cl ouds atth e start or end of fl ow s indicate system boundaries.

System Dynamics with MCSim: A Facilitated Systems Quick ... · A Facilitated System s Quick Reference Model Listing: Sim ulation File: An Exam ple: th e SIR Model Th is sim ple m

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: System Dynamics with MCSim: A Facilitated Systems Quick ... · A Facilitated System s Quick Reference Model Listing: Sim ulation File: An Exam ple: th e SIR Model Th is sim ple m

Syste m Dynam ics w ith M CSim

A Facilitate d Syste m s Q uick Re fe re nce

M ode l Listing: Sim ulation File :

An Exam ple : th e SIR M ode l

Th is sim ple m ode l of a dise ase e pide m ic h as

th re e state variable s, S, I, and R, re pre se nting

th e num be r of susce ptible , infe ctious, and

re cove re d (and th us im m une ) pe ople in th e

population.

Sim ulation File Com m ands

<rtol>: re l. e rror tole rance at e ach ste p

<atol>: abs. e rror tole rance at e ach ste p

<m e th od>: 0 for non- sti ff , 1 for sti ff sy ste m s

M ode l Exe cution

Cygw in:

O th e r Environm e nts:

Facilitate d Syste m s

m ak ing se nse of tough proble m s toge th e r

+ 1 425 374-1845

© 2006 Facilitate d Syste m s

M ode l O utput

Gnuplot

Th is w ork is lice nse d unde r th e Cre ative Com m ons

Attribution- NonCom m e rcial- Sh are Alik e 2.5 Lice nse . To

vie w a copy of th is lice nse , visit

or se nd a le tte r to Cre ative Com m ons, 543 H ow ard Stre e t,

5th Floor, San Francisco, California, 9 4105, USA.

Susce ptible pe ople be com e ill and th us

infe ctious by contacting an infe ctious pe rson.

Th e num be r ge tting ill pe r day is th e product of

th e total num be r of susce ptible pe ople , th e

num be r of contacts th e y h ave pe r day w ith

infe ctious pe ople , and th e probability th at a

contact re sults in dise ase . Th e probability of a

contact be ing w ith an infe ctious pe rson is th e

ratio of th e num be r of infe ctious pe ople to th e

total population. Th e re is no incubation pe riod.

Th e dise ase h as a fi xe d ave rage duration. Th e

num be r of pe ople re cove ring pe r day is th e

num be r of infe ctious pe ople divide d by th e

ave rage duration.

A stock and fl ow diagram can be use d to h e lp

de sign a sy ste m dynam ics m ode l and to

com m unicate its structure to oth e rs. In th e

diagram , re ctangle s re pre se nt state variable s

(stock s), pipe s w ith styliz e d valve s re pre se nt

fl ow s be tw e e n state variable s, and dotte d line s

re pre se nt inform ation fl ow s. Clouds at th e start

or e nd of fl ow s indicate sy ste m boundarie s.

Page 2: System Dynamics with MCSim: A Facilitated Systems Quick ... · A Facilitated System s Quick Reference Model Listing: Sim ulation File: An Exam ple: th e SIR Model Th is sim ple m

Re fe re nce s

Bois, Frédéric Y. and D on R. M asz le . 2004.

M CSim : A M onte Carlo Sim ulation Program .

Use r's M anual, softw are ve rsion 5.0.0.

Ste rm an, Joh n D. 2000. Busine ss D ynam ics:

Syste m s Th ink ing and M ode ling for a Com ple x

W orld. Boston: M cGraw - H ill.

M ak ing Se nse W ith Facilitate d Syste m s

Softw are

Program s:

M CSim (5.1.be ta or late r)

bash , gcc, m ak e , GNU Scie nti fi c Library

m an, te xinfo

Gnuplot

J

Em acs or Vim

RCS, CVS, or Subve rsion

D ia; O pe nO ffice .org, LaTe X, or D ocBook

W indow s Source s:

M ac O S X Source s:

Linux Source s:

Com m on Source s:

Inline Variable Nam e s

To use th e output variable foo in an inline

se ction, call it rgM ode lVars[ID_foo]. For an

input, use vrgInputs[ID_foo]. For th e

calculate d de rivative of a state variable , use

rgDe rivs[ID_foo]. For a dynam ic variable or a

global param e te r, use foo.

J

Th e follow ing script w ill load an M CSim output

fi le containing m ultiple e xpe rim e nts if e ach

e xpe rim e nt h as th e sam e outputs. Note th at J

com m ands can only be one line long, so you

m ust type w h at are sh ow n as inde nte d

continuation line s all on one line .

Run th e script, and th e n use th e follow ing

com m ands to analyz e th e data:

Nonline aritie s

Copy th e italiciz e d Inline code , substituting

your ow n e xpre ssions for th e bold te xt.