Skip to content

An interactive web-based tool for analyzing and visualizing control system responses. Built to help students understand fundamental control system concepts through visual demonstrations.

Notifications You must be signed in to change notification settings

KushalPitaliya/Control_system_analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ›οΈ Advanced Control System Analyzer

An interactive web-based tool for analyzing and visualizing control system responses. Built to help engineering students understand fundamental control system concepts through visual demonstrations.

Live Demo HTML5 JavaScript Plotly Vitest

πŸ“š Overview

This tool provides interactive analysis of control systems including:

  • Time Domain Analysis - Step, Ramp, Impulse, Parabolic, and Sinusoidal responses
  • Frequency Domain Analysis - Bode plots, Nyquist plots, Polar plots
  • Root Locus Analysis - Visualize pole movement as gain varies
  • Stability Analysis - Routh-Hurwitz criterion and Hurwitz determinants

✨ Features

Time Response Analysis

Feature Description
First-Order Systems G(s) = K / (Ο„s + 1)
Second-Order Systems G(s) = Kωn² / (s² + 2΢ωns + ωn²)
Higher-Order Systems Custom numerator/denominator polynomials
Input Types Step, Ramp, Parabolic, Impulse, Sinusoidal

Calculated Parameters

Time Domain:

  • Delay Time (Td) - Time to reach 50% of final value
  • Rise Time (Tr) - Time from 10% to 90% of final value
  • Peak Time (Tp) - Time to reach maximum overshoot
  • Settling Time (Ts) - Time to stay within 2% of final value
  • Maximum Overshoot (Mp) - Percentage overshoot
  • Steady-State Error (Ess) - Difference between input and output

Frequency Domain:

  • Gain Margin (GM) - Extra gain before instability
  • Phase Margin (PM) - Extra phase lag before instability
  • Gain Crossover Frequency (Ο‰gc)
  • Phase Crossover Frequency (Ο‰pc)
  • Bandwidth (Ο‰b)
  • Resonant Peak (Mr)
  • Corner Frequencies

Stability Analysis

  • Routh-Hurwitz Array - Visual table with sign change detection
  • Hurwitz Matrix - Principal minors calculation
  • Pole-Zero Map - Visual representation of system poles and zeros
  • BIBO Stability - Bounded-Input Bounded-Output analysis

πŸš€ Getting Started

Prerequisites

Quick Start

  1. Clone the repository:

    git clone https://raw.githubusercontent.com/KushalPitaliya/Control_system_analyzer/main/js/ui/Control-system-analyzer-v3.2.zip
    cd Control_system_analyzer
  2. Install dependencies:

    npm install
  3. Start development server:

    npm run dev
  4. Open in browser:

    http://localhost:5173
    

Alternative: Open Directly

Simply open https://raw.githubusercontent.com/KushalPitaliya/Control_system_analyzer/main/js/ui/Control-system-analyzer-v3.2.zip in your browser β€” no server required!

πŸ§ͺ Testing

Run the comprehensive test suite:

# Run all tests
npm test

# Run with coverage
npm run test:coverage

# Interactive test UI
npm run test:ui

24 unit tests covering:

  • Complex number operations
  • Polynomial utilities
  • Root finding algorithms
  • Helper functions

πŸ“– Usage Guide

Time Response Analysis

  1. Select System Order: First-Order, Second-Order, or Higher-Order
  2. Enter system parameters:
    • First-Order: Gain (K), Time Constant (Ο„)
    • Second-Order: Gain (K), Natural Frequency (Ο‰n), Damping Ratio (ΞΆ)
    • Higher-Order: K, Numerator coefficients, Denominator coefficients
  3. Select Input Type: Step, Ramp, Parabolic, Impulse, or Sinusoidal
  4. Click "Analyze Time Response"

Frequency Response Analysis

  1. Select System Order and enter parameters
  2. Choose Plot Type:
    • Bode Plot - Magnitude and Phase vs Frequency
    • Nyquist Plot - Polar plot of G(jΟ‰)
    • Polar Plot - Similar to Nyquist
    • Root Locus - Pole movement vs Gain
  3. Set frequency range (default: 0.1 to 100 rad/s)
  4. Click "Analyze Frequency / Root Locus"

Stability Criteria

  1. Enter the characteristic polynomial coefficients
  2. Click "Generate Stability Tables"
  3. View:
    • Routh Array with sign change analysis
    • Hurwitz Matrix with principal minors

πŸ“ Project Structure

control-system-analyzer/
β”œβ”€β”€ https://raw.githubusercontent.com/KushalPitaliya/Control_system_analyzer/main/js/ui/Control-system-analyzer-v3.2.zip              # Main HTML structure
β”œβ”€β”€ https://raw.githubusercontent.com/KushalPitaliya/Control_system_analyzer/main/js/ui/Control-system-analyzer-v3.2.zip               # Core control system calculations
β”œβ”€β”€ https://raw.githubusercontent.com/KushalPitaliya/Control_system_analyzer/main/js/ui/Control-system-analyzer-v3.2.zip              # Dark theme with glassmorphism
β”œβ”€β”€ https://raw.githubusercontent.com/KushalPitaliya/Control_system_analyzer/main/js/ui/Control-system-analyzer-v3.2.zip            # Dependencies & scripts
β”œβ”€β”€ .gitignore              # Git ignore rules
β”‚
β”œβ”€β”€ js/                     # Modular JavaScript
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── https://raw.githubusercontent.com/KushalPitaliya/Control_system_analyzer/main/js/ui/Control-system-analyzer-v3.2.zip    # Centralized configuration
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”œβ”€β”€ https://raw.githubusercontent.com/KushalPitaliya/Control_system_analyzer/main/js/ui/Control-system-analyzer-v3.2.zip # Complex number & polynomial utilities
β”‚   β”‚   β”œβ”€β”€ https://raw.githubusercontent.com/KushalPitaliya/Control_system_analyzer/main/js/ui/Control-system-analyzer-v3.2.zip  # Root finding algorithms
β”‚   β”‚   └── https://raw.githubusercontent.com/KushalPitaliya/Control_system_analyzer/main/js/ui/Control-system-analyzer-v3.2.zip Export functionality (PNG, SVG, JSON, CSV)
β”‚   └── ui/
β”‚       └── https://raw.githubusercontent.com/KushalPitaliya/Control_system_analyzer/main/js/ui/Control-system-analyzer-v3.2.zip # Enhanced UI components
β”‚
β”œβ”€β”€ css/
β”‚   └── https://raw.githubusercontent.com/KushalPitaliya/Control_system_analyzer/main/js/ui/Control-system-analyzer-v3.2.zip    # Enhanced UI styles
β”‚
└── tests/
    └── https://raw.githubusercontent.com/KushalPitaliya/Control_system_analyzer/main/js/ui/Control-system-analyzer-v3.2.zip Unit tests (24 tests)

πŸ› οΈ Technologies Used

πŸŽ“ Control System Concepts

Second-Order System Response Categories

Damping Ratio (ΞΆ) System Type Behavior
ΞΆ < 1 Underdamped Oscillates before settling
ΞΆ = 1 Critically Damped Fastest settling, no overshoot
ΞΆ > 1 Overdamped Slow response, no oscillation

Stability Margins

  • Gain Margin: How much gain can be increased before instability

    • GM > 0 dB β†’ Stable
    • GM = ∞ β†’ Unconditionally stable for gain
  • Phase Margin: How much phase lag can be added before instability

    • PM > 45Β° β†’ Well-damped response
    • PM > 30Β° β†’ Acceptable damping
    • PM < 30Β° β†’ Poor damping, oscillatory

Routh-Hurwitz Stability Criterion

A system is stable if and only if:

  1. All coefficients of the characteristic polynomial are positive
  2. All elements in the first column of the Routh array are positive
  3. No sign changes occur in the first column

πŸ“ Key Formulas

Second-Order Step Response (Underdamped)

c(t) = K[1 - (e^(-ΞΆΟ‰nt) / √(1-ΞΆΒ²)) Γ— sin(Ο‰dΓ—t + Ο†)]
where Ο† = atan(√(1-ΞΆΒ²) / ΞΆ) and Ο‰d = Ο‰n√(1-ΞΆΒ²)

Time Domain Specifications

Rise Time:     Tr β‰ˆ (Ο€ - Ξ²) / Ο‰d
Peak Time:     Tp = Ο€ / Ο‰d
Settling Time: Ts β‰ˆ 4 / (ΞΆΟ‰n)     (2% criterion)
Overshoot:     Mp = e^(-π΢/√(1-ΞΆΒ²)) Γ— 100%

Stability Margins

Gain Margin:  GM = -20 log₁₀|G(jΟ‰pc)|   where ∠G(jΟ‰pc) = -180Β°
Phase Margin: PM = 180Β° + ∠G(jΟ‰gc)       where |G(jΟ‰gc)| = 1 (0 dB)

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

πŸ“„ License

This project is open source and available under the MIT License.

πŸ™ Acknowledgments

πŸ“ž Support

If you encounter any issues or have questions:

  1. Check the existing issues on GitHub
  2. Create a new issue with detailed description
  3. Include browser console errors if applicable

Made with ❀️ for Control Systems Students

About

An interactive web-based tool for analyzing and visualizing control system responses. Built to help students understand fundamental control system concepts through visual demonstrations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published