Setup guide: COPPER-PRAS¶
This page covers the pieces that are specific to running PRAS through M3-linkages. COPPER itself is installed exactly as for the CIMS-COPPER-SILVER linkage; only the COPPER and linkage-runner steps from that page are needed (no CIMS, no SILVER).
1. Prerequisites¶
- Conda (Anaconda or Miniconda).
- Julia 1.10 or newer on the
PATH. On Digital Research Alliance clusters the runner loadsjulia/1.10.0; pras-linkage's own SLURM script usesjulia/1.11.3. - A CODERS API key from https://coders.cme-emh.ca/. CEM mode still needs CODERS for the network backbone.
- An optimisation solver for COPPER (CPLEX recommended, GLPK for tests).
2. Linkage runner on the PRAS branch¶
git clone https://gitlab.com/sesit/M3-linkages.git
cd M3-linkages
git checkout PRAS
conda create -n m3linkages_env python=3.10
conda activate m3linkages_env
pip install -r requirements.txt
The PRAS branch is where linkage.py accepts ["COPPER", "PRAS"] and where
scripts/pras_runner.py lives.
3. COPPER¶
Follow the COPPER steps of the CIMS-COPPER-SILVER setup guide, cloning into
dependencies/copper. Check out the branch you intend to reproduce, for
example lmp_testing_clean for the Electricity Canada work.
4. pras-linkage and its environments¶
Either run the interactive installer, which handles every step below for the
model named PRAS:
python cli.py
(it clones pras-linkage main, creates the pras_env Conda environment on
Python 3.10, installs the Python requirements and adds the Julia packages), or
do it by hand so that you can choose the branch:
git clone https://gitlab.com/sesit/pras-linkage.git dependencies/pras-linkage
cd dependencies/pras-linkage
git checkout dev
conda create -n pras_env python=3.10
conda activate pras_env
pip install -r requirements.txt
requirements.txt includes coders2iamc; if you are offline, install it from
the bundled wheels with pip install --find-links=./wheels coders2iamc.
Then install the Julia side once:
julia -e 'using Pkg; Pkg.add(["PRAS", "HDF5", "CSV", "DataFrames", "PRASCapacityCredits"])'
PRASCapacityCredits is only needed for the EFC and ELCC analyses.
5. The [Models.PRAS] block in config.toml¶
Add this to a scenario's config.toml beside [Models.COPPER] and set
models_to_run = ["COPPER", "PRAS"] under [General].
[Models.PRAS]
repo_path = "dependencies\pras-linkage" # double backslashes on Windows
env_name = "pras_env"
[Models.PRAS.Config]
year = 2050 # target year of the adequacy assessment
demand_year = 2050 # defaults to year
merra_year = 2021 # VRE capacity-factor weather year; defaults to [CODERS].vre_year
pras_samples = 10000 # Monte Carlo samples
test_pras_samples = 100 # used when linkage.py runs with -t
mode = "cem"
aggregate_provinces = false
include_interprovincial = true
new_transmission_mode = "distribute" # or "new_line"
apply_weather_multipliers = false
weather_multiplier_scenario = 2025 # folder under pras-linkage/configurations/
# provinces = ["BC", "AB"] # optional override; default is [CODERS].regions
# efc_enabled = false, efc_baseline_scenario, efc_comparison_scenario,
# efc_capacity_bound = 2608, efc_samples = 101
Every key the runner writes into pras-linkage's config.yaml:
| Key | Default | Meaning |
|---|---|---|
year |
2050 |
Year of the COPPER solution to assess; also selects the weather-multiplier year when weather_multiplier_scenario is unset. |
demand_year |
year |
COPPER demand year to load. |
merra_year |
[CODERS].vre_year, else 2021 |
Weather year for wind and solar hourly capacity factors. |
pras_samples |
10000 |
Sequential Monte Carlo samples. |
test_pras_samples |
min(pras_samples, 100) |
Samples used in test mode (-t). |
provinces |
[CODERS].regions |
Provinces to include; long names or two-letter codes both accepted. |
mode |
"cem" |
cem uses COPPER outputs; coders assesses the CODERS fleet alone (standalone use). |
aggregate_provinces |
false |
Collapse nodes to one region per province after preprocessing. |
include_interprovincial |
true |
Keep interprovincial lines and interfaces. |
new_transmission_mode |
"distribute" |
How COPPER's new transmission is represented: spread over existing corridors, or as new lines. |
apply_weather_multipliers |
false |
Scale capacity and outage probabilities by type and region. |
weather_multiplier_scenario |
year |
Folder name under pras-linkage/configurations/ holding the multiplier CSVs. |
api_key |
[CODERS].api_key |
CODERS key. |
efc_enabled, efc_baseline_scenario, efc_comparison_scenario, efc_capacity_bound, efc_samples |
off, 2608, 101 |
Equivalent-firm-capacity comparison between two already-built PRAS systems. |
Two values are fixed by the runner and cannot be set from config.toml:
the pras-linkage scenario name is always pras, and cem_path is always
<iteration folder>/copper/outputs.
6. Running on a SLURM cluster¶
scripts/pras_runner.sh is a SLURM job that runs only the PRAS stage
against COPPER outputs that already exist in the scenario's iteration folder:
sbatch scripts/pras_runner.sh -lp scenarios/<scenario> -i 1 [-t] [-o /scratch/<user>/m3]
It loads StdEnv/2023 python/3.10 gcc/12.3 julia/1.10.0, builds an ephemeral
virtual environment in $SLURM_TMPDIR, installs pras-linkage's requirements
from wheels/ where the cluster has no index, then calls
pras_runner.py --slurm to write the configuration and main.py to run it.
Run COPPER first with the COPPER SLURM script from the CIMS-COPPER-SILVER
linkage.