-
Notifications
You must be signed in to change notification settings - Fork 0
/
SIR_Stroud.st
42 lines (37 loc) · 1.15 KB
/
SIR_Stroud.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
sirConcern := KEModelPart new.
sirConcern attributes:
{#status->#(#S #I #R)}.
sirConcern addParameters: {#lambda. #gamma}.
sirConcern
addTransitionFrom: {(#status -> #S)}
to: {(#status -> #I)}
probability: 'lambda'.
sirConcern changeParameter: #lambda
value: 'it_gen*tau_gen*alpha_gen'.
sirConcern
addTransitionFrom: {(#status -> #I)}
to: {(#status -> #R)}
probability: 'gamma'.
stroudConcern := KEModelPart new.
stroudConcern addParameter: #it_gen
value: '(I*(S/N)^nu)/S'.
model := sirConcern + stroudConcern.
model atCompartment: {(#status -> #S)} put: 9999.
model atCompartment: {(#status -> #I)} put: 1.
model atParameter: #tau_gen assignValue: 0.025.
model atParameter: #nu assignValue: 1.7.
model atParameter: #gamma assignValue: 0.1.
model atParameter: #alpha_gen assignValue: 10.
simulator := KESimulator
new: #RungeKutta
from: 0.0
to: 200
step: 0.1.
simulator executeOn: model.
chart := KEChart new.
chart addDataFrame:
(simulator timeSeriesOutputsAt:
{(#status -> #I)})/10000.
chart yLabel: 'New infections per day'.
chart legendTitle: 'Stroud Scale Free Network'.
chart plot