Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GreenHEART Release Preparation #365

Merged
merged 18 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 3 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.9", "3.10" ]
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
Expand All @@ -22,26 +22,17 @@ jobs:
run: |
sudo apt-get update && sudo apt-get install -y libglpk-dev glpk-utils coinor-cbc
python -m pip install --upgrade pip
pip install scikit-learn
pip install -r requirements.txt
- name: Install package
run: |
python setup.py install
pip install ".[develop]"
- name: Create env file
run: |
touch .env
# echo NREL_API_KEY=${{ secrets.NREL_API_KEY }} >> .env
# cat .env
- name: Install test dependencies
run: |
pip install pytest
pip install pytest-subtests
pip install responses
- name: Run tests
run: |
PYTHONPATH=. pytest tests
- name: Lint with flake8
run: |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
pip install flake8
flake8 . --count --exit-zero --statistics --ignore=E501
flake8 . --count --exit-zero --statistics --ignore=E501
2 changes: 1 addition & 1 deletion .github/workflows/conda_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.7
python-version: 3.9
- name: Build and upload conda package
shell: bash -l {0}
env:
Expand Down
29 changes: 17 additions & 12 deletions .github/workflows/publish_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,25 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
if: github.event.action == 'published'
environment:
name: pypi-publishing
url: https://pypi.org/p/greenheart
permissions:
id-token: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
python-version: 3.9
- name: Build package
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
pip install setuptools build wheel twine
python -m build
twine check --strict dist/*
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: True
34 changes: 34 additions & 0 deletions .github/workflows/publish_to_test_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Upload to PyPi

on:
push:
tags:
- 'v*'

jobs:
deploy:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
environment:
name: pypi-publishing
url: https://test.pypi.org/p/greenheart
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Build package
run: |
python -m pip install --upgrade pip
pip install setuptools build wheel twine
python -m build
twine check --strict dist/*
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: True
repository-url: https://test.pypi.org/legacy/

14 changes: 1 addition & 13 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ log/
# needed for h2 test inputs: tests/analysis/results/
*_disp.txt

# Resource files (force add ones that are really needed in the repository)
hopp/simulation/resource_files/wind
hopp/simulation/resource_files/solar
hopp/simulation/resource_files/grid

.idea/*
.idea/workspace.xml
.vscode/
Expand Down Expand Up @@ -126,19 +121,12 @@ tests/greenheart/data/*
tests/greenheart/output.txt
tests/greenheart/test_hydrogen/data/*
tests/greenheart/test_hydrogen/output.txt
hopp/simulation/resource_files/*/*.csv
hopp/simulation/resource_files/*/*.srw
examples/reference_plants/*/output/*
*speed_dir_data.csv
examples/greenheart/*/data
examples/greenheart/*/figures
tests/greenheart/reports/
tests/greenheart/test_hydrogen/output/
tests/hopp/data/
tests/reports/
tests/data/
tests/resource_files/
tests/test_dump.txt

output*
snopt_history.txt
reports/*
31 changes: 0 additions & 31 deletions .readthedocs.yaml

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CHANGELOG

## v0.1 [16 October 2024]

- Project has been separated from HOPP and moved into GreenHEART, removing all HOPP infrastructure.
143 changes: 88 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,105 +1,138 @@
# Packages
# Packages

## HOPP: Hybrid Optimization and Performance Platform
## GreenHEART: Green Hydrogen Energy and Renewable Technologies

![CI Tests](https://github.com/NREL/HOPP/actions/workflows/ci.yml/badge.svg)
[![PyPI version](https://badge.fury.io/py/greeheart.svg)](https://badge.fury.io/py/hopp)
![CI Tests](https://github.com/NREL/GreenHEART/actions/workflows/ci.yml/badge.svg)
[![image](https://img.shields.io/pypi/pyversions/greeheart.svg)](https://pypi.python.org/pypi/greeheart)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)

As part of NREL's [Hybrid Energy Systems Research](https://www.nrel.gov/wind/hybrid-energy-systems-research.html), this
software assesses optimal designs for the deployment of utility-scale hybrid energy plants, particularly considering wind,
solar and storage.
Hybrid project power-to-x component-level system performance and financial modeling for control and
design optimization. Currently includes renewable energy, hydrogen, ammonia, and steel. Other
elements such as desalination systems, pipelines, compressors, and storage systems can also be
included as needed.

## GreenHEART: Grean Hydrogen Energy and Renewable Technologies
Hybrid project power-to-x component-level system performance and financial modeling for control and design optimization. Currently includes renewable energy, hydrogen, ammonia, and steel. Other elements such as desalination systems, pipelines, compressors, and storage systems can also be included as needed.

`greenheart` will install alongside `hopp` by following the instructions for installing HOPP from source.
`greenheart` will install alongside `hopp` by following the instructions for installing HOPP from
source.

## Software requirements

- Python version 3.8, 3.9, 3.10 64-bit
- Other versions may still work, but have not been extensively tested at this time

## Installing from Package Repositories
1. HOPP is available as a PyPi package:

1. GreenHEART is available as a PyPi package:

```bash
pip install greenheart
```
pip install HOPP
```

## Installing from Source
## Installing from Source

1. Using Git, navigate to a local target directory and clone repository:
```
git clone https://github.com/NREL/HOPP.git
```

2. Navigate to `HOPP`
```
cd HOPP
```bash
git clone https://github.com/NREL/GreenHEART.git
```

3. Create a new virtual environment and change to it. Using Conda and naming it 'hopp':
```
conda create --name hopp python=3.8 -y
conda activate hopp
```
2. Navigate to `GreenHEART`

4. Install dependencies:
```
conda install -c conda-forge coin-or-cbc=2.10.8 -y
conda install -c conda-forge glpk -y
pip install -r requirements.txt
```bash
cd GreenHEART
```

Note if you are on Windows, you will have to manually install Cbc: https://github.com/coin-or/Cbc

If you also want development dependencies for running tests and building docs:
3. Create a new virtual environment and change to it. Using Conda and naming it 'greenheart':

```
pip install -r requirements-dev.txt
```bash
conda create --name greenheart python=3.9 -y
conda activate greenheart
```

5. Install HOPP:
```
pip install -e .
4. Install GreenHEART and its dependencies:

```bash
conda install -y -c conda-forge coin-or-cbc=2.10.8 glpk
```

6. The functions which download resource data require an NREL API key. Obtain a key from:

Note if you are on Windows, you will have to manually install Cbc: https://github.com/coin-or/Cbc.

- If you want to just use GreenHEART:

```bash
pip install .
```

- If you want to work with the examples:

```bash
pip install ".[examples]"
```

- If you also want development dependencies for running tests and building docs:

```bash
pip install -e ".[develop]"
```

- In one step, all dependencies can be installed as:

```bash
pip install -e ".[all]
```

5. The functions which download resource data require an NREL API key. Obtain a key from:

[https://developer.nrel.gov/signup/](https://developer.nrel.gov/signup/)


7. To set up the `NREL_API_KEY` and `NREL_API_EMAIL` required for resource downloads, you can create Environment Variables called `NREL_API_KEY` and `NREL_API_EMAIL`. Otherwise, you can keep the key in a new file called ".env" in the root directory of this project.
6. To set up the `NREL_API_KEY` and `NREL_API_EMAIL` required for resource downloads, you can create
Environment Variables called `NREL_API_KEY` and `NREL_API_EMAIL`. Otherwise, you can keep the key
in a new file called ".env" in the root directory of this project.

Create a file ".env" that contains the single line:
```

```bash
NREL_API_KEY=key
[email protected]
```

8. Verify setup by running tests:
```
7. Verify setup by running tests:

```bash
pytest
```


2. To set up `NREL_API_KEY` for resource downloads, first refer to section 7 and 8 above. But for the `.env` file method,
the file should go in the working directory of your Python project, e.g. directory from where you run `python`.
2. To set up `NREL_API_KEY` for resource downloads, first refer to section 7 and 8 above. But for
the `.env` file method, the file should go in the working directory of your Python project, e.g.
directory from where you run `python`.

## Parallel Processing for GreenHEART finite differences and design of experiments
GreenHEART is set up to run in parallel using MPI and PETSc for finite differencing and for design of experiments runs through OpenMDAO. To use this capability you will need to follow the addtional installation instruction below:
```
conda install -c conda-forge mpi4py petsc4py

GreenHEART is set up to run in parallel using MPI and PETSc for finite differencing and for design of
experiments runs through OpenMDAO. To use this capability you will need to follow the addtional installation
instruction below:

```bash
conda install -c conda-forge mpi4py petsc4py
```

For more details on implementation and installation, reference the documentation for OpenMDAO.

To to check that your installation is working, do the following:
```
cd tests/greenheart/
mpirun -n 2 pytest test_openmdao_mpi.py

```bash
cd tests/greenheart/
mpirun -n 2 pytest test_openmdao_mpi.py
```

## Getting Started

The [Examples](./examples/) contain Jupyter notebooks and sample YAML files for common usage scenarios in HOPP. These are actively maintained and updated to demonstrate HOPP's capabilities. For full details on simulation options and other features, see the [documentation](https://hopp.readthedocs.io/en/latest/).
The [Examples](./examples/) contain Jupyter notebooks and sample YAML files for common usage
scenarios in GreenHEART. These are actively maintained and updated to demonstrate GreenHEART's
capabilities. For full details on simulation options and other features, documentation is
forthcoming.

## Contributing

Interested in improving HOPP? Please see the [Contributing](./CONTRIBUTING.md) section for more information.
Interested in improving GreenHEART? Please see the [Contributing](./CONTRIBUTING.md) section for more information.
Loading
Loading