Skip to content

Latest commit

ย 

History

87 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Nuclear Reactor AI Control System

Anomaly & Fault Detection with Machine Learning

A comprehensive AI-powered nuclear reactor control and monitoring system using Deep Reinforcement Learning (Soft Actor-Critic) models.

๐ŸŽฏ Project Overview

This project demonstrates an advanced control system for nuclear reactors using pre-trained SAC (Soft Actor-Critic) reinforcement learning models. The system provides:

  • Real-time Reactor Monitoring: Live dashboards with gauges, graphs, and metrics
  • AI-Powered Control: Automatic reactor control using trained SAC agents
  • Manual Override: User-adjustable controls for testing and education
  • Scenario Testing: Multiple test scenarios (LOFA, rod malfunction, power ramp)
  • Event Detection: Anomaly detection and critical event logging
  • Performance Metrics: Comprehensive statistics on model performance

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • Python 3.8+
  • Ports 3000 (frontend) and 8000 (backend) available

Installation & Run

# Terminal 1: Start Backend
cd backend
pip install -r requirements.txt
python run.py
# Expected: "Running on http://localhost:8000"

# Terminal 2: Start Frontend
cd frontend
npm install
npm run dev
# Expected: "Ready on http://localhost:3000"

First Simulation

  1. Open http://localhost:3000
  2. Select a model from dropdown (e.g., "Enhanced SAC Agent")
  3. Select a scenario (e.g., "Normal Operation")
  4. Click "Start Simulation"
  5. Watch the AI control the reactor in real-time!

๐Ÿ“Š Dashboard Features

lofa full

Left Panel - Reactor Visualization

  • 4 Circular Gauges: Power, Fuel Temperature, Coolant Temperature, Pressure
  • Control Rods Display: Visual representation of power and precursor levels
  • Temperature Heatmap: Color-coded thermal profile

Center Panel - Simulation Control

  • Model Selector: Choose between Enhanced or Optimized SAC agent
  • Scenario Selector: Test different reactor conditions
  • Control Buttons: Start, Stop, Pause, Reset
  • Manual Controls: Adjustable sliders for control rods and coolant flow
  • Status Card: Current simulation state and progress

Right Panel - Metrics & Analysis

  • Event Log: Timestamped events (100 max, circular buffer)
  • Metrics Summary: Statistics (reward, steps, temperature peaks, etc.)
  • Score Cards: Key performance indicators
  • Real-time Graphs: Power, temperatures, and pressure trends
completed dashboard

๐Ÿ”Œ API Endpoints

Health & Status

GET  /api/health           โ†’ Backend health check
GET  /api/status           โ†’ System status & available models/scenarios

Models

GET  /api/models           โ†’ List all models
GET  /api/models/{id}      โ†’ Model details
POST /api/models/{id}/load โ†’ Load model into memory

Scenarios

GET  /api/scenarios        โ†’ List available scenarios

Simulation Control

POST /api/simulation/reset     โ†’ Reset environment
POST /api/simulation/start     โ†’ Start with model & scenario
POST /api/simulation/step      โ†’ Execute AI step
POST /api/simulation/action    โ†’ Execute manual action
GET  /api/simulation/state     โ†’ Get current state
POST /api/simulation/stop      โ†’ Stop & get summary

๐Ÿง  Models Included

Enhanced SAC Agent

  • Training Steps: 250,000
  • Average Reward: 48.6 points/step
  • Network Size: Large
  • Performance: Excellent control stability
  • Use Case: Production control
  • Location: python/SAC_enhanced_model/nuclear_reactor_sac/models/enhanced/best_model.pth
best_episode

Optimized SAC Agent

  • Training Steps: 150,000
  • Average Reward: 7.3 points/step
  • Network Size: Smaller
  • Performance: Good control with faster inference
  • Use Case: Real-time edge deployment
  • Location: python/SAC_model/models/optimized/best_model.pth

๐Ÿงช Test Scenarios

Normal Operation

Default safe reactor operation at nominal 100 MW. Used for baseline testing.

LOFA (Loss of Coolant Flow Accident)

Simulates loss of coolant flow (40% reduction) starting at t=5s. Tests AI's ability to manage reactor without added cooling.

Rod Malfunction

Control rod stuck at 50% insertion starting at t=3s. Tests AI's ability to control power with limited rod movement.

Power Ramp

Gradual demand increase to 120 MW. Tests safe power escalation and thermal management.


๐ŸŽ›๏ธ User Controls

Automatic Mode

  • Select model and scenario
  • Click "Start"
  • Watch AI maintain reactor stability
  • Monitor real-time metrics and events

Manual Mode

  • Start simulation in any scenario
  • Adjust control rods (-1.0 fully retracted, 1.0 fully inserted)
  • Adjust coolant flow (-1.0 decrease, 1.0 increase)
  • Compare your manual control against the AI

Analysis Mode

  • Stop simulation at any time
  • View final metrics and performance
  • Compare multiple models on same scenario
  • Export event history and metrics

โœจ Features Implemented

Completed โœ…

  • โœ… Production-ready Flask backend
  • โœ… Complete Next.js frontend
  • โœ… 20+ React components
  • โœ… Real-time reactor monitoring
  • โœ… AI model integration
  • โœ… Manual control override
  • โœ… Multiple scenarios
  • โœ… Performance metrics
  • โœ… Event logging
  • โœ… Comprehensive documentation
  • โœ… Type-safe code
  • โœ… Error handling
  • โœ… CORS configuration

Future Enhancements ๐Ÿ”ฎ

  • WebSocket real-time updates
  • Model comparison mode
  • Historical data storage
  • Advanced charting (Recharts)
  • Dark mode
  • Export capabilities
  • Model training UI
  • Docker containerization

๐Ÿ“ License

This project is licensed under the terms specified in the MIT License.



๐ŸŽฏ Summary

A complete, production-ready AI-powered nuclear reactor control system demonstrating:

  • โœ… Advanced AI control (Soft Actor-Critic)
  • โœ… Real-time monitoring and visualization
  • โœ… Comprehensive documentation
  • โœ… Professional code quality
  • โœ… Modern web technologies
  • โœ… Ready to run locally
  • โœ… Ready to deploy

Status: โœ… FULLY FUNCTIONAL


๐Ÿš€ Get Started Now!

# 1. Backend (Terminal 1)
cd backend && pip install -r requirements.txt && python run.py

# 2. Frontend (Terminal 2)
cd frontend && npm install && npm run dev

# 3. Open Browser
http://localhost:3000

Then explore, experiment, and enjoy controlling a nuclear reactor with AI! ๐Ÿ”‹โš›๏ธ


Version: 1.0.0
Last Updated: April 2025
Status: Production Ready

About

Physics-informed machine learning system for anomaly detection and fault diagnosis in nuclear power plants, combining thermodynamic laws with AI to improve safety, reliability, and early fault prediction.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages