Run from Python¶
Programmatic control over runs, from a single baseline to large ensembles of scenarios, sensitivity sweeps, and Monte Carlo analyses.
Prerequisites: Python environment set up. If not done yet, see Installation.
Quick start¶
Open a terminal from inside your EPM repository folder and run:
--folder_input: your input data folder (insideepm/input/)--config: the configuration file that tells EPM which CSV files to use
Results are written to output/simulations_run_<timestamp>/.
Common workflows¶
Run EPM with your own input folder:
Use --simple to relax integer constraints (faster, good for first tests):
Run all scenarios defined in a scenarios.csv file, using 4 CPU cores in parallel:
Run only a subset of scenarios:
Run 50 Monte Carlo samples using an uncertainties definition file:
python epm.py --folder_input my_country --config my_country/config.csv \
--montecarlo --montecarlo_samples 50 \
--uncertainties my_country/uncertainties.csv \
--cpu 8 --reduced_output
Windows prerequisite
Monte Carlo requires chaospy. On Windows, install C++ Build Tools first, then pip install chaospy==4.3.18.
Re-run postprocessing on an existing results folder without re-solving the model:
All options¶
The tables below list every argument you can pass to python epm.py. Arguments are optional unless stated otherwise (the model uses default values for anything not specified).
Core inputs¶
| Argument | Default | Description |
|---|---|---|
--folder_input |
data_test |
Input data folder (inside epm/input/) |
--config |
config.csv |
Configuration file path, relative to folder_input |
--modeltype |
None |
Override solver type: MIP or RMIP |
Scenarios¶
| Argument | Default | Description |
|---|---|---|
--scenarios |
None |
Scenario file. Use without value to load scenarios.csv, or provide a custom path |
-S / --selected_scenarios |
None |
Run only a subset of scenarios. Example: -S baseline HighDemand |
--simple |
None |
Relax integer constraints. Use without arguments for default ['DiscreteCap', 'y'] |
Performance¶
| Argument | Default | Description |
|---|---|---|
--cpu |
1 |
Number of CPU cores for parallel scenario runs |
--reduced_output |
False |
Generate smaller output files (recommended for large Monte Carlo runs) |
--output_zip |
False |
Zip the output folder after processing |
Monte Carlo & sensitivity¶
| Argument | Default | Description |
|---|---|---|
--montecarlo |
False |
Enable Monte Carlo simulation |
--montecarlo_samples |
10 |
Number of random samples |
--uncertainties |
None |
CSV file defining uncertain parameters and their distributions |
--sensitivity |
False |
Enable built-in sensitivity analysis |
Assessment¶
| Argument | Default | Description |
|---|---|---|
--generator_assessment |
None |
Exclude named generators to assess their counterfactual value |
--project_assessment |
None |
Create individual and combined assessment scenarios per project |
--interco_assessment |
None |
Assess the value of a named interconnection |
Regional & country filtering¶
| Argument | Default | Description |
|---|---|---|
--country |
None |
Filter zones to include only those belonging to this country |
--focus_country |
None |
After a regional run, generate single-country inputs for this country |
Postprocessing & output¶
| Argument | Default | Description |
|---|---|---|
--postprocess |
None |
Run postprocessing only on an existing results folder |
--generate_figures |
False |
Generate figures during postprocessing |
--no_plot_dispatch |
Disable dispatch plots (saves time on large runs) | |
--plot_selected_scenarios |
all |
Restrict plots to a subset of scenarios |
--graphs_folder |
img |
Folder where postprocessing plots are saved |
--reduce_definition_csv |
False |
Generate reduced yearly CSV files for Tableau |
--simulation_label |
timestamp | Custom name for the results folder |
Debugging¶
| Argument | Default | Description |
|---|---|---|
--debug |
False |
Enable verbose DEBUG mode in GAMS |
--trace |
False |
Enable TRACE mode in GAMS |
Related¶
- Input Setup: how
config.csv,pSettings, and scenarios work together - Input Catalog: full reference of all input parameters
- Debugging: what to do when the model does not converge