GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - HuzaifaAshrafi1/elevator-moore-machine: Elevator Control System using 9-State Moore Machine with Real-time Analytics & PDF Reporting

BranchesTags
Open more actions menu

Latest commit

 

History

13 Commits
13 Commits

Folders and files

NameName
Last commit message
Last commit date
.vscode
.vscode
 
 
.gitignore
.gitignore
 
 
ISSUE_TEMPLATE.md
ISSUE_TEMPLATE.md
 
 
License
License
 
 
README.md
README.md
 
 
contribution.md
contribution.md
 
 
index.html
index.html
 
 
package.json
package.json
 
 
script.js
script.js
 
 
style.css
style.css
 
 

Repository files navigation

Elevator Control System - Moore Machine Implementation

Moore Machine 9 States Version Live Demo License Status JavaScript Chart.js PDF Generation

A sophisticated web-based simulation of an elevator control system implemented as a 9-state Moore Machine, featuring real-time analytics, comprehensive emergency protocols, and automated PDF reporting.

Live Demo

View Live Project

Project Overview

This project demonstrates a complete finite state machine (FSM) implementation for elevator control, combining theoretical automata concepts with practical web development. The system simulates a 5-story building elevator with advanced features like overload detection, emergency protocols, and real-time performance analytics.

Key Academic Contributions

  • Pure Moore Machine implementation (outputs depend solely on current state)
  • 9 distinct states with complete transition logic
  • Real-world elevator protocols simulation
  • Comprehensive state diagram visualization
  • Performance metrics tracking and analysis

Features

Core Implementation

  • 9-State Moore Machine with deterministic transitions
  • Visual State Diagram showing all state relationships
  • Complete State Table documenting all Moore outputs
  • Real-time UI Updates synchronized with state changes

Analytics & Monitoring

  • Live Statistics Dashboard with key performance indicators
  • Interactive Charts (pie chart, line graph) using Chart.js
  • State Distribution Tracking across all 9 states
  • Performance Metrics calculation (efficiency, wait times, idle time)
  • State Transition History with timestamps

Emergency & Safety Systems

  • Emergency Stop Protocol with audio/visual alerts
  • Overload Detection (weight limit simulation)
  • Power Failure Simulation with automatic recovery
  • Occupant Management system
  • Safety Interlocks and protocol enforcement

Reporting & Documentation

  • PDF Report Generation using jsPDF
  • Comprehensive System Reports with statistics
  • Emergency Event Logging
  • Performance Analysis export

User Experience

  • Dark/Light Mode Toggle with automatic detection
  • Keyboard Shortcuts for all operations
  • Responsive Design for all screen sizes
  • Animated Visuals (elevator movement, door operations)
  • Audio Feedback (ding sounds, emergency alarms)

Testing & Scenarios

  • Pre-defined Test Scenarios (Morning Rush, Emergency Test)
  • Auto Test Mode for complete system validation
  • Queue Management with priority scheduling
  • Preset Modes (Up Peak, Down Peak, Random)

Architecture

Moore Machine States

State Description Key Outputs
IDLE Stationary, waiting for requests Motor: STOP, Door: CLOSED
MOVING_UP Ascending to target floor Motor: UP, Door: CLOSED
MOVING_DOWN Descending to target floor Motor: DOWN, Door: CLOSED
DOOR_OPENING Doors opening at arrival Motor: STOP, Door: OPENING
DOOR_OPEN Doors open for boarding Motor: STOP, Door: OPEN
DOOR_CLOSING Doors closing after dwell time Motor: STOP, Door: CLOSING
DOOR_CLOSED Doors closed, ready for next move Motor: STOP, Door: CLOSED
EMERGENCY Emergency stop activated Motor: STOP, Alarm: ON
OVERLOAD Weight limit exceeded Motor: STOP, Door: OPEN, Alarm: ON

Technical Stack

  • Frontend: HTML5, CSS3 (with CSS Variables for theming), Vanilla JavaScript (ES6+)
  • Charts: Chart.js v4.4.0
  • PDF Generation: jsPDF v2.5.1 with AutoTable plugin
  • Icons: Font Awesome v6.4.0
  • Animations: Animate.css v4.1.1
  • Fonts: Poppins (Google Fonts)
  • Development: VS Code with Prettier, ESLint, Live Server

Quick Start

Prerequisites

  • Modern web browser (Chrome 90+, Firefox 88+, Safari 14+)
  • Node.js (optional, for development server)
  • VS Code (recommended for development)

Installation & Running

Method 1: Direct Browser (Simplest)

# Clone the repository
git clone https://github.com/HuzaifaAshrafi1/elevator-moore-machine.git

# Open index.html in your browser
cd elevator-moore-machine
open index.html  # On macOS
# or
start index.html # On Windows

Method 2: Development Server (Recommended)

# Install dependencies
npm install

# Start development server
npm start

# Server will open at http://localhost:3000

Method 3: VS Code Live Server

  1. Open project in VS Code
  2. Install "Live Server" extension (recommended in .vscode/extensions.json)
  3. Right-click index.html → "Open with Live Server"

Usage Guide

Basic Operations

  1. Floor Selection: Click floor buttons (G, 1, 2, 3, 4) or use keyboard shortcuts (0-4)
  2. Direction Requests: Use call buttons on building visualization (up/down arrows)
  3. Door Control: Open/Close doors using control panel buttons
  4. Emergency: Activate emergency stop for safety protocols

Advanced Features

  • Occupant Management: Simulate passengers entering/exiting
  • Performance Monitoring: View real-time statistics in dashboard
  • Scenario Testing: Run pre-defined test scenarios
  • Report Generation: Create PDF reports of system activity

Keyboard Shortcuts

Shortcut Action
0 or G Request Ground Floor
1-4 Request Floor 1-4
↑ / ↓ Request adjacent floor
O / C Open / Close door
Ctrl+E Emergency stop
Ctrl+R Reset system
Ctrl+P Generate PDF report
Ctrl+A Run auto test
+ / - Add / Remove occupant

Project Structure

elevator-moore-machine/
├── index.html                 # Main HTML file with complete UI
├── style.css                  # CSS with dark/light theme system
├── script.js                  # Core JavaScript (ES6+ classes)
├── LICENSE                    # CC BY-NC 4.0 License
├── README.md                  # This documentation
├── package.json               # Project configuration & dependencies
└── .vscode/                   # VS Code workspace settings
    ├── settings.json          # Editor preferences
    └── extensions.json        # Recommended extensions

Testing

Automated Tests

# Run auto test sequence from UI
1. Click "Auto Test" button
2. Observe complete system validation

Manual Testing Scenarios

  1. Morning Rush Hour: Simulates peak usage patterns
  2. Emergency Protocol Test: Validates emergency response
  3. Overload Simulation: Tests weight limit handling
  4. Power Failure: Tests backup systems

Performance Metrics Tracked

  • State transition frequency
  • Average wait time per request
  • Travel efficiency (optimal vs actual)
  • Door operation cycles
  • Emergency event count

Development

Setup Development Environment

# Install all dependencies
npm install

# Format code (Prettier)
npm run format

# Lint code (ESLint)
npm run lint

# Start development server with live reload
npm run dev

Code Architecture

  • ElevatorController Class: Main controller with all state logic
  • ThemeManager Class: Handles dark/light mode switching
  • Chart Management: Real-time chart updates
  • Event System: Comprehensive keyboard and click handlers
  • PDF Generation: Modular report creation system

Adding New Features

  1. Extend the ElevatorController class for new states
  2. Update state transition logic in transitionTo() method
  3. Add corresponding UI elements in index.html
  4. Style new components in style.css
  5. Test thoroughly with existing scenarios

Performance & Optimization

Optimizations Implemented

  • Debounced state updates to prevent excessive renders
  • Chart.js lazy updates for better performance
  • Efficient DOM queries with querySelector caching
  • CSS transitions instead of JavaScript animations where possible
  • LocalStorage caching for theme preferences

Browser Compatibility

  • Chrome 90+: Fully supported
  • Firefox 88+: Fully supported
  • Safari 14+: Fully supported
  • Edge 90+: Fully supported
  • Mobile Browsers: Responsive design supported

Contributing

This is an academic project, but suggestions are welcome:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/improvement)
  3. Commit changes (git commit -m 'Add some improvement')
  4. Push to branch (git push origin feature/improvement)
  5. Open a Pull Request

Code Standards

  • Follow existing code structure and naming conventions
  • Use Prettier for code formatting
  • Add comments for complex logic
  • Update documentation for new features

License

This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License.

You are free to:

  • Share, copy, and redistribute the material
  • Adapt, remix, transform, and build upon the material
  • Use for academic, educational, and research purposes

Under these terms:

  • Attribution Required: Credit must be given to the authors
  • NonCommercial: Commercial use is not permitted

For complete license terms, see the LICENSE file.

Academic Context

This project serves as a practical implementation of theoretical concepts learned in Automata Theory, specifically:

  • Finite State Machines (FSM)
  • Moore Machines vs Mealy Machines
  • State transition diagrams
  • Deterministic vs Non-deterministic automata
  • Formal language theory applications

Related Resources

  • Moore Machine Theory - Wikipedia
  • Chart.js Documentation
  • jsPDF Documentation
  • Project Repository
  • Issue Tracker

Contact

Feel free to reach out for collaboration or questions!

Email: [email protected] LinkedIn: www.linkedin.com/in/huzaifa-ashrafi


About

Elevator Control System using 9-State Moore Machine with Real-time Analytics & PDF Reporting

huzaifaashrafi1.github.io/elevator-moore-machine

Topics

academicacademic-projectautomatachartjscsselevatorelevator-simulationelevatorprojectfinite-state-machinehtmlhtml5javascriptmoore-machine

Resources

Readme
License
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.