When the data is with this structure then it is used by the Model Generator as Fig. 3.8 shows. Model Generator analyses all this information and creates the corresponding objects of the Ramen classes Camera, Floorplan, Agents, Scene and Items. Scene is the main one that uses the other to represent all the data and creates the visualization where there are two types of controls: camera controls to see the scene by differents angles and the simulation controls to stop and start the simulation.
Figure 3.8: Ramen Architecture
3.4 Operating Mode
As it was mentioned in Sect. 3.1.1 when all the modules are introduced it is time to explain detailedly how the project works and the connections between the files.
Before starting it is important to remind the project architecture shown in Fig. 3.2.
For this explication we are going to simulate with ’visual.py’ file which helps us to see step by step the simulation. This file calls the model (’model.py’) and it is the model object is in charge of creating the Scene object.
First of all model initializes the configuration files and some control variables. After that the model creates the rooms, sets the agents and calls the methods of ’BuildingGrid.py’
to create the map. Before this, it sets the agents because when agents are initialized they are placed into the map. As we have mentioned previously ’BuildingGrid.py’ uses
CHAPTER 3. ARCHITECTURE
’defineMap.py’ to create walls and doors. Also the model calls ’defineMap.py’ to create the rooms and ’defineOccupancy.py’ to create the agents.
When everything is created the model starts running and by each step of the model there is one step by each agent. In each step of the model we check if it is the fire time, when it is this time the model creates the fire agent and place it into the map. If we have passed this time each 30 seconds the fire advances to the neighbor cells and in this way the fire gradually spreads. Here in this model step we also check if the fire time was one minute ago and the model changes the agents’ state to the emergency ones. This minute is the reaction time since the alarms sounds and the evacuation starts.
For each model step there is one step by each agent then we are going to explain how
’occupant.py’ works. First of all when an agent is created there is initialization where it is defined the states, the position by state and several control variables. Each time when the state changes it is called the method ’start activity’ which is in charge of deciding where the agents have to go depending on the state. Each state has one position, and calculates the path using ’aStar.py’. It is in this method where in case of emergency agents choose one of the differents policies.
In each agent step we check if it is time to change the state, this file uses ’behaviour.py’
to this objective. If it is not time to change the state, agent has several options depending of the situation:
• Normal situation: if agent has not reached the goal then tries to move to the next cell if this cell is empty. In case of agent has reached the goal, the time in this state starts to decrease and if this time by state is over the state machine is called to change the state.
• Fire situation: in this case first of all we check if the agent has been reached by the fire and tries to move like in the normal situation
It is important to mention that each step represents one second. This time by step is defined in ’settings.py’, which is imported by ’aStar.py’.
The simulation finishes when all the agents are out of the building and we have stored all the data by each model step to know how it is the simulation in each moment.
32
CHAPTER 4
Case study
In this chapter it will be suggested five research questions and with all data obtained they will be answered.
Many simulations have been made to try to get a reply. These simulations will be differents features depending on the research questions.
4.1 RQ1: Does emergency time affect the evacuation?
To answer this question we have simulated in three differents hours with these features:
• Fire position: Office 6, (54,16), this parameter did not change between simulations.
• Fire hour: 10:20, 12:00, 15:00
We have obtained the following information:
• 10:20: 22 agents in the building and 1 burned
• 12:00: 41 agents in the building and 2 burned
CHAPTER 4. CASE STUDY
• 15:00: 10 agents in the building and 0 burned
Figure 4.1: Graphic of data obtained
We can see the differents results in the charts, being ’x’ axis each agent and ’y’ axis their exit time. The number of dead agents depends on the time the fire occurs. Considering this data we can answer with total certain that the emergency hour is very important.
Depending of the hour there will be more or less agents in the building. Being the worst hour at midday and the best hour at lunch time in these cases of study.
34