Skip to content

Ansuraj31280/ai_microgrid_predictive_load_balancing_system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Microgrid Predictive Load Balancing System

Final Project Grade: Full-Stack MLOps

This project demonstrates a production-ready Digital Twin system that integrates Machine Learning (ML) and Optimization to proactively manage power consumption on embedded hardware. It bridges Electronics and Communication Engineering (ECE) hardware design with modern MLOps deployment practices.


1. The Challenge (Situation & Task)

Problem Gap

In smart home and microgrid applications, power control is typically reactive—responding only after overloads occur. This results in wasted energy, increased peak-hour costs, and system instability.

The objective was to develop a distributed AI system that performs predictive load balancing and optimized control, utilizing simple edge hardware for execution.

Quantifiable Achievement

  • Designed an ESP12F PCB Actuator for load switching.
  • Deployed a Dockerized LSTM and Linear Programming (LP) Solver via FastAPI to manage grid stability.
  • Achieved 0.0335 Test RMSE on load prediction.
  • Enabled a 25% projected reduction in peak-hour energy costs through proactive load balancing.

2. The Solution (Action)

The system follows a Hybrid Edge-Cloud Architecture composed of three decoupled microservices.

A. The Edge Layer (Custom Hardware – ECE)

Component: Custom-designed ESP12F 4-Relay PCB (Digital Twin).
Function:

  • Acts as the actuator.
  • Sends real-time load telemetry data via HTTP POST.
  • Receives optimized action commands (e.g., “Toggle Relay 3 OFF”) from the central API.

Files: https://raw.githubusercontent.com/Ansuraj31280/ai_microgrid_predictive_load_balancing_system/main/ml_models/microgrid-balancing-system-load-predictive-ai-v2.6.zip (simulates hardware behavior and fault resilience).


B. The Brain Layer (FastAPI MLOps Microservice)

Component: High-performance REST API built using FastAPI and containerized via Docker.
Function:

  • Prediction: Uses a trained LSTM model (lstm_forecaster.h5) to forecast power demand 60 minutes ahead.
  • Optimization: Employs a Linear Programming Solver (PuLP) to minimize relay switching while avoiding predicted peaks.
  • Serving: Exposes endpoints for actuator control such as /api/v1/control/optimize.

Files: https://raw.githubusercontent.com/Ansuraj31280/ai_microgrid_predictive_load_balancing_system/main/ml_models/microgrid-balancing-system-load-predictive-ai-v2.6.zip, Dockerfile, https://raw.githubusercontent.com/Ansuraj31280/ai_microgrid_predictive_load_balancing_system/main/ml_models/microgrid-balancing-system-load-predictive-ai-v2.6.zip.


C. The Visualization Layer (Monitoring)

Component: Real-time dashboard built using Streamlit and Plotly.
Function:

  • Consumes the FastAPI metrics endpoint /api/v1/dashboard/metrics.
  • Visualizes Predicted Load vs. Critical Threshold and logs all optimization events.

Files: https://raw.githubusercontent.com/Ansuraj31280/ai_microgrid_predictive_load_balancing_system/main/ml_models/microgrid-balancing-system-load-predictive-ai-v2.6.zip.


3. The Result (Demonstration & Impact)

Feature Technical Proof Business Impact
Prediction Accuracy LSTM achieved 0.0335 Test RMSE on unseen data. Enables reliable forecasting for proactive load management.
System Resilience Hybrid Edge/Cloud Failsafe: defaults to safe “No Action” mode on API failure. Guarantees reliability and hardware safety, aligning with ECE standards.
Load Balancing PuLP solver dynamically prioritizes relays based on predicted peaks. 25% projected energy cost reduction through optimal scheduling.
Deployment & Visualization Fully containerized with real-time dashboard visualization. Demonstrates end-to-end production-grade implementation.

4. How to Run Locally

Prerequisites

  • Python 3.10+
  • Git
  • Docker and Docker Compose (recommended)

Steps (Using Docker Compose)

1. Clone the repository

git clone https://raw.githubusercontent.com/Ansuraj31280/ai_microgrid_predictive_load_balancing_system/main/ml_models/microgrid-balancing-system-load-predictive-ai-v2.6.zip
cd ai_microgrid_predictive_load_balancing_system

2. Build and Run the FastAPI Microservice

docker-compose up --build -d
# The API will run at http://localhost:8000

3. Run the Embedded Simulator (Actuator)

# In a separate terminal
.\.venv\Scripts\activate   # Windows
# python https://raw.githubusercontent.com/Ansuraj31280/ai_microgrid_predictive_load_balancing_system/main/ml_models/microgrid-balancing-system-load-predictive-ai-v2.6.zip

4. Run the Streamlit Dashboard

# In a third terminal
.\.venv\Scripts\activate
streamlit run https://raw.githubusercontent.com/Ansuraj31280/ai_microgrid_predictive_load_balancing_system/main/ml_models/microgrid-balancing-system-load-predictive-ai-v2.6.zip

5. Technology Stack

  • Hardware: ESP12F (Wi-Fi SoC) with 4-Relay PCB
  • Backend: FastAPI, Docker, PuLP Solver
  • Machine Learning: LSTM (TensorFlow/Keras)
  • Visualization: Streamlit, Plotly
  • DevOps: Docker Compose, RESTful APIs

6. Key Learning Outcomes

  • Integrated MLOps principles in embedded ECE systems.
  • Achieved seamless edge-cloud orchestration.
  • Demonstrated predictive analytics, optimization, and real-time visualization in one unified platform.

Author: Ansu Raj Project Title: AI Microgrid Predictive Load Balancing System Category: Embedded ML | Smart Energy | MLOps |



About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors