Power Systems · Python

Power Grid EMS Simulator

A from-scratch energy management system that simulates minute-by-minute dispatch decisions across solar generation, battery storage, and mixed electrical loads. Built to understand how real grid control logic handles competing constraints: cost, reliability, and renewable integration.

Python 3.10+ NumPy SciPy matplotlib Optimization EMS

System Design

The simulator separates physical models from control logic. Each component (solar array, battery bank, load types) maintains its own state and exposes a simple interface to the dispatch controller. This mirrors how real EMS platforms are structured.

system-architecture.svg
System Architecture Diagram
Component layout showing physical models, control layer, and data flow between subsystems.

Simulation Loop

Each time step, the controller collects current state from all components, solves a dispatch optimization, and issues setpoints. The loop runs at one-minute resolution to capture fast dynamics like battery ramp rates and solar irradiance changes.

simulation-loop.svg
Simulation Loop Diagram
Minute-by-minute dispatch loop: sense → decide → actuate → advance time.

Key Takeaways

Physical vs. Control Separation

Keeping battery SOC physics separate from dispatch logic made the codebase much easier to reason about, the same lesson real SCADA systems are built on.

Duck Curve in Practice

Simulating solar + battery together makes the duck curve tangible: midday oversupply charges storage, which then covers the steep evening ramp.

Constraint Cascades

A battery ramp rate limit can cause a load shed several minutes later. Tracing those cascades manually built real intuition for grid stability margins.

Optimization Tradeoffs

Minimizing cost vs. minimizing grid imports are often in tension. Encoding both as objectives revealed why real grid operators use hierarchical control.