Skip to content

Commit 4a9bbb1

Browse files
committed
Simple SIR model example. Implemented in basic CD++. No ports. No state variables
1 parent 281c89a commit 4a9bbb1

File tree

5 files changed

+109
-0
lines changed

5 files changed

+109
-0
lines changed

tr_0.4_dr_0.05_cd++/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#Disease Spread Model
2+
3+
New rule added for the Incubation period where people are Asymptomatic.
4+
People cannot die during Asymptomatic incubation (they have no even symptoms...)
5+
6+
##Parameters:
7+
Von Neumann Neighborhood
8+
Transport Delays
9+
Death Rate:0.05
10+
Transmission Rate:0.4
11+
12+
##How to run the model:
13+
14+
In the linux terminal, type:
15+
16+
> ./../cd++ -mcovid.ma -lresults/covid.log

tr_0.4_dr_0.05_cd++/VN.inc

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#BeginMacro(susceptible)
2+
0
3+
#EndMacro
4+
5+
#BeginMacro(infected)
6+
1
7+
#EndMacro % asymptomatic
8+
9+
#BeginMacro(sick)
10+
8
11+
#EndMacro % separate asymptomatic
12+
13+
#BeginMacro(recovered)
14+
16
15+
#EndMacro
16+
17+
#BeginMacro(dead)
18+
-1
19+
#EndMacro
20+
21+
#BeginMacro(imAsymp)
22+
( ((0,0)>=1) and ((0,0) < 8))
23+
#EndMacro
24+
25+
#BeginMacro(imInfected)
26+
((0,0)>=1 and (0,0)<16)
27+
#EndMacro
28+
29+
#BeginMacro(imRecovered)
30+
((0,0)=16 ) %(((0,0) > 8) and not ((0,0)>0 and (0,0)<16))
31+
#EndMacro
32+
33+
#BeginMacro(anyNeighborIsInfected)
34+
( ( (-1,0)>0 and (-1,0)<16 ) or ( (0,-1)>0 and (0,-1)<16) or
35+
( (0,0)>0 and (0,0)<16 ) or ( (0,1)> 0 and (0,1)<16 ) or
36+
( (1,0)>0 and (1,0)<16 )
37+
)
38+
#EndMacro
39+
40+
#BeginMacro(gotInfected)
41+
(uniform(0,1) <= 0.4)
42+
#EndMacro
43+
44+
%#BeginMacro(asymp)
45+
% (uniform(0,1) <= 0.5)
46+
%#EndMacro
47+
48+
#BeginMacro(died)
49+
(uniform(0,1) <= 0.05)
50+
#EndMacro

tr_0.4_dr_0.05_cd++/covid.ma

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include(VN.inc)
2+
[top]
3+
components : population
4+
5+
[population]
6+
type : cell
7+
dim : (200,200)
8+
delay : transport
9+
defaultDelayTime : 1
10+
border : nowrapped
11+
neighbors : population(0,-1) population(0,0) population(0,1)
12+
neighbors : population(-1,0)
13+
neighbors : population(1,0)
14+
15+
initialvalue : 0
16+
InitialCellsValue : covid.val
17+
18+
localtransition : infections
19+
20+
[infections]
21+
rule : {if( #macro(gotInfected), #macro(infected), (0,0))} 1
22+
{ (0,0)=0 and #macro(anyNeighborIsInfected)}
23+
24+
rule : { #macro(sick) } 7 { #macro(imAsymp) }
25+
26+
rule : {if( #macro(died), #macro(dead), (0,0)+1)} 1
27+
{#macro(imInfected)}
28+
29+
rule : {(0,0)} 1000 { t }
30+
31+
% neighbors : population(-1,-1) population(-1,0) population(-1,1)
32+
% neighbors : population(1,-1) population(1,0) population(1,1)

tr_0.4_dr_0.05_cd++/covid.pal

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[-1.5;-0.5] 0 0 0
2+
[-0.5;0.5] 255 255 255
3+
[0.5;7.5] 255 255 0
4+
[7.5;15.5] 255 0 0
5+
[15.5;16.5] 0 255 0
6+
[16.5;100] 128 128 128

tr_0.4_dr_0.05_cd++/covid.val

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
(19,10) = 1
2+
(159,100) = 1
3+
(180,190) = 1
4+
5+

0 commit comments

Comments
 (0)