Skip to content

Modular, physics-informed simulation of local smart grids with battery storage, decentralized trading, overload mitigation, and line-loss modeling.

Notifications You must be signed in to change notification settings

The-Milad-A/smart-grid-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 

Repository files navigation

Smart Grid Simulator

This project models a modular, physics-informed smart grid system composed of decentralized household agents, each with local power generation, consumption, and battery storage. It simulates energy flows, system balancing, overload responses, and basic market dynamics across a neighborhood-scale power grid.


πŸ”‹ Project Goals

  • Simulate real-time power distribution across household agents
  • Model storage, transfer, and loss mechanisms within a local grid
  • Implement overload handling (e.g. dump nodes / fail-safe agents)
  • Capture system behavior under generation/load imbalances
  • Provide a framework to test decentralized energy trading and pricing

πŸ› οΈ Key Features

  • Household agents with solar generation, demand profiles, and battery systems
  • Power balancing across agents and with grid connection
  • Resistance-based line loss (Ohmic model)
  • Dump load logic to absorb excess power in overload conditions
  • Hour-by-hour time loop simulation over multiple days
  • Optional pricing/market logic for peer-to-peer energy trades
  • Modular structure for extensibility and experimentation

🧱 Architecture

smart-grid-simulator/
β”‚
β”œβ”€β”€ agents/
β”‚ β”œβ”€β”€ household.py # Generation, consumption, battery
β”‚ β”œβ”€β”€ dumpnode.py # Absorbs overload / excess energy
β”‚
β”œβ”€β”€ network/
β”‚ β”œβ”€β”€ transmission.py # Power flow and resistive losses
β”‚
β”œβ”€β”€ market/
β”‚ β”œβ”€β”€ pricing.py # Optional pricing logic and P2P trades
β”‚
β”œβ”€β”€ planner/
β”‚ β”œβ”€β”€ simulate_day.py # Time-loop simulation and event management
β”‚
β”œβ”€β”€ data/
β”‚ └── sample_inputs/ # Example load/gen profiles
β”‚
β”œβ”€β”€ notebooks/
β”‚ └── demo_run.ipynb # Example use and visualization
β”‚
β”œβ”€β”€ README.md
└── requirements.txt


πŸ“ˆ Sample Use Case

  • 10 households with hourly solar and consumption profiles
  • Shared local battery capacity or individual storage
  • Hour-by-hour simulation for a 7-day period
  • Visualization of power flow, battery charge, and overload events
  • Optional price signal simulation or peer-to-peer trading activation

🌱 Future Directions

  • Integration of real ISO data (PJM, MISO, CAISO)
  • Bayesian modeling of generation uncertainty (weather-based)
  • Grid frequency & voltage fluctuation modeling
  • Streamlit dashboard or REST API for grid planning
  • Quantum-inspired optimization integration (AWS Braket)

πŸ“š Tools & Technologies

  • Python 3.x
  • pandas, numpy, matplotlib
  • Modular class structure
  • Optional: streamlit, plotly, boto3 (AWS integration)

πŸ“„ License

MIT License β€” open for educational and non-commercial adaptation.


✍️ Author

Developed by Milad Alibabaie, with focus on modeling energy systems & designing infrastructure.

About

Modular, physics-informed simulation of local smart grids with battery storage, decentralized trading, overload mitigation, and line-loss modeling.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published