Skip to content

A comprehensive simulation and test-prototype system for intelligent air quality control in indoor environments, focusing on carbon monoxide (CO) monitoring and automated ventilation management.

Notifications You must be signed in to change notification settings

Ishikawa7/Simulate_air_quality_control

Repository files navigation

Air Quality Control System Simulator

A comprehensive simulation and test-prototype system for intelligent air quality control in indoor environments, focusing on carbon monoxide (CO) monitoring and automated ventilation management.

Project Overview

This repository presents a complete air quality control system that demonstrates real-time monitoring, predictive modeling, and automated control of indoor air quality through intelligent ventilation management. The system serves as both a functional prototype and a showcase of modern approaches to environmental control using machine learning and real-time simulation.

What This Project Showcases

This repository demonstrates several key concepts and technologies:

  1. Model Predictive Control (MPC): Implementation of a complete MPC framework for environmental control systems, featuring prediction horizon, optimization, and receding horizon control.

  2. Predictive Environmental Control: Using machine learning models to predict future air quality conditions and optimize ventilation systems proactively rather than reactively.

  3. Real-time Simulation Framework: A comprehensive simulation environment that models the complex interactions between occupancy, ventilation systems, and air quality parameters.

  4. Interactive Web-based Interface: A modern dashboard built with Dash/Plotly that provides real-time visualization and control capabilities.

  5. Test-Prototype Methodology: A systematic approach to developing and validating environmental control systems through simulation before physical implementation.

System Architecture

Core Components

1. Data Generation and Modeling (data_creation/)

  • data_creation.ipynb: Synthetic data generation for training machine learning models
  • data/data.csv: Comprehensive dataset containing CO levels, occupancy patterns, and ventilation parameters
  • Simulates realistic indoor air quality scenarios with varying occupancy and ventilation conditions

2. Predictive Models

  • predictive_model.ipynb: Development and training of neural networks and regression models
  • predict_model.keras: Trained TensorFlow/Keras neural network for CO prediction
  • linear_regressor.pkl: Linear regression model for comparison and fallback
  • scaler.pkl: Data preprocessing scaler for model inputs

3. Simulation Engine (simulator.py)

The heart of the system, featuring a Model Predictive Control (MPC) implementation:

  • Real-time air quality simulation based on physical parameters
  • Model Predictive Control (MPC) algorithm that predicts CO levels over a 10-minute horizon
  • Predictive optimization using trained models to forecast CO levels and optimize control actions
  • Automated pump control with power optimization algorithms
  • Adaptive thresholding for different environmental conditions

4. Web Application (app.py, pages/)

  • Interactive dashboard with real-time visualization
  • Parameter control interface for system configuration
  • Live simulation monitoring with predictive forecasting display
  • User-friendly controls for adjusting room volume, occupancy, and ventilation parameters

5. Testing and Validation (test_predict_model.ipynb)

  • Model validation and performance testing
  • Scenario testing with various environmental conditions
  • Comparative analysis between different prediction approaches

Simulation Running


Key Features

Intelligent Control System

  • Model Predictive Control (MPC): The system implements a full MPC framework that predicts CO levels 10 minutes into the future and optimizes pump power accordingly
  • Predictive Horizon: Uses a 10-step prediction horizon to anticipate future air quality conditions
  • Optimization Algorithm: Automatically determines optimal pump power (0-100%) by evaluating multiple control scenarios
  • Receding Horizon Control: Updates control actions at each time step based on new measurements and updated predictions
  • Adaptive Response: Considers occupancy patterns, room volume, and current air quality conditions

Real-time Monitoring

  • Live CO Concentration Tracking: Real-time display of current and predicted CO levels
  • Threshold Management: Configurable safety thresholds with visual alerts
  • Historical Data Visualization: Trend analysis and pattern recognition

Environmental Parameters

  • Room Volume: Adjustable space size (10-30 m³)
  • Occupancy: Real-time people count (0-10 persons)
  • Ventilation Capacity: Configurable pump capacity (141-708 L/min)
  • System Scaling: Multiple pump configuration (1-8 pumps)

The Test-Prototype Significance

Why This Approach Matters

This project represents a test-prototype methodology that bridges the gap between theoretical environmental control systems and real-world implementation. The significance includes:

  1. Risk Mitigation: Testing control algorithms in simulation before deploying to actual buildings prevents potentially dangerous situations with air quality.

  2. Cost-Effective Development: Validating system behavior across thousands of scenarios without physical hardware reduces development costs and time.

  3. Performance Optimization: Fine-tuning control parameters and algorithms in a controlled environment ensures optimal performance.

  4. Scalability Testing: Evaluating system behavior across different room sizes, occupancy levels, and ventilation configurations.

Real-World Applications

The prototype demonstrates applicability to:

  • Office Buildings: Automated air quality management for varying occupancy
  • Residential Spaces: Smart home integration for health-conscious living
  • Industrial Facilities: Worker safety through predictive air quality control
  • Healthcare Facilities: Critical air quality management in sensitive environments

Technical Implementation

Model Predictive Control (MPC) Framework

The system implements a complete MPC architecture with the following components:

1. Prediction Model

  • Neural Network Predictor: Uses a trained TensorFlow/Keras model to predict CO concentrations
  • Multi-step Prediction: Generates 10-minute ahead predictions iteratively
  • State Variables: Considers current CO levels, occupancy, room volume, and ventilation parameters

2. Optimization Problem

  • Objective Function: Minimizes deviation from CO threshold over the prediction horizon
  • Control Variables: Pump power percentage (0-100%)
  • Constraints: Physical limits on pump capacity and power consumption
  • Discrete Optimization: Evaluates multiple pump power levels [0, 25, 50, 60, 65, 70, 75, 80, 85, 90, 95, 100]

3. Receding Horizon Implementation

  • Control Update: Optimal pump power is applied for one time step
  • State Update: System state is updated with new measurements
  • Horizon Shift: Prediction horizon shifts forward for next optimization cycle

4. Key MPC Functions in simulator.py

  • predict(): Multi-step prediction over 10-minute horizon
  • optimize(): Evaluates different pump power levels and selects optimal control action
  • simulate_time_step(): Implements the receding horizon control loop

Machine Learning Pipeline

  1. Data Collection: Synthetic data generation based on real-world parameters
  2. Feature Engineering: Processing occupancy patterns, environmental conditions, and ventilation parameters
  3. Model Training: Multiple approaches including neural networks and linear regression
  4. Validation: Comprehensive testing across various scenarios
  5. Deployment: Real-time model inference in the simulation environment

Simulation Framework

  • Physics-Based Modeling: Realistic air quality dynamics considering room volume, occupancy, and ventilation
  • Model Predictive Control Implementation: Complete MPC framework with prediction model, optimization, and receding horizon control
  • Stochastic Elements: Random variations to simulate real-world uncertainty
  • Optimization Algorithms: Smart pump control using predictive models with discrete optimization over pump power levels
  • Real-time Processing: Live simulation with configurable time steps

Installation and Usage

Prerequisites

  • Python 3.10.12
  • Required packages: dash, plotly, tensorflow, pandas, numpy, scikit-learn

Quick Start

  1. Clone the repository
  2. Install dependencies: pip install -r requirements.txt (if available)
  3. Run the application: python app.py
  4. Access the dashboard at http://localhost:8050

Using the Simulator

  1. Configure Parameters: Set room volume, occupancy, and ventilation capacity
  2. Start Simulation: Begin real-time air quality monitoring
  3. Monitor Performance: Observe CO levels, pump power, and predictions
  4. Adjust Settings: Modify parameters to see system response

Future Enhancements

This test-prototype provides a foundation for:

  • IoT Integration: Connecting real sensors and actuators
  • Multi-pollutant Monitoring: Expanding beyond CO to include CO₂, PM2.5, VOCs
  • Building Integration: HVAC system integration and building automation
  • Mobile Applications: Remote monitoring and control capabilities
  • Energy Optimization: Balancing air quality with energy efficiency

License

This project is intended for educational and research purposes, demonstrating the application of machine learning and simulation techniques to environmental control systems.


This repository showcases the potential of combining Model Predictive Control, real-time simulation, and intelligent control systems to create safer, more efficient indoor environments.

About

A comprehensive simulation and test-prototype system for intelligent air quality control in indoor environments, focusing on carbon monoxide (CO) monitoring and automated ventilation management.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published