# yohanapereyra/microgrids-ems architecture

> Architecture diagram of the GitHub repository yohanapereyra/microgrids-ems, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yohanapereyra/microgrids-ems
- Repository: https://github.com/yohanapereyra/microgrids-ems

## Overview

This is a research project for microgrid energy management, evolving from deterministic PV–battery–grid dispatch to an EMS MILP that accounts for solar uncertainty. The historical workflow prepares PVGIS references and persistence forecasts, calibrates an error-scenario bank, optimizes plans with and without UCF, evaluates them over held-out days, then explores parameter sensitivity. Earlier scripts provide synthetic dispatch, forecast-error demonstrations, and UCF prototypes. The excerpts show several module-loading and data-use links; other stage relationships follow the README’s documented workflow, not inspection of unsampled source.

Main entry points: [`resultados_02`](https://github.com/yohanapereyra/microgrids-ems/tree/main/resultados_02) (Experiment outputs), [`02_microrred_24_horas.py`](https://github.com/yohanapereyra/microgrids-ems/blob/main/02_microrred_24_horas.py) (24-hour EMS), [`08_datos_historicos_pvgis.py`](https://github.com/yohanapereyra/microgrids-ems/blob/main/08_datos_historicos_pvgis.py) (Historical solar data), [`09_calibracion_ucf_historica.py`](https://github.com/yohanapereyra/microgrids-ems/blob/main/09_calibracion_ucf_historica.py) (Historical UCF calibration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dispatch["Dispatch foundations"]
  node_intro_milp["Three-hour MILP"]
  node_dispatch_24["24-hour EMS"]
  node_dispatch_viz["Dispatch visualization"]
  node_forecast_demo["Forecast error demo"]
end

subgraph group_ucf["UCF development"]
  node_ucf_demo["Single-period UCF<br/>[05_primera_ucf.py]"]
  node_ucf_synthetic["Synthetic UCF EMS<br/>[06_milp_con_ucf.py]"]
end

subgraph group_history["Historical EMS"]
  node_historical_data["Historical solar data"]
  node_ucf_calibration["Historical UCF calibration"]
  node_historical_ems["Historical EMS MILP"]
end

subgraph group_evaluation["Evaluation studies"]
  node_sens_det["Deterministic sensitivity"]
  node_synthetic_validation["Synthetic-day validation"]
  node_historical_validation["109-day validation"]
  node_ucf_sensitivity["EMS UCF sensitivity"]
  node_results_02_12["Experiment outputs"]
end

node_user(("Researcher"))
node_pvgis["PVGIS"]

node_user -->|"runs"| node_intro_milp
node_user -->|"runs"| node_dispatch_24
node_dispatch_24 -->|"extends"| node_dispatch_viz
node_dispatch_24 -->|"provides base"| node_sens_det
node_dispatch_24 -->|"provides plan"| node_forecast_demo
node_user -->|"runs"| node_ucf_demo
node_dispatch_24 -->|"provides EMS base"| node_ucf_synthetic
node_ucf_synthetic -->|"provides plans"| node_synthetic_validation
node_user -->|"runs"| node_historical_data
node_pvgis -->|"supplies solar"| node_historical_data
node_historical_data -->|"provides forecasts"| node_ucf_calibration
node_dispatch_24 -->|"provides EMS base"| node_historical_ems
node_ucf_calibration -->|"provides scenarios"| node_historical_ems
node_historical_ems -->|"provides formulation"| node_historical_validation
node_historical_data -->|"provides test data"| node_historical_validation
node_historical_validation -->|"provides evaluation"| node_ucf_sensitivity
node_dispatch_24 -->|"provides EMS base"| node_ucf_sensitivity
node_ucf_calibration -->|"provides scenarios"| node_ucf_sensitivity
node_intro_milp -.->|"writes experiment results"| node_results_02_12
node_dispatch_24 -->|"writes experiment results"| node_results_02_12
node_sens_det -->|"writes experiment results"| node_results_02_12
node_forecast_demo -->|"writes experiment results"| node_results_02_12
node_ucf_demo -->|"writes experiment results"| node_results_02_12
node_ucf_synthetic -->|"writes experiment results"| node_results_02_12
node_synthetic_validation -->|"writes experiment results"| node_results_02_12
node_historical_data -->|"writes forecasts"| node_results_02_12
node_ucf_calibration -->|"writes experiment results"| node_results_02_12
node_historical_ems -->|"writes experiment results"| node_results_02_12
node_historical_validation -->|"writes experiment results"| node_results_02_12
node_ucf_sensitivity -->|"writes experiment results"| node_results_02_12

click node_intro_milp "https://github.com/yohanapereyra/microgrids-ems/blob/main/01_microrred_3_horas.py"
click node_dispatch_24 "https://github.com/yohanapereyra/microgrids-ems/blob/main/02_microrred_24_horas.py"
click node_dispatch_viz "https://github.com/yohanapereyra/microgrids-ems/blob/main/02_microrred_24_horas_extra.py"
click node_sens_det "https://github.com/yohanapereyra/microgrids-ems/blob/main/03_analisis_sensibilidad.py"
click node_forecast_demo "https://github.com/yohanapereyra/microgrids-ems/blob/main/04_error_pronostico.py"
click node_ucf_demo "https://github.com/yohanapereyra/microgrids-ems/blob/main/05_primera_ucf.py"
click node_ucf_synthetic "https://github.com/yohanapereyra/microgrids-ems/blob/main/06_milp_con_ucf.py"
click node_synthetic_validation "https://github.com/yohanapereyra/microgrids-ems/blob/main/07_validacion_nuevos_dias.py"
click node_historical_data "https://github.com/yohanapereyra/microgrids-ems/blob/main/08_datos_historicos_pvgis.py"
click node_ucf_calibration "https://github.com/yohanapereyra/microgrids-ems/blob/main/09_calibracion_ucf_historica.py"
click node_historical_ems "https://github.com/yohanapereyra/microgrids-ems/blob/main/10_milp_ucf_historica.py"
click node_historical_validation "https://github.com/yohanapereyra/microgrids-ems/blob/main/11_validacion_historica_ems.py"
click node_ucf_sensitivity "https://github.com/yohanapereyra/microgrids-ems/blob/main/12_sensibilidad_ems_ucf.py"
click node_results_02_12 "https://github.com/yohanapereyra/microgrids-ems/tree/main/resultados_02"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_intro_milp,node_dispatch_24,node_dispatch_viz,node_forecast_demo toneBlue
class node_ucf_demo,node_ucf_synthetic toneAmber
class node_historical_data,node_ucf_calibration,node_historical_ems toneMint
class node_sens_det,node_synthetic_validation,node_historical_validation,node_ucf_sensitivity,node_results_02_12 toneRose
class node_user,node_pvgis toneIndigo
```

## Components

### Dispatch foundations

- [Three-hour MILP](https://github.com/yohanapereyra/microgrids-ems/blob/main/01_microrred_3_horas.py): `01_microrred_3_horas.py`
- [24-hour EMS](https://github.com/yohanapereyra/microgrids-ems/blob/main/02_microrred_24_horas.py): `02_microrred_24_horas.py`
- [Dispatch visualization](https://github.com/yohanapereyra/microgrids-ems/blob/main/02_microrred_24_horas_extra.py): `02_microrred_24_horas_extra.py`
- [Forecast error demo](https://github.com/yohanapereyra/microgrids-ems/blob/main/04_error_pronostico.py): `04_error_pronostico.py`

### UCF development

- [Single-period UCF](https://github.com/yohanapereyra/microgrids-ems/blob/main/05_primera_ucf.py): `05_primera_ucf.py`
- [Synthetic UCF EMS](https://github.com/yohanapereyra/microgrids-ems/blob/main/06_milp_con_ucf.py): `06_milp_con_ucf.py`

### Historical EMS

- [Historical solar data](https://github.com/yohanapereyra/microgrids-ems/blob/main/08_datos_historicos_pvgis.py): `08_datos_historicos_pvgis.py`
- [Historical UCF calibration](https://github.com/yohanapereyra/microgrids-ems/blob/main/09_calibracion_ucf_historica.py): `09_calibracion_ucf_historica.py`
- [Historical EMS MILP](https://github.com/yohanapereyra/microgrids-ems/blob/main/10_milp_ucf_historica.py): `10_milp_ucf_historica.py`

### Evaluation studies

- [Deterministic sensitivity](https://github.com/yohanapereyra/microgrids-ems/blob/main/03_analisis_sensibilidad.py): `03_analisis_sensibilidad.py`
- [Synthetic-day validation](https://github.com/yohanapereyra/microgrids-ems/blob/main/07_validacion_nuevos_dias.py): `07_validacion_nuevos_dias.py`
- [109-day validation](https://github.com/yohanapereyra/microgrids-ems/blob/main/11_validacion_historica_ems.py): `11_validacion_historica_ems.py`
- [EMS UCF sensitivity](https://github.com/yohanapereyra/microgrids-ems/blob/main/12_sensibilidad_ems_ucf.py): `12_sensibilidad_ems_ucf.py`
- [Experiment outputs](https://github.com/yohanapereyra/microgrids-ems/tree/main/resultados_02): `resultados_02`

### Other components

- **Researcher**
- **PVGIS**

## Connections

- Researcher → Three-hour MILP: runs (evidence: `README.md`)
- Researcher → 24-hour EMS: runs (evidence: `README.md`)
- 24-hour EMS → Dispatch visualization: extends (evidence: `README.md`)
- 24-hour EMS → Deterministic sensitivity: provides base (evidence: `03_analisis_sensibilidad.py`)
- 24-hour EMS → Forecast error demo: provides plan (evidence: `04_error_pronostico.py`)
- Researcher → Single-period UCF: runs (evidence: `README.md`)
- 24-hour EMS → Synthetic UCF EMS: provides EMS base (evidence: `06_milp_con_ucf.py`)
- Synthetic UCF EMS → Synthetic-day validation: provides plans (evidence: `07_validacion_nuevos_dias.py`)
- Researcher → Historical solar data: runs (evidence: `README.md`)
- PVGIS → Historical solar data: supplies solar (evidence: `08_datos_historicos_pvgis.py`)
- Historical solar data → Historical UCF calibration: provides forecasts (evidence: `09_calibracion_ucf_historica.py`)
- 24-hour EMS → Historical EMS MILP: provides EMS base (evidence: `10_milp_ucf_historica.py`)
- Historical UCF calibration → Historical EMS MILP: provides scenarios (evidence: `10_milp_ucf_historica.py`)
- Historical EMS MILP → 109-day validation: provides formulation (evidence: `11_validacion_historica_ems.py`)
- Historical solar data → 109-day validation: provides test data (evidence: `11_validacion_historica_ems.py`)
- 109-day validation → EMS UCF sensitivity: provides evaluation (evidence: `12_sensibilidad_ems_ucf.py`)
- 24-hour EMS → EMS UCF sensitivity: provides EMS base (evidence: `12_sensibilidad_ems_ucf.py`)
- Historical UCF calibration → EMS UCF sensitivity: provides scenarios (evidence: `12_sensibilidad_ems_ucf.py`)
- Three-hour MILP → Experiment outputs: writes experiment results (evidence: `README.md`)
- 24-hour EMS → Experiment outputs: writes experiment results (evidence: `README.md`)
- Deterministic sensitivity → Experiment outputs: writes experiment results (evidence: `README.md`)
- Forecast error demo → Experiment outputs: writes experiment results (evidence: `README.md`)
- Single-period UCF → Experiment outputs: writes experiment results (evidence: `README.md`)
- Synthetic UCF EMS → Experiment outputs: writes experiment results (evidence: `README.md`)
- Synthetic-day validation → Experiment outputs: writes experiment results (evidence: `README.md`)
- Historical solar data → Experiment outputs: writes forecasts (evidence: `08_datos_historicos_pvgis.py`)
- Historical UCF calibration → Experiment outputs: writes experiment results (evidence: `README.md`)
- Historical EMS MILP → Experiment outputs: writes experiment results (evidence: `README.md`)
- 109-day validation → Experiment outputs: writes experiment results (evidence: `README.md`)
- EMS UCF sensitivity → Experiment outputs: writes experiment results (evidence: `README.md`)
