Skip to content

Commit 8f04d6c

Browse files
authored
Merge pull request #447 from PyPSA/develop
v0.4.0 Release
2 parents 3e17ad8 + 7edab0b commit 8f04d6c

File tree

83 files changed

+3252
-2975
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+3252
-2975
lines changed

.pre-commit-config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ repos:
5151
- id: docformatter
5252
args: ["--in-place", "--make-summary-multi-line", "--pre-summary-newline"]
5353

54+
5455
- repo: https://github.com/keewis/blackdoc
5556
rev: v0.3.9
5657
hooks:
@@ -60,4 +61,15 @@ repos:
6061
rev: 24.10.0
6162
hooks:
6263
- id: black
64+
language_version: python3.11
65+
args: ["--line-length", "120"]
6366
- id: black-jupyter
67+
language_version: python3.11
68+
args: ["--line-length", "120"]
69+
70+
71+
- repo: https://github.com/pycqa/flake8
72+
rev: 7.1.1
73+
hooks:
74+
- id: flake8
75+
args: [--select=F841] # F841 is the error code for unused variables
179 KB
Loading

docs/source/about-install.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,43 @@ Users can clone the repository using HTTPS, SSH, or GitHub CLI. See [GitHub docs
66

77
### Using HTTPS
88

9-
```bash
10-
$ git clone https://github.com/PyPSA/pypsa-usa.git
9+
```console
10+
git clone https://github.com/PyPSA/pypsa-usa.git
1111
```
1212

1313
### Using SSH-Key
1414

1515
If it your first time cloning a **repository through ssh**, you will need to set up your git with an ssh-key by following these [directions](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent).
1616

17-
```bash
18-
$ git clone [email protected]:PyPSA/pypsa-usa.git
17+
```console
18+
git clone [email protected]:PyPSA/pypsa-usa.git
1919
```
2020

2121
## Step 2. Initialize Configuration files
2222

2323
From the command line, run the script `init_pypsa_usa.sh` to copy configuration file
2424
templates into the `workflow/config` folder.
2525

26-
```bash
27-
$ bash init_pypsa_usa.sh
26+
```console
27+
bash init_pypsa_usa.sh
2828
```
2929

30-
## Step 3: Create Conda Environment
30+
## Step 3: Create Mamba Environment
3131

3232
PyPSA-USA uses conda/mamba to manage project dependencies. You can download and install mamba following the [instructions](https://mamba.readthedocs.io/en/latest/mamba-installation.html). Follow links for mambaforge installation. There are two ways to install mamba, the first (recommended) method will start with a fresh install, meaning if you have previously installed conda environments, you will need to recreate these conda envs. If you already have conda installed and do not wish to install mamba, you can follow the same set of instructions replacing any `mamba` with `conda`
3333

3434
Once mamba is installed, use the environment file within your git repository to activate the `pypsa-usa` conda environment. This step can take ~10-20 minutes. After creating the mamba environment, you will only need to activate it before running the snakemake workflow.
3535

36-
```bash
37-
$ mamba env create -f workflow/envs/environment.yaml
38-
$ mamba activate pypsa-usa
36+
```console
37+
mamba env create -f workflow/envs/environment.yaml
38+
mamba activate pypsa-usa
3939
```
4040

4141
You also have the option to use miniconda. Download [Miniconda](https://docs.conda.io/en/latest/miniconda.html) following their [instructions](https://docs.conda.io/en/latest/miniconda.html).
4242

43+
```{seealso}
44+
If you are planning to develop PyPSA-USA, please see our [contribution guidelines](./contributing.md#code-contributions) for installing additional dependencies
45+
```
4346

4447
## Step 4: Install a Solver
4548

docs/source/about-introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The diagram below illustrates the workflow of PyPSA-USA, highlighting how the da
3030

3131
PyPSA-USA is organized to facilitate easy navigation and efficient execution. Below is the folder structure of the project. Each folder serves a specific purpose, from environment setup to data processing and storage. After running the Snakemake file for the first time, your directory will be built and populated with the necessary data files.
3232

33-
```bash
33+
```console
3434
├── .gitignore
3535
├── README.md
3636
├── LICENSE.md

docs/source/about-usage.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ You can find more information on each configuration setting on the [configuratio
1616

1717
To run the workflow, `cd` into the `workflow` directory and run the `snakemake` from your terminal with your selection of config file:
1818

19-
```bash
19+
```console
2020
snakemake -j1 --configfile config/config.default.yaml
2121
```
2222

@@ -30,7 +30,7 @@ Next, identify the name of the configuration file you would like to run by editi
3030

3131
To run, open a terminal within a login node of your cluster and run the script included in the `workflow` directory:
3232

33-
```bash
33+
```console
3434
bash run_slurm.sh
3535
```
3636

@@ -45,7 +45,7 @@ Result plots and images are automatically built in the `workflow/results` folder
4545

4646
To force the execution of a portion of the workflow up to a given rule, cd to the `workflow` directory and run:
4747

48-
```bash
48+
```console
4949
snakemake -j4 -R build_shapes --until build_base_network
5050
```
5151
where `build_shapes` is forced to run, and `build_base_network` is the last rule you would like to run.

docs/source/config-configuration.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ Sector coupling studies are all under active development. More info to come!
215215
(clustering_cf)=
216216
## `clustering`
217217

218-
When clustering `aggregation_zones` defines the region boundaries which will be respected through the clustering process; State boarders, balancing authority regions, or REeDs shapes. This feature is important for imposing constraints (`opts`) which are defined over specific regions. For example, the data included in the model on interface transfer capacities are prepared for REeDs shapes but not states and BA regions. Moving forward we plan to use REeDs shapes as our default however we will maintain States and BA regions as well.
219218

220219
Each clustering and interconnection option will have a different number of minimum nodes which can be clustered to, an error will be thrown in `cluster_network` notifying you of that number if you have selected a value too low.
221220

docs/source/config-spatial.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Spatial Configuration
2+
3+
## Configuring Spatial Scope
4+
5+
PyPSA-USA allows for flexible configuration of the spatial scope of your energy model, enabling you to define the geographical area and level of detail for your simulations. The **spatial scope** is determined by the `interconnect`, `model_topology` configuration settings.
6+
7+
- `{interconnect}` is used to select which of the three asynchronous interconnection to model. You can select `western`, `eastern`, `texas`, or `usa` to model the entire US.
8+
- After selecting your `{interconnect}`, you can specify `model_topology: include:` to filter individual states or balancing authorities to be selected in your model.
9+
10+
### Example: Modeling California
11+
12+
To create a model that includes only California, you can specify the relevant ReEDS zone IDs (p8-11) as shown below. This will limit the spatial scope to the specified regions within California. Your interconnect could be set to `western` or `usa`.
13+
14+
```yaml
15+
model_topology:
16+
include:
17+
reeds_zone: ['p8', 'p9', 'p10', 'p11']
18+
```
19+
20+
Alternatively, you can use the reeds_state: 'CA' option to achieve the same result by specifying the entire state.
21+
22+
## Configuring Resource Resolution
23+
PyPSA-USA allows you to independently configure the resolution of resource zones from the transmission network. You can control this using the simpl and clusters parameters in the configuration file.
24+
25+
For example, if you want a transmission network with 10 nodes and a resource model with 100 nodes, you would configure it as follows:
26+
27+
```yaml
28+
scenario:
29+
clusters: [10m]
30+
simpl: [100]
31+
```
32+
33+
This setup results in a model with 10 transmission nodes and 100 distinct resource zones, allowing for more granular modeling of renewable resource distribution while keeping the transmission network simplified.
34+
35+
## Configuring Transmission Resolution
36+
37+
### Transmission Network Selection
38+
You can specify the transmission network you want to use by setting the `model_topology: transmission_network:` option. There are two available options:
39+
40+
- 'reeds': The ReEDS NARIS networks.
41+
- 'tamu': The synthetic BE-TAMU nodal network.
42+
43+
When selecting between the three ReEDS NARIS networks, you will need to also specify the `model_topology: topological_boundaries:`. Currently you can set either `county` or `reeds_zone`. To use the FERC 1000 regions, you will need to use the custom network topologies described in the example below.
44+
45+
### Transmission Network Resolution
46+
47+
IF you are using the TAMU/BE network, you can flexibly set an arbitrary number of clusters between the min and max number of nodes. If using a ReEDS NARIS network, you need to specify the minimum number of clusters (nodes) for your modeled interconnection. The number of nodes for each zone is **detailed in the table below**.
48+
49+
If you're working with custom configurations, PyPSA-USA will notify you during the cluster_network stage, indicating the correct number of nodes to set in the clusters configuration.
50+
51+
```{eval-rst}
52+
.. csv-table::
53+
:header-rows: 1
54+
:widths: 22,22,33
55+
:file: datatables/transmission_nodes.csv
56+
```
57+
58+
#### Example: Meshed ReEDS NARIS WECC Topology
59+
60+
If you would like to mesh the three ReEDS NARIS networks you can do so by using the `model_topology: aggregate:` option. For instance, to create a model where California is represented at a county level resolution, but Non-CA WECC areas are represented at the FERC 1000 level, you would configure the model as follows:
61+
62+
63+
```yaml
64+
scenario:
65+
interconnect: [western]
66+
clusters: [87]
67+
simpl: [380] # can be set differently based on number of resource zones you'd like to keep
68+
69+
70+
model_topology:
71+
transmission_network: 'reeds'
72+
topological_boundaries: 'county'
73+
interface_transmission_limits: false
74+
include:
75+
# nothing specified here since we are modeling the entire WECC
76+
aggregate:
77+
trans_grp: ['NorthernGrid_South', 'NorthernGrid_West', 'NorthernGrid_East', 'WestConnect_North','WestConnect_South']
78+
```
79+
80+
This configuration will copper plate the Non-CA regions listed under `trans_grp`, effectively creating a copper-plate network where resources can be clustered and shared across the region. Using these custom aggregation requires information on the region memberships which you can find in `workflow/repo_data/ReEDS_Constraints/membership.csv`.

docs/source/config-wildcards.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,35 +48,28 @@ The `{ll}` wildcard specifies what limits on
4848
line expansion are set for the optimisation model.
4949
It is handled in the rule :mod:`prepare_network`.
5050

51-
The wildcard, in general, consists of two parts:
51+
We reccomend using the line volume limit for constraining
52+
transission expansion. Use ``lv`` (for setting a limit on line volume)
5253

53-
1. The first part can be
54-
``v`` (for setting a limit on line volume) or
55-
``c`` (for setting a limit on line cost)
54+
After ``lv`` you can specify two type of limits:
5655

57-
2. The second part can be
5856
``opt`` or a float bigger than one (e.g. 1.25).
5957

6058
(a) If ``opt`` is chosen line expansion is optimised
61-
according to its capital cost
62-
(where the choice ``v`` only considers overhead costs for HVDC transmission lines, while
63-
``c`` uses more accurate costs distinguishing between
64-
overhead and underwater sections and including inverter pairs).
59+
according to its capital cost.
6560

6661
(b) ``v1.25`` will limit the total volume of line expansion
6762
to 25 % of currently installed capacities weighted by
6863
individual line lengths; investment costs are neglected.
6964

70-
(c) ``c1.25`` will allow to build a transmission network that
71-
costs no more than 25 % more than the current system.
7265

7366
(opts)=
7467
## The `{opts}` wildcard
7568

7669
The `{opts}` wildcard is used for electricity-only studies. It triggers
7770
optional constraints, which are activated in either :mod:`prepare_network` or
7871
the :mod:`solve_network` step. It may hold multiple triggers separated by `-`,
79-
i.e. `Co2L-3H` contains the `Co2L` trigger and the `3H` switch.
72+
i.e. `REM-3H` contains the `REM` regional emissions limit trigger and the `3H` switch.
8073

8174
The REM, SAFER, RPS can be defined using either the reeds zone name 'p##"
8275
the state code (eg, TX, CA, MT), pypsa-usa interconnect name (western, eastern, texas, usa),

docs/source/configtables/clustering.csv

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ feature,str," {'solar+onwind-time', 'solar+onwind-cap', 'solar-time', 'solar-cap
66
cluster_network:,,,
77
algorithm,str,{'kmeans'},
88
feature,str," {'solar+onwind-time', 'solar+onwind-cap', 'solar-time', 'solar-cap', 'solar+offwind-cap'}",For HAC clustering.
9-
aggregation_zones,str,"{'balancing_area', 'state', 'reeds_zone'}",Boundaries of GIS shapes that are to be respected in clustering. Retain if you would like to analyze expansion within a given zone.
109
aggregation_strategies:,,,
1110
table --> {key},str,"{'mean','max','min',etc}","Specifiy the method of aggregating fields within the generators, buses tables. "
1211
focus_weights:,,,
13-
region_name',float,,Specify the proportion of nodes to be attributed to a given zone in the form (California: 0.5) for half of all nodes to be located in California
12+
region_name',float,,Specify the proportion of nodes to be attributed to a given zone in the form (California: 0.5) for half of all nodes to be located in California. Only used with TAMU Network
Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
,Unit,Values,Description
22
conventional_carriers,--,"Any subset of {nuclear, oil, OCGT, CCGT, coal, geothermal, biomass}","List of conventional power plants to include in the model from ``resources/powerplants.csv``. If an included carrier is also listed in ``extendable_carriers``, the capacity is taken as a lower bound."
33
renewable_carriers,--,"Any subset of {solar, onwind, offwind-ac, offwind-dc, hydro}",List of renewable generators to include in the model.
4-
voltage_simplified,kV,int,Voltage level to simplify network to in rule ``simplify_network``
5-
gaslimit,MWhth,float or false,Global gas usage limit (Set False for development)
6-
co2limit,:math:`t_{CO_2-eq}/a`,float,Cap on total annual system carbon dioxide emissions
7-
co2base,:math:`t_{CO_2-eq}/a`,float,Reference value of total annual system carbon dioxide emissions if relative emission reduction target is specified in ``{opts}`` wildcard.
84
retirement, --,One of ``economic`` or ``technical``,"Sets the retirement method for converntional generators. If ``technical`` all generators ``p_nom_min`` are set to ``p_nom`` to prevent selling off of the asset. Retirements are then tracked in post-proccessing. If ``economic`` existing plants have their ``p_nom_min`` set as ``0``, ``p_nom_max`` set to ``p_nom``, and capital costs set to fixed costs. Generators with ``p_nom`` are then added to handle capacity expansion."""
95
,,,
106
operational_reserve:,,,Settings for reserve requirements following `GenX <https://genxproject.github.io/GenX.jl/stable/Model_Reference/core/#Operational-Reserves>`_
11-
--activate,bool,true or false,Whether to take operational reserve requirements into account during optimisation
12-
--epsilon_load,--,float,share of total load
13-
--epsilon_vres,--,float,share of total renewable supply
14-
--contingency,MW,float,fixed reserve capacity
7+
#NAME?,bool,true or false,Whether to take operational reserve requirements into account during optimisation
8+
#NAME?,--,float,share of total load
9+
#NAME?,--,float,share of total renewable supply
10+
#NAME?,MW,float,fixed reserve capacity
1511
,,,
1612
max_hours:,,,
1713
battery,h,float,Maximum state of charge capacity of the battery in terms of hours at full output capacity ``p_nom``. Cf. `PyPSA documentation <https://pypsa.readthedocs.io/en/latest/components.html#storage-unit>`_.
@@ -23,14 +19,14 @@ Store,--,Any subset of {``battery``},Adds extendable storage units (battery and/
2319
Links,--,Any subset of {},Adds extendable linksat every connection where there are lines or HVDC links without capacity limits and with zero initial capacity. Hydrogen pipelines require hydrogen storage to be modelled as ``Store``.
2420
,,,
2521
demand:,,,
26-
--profile,--,"One of {``efs``, ``eia``}",Datasource for electrical load data. ``EFS`` pulls future state level electrical demand data. ``EIA`` pulls historical balancing level electrical demand dataa.
27-
--scale,--,"One of {``efs``, ``aeo``}, or a float",(UNDER DEVELOPMENT) Used to scale the demand profile data. ``AEO`` will scale according to demand projections from the Annual Energy Outlook. ``EFS`` will scale according to growth rates from the Electrification Futures Study. Or can sclae according to a user defined value.
28-
--disaggregation,--,One of {``pop``},Method to dissagreagate load data. ``pop`` will dissagregate based on population from Breakthrough Energy.
22+
#NAME?,--,"One of {``efs``, ``eia``}",Datasource for electrical load data. ``EFS`` pulls future state level electrical demand data. ``EIA`` pulls historical balancing level electrical demand dataa.
23+
#NAME?,--,"One of {``efs``, ``aeo``}, or a float",(UNDER DEVELOPMENT) Used to scale the demand profile data. ``AEO`` will scale according to demand projections from the Annual Energy Outlook. ``EFS`` will scale according to growth rates from the Electrification Futures Study. Or can sclae according to a user defined value.
24+
#NAME?,--,One of {``pop``},Method to dissagreagate load data. ``pop`` will dissagregate based on population from Breakthrough Energy.
2925
scenario:,,,
30-
--efs_case,--,"One of {``reference``, ``medium``, ``high``}",(UNDER DEVELOPMENT) Extracts EFS data according to level of adoption
31-
--efs_speed,--,"One of {``slow``, ``moderate``, ``fast``}",(UNDER DEVELOPMENT) Extracts EFS data according to speed of electrification
32-
--aeo,--,One of the AEO scenarios `here <https://www.eia.gov/outlooks/aeo/data/browser/>`_,(UNDER DEVELOPMENT) Scales future demand according to the AEO scenario
26+
#NAME?,--,"One of {``reference``, ``medium``, ``high``}",(UNDER DEVELOPMENT) Extracts EFS data according to level of adoption
27+
#NAME?,--,"One of {``slow``, ``moderate``, ``fast``}",(UNDER DEVELOPMENT) Extracts EFS data according to speed of electrification
28+
#NAME?,--,One of the AEO scenarios `here <https://www.eia.gov/outlooks/aeo/data/browser/>`_,(UNDER DEVELOPMENT) Scales future demand according to the AEO scenario
3329
,,,
3430
autarky,,,
35-
--enable,bool,``true`` or ``false``,Require each node to be autarkic by removing all lines and links.
36-
--by_country,bool,``true`` or ``false``,Require each region to be autarkic by removing all cross-border lines and links. ``electricity: autarky`` must be enabled.
31+
#NAME?,bool,``true`` or ``false``,Require each node to be autarkic by removing all lines and links.
32+
#NAME?,bool,``true`` or ``false``,Require each region to be autarkic by removing all cross-border lines and links. ``electricity: autarky`` must be enabled.

0 commit comments

Comments
 (0)