-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEvacAttackModel.py
More file actions
34 lines (29 loc) · 1.4 KB
/
EvacAttackModel.py
File metadata and controls
34 lines (29 loc) · 1.4 KB
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
from BimEvac import Moving
from BimIntruder import Intruder
class EvacAttackModel:
def __init__(self, json_bim):
self.bim = json_bim
self.moving = Moving(json_bim)
self.moving.active = True
self.intruder = None
def set_intruder(self, door, precalculate_path, intruder_type, intruder_speed):
self.intruder = Intruder(self.bim, door, precalculate_path, intruder_type, intruder_speed)
i_room = self.intruder.bim_curr_path[-1]["Id"]
self.intruder.victims = self.moving.zones[i_room]["NumPeople"]
self.moving.zones[i_room]["NumPeople"] = 0
self.moving.zones[i_room]["Density"] = 0
self.moving.zones[i_room]["IsBlocked"] = True
def step(self):
if self.moving.active:
self.moving.step()
else:
self.moving.time += self.moving.MODELLING_STEP
if self.intruder and self.intruder.path_len()/self.intruder.speed < self.moving.time:
i_room = self.intruder.bim_curr_path[-1]["Id"]
self.moving.zones[i_room]["IsBlocked"] = False
self.intruder.step_next()
i_room = self.intruder.bim_curr_path[-1]["Id"]
self.moving.zones[i_room]["IsBlocked"] = True
self.intruder.victims += self.moving.zones[i_room]["NumPeople"]
self.moving.zones[i_room]["NumPeople"] = 0
self.moving.zones[i_room]["Density"] = 0