How aralkaramogh/dc-microgrid-black-start-controller works
This repository develops a DC microgrid black-start controller in two forms: a MATLAB digital twin for scenario and Monte Carlo evaluation, and ESP32 firmware intended to run the controller on hardware. The principal workflow detects blackout, authorises an operator, checks sensors and SOC, soft-starts the bus, connects solar, restores loads by priority, then monitors and protects normal operation. The graph includes simulation evaluation and hardware telemetry branches. Firmware calls are supported by the shown excerpts; MATLAB subsystem relationships are limited to README-documented workflow and capabilities, since MATLAB source was not sampled.
Main entry points: run_all.m Simulation Runner · main.cpp RTOS Task Runtime · fsm.cpp Black-Start FSM · plant_fallback.m Circuit Plant
Components 24
Digital Twin
- Microgrid Parameters
params/dc_microgrid_params.m - Scenarios
src/define_scenarios.m - PV Model
src/pv_model.m - Circuit Plant
src/plant_fallback.m - Black-Start FSM
src/blackstart_fsm.m - Load Restoration
src/load_restoration_engine.m - Restoration Step
src/load_restoration_engine_step.m - Simulation Runner
run_all.m
Firmware Control
- RTOS Task Runtime
firmware/src/main.cpp - Black-Start FSM
firmware/src/fsm.cpp - Load Restoration
firmware/src/restoration.cpp - Fault Protection
firmware/src/protection.cpp - Controller Configuration
firmware/include/config.h
Firmware I/O
- Sensor Acquisition
firmware/src/sensors.cpp - RFID Authentication
firmware/src/auth_rfid.cpp - Soft-Start PWM
firmware/src/pwm_soft_start.cpp - Serial Telemetry
firmware/src/telemetry.cpp
Evaluation
- KPI Evaluation
src/kpi_compute.m - Monte Carlo
src/montecarlo.m - SIL Vectors
src/export_sil_vectors.m - Serial Capture
tools/capture_serial.py - Hardware Comparison
tools/compare_hw_vs_sim.m
Other components
- Operator
- Microgrid Hardware
Connections 26
- Operator → RFID Authentication: presents card
README.md - Microgrid Hardware → Sensor Acquisition: provides readings
- RTOS Task Runtime → Sensor Acquisition: reads and calibrates
firmware/src/main.cpp - RTOS Task Runtime → Black-Start FSM: ticks
firmware/src/main.cpp - RTOS Task Runtime → RFID Authentication: polls
firmware/src/main.cpp - RTOS Task Runtime → Serial Telemetry: prints telemetry
firmware/src/main.cpp - RTOS Task Runtime → Soft-Start PWM: sets duty
firmware/src/main.cpp - RTOS Task Runtime → Microgrid Hardware: applies gates
firmware/src/main.cpp - Black-Start FSM → Fault Protection: checks faults
firmware/src/fsm.cpp - Black-Start FSM → Load Restoration: steps loads
firmware/src/fsm.cpp - RFID Authentication → Black-Start FSM: injects auth
firmware/src/auth_rfid.cpp - Scenarios → Simulation Runner: defines cases
README.md - Simulation Runner → Circuit Plant: runs scenarios
README.md - Simulation Runner → KPI Evaluation: evaluates runs
README.md - Simulation Runner → Monte Carlo: runs variations
README.md - Simulation Runner → SIL Vectors: exports readings
README.md - Circuit Plant → Black-Start FSM: simulates control
README.md - Black-Start FSM → Load Restoration: uses restoration logic
README.md - Load Restoration → Restoration Step: delegates steps
- PV Model → Simulation Runner: plots PV curves
README.md - Microgrid Parameters → Simulation Runner: supplies parameters
README.md - SIL Vectors → Black-Start FSM: replays sensor vectors
README.md - Serial Telemetry → Serial Capture: streams serial data
README.md - Serial Capture → Hardware Comparison: provides capture
README.md - Circuit Plant → Hardware Comparison: provides simulation
README.md - Controller Configuration → Black-Start FSM: sets thresholds