-
Notifications
You must be signed in to change notification settings - Fork 0
3. Key Changes (2018.04.12)
Note: This writing applies to both test_matrix_Gangnam.nlogo and Gangnam_Air pollution exposure_v6.nlogo
In the previous version of this model, there was a slight confusion in terms of defining names and values (especially to me). A resident's destinationName
and destinationPatch
was assigned as homePatch
and 0
respectively. It was okay, but made quite difficult to validate the agent's destination after the OD matrix was calculated. During validation, the 'destinationPatch' was zero all the time which made me convert to something in a string format. So, I converted the values assigned in both destinationName
and destinationPatch
to "unidentified"
. I believe this seems a little better to understand.
In the last part of set-gis
, I added some codes that looks quite tedious but somehow worked:
;-- Set Location Name
let rawCode csv:from-file "data/census2010_age.csv"
let adCode table:make
foreach rawCode [ code ->
if item 1 code = "gangnam"
[table:put adCode item 0 code list (item 1 code)(item 2 code) ]
]
foreach table:keys adCode [ adminCODE ->
let loops 0
foreach table:get adCode adminCODE [ x ->
ask patches [if dong = adminCODE [set locationName x]]
]
set loops loops + 1
]
end
Note: "data/census2010_age.csv" file is captured and screened at Footnote 1.
If you open the netlogo file, you would notice a new button called 2.ODmatrix
. I came up with idea because a sole setup button looked to slow and boring to wait. And I suppose it looks better?
According to the matrix, some agents failed to obtain their destinationName
and destinationPatch
.
ap: 15 out of 247
chungdam: 10 out of 266
daechi1: 9 out of 237
daechi2: 11 out of 400
daechi4: 11 out of 206
dogok1: 14 out of 193
dogok2: 10 out of 293
gaepo1: 12 out of 210
gaepo2: 13 out of 332
gaepo4: 12 out of 217
ilwon1: 12 out of 171
ilwon2: 11 out of 178
ilwon: 10 out of 210
nonhyun1: 12 out of 239
nonhyun2: 11 out of 213
samsung1: 12 out of 139
samsung2: 10 out of 285
segok: 6 out of 39
sinsa: 10 out of 179
suseo: 12 out of 162
yeoksam1: 13 out of 325
yeoksam2: 10 out of 309
others: 0 out of 0
* Total pop: 5050
* Lost destination pop: 246
* Current population: 4804
Because I couldn't think of a better idea for the meanwhile, I had to remove them temporarily.
Assuming that a tick
is a day, I gave a tick-advance 0.5
to make them move out (to work, shop, hang out, etc.), and come back home. But there was a problem. The PM10 was changing every 0.5 tick, which was initially expected to change every day. So, I changed it.
I added ticks != round ticks
to every seasonal functions to enable pm10 changes every day.
to calc-pm10
ask patches with [gangnam = true]
[if (ticks mod 360 < 90 and ticks != round ticks)[set gangnam_sp (random-float (spr_angle / 90) + gangnam_sp)]
if (ticks mod 360 >= 90 and ticks mod 360 < 180 and ticks != round ticks)[set gangnam_su (random-float (sum_angle / 90) + gangnam_su)]
if (ticks mod 360 >= 180 and ticks mod 360 < 270 and ticks != round ticks)[set gangnam_au (random-float (aut_angle / 90) + gangnam_au)]
if (ticks mod 360 >= 270 and ticks mod 360 < 360 and ticks != round ticks)[set gangnam_wi (random-float (win_angle / 90) + gangnam_wi)]
]
inhalation
end
In Netlogo, I noticed that there was a brilliant function called Behavior Space. This tutorial link (http://stemccm.com/stemccm-home/netlogo-coding/netlogo-behavior-space/) helped me to use a macro in Netlogo using a pull power of my CPU. This function has more cleaner outcomes than the iteration button of my current model.
Note: Behavior Space interface is captured and screened at Footnote 2.
Fig.1: CSV Capture file: 2010 Korea Census aggregated by age groups and districts
Fig.2: Interface of Behavioral Space