Project Iteration 5 builds on Iteration 4 by implementing code to log and generate analytics on key simulation events.
Config.javaadded for increased customization and simulation stabilitySystemLauncher.javaadded for the convenient starting of simulationEventLogger.javaadded to record simulation events- 3 different analytics are generated based on logged data: average drone response time and total simulation time
- individual drone metrics (total flight time, total idle time, drone id) are recorded and displayed
| File | Description |
|---|---|
Scheduler.java |
Monitor/server that queues fire events, applies a priority algorithm, delegates tasks to drones, and relays extinguishment confirmations back to FireIncidentSubSystem. |
FireIncidentSubSystem.java |
Reads fire events from the event CSV, maintains the active-fires list, and confirms extinguishment or partial updates received from the Scheduler. |
DroneSubsystem.java |
Models a single drone: dispatches to a zone, drops 15 L of agent, returns to base, and refills. Reports task results and fault messages back to the Scheduler. |
FireEvent.java |
Data class describing one fire event (time, zone ID, event type, severity, water remaining). |
ZoneMap.java |
Aggregates all Zone objects loaded from the zone CSV. |
Zone.java |
Rectangular fire zone with coordinates, centre calculation, and zone ID. |
ZoneFileReader.java |
Parses the zone CSV into Zone objects. |
FireEventFileReader.java |
Parses the event CSV into FireEvent objects. |
TimeSimulation.java |
Replays fire events in real-time (scaled by a clock factor) by calling FireIncidentSubSystem.processEvent. |
FireFightingGUI.java |
Swing GUI displaying the zone map, active fires, drone positions, and a status bar. Receives UDP updates. |
FireInfo.java |
Storage for certain FireEvent data required by the GUI. |
DroneInfo.java |
Storage for certain Drone data required by the GUI. |
Config.java |
Storage for certain simulation data. Allows simulation to run in case of missing or misconfigured input file. |
EventLogger.java |
Generates log file of metadata for important simulation events. |
SystemLauncher.java |
Starts simulation; runs key files in the correct order. |
DroneStatus.java |
Enum for drone states: IDLE, EN_ROUTE, DROPPING_AGENT, RETURNING. Each state has an associated display colour. |
EventType.java |
Enum for fire event types: FireDetected, DroneRequested. |
Severity.java |
Enum for fire severity (LOW = 10 L, MODERATE = 20 L, HIGH = 30 L). |
FaultType.java |
Enum for fault types: NONE, FLIGHT_TIMEOUT, NOZZLE_STUCK_CLOSED, MESSAGE_CORRUPTED. |
FireStatus.java |
Enum for fire status: Active, BeingServiced, Extinguished. |
EventCode.java |
Enum for simulation occurrences: DRONE_STATE_CHANGE, FIRE_ENTER_QUEUE, FIRE_EXIT_QUEUE, FIRE_REQUEUD, FIRE_RESERVED, and more. |
SchedulerState.java |
Enum for scheduler states: WAITING, ASSIGNING, MONITORING, HANDLING_FAULT. |
DroneSubsystemTest.java |
JUnit 5 tests for DroneSubsystem. |
SchedulerTest.java |
JUnit 5 tests for Scheduler. |
FireIncidentSubSystemTest.java |
JUnit 5 tests for FireIncidentSubSystem. |
Time = hh:mm:ss, zoneID = int, Event type = FIRE_DETECTED|DRONE_REQUEST, Severity = High|Moderate|Low, Fault type = NONE|FLIGHT_TIMEOUT|MESSAGE_CORRUPTED|NOZZLE_STUCK_CLOSED
14:03:15,3,FIRE_DETECTED,High,NONE
14:10:00,7,DRONE_REQUEST,Moderate,FLIGHT_TIMEOUT
zoneID,(x1,y1),(x2,y2)
1,(0,0),(700,600)
2,(0,600),(650,1500)
- Download and unzip
L4G8_Iteration_5.zipinto an IntelliJ IDEA project folder. - Ensure the following are in the
src/folder:- All
.javasource files listed above. sample_zone_file.csvandSample_event_file.csv(place in the project root, notsrc/).
- All
- Add JUnit 5 as a dependency (via Maven or by adding the JUnit Jupiter JARs to the module classpath).
- Run the file
SystemLauncher.javato start the simulation. - (Optional) Alternatively, the program may be manually started by running the following files in the correct order:
Scheduler.java->FireFightingGUI.java->DroneSubsystem.java->FireIncidentSubSystem.java
Each test class can be run individually inside IntelliJ IDEA:
- Right-click
DroneSubsystemTest.java→ Run 'DroneSubsystemTest' - Right-click
SchedulerTest.java→ Run 'SchedulerTest' - Right-click
FireIncidentSubSystemTest.java→ Run 'FireIncidentSubSystemTest'
Note:
DroneSubsystemTest.tankIsFullAfterHandleTaskanddroneStatusIsIdleAfterHandleTaskinvolve realThread.sleepcalls (drone travel + agent drop times). These tests take approximately 20–30 seconds each to complete. This is expected behaviour.
EventLogger.java records numerous key statistics as the simulator progresses that aim to analyze the overall performance of each drone and their scheduling algorithm. Utilizing these figures, the following analytics are generated:
- Average Drone Response Time: Calculates the average time it takes for any drone to reach their designated FireEvents once a fireEvent has been detected. This figure is calculated by collecting the time of initialization for FireEvents and subtracting the time of arrival of each applicable drone, then taking the average of all calculated figures.
- Total Simulation Time: The total time required for the simulation to conclude. Therefore, this figure determines the overall efficiency of the scheduler by tracking the total time to extinguish all fires. This figure is calculated by subtracting the time in which the final FireEvent is extinguished from the time in which the first FireEvent is detected.
Additionally, the following data for each individual drone is logged by the simulation:
- Total Flight Time: The total time a given drone has spent away from the Base. Determined by calculating the time between IDLE DroneStatus events.
- Total Idle Time: The total time a given drone has spent in the Base. Determined by calculating the time between IDLE DroneStatus events.
The scheduler orders the fire queue using the following rules
(see Scheduler.determineFirePriority()):
- Full-tank trips first – events whose
amountOfWaterNeededis a multiple of 15 (i.e. exactly 15 L or 30 L remaining) are placed at the front of the queue. This maximises agent delivery efficiency by ensuring drones always fly with a full load. - Furthest zone wins – within the same priority tier, the zone furthest from the base is chosen first to avoid sending a heavily-loaded drone on a short trip while a distant fire waits.
- Route optimisation (pairing) – if two fires each need less than a full tank, the algorithm pairs them so a drone can top up both in a single round trip when the detour is shorter than returning to base.
Practical severity ordering under this algorithm:
- HIGH (30 L) – dispatched first (30 % 15 == 0).
- LOW (10 L) / MODERATE (20 L) – dispatched afterwards (neither is divisible by 15).