Configuration Flow#
This page explains how EPM loads and uses configuration files, settings, and resources when running a simulation.
Overview#
EPM uses a layered configuration system:
Command Line Arguments
↓
config.csv (maps parameter names → CSV files)
↓
pSettings.csv (model behavior switches)
↓
resources/ (shared model constants)
↓
Input CSV files (data)
Entry Point: epm.py#
When you run EPM from Python:
python epm.py --folder_input data_test --config config.csv
The main() function in epm/epm.py parses command-line arguments and calls launch_epm_multi_scenarios() to orchestrate execution.
Key Command-Line Arguments#
Argument |
Default |
Description |
|---|---|---|
|
|
Input folder name inside |
|
|
Configuration file relative to folder_input |
|
|
Solver type: |
|
|
Scenarios file for variant runs |
|
|
Subset of scenarios to run |
|
|
Parallel processes |
|
|
Enable sensitivity analysis |
|
|
Enable Monte Carlo analysis |
|
|
Enable verbose GAMS output |
config.csv: The Master Index#
The config.csv file maps parameter names to their corresponding CSV data files. It serves as the central routing table for all model inputs.
Location: epm/input/<folder_input>/config.csv
Structure:
metadata,paramNames,file
modeltype type (MIP or RMIP),modeltype,RMIP
Cplex file path,cplexfile,cplex/cplex_baseline.opt
,GENERAL,
Global model settings,pSettings,pSettings.csv
Planning horizon years,y,y.csv
Zone-country mapping,zcmap,zcmap.csv
...
Columns:
metadata: Human-readable description (ignored by code)paramNames: Parameter name used internally by the modelfile: Relative path to the CSV file within the input folder
How config.csv is Loaded#
Python reads
config.csvand creates a dictionary mappingparamNames → fileFile paths are normalized to POSIX format for cross-platform compatibility
Full absolute paths are constructed by prepending
folder_inputThe dictionary becomes the “baseline” scenario
# Example of what happens internally
config = {
'pSettings': '/path/to/epm/input/data_test/pSettings.csv',
'y': '/path/to/epm/input/data_test/y.csv',
'pGenDataInput': '/path/to/epm/input/data_test/supply/pGenDataInput.csv',
...
}
Parameter Categories in config.csv#
Category |
Parameters |
|---|---|
GENERAL |
pSettings, y, zcmap, pHours |
STATIC |
pDays, mapTS |
LOAD |
pDemandProfile, pDemandData, pDemandForecast, sRelevant, pEnergyEfficiencyFactor |
SUPPLY |
pGenDataInput, pGenDataInputDefault, pAvailability, pAvailabilityDefault, pCapexTrajectories, pCapexTrajectoriesDefault, pFuelPrice, pVREProfile, pVREgenProfile, pStorageDataInput, pCSPData |
RESERVE |
pPlanningReserveMargin, pSpinningReserveReqCountry, pSpinningReserveReqSystem |
CONSTRAINT |
pEmissionsTotal, pEmissionsCountry, pMaxFuellimit, pCarbonPrice |
TRADE |
zext, pExtTransferLimit, pLossFactorInternal, pMaxPriceImportShare, pMaxAnnualExternalTradeShare, pMinImport, pNewTransmission, pTradePrice, pTransferLimit |
H2 |
pH2DataExcel, pAvailabilityH2, pCapexTrajectoryH2, pExternalH2, pFuelDataH2 |
pSettings.csv: Model Behavior#
The pSettings.csv file controls model behavior through feature flags and economic parameters.
Location: epm/input/<folder_input>/pSettings.csv
Structure:
Abbreviation,Value
fEnableCapacityExpansion,1
WACC,0.08
VoLL,5000
...
Key Settings Categories#
Capacity & Dispatch#
Setting |
Description |
|---|---|
|
Enable capacity expansion (1) or dispatch-only (0) |
|
Dispatch mode configuration |
Economic Parameters#
Setting |
Description |
Typical Value |
|---|---|---|
|
Weighted average cost of capital |
0.08 (8%) |
|
Discount rate |
0.05 (5%) |
|
Value of Lost Load ($/MWh) |
5000 |
|
Cost of surplus energy |
0 |
|
Cost of curtailment |
0 |
Interconnection & Trade#
Setting |
Description |
|---|---|
|
Allow internal zone transfers |
|
Remove internal transfer limits |
|
Allow new transmission investment |
|
Allow external trade |
|
Max hourly import share |
|
Max hourly export share |
Reserves#
Setting |
Description |
|---|---|
|
Enforce planning reserve margin |
|
Planning reserve margin (%) |
|
Country spinning reserve |
|
System spinning reserve |
|
VRE forecast error (%) |
Emissions & Renewables#
Setting |
Description |
|---|---|
|
Country CO2 limits |
|
System CO2 limit |
|
Enable carbon pricing |
|
Minimum renewable share (%) |
|
Year for renewable target |
Special Features#
Setting |
Description |
|---|---|
|
Enable CSP modeling |
|
Enable storage modeling |
|
Enable hydrogen production |
|
Allow economic retirement |
|
Include startup costs |
|
Apply ramping constraints |
Complete Execution Flow#
1. main() in epm.py
│
├── Parse command-line arguments
│
└── launch_epm_multi_scenarios()
│
├── Read config.csv → Create baseline scenario dictionary
├── Read scenarios.csv (if provided) → Create variant scenarios
├── Apply selected_scenarios filter
├── Perform sensitivity analysis (if enabled)
├── Perform Monte Carlo sampling (if enabled)
├── Create output folder with timestamp
└── Export input_scenarios.csv for documentation
│
└── For each scenario (in parallel via multiprocessing):
│
└── launch_epm() for individual scenario
│
├── Create scenario subfolder
├── Build GAMS command with arguments
└── Execute: gams main.gms <options>
│
└── GAMS Execution:
│
├── Include input_readers.gms
│ ├── Load CSV files via GAMS Connect
│ └── Write all data to input.gdx
│
├── Load input.gdx
│
├── Run Python input_treatment (embedded):
│ ├── Filter to allowed zones
│ ├── Interpolate time series
│ ├── Auto-fill hydro availability
│ ├── Fill defaults
│ └── Expand availability by year
│
├── Run input_verification
├── Include base.gms (model definitions)
├── Solve optimization problem
├── Include generate_report.gms
└── Write epmresults.gdx
│
└── postprocess_output()
├── Extract results from epmresults.gdx
├── Generate CSV outputs
└── Create visualizations
Input Treatment and Preprocessing#
Before the model runs, input_treatment.py automatically processes input data:
Column Renaming: Standardizes column names (e.g.,
uni→g,zone→z)Zone Filtering: Removes generators/transmission not in
zcmap.csvStatus Validation:
Removes generators with invalid Status
Sets Capacity=0 for status not in {1, 2, 3}
Time Series Interpolation: Linearly interpolates yearly parameters
Default Value Handling:
pGenDataInputDefaultfills missingpGenDataInputvaluespAvailabilityDefaultfills missingpAvailabilityvaluespCapexTrajectoriesDefaultfills missingpCapexTrajectories
Hydro Processing (controlled by pSettings flags):
EPM_FILL_HYDRO_AVAILABILITY: Auto-fill missing hydro availabilityEPM_FILL_HYDRO_CAPEX: Auto-fill missing hydro capexEPM_FILL_ROR_FROM_AVAILABILITY: Fill ROR profiles from seasonal availability
Availability Expansion:
pAvailabilityInput(g,q)→pAvailability(g,y,q)by yearApplies
pEvolutionAvailability(g,y)multipliers
Scenarios#
Scenarios are created by overlaying changes on the baseline configuration.
scenarios.csv#
paramNames,ScenarioA,ScenarioB
pSettings,pSettings_alt.csv,
pDemandForecast,,demand/high_demand.csv
pFuelPrice,supply/fuel_high.csv,supply/fuel_low.csv
Empty cells inherit from baseline
Non-empty cells override the baseline file path
Supported Scenario Types#
Type |
Description |
|---|---|
Standard |
Direct overrides via scenarios.csv |
Sensitivity |
Systematic parameter variation |
Monte Carlo |
Sample from uncertainty distributions |
Project Assessment |
Remove specific generators |
Interconnection Assessment |
Remove transmission corridors |
Summary#
config.csv is the master index - maps parameter names to CSV files
pSettings.csv controls behavior - enables/disables features and sets economic parameters
Resources are model constants - shared across all scenarios
Input treatment is automatic - fills gaps, validates, expands dimensions
Scenarios inherit from baseline - only changed parameters need specification
Data flow: CSV → GDX → Python treatment → GAMS optimization → Results GDX → Python postprocessing