This project simulates a fire incident management system where a FireIncidentSubsystem detects fire events, a Scheduler prioritizes and schedules them, and a DroneSubsystem finds an available drone to handle the event. The communication between the three subsystems is done using a RPC communication through datagram sockets and packets. An additional subsystem is added for the GUI which provides real-time visualization and metrics for the system. Performance metrics such as average drone response time, fire extinguishment response time, and throughput are displayed and updated periodically.
- FireIncidentSubsystem.java - Reads fire incident data and sends it to the Scheduler.
- Scheduler.java - Prioritizes events and schedules them for the DroneSubsystem.
- DroneSubsystem.java - Simulates a drone handling fire events.
- InputEvent.java - Represents a fire incident event with details like time, zone, severity, and status.
- Coordinate.java - Represents a 2D coordinate (x, y) used for zone and event locations.
- Zone.java - Represents a geographical zone with start, end, and center coordinates.
- RelayPackage.java - Represents a package used for communication between subsystems.
- DroneStateMachine.java - An interface that handles the drone state transitions for a drone when it has been scheduled to take action by the drone subsystem.
- Status.java - An enum representing the status of an event (COMPLETE or UNRESOLVED).
- EventType.java - A enum to represents different types of events.
- Severity.java - Represents different levels of severity with associated amount of water/foam needed for each event severity
- Systems.java - A enum Represents different subsystems within the program.
- Drone.java - Represents the drone having its states and a unique identifier .
- SchedulerState.java - A enum to represent the different types of states for the scheduler.
- DroneState.java - A enum to represent the different types of states for the drone.
- DroneSubsystemState.java - A enum to represent the different types of states for the drone subsystem.
- FireIncidentSubsystemStatus.java - A enum to represent the current state of the fire incident subsystem as it sends a relay package to the scheduler and receives the confirmation.
- DroneStatus - An enum to represent the current state of the Drone.
- GUISubsystem - Updates the GUI with current system state and metrics in real time
- DroneMapView - Visual display of the system
- DroneModel - Polls drone locations and states to provide updates for the GUI
- DroneMapController - Listens for drone status, events, and metrics updates via UDP and relays them to DroneMapView
- MetricAnalysisLogger - Integrates metric collection and calculation
-
Prerequisites:
- Ensure you have Java Development Kit (JDK) installed on your system.
-
File Structure:
- Ensure the input files are placed in a
\datafolder within the project directory.
- Ensure the input files are placed in a
-
Run the Program:
- Once Program is complied, run the program by running the three subsystem. First run the drone subsystem main thread, then the scheduler main thread, the GUI subsystem, and finally the fire incident subsystem main thread.
-
FireIncidentSubsystem:
- Reads fire incident data from
Sample_event_file.csvand zone data fromsample_zone_file.csv. - Sends zone information and fire events to the Scheduler via the RelayBuffer.
- Checks RelayBuffer to see if it has gotten any acknowledgement for the packages it sent.
- Reads fire incident data from
-
Scheduler:
- Receives events from the FireIncidentSubsystem and prioritizes them based on severity.
- Sends the highest-priority events to the DroneSubsystem via the EventBuffer.
- Receives confirmation from the DroneSubsystem and sends it back to the FireIncidentSubsystem.
-
DroneSubsystem:
- Receives events from the Scheduler and simulates handling them.
- Finds an available drone to be sent to the zone that was requested.
- Sends confirmation back to the Scheduler.
-
Drone
- Sent out by the drone subsystem to go a fire zone or a drone requested zone.
- Transitions through its states such to travel, take out a fire, and return to the station.
- Alerts the drone subsystem when it has arrived to a zone which tells the scheduler.
-
DroneMapView
- Extends a Swing JPanel and renders:
- A grid representing the map.
- Geographical zones with labels.
- The current position and state of each drone.
- Fire events as icons on the map.
- New logic splits a grid cell into multiple subsections for events if more than one fire occurs in a single zone. This prevents events from overlapping and ensures visibility.
- Reacts to updated metrics from the subsystems.
- Extends a Swing JPanel and renders:
-
DroneMapController
- Listens for UDP messages (status updates, metrics, fire events) from the DroneSubsystem.
- Updates the DroneMapView in real time, ensuring that the GUI reflects the current system state.
-
MetricsAnalysisLogger
- Collects and calculates metrics such as:
- Drone Average Response Time: The average time drones take to respond after receiving an event.
- Fire Extinguished Response Time: The time taken from when a fire is detected until it is extinguished.
- Throughput: The number of fires handled per minute.
- Drone Utilization: Visual metrics showing the percentage of time drones are busy versus idle.
- Metrics are automatically updated to the GUI and sent by the DroneSubsystem via the DroneMapController.
- Collects and calculates metrics such as:
-
Sample_event_file.csv:
- Contains fire incident events with columns:
time,zone_id,event_type,severity.
- Contains fire incident events with columns:
-
sample_zone_file.csv:
- Contains zone information with columns:
zone_id,zone_start,zone_end.
- Contains zone information with columns:
The program outputs messages to the console, showing the flow of events and confirmations between subsystems.
Example output:
FireIncident
- [FIS] subsystem started...
- [FIS] SENDING --> ZONE_PKG_1 TO: Scheduler
- [FIS] SENDING --> INPUT_EVENT_0 TO: Scheduler
- [FIS] Received confirmation for DRONE_CONFIRMATION
- [FIS] SENDING --> INPUT_EVENT_1 TO: Scheduler
- [FIS] Received confirmation for DRONE_CONFIRMATION
Scheduler
- [Scdlr] subsystem started...
- [Scdlr] Added zones: {1=Zone ID: 1 Zone Start: (0.0, 0.0) Zone End: (700.0, 600.0) Zone Center: (350.0, 300.0), 2=Zone ID: 2 Zone Start: (0.0, 600.0) Zone End: (650.0, 1500.0) Zone Center: (325.0, 1050.0)}
- [Scdlr] RECEIVED AN EVENT <-- INPUT_EVENT_0 FROM: FireIncidentSubsystem
- [Scdlr] SENDING THE EVENT --> Time: 14:00:15 Zone: 1 Event Type: FIRE_DETECTED Severity: High TO: DroneSubsystem
- [Scdlr] RECEIVED EVENT <-- Time: 14:00:15 Zone: 1 Event Type: FIRE_DETECTED Severity: High FROM: DroneSubsystem
- [Scdlr] SENDING CONFIRMATION FOR --> Time: 14:00:15 Zone: 1 Event Type: FIRE_DETECTED Severity: High TO: FireIncidentSubsystem
- [Scdlr] RECEIVED AN EVENT <-- INPUT_EVENT_1 FROM: FireIncidentSubsystem
- [Scdlr] SENDING THE EVENT --> Time: 14:10:01 Zone: 2 Event Type: DRONE_REQUEST Severity: Moderate TO: DroneSubsystem
- [Scdlr] RECEIVED EVENT <-- Time: 14:10:01 Zone: 2 Event Type: DRONE_REQUEST Severity: Moderate FROM: DroneSubsystem
- [Scdlr] SENDING CONFIRMATION FOR --> Time: 14:10:01 Zone: 2 Event Type: DRONE_REQUEST Severity: Moderate TO: FireIncidentSubsystem
Drone
- Drone2: WAITING FOR EVENT
- Drone5: WAITING FOR EVENT
- Drone4: WAITING FOR EVENT
- Drone1: WAITING FOR EVENT
- Drone3: WAITING FOR EVENT
- [DS] subsystem started with 5 drones
- [DS] received event: Time: 14:00:15 Zone: 1 Event Type: FIRE_DETECTED Severity: High
- [DS] Assigned Drone1 to event
- Drone1 GOT EVENTTime: 14:00:15 Zone: 1 Event Type: FIRE_DETECTED Severity: High
- Drone1: TRAVELING TO ZONE: 1 : AT TIME: 14:00:15
- Drone1: ASCENDING AT TIME: 14:00:37
- Drone1: CRUISING TO ZONE: 1 : AT TIME: 14:00:37
- Drone1: WATER DROPPED, RETURNING TO BASE: AT TIME: 14:00:37
- Drone1: ARRIVED BACK AT BASE AND READY FOR NEXT EVENT: AT TIME: 14:00:55
- Drone1: WAITING FOR EVENT
- [DS] Drone1: COMPLETED EVENT
- [DS] SENDING EVENT TO SCHEDULER --> Time: 14:00:15 Zone: 1 Event Type: FIRE_DETECTED Severity: High
- [DS] received event: Time: 14:10:01 Zone: 2 Event Type: DRONE_REQUEST Severity: Moderate
- [DS] Assigned Drone1 to event
- Drone1 GOT EVENTTime: 14:10:01 Zone: 2 Event Type: DRONE_REQUEST Severity: Moderate
- Drone1: TRAVELING TO ZONE: 2 : AT TIME: 14:10:01
- Drone1: ASCENDING AT TIME: 14:10:53
- Drone1: CRUISING TO ZONE: 2 : AT TIME: 14:10:53
- Drone1: WATER DROPPED, RETURNING TO BASE: AT TIME: 14:10:53
- Drone1: ARRIVED BACK AT BASE AND READY FOR NEXT EVENT: AT TIME: 14:11:41
- Drone1: WAITING FOR EVENT
- [DS] Drone1: COMPLETED EVENT
- [DS] SENDING EVENT TO SCHEDULER --> Time: 14:10:01 Zone: 2 Event Type: DRONE_REQUEST Severity: Moderate
-
Rami Ayoub & Louis Pantazopoulos & Liam Bennet
- Enhanced RPC communication between subsystems using UDP and object serialization.
- Updated the state machine logic for drones, including refining state transitions and fault handling
- Updated UML, sequence, and state machine diagrams to reflect these changes.
-
Ranveer Dhaliwal & Tharusha Herath & Sarah AlSaady
- Designed and implemented the GUI (DroneMapView) along with the DroneMapController and DroneModel to probe drone locations.
- Added real-time metrics functionality for monitoring drone response times, fire extinguishment times, throughput, and drone utilization.
- Added new test cases and updated the existing ones.