Skip to content

Commit 021f0fd

Browse files
committed
Merge remote-tracking branch 'origin/master' into HydroCHiPPs
2 parents 4cb4fcc + c5cb043 commit 021f0fd

File tree

159 files changed

+81199
-5137
lines changed

Some content is hidden

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

159 files changed

+81199
-5137
lines changed

.github/workflows/python-app.yml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,48 @@ jobs:
1919

2020
steps:
2121
- uses: actions/checkout@v4
22+
2223
- name: Set up Python 3.10
2324
uses: actions/setup-python@v3
2425
with:
2526
python-version: "3.10"
26-
cache: 'pip'
27+
2728
- name: Install dependencies
2829
run: |
2930
python -m pip install --upgrade pip
3031
pip install flake8
3132
pip install .
33+
3234
- name: Lint with flake8
3335
run: |
3436
# stop the build if there are Python syntax errors or undefined names
35-
flake8 . --ignore=E501,F401,W503,E266 --count --select=E9,F63,F7,F82 --show-source --statistics
37+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
3638
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
37-
flake8 . --ignore=E501,F401,W503,E266 --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
38-
- name: Test with unittest
39+
flake8 . --ignore=E501,W503,E266,C901 --count --exit-zero --max-complexity=10 --statistics
40+
41+
- name: Unit testing
3942
run: |
40-
python -m unittest discover src/test_pownet
43+
coverage run -m unittest discover src/test_pownet
44+
echo "--------------------------------------------------" # For clarity in logs
45+
echo "DEBUG: Coverage text report from CI environment:"
46+
coverage report -m # <<< THIS IS THE CRITICAL OUTPUT NEEDED
47+
echo "--------------------------------------------------"
48+
coverage json
49+
COVERAGE_PERCENT=$(python -c "import json; print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
50+
echo "Total Coverage: $COVERAGE_PERCENT%"
51+
echo "total=$COVERAGE_PERCENT" >> $GITHUB_ENV
52+
53+
- name: Code coverage
54+
uses: schneegans/[email protected]
55+
with:
56+
auth: ${{ secrets.GIST_TOKEN }}
57+
gistID: 23c151ad08ede7f698ce7cfbc2c09a0a
58+
filename: covbadge.json
59+
label: Coverage
60+
message: ${{ env.total }}%
61+
minColorRange: 50
62+
maxColorRange: 90
63+
valColorRange: ${{ env.total }}
64+
65+
66+

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,9 @@ user_inputs/*
119119
# Ignore subfolders in the analysis folder
120120
src/analysis/decom_files/*
121121
src/analysis/results/*
122-
scripts/scratch.py
122+
scripts/*
123123

124124
# Pownet generated files
125125
/model_library/*/pownet_*.csv
126126
/model_library/*/pownet_*.json
127+
coverage.json

.readthedocs.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ build:
77

88
python:
99
install:
10+
# Install dependencies for Read the Docs
1011
- requirements: docs/requirements.txt
12+
# Install PowNet package
13+
- method: pip
14+
path: .
1115

1216
sphinx:
1317
configuration: docs/source/conf.py
18+

README.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
![license MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
22
[![CI Tests](https://github.com/Critical-Infrastructure-Systems-Lab/PowNet/actions/workflows/python-app.yml/badge.svg)](https://github.com/Critical-Infrastructure-Systems-Lab/PowNet/actions)
3+
[![Coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/phumthep/23c151ad08ede7f698ce7cfbc2c09a0a/raw/covbadge.json)](https://github.com/Critical-Infrastructure-Systems-Lab/PowNet/actions)
34
[![GitHub Release](https://img.shields.io/github/v/release/Critical-Infrastructure-Systems-Lab/PowNet)](https://github.com/Critical-Infrastructure-Systems-Lab/PowNet/releases/tag/v2.0)
45
[![Read the Docs](https://img.shields.io/readthedocs/pownet)](https://pownet.readthedocs.io/en/latest/)
6+
[![status](https://joss.theoj.org/papers/f7509a62fde550bec7ae3d1da0181b7d/status.svg)](https://joss.theoj.org/papers/f7509a62fde550bec7ae3d1da0181b7d)
57

6-
# PowNet: Unit Commitment / Economic Dispatch model in Python
7-
PowNet is a least-cost optimization model for simulating the Unit Commitment and Economic Dispatch (UC/ED) of large-scale (regional to country) power systems. In PowNet, a power system is represented by a set of nodes that include power plants, high-voltage substations, and import/export stations (for cross-border systems). The model schedules and dispatches the electricity supply from power plant units to meet hourly electricity demand in substations at a minimum cost. It considers the techno-economic constraints of both generating units and high-voltage transmission network. The power flow calculation is based on a Direct Current (DC) network (with N-1 criterion), which provides a reasonable balance between modelling accuracy and data and computational requirements. PowNet can easily integrate information about variable renewable resources (e.g., hydro, wind, solar) into the UC/ED process. For example, it can be linked with models that estimate the electricity supply available from renewable resources as a function of the climatic conditions. In addition, PowNet has provision to account for the effect of droughts on the generation of dispatchable thermal units (e.g., coal, oil, gas-fired units) that depend on freshwater availability. These features facilitate the application of PowNet to problems in the water-energy nexus domain that investigate the impact of water availability on electricity supply and demand.
8+
# PowNet: A Production Cost Modeling Framework for Large-scale Power Systems
9+
PowNet is an open-source production cost model (PCM) framework written in Python, designed to simulate the operational scheduling of large-scale (regional or national) power systems. It determines the least-cost schedule for power generation by solving the unit commitment (UC) and economic dispatch (ED) problems – a process commonly used for applications like day-ahead market simulation. Designed for users focused on power system analysis rather than complex model development, PowNet uses simple spreadsheet files for data inputs, significantly simplifying model setup and modification. As for advanced users, the framework's modular design provides modeling flexibility to implement customized analysis or explore complex modeling algorithms.
810

9-
Read the PowNet Documentation here: https://pownet.readthedocs.io/en/latest
11+
## Key functionalities
12+
- Models power systems including generator techno-economic constraints and network limits
13+
- Uses computationally efficient linearized DC power flow for network analysis
14+
- Supports variable renewable energy (VRE) sources, such as hydro, wind, and solar
15+
- Built for computational speed using the high-performance Gurobipy modeling framework with support for the open-source HiGHS solver
16+
- Includes features allowing the analysis of water-energy nexus impacts (e.g., drought effects on thermal units)
1017

11-
## Installing and using PowNet
18+
PowNet enables analysts to readily study grid operations, VRE integration, and water-energy interactions in a low-code environment. For advanced users, it retains the flexibility needed to explore complex model configurations and research modeling algorithms.
19+
20+
Read the Documentation for more information at https://pownet.readthedocs.io/en/latest.
21+
22+
## Using PowNet
1223
To use PowNet, a user needs to supply it with CSV files. For guidance on creating these CSV files, please see examples provided [here](https://github.com/Critical-Infrastructure-Systems-Lab/PowNet/tree/master/model_library). Please ensure that column names matches with those from the examples. Details on preparing some input files can be found [here](https://critical-infrastructure-systems-lab.github.io/manual/docs/CIS-Lab-software).
1324

1425
As for installing PowNet, there are multiple options depending on whether we want to modify the source code. However, the following step is highly recommended for any user: creating a virtual environment to manage dependencies. If using Conda, we can create an envrionment with the following command
@@ -45,7 +56,7 @@ working_directory/
4556
└── outputs/
4657
```
4758

48-
A Python script called "[run_quickstart.py](https://github.com/Critical-Infrastructure-Systems-Lab/PowNet/blob/master/scripts/run_quickstart.py)" provides an example on running a simulation, saving the simulation outputs, and visualizing the outputs.
59+
A tutorial "[quickstart.py](./examples/quickstart.ipynb)" provides an example on running a simulation, saving the simulation outputs, and visualizing the outputs.
4960

5061
### Option 2: Power user (no pun intended)
5162
In case we wish to modify the source code, PowNet should be installed as an editable package. First, download or clone the PowNet repository to your local machine. For example: if we want to clone to "C://user/pownet",
@@ -68,10 +79,9 @@ pip install -e .
6879

6980
This command installs the package in "editable" mode (-e) using pyproject.toml that is located in the root directory of PowNet. The editable mode allows us to edit PowNet codebase when we need to modify or implement new features. The pyproject.toml file specifies the dependencies required to run PowNet.
7081

71-
A quick start tutorial to run a simple case study is provided here: https://pownet.readthedocs.io/en/latest/pages/quickstarter.html
7282

7383
## Overview of PowNet
7484

75-
![overview_pownet](./docs/overview_pownet.png)
85+
![overview_pownet](./joss_submission/overview_pownet.png)
7686

7787

README.rst

Lines changed: 0 additions & 13 deletions
This file was deleted.

docs/.github/CODE_OF_CONDUCT.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
2+
# Contributor Covenant Code of Conduct
3+
4+
## Our Pledge
5+
6+
We pledge to foster a harassment-free community where every person is treated with decency and respect as a fellow human being.
7+
8+
## Our Standards
9+
10+
Examples of behavior that contributes to a positive environment for our
11+
community include:
12+
13+
* Demonstrating empathy and kindness toward other people
14+
* Being respectful of differing opinions, viewpoints, and experiences
15+
* Giving and gracefully accepting constructive feedback
16+
* Accepting responsibility and apologizing to those affected by our mistakes,
17+
and learning from the experience
18+
* Focusing on what is best not just for us as individuals, but for the overall
19+
community
20+
21+
Examples of unacceptable behavior include:
22+
23+
* Conducts which could reasonably be considered inappropriate in a
24+
professional setting
25+
* Trolling, insulting or derogatory comments, and personal or political attacks
26+
* Public or private harassment
27+
* Publishing others' private information, such as a physical or email address,
28+
without their explicit permission
29+
30+
31+
## Enforcement Responsibilities
32+
33+
Community leaders are responsible for clarifying and enforcing our standards of
34+
acceptable behavior and will take appropriate and fair corrective action in
35+
response to any behavior that they deem inappropriate, threatening, offensive,
36+
or harmful.
37+
38+
Community leaders have the right and responsibility to remove, edit, or reject
39+
comments, commits, code, wiki edits, issues, and other contributions that are
40+
not aligned to this Code of Conduct, and will communicate reasons for moderation
41+
decisions when appropriate.
42+
43+
## Scope
44+
45+
This Code of Conduct applies within all community spaces, and also applies when
46+
an individual is officially representing the community in public spaces.
47+
Examples of representing our community include using an official email address,
48+
posting via an official social media account, or acting as an appointed
49+
representative at an online or offline event.
50+
51+
## Enforcement
52+
53+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
54+
reported to the community leaders responsible for enforcement
55+
[here](https://github.com/stefano-galelli).
56+
All complaints will be reviewed and investigated promptly and fairly.
57+
58+
All community leaders are obligated to respect the privacy and security of the
59+
reporter of any incident.
60+
61+
## Enforcement Guidelines
62+
63+
Community leaders will follow these Community Impact Guidelines in determining
64+
the consequences for any action they deem in violation of this Code of Conduct:
65+
66+
### 1. Correction
67+
68+
**Community Impact**: Use of inappropriate language or other behavior deemed
69+
unprofessional or unwelcome in the community.
70+
71+
**Consequence**: A private, written warning from community leaders, providing
72+
clarity around the nature of the violation and an explanation of why the
73+
behavior was inappropriate. A public apology may be requested.
74+
75+
### 2. Warning
76+
77+
**Community Impact**: A violation through a single incident or series of
78+
actions.
79+
80+
**Consequence**: A warning with consequences for continued behavior. No
81+
interaction with the people involved, including unsolicited interaction with
82+
those enforcing the Code of Conduct, for a specified period of time. This
83+
includes avoiding interactions in community spaces as well as external channels
84+
like social media. Violating these terms may lead to a temporary or permanent
85+
ban.
86+
87+
### 3. Temporary Ban
88+
89+
**Community Impact**: A serious violation of community standards, including
90+
sustained inappropriate behavior.
91+
92+
**Consequence**: A temporary ban from any sort of interaction or public
93+
communication with the community for a specified period of time. No public or
94+
private interaction with the people involved, including unsolicited interaction
95+
with those enforcing the Code of Conduct, is allowed during this period.
96+
Violating these terms may lead to a permanent ban.
97+
98+
### 4. Permanent Ban
99+
100+
**Community Impact**: Demonstrating a pattern of violation of community
101+
standards, including sustained inappropriate behavior, harassment of an
102+
individual, or aggression toward or disparagement of classes of individuals.
103+
104+
**Consequence**: A permanent ban from any sort of public interaction within the
105+
community.
106+
107+
## Attribution
108+
109+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
110+
version 2.1, available at
111+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
112+
113+
Community Impact Guidelines were inspired by
114+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
115+
116+
For answers to common questions about this code of conduct, see the FAQ at
117+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
118+
[https://www.contributor-covenant.org/translations][translations].

0 commit comments

Comments
 (0)