Skip to content

MRvandals4vage/scheduling-algorithm---visualization

Repository files navigation

Air Traffic Control - Priority Scheduling Visualization

This is an interactive web-based visualization of the Priority Preemptive Scheduling algorithm for an Air Traffic Control system, based on the C program implementation.

Features

  • Real-time Animation: Watch aircraft landing in real-time with smooth animations
  • Priority-based Scheduling: Implements priority preemptive scheduling (lower number = higher priority)
  • Interactive Controls: Start, pause, reset, and adjust simulation speed
  • Dynamic Aircraft Management: Add new aircraft during simulation
  • Comprehensive Logging: Detailed simulation log with timestamps
  • Statistics Display: Real-time turnaround and waiting time calculations

How It Works

The visualization simulates an airport runway system where:

  • Aircraft arrive at different times with different landing time requirements
  • Priority levels: 1 (Emergency), 2 (Fuel Shortage), 3+ (Normal)
  • Preemptive scheduling: Higher priority aircraft can preempt lower priority ones currently landing
  • Real-time animation: Shows aircraft movement, queue status, and progress

Installation & Setup

  1. Install dependencies:

    npm install
  2. Start the server:

    npm start
  3. Open browser: Navigate to http://localhost:3000

Usage

Controls

  • Start/Pause: Control simulation playback
  • Reset: Restart simulation with current aircraft
  • Speed Control: Adjust simulation speed (0.5x to 5x)
  • Add Aircraft: Add new aircraft with custom parameters

Visualization Areas

  • Runway Canvas: Shows current aircraft landing with progress bar
  • Queue Canvas: Displays waiting aircraft in priority order
  • Statistics: Shows average turnaround and waiting times
  • Log Panel: Real-time simulation events and timestamps

Adding Aircraft

Click "Add Aircraft" to open the modal:

  • Arrival Time: When the aircraft arrives (must be ≥ current time)
  • Landing Time: Time required for landing (1+ time units)
  • Priority: 1 (Emergency), 2 (Fuel Shortage), 3 (Normal)
  • Color: Visual representation color

Algorithm Details

The simulation implements the Priority Preemptive Scheduling algorithm:

  1. Selection: At each time unit, select the highest priority aircraft that has arrived
  2. Preemption: If a higher priority aircraft arrives, preempt the current aircraft
  3. Execution: Process one time unit of the selected aircraft's landing
  4. Completion: Continue until all aircraft have completed landing

Sample Aircraft Data

The visualization comes with sample data:

  • Aircraft 1: Arrival: 0, Landing: 8, Priority: 2 (Red)
  • Aircraft 2: Arrival: 1, Landing: 4, Priority: 1 (Teal) - Emergency
  • Aircraft 3: Arrival: 3, Landing: 9, Priority: 3 (Blue) - Normal
  • Aircraft 4: Arrival: 5, Landing: 5, Priority: 2 (Yellow)

Performance Metrics

  • Turnaround Time: Total time from arrival to completion
  • Waiting Time: Time spent waiting (Turnaround - Landing Time)
  • Throughput: Number of aircraft processed per time unit

Technical Implementation

  • Backend: Node.js with Express server
  • Frontend: HTML5 Canvas for animations, CSS3 for styling
  • Algorithm: Pure JavaScript implementation of priority scheduling
  • Real-time Updates: RequestAnimationFrame for smooth 60fps animation

Browser Compatibility

  • Chrome 60+
  • Firefox 55+
  • Safari 11+
  • Edge 79+

Requires modern browser with ES6 support and HTML5 Canvas.

License

MIT License - feel free to use for educational purposes.

About

c scheduling alg + js and html visualization

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published