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

Hercules v1.1 #116

Merged
merged 46 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d862f0a
Update README.md
jfrederik-nrel Dec 22, 2023
d4e65b2
Add alternative standin for AMR-wind that runs FLORIS (#63)
misi9170 Jan 30, 2024
bfc53ba
Update README.md (#65)
genevievestarke Jan 30, 2024
f30f582
Bugfix -- track floris v4 change in input file. (#66)
misi9170 Feb 5, 2024
2b0536b
simple_battery unit tests (#64)
ZackTully Feb 6, 2024
cec5d88
Fix sync issue (#74)
genevievestarke Feb 7, 2024
176d9e7
Remove main branch for deploy-pages; would like to build from develop…
misi9170 Feb 26, 2024
6fb874a
Bugfix: generator_efficiency usage changed in FLORIS; this tracks tha…
misi9170 Feb 26, 2024
3a58379
Enable passing power setpoints to wind simulators (#76)
misi9170 Feb 26, 2024
bf2cf51
[BUGFIX] Update FlorisStandin to use set() run() paradigm introduced …
misi9170 Feb 27, 2024
2720b10
Updating installation documentation (#81)
genevievestarke Feb 27, 2024
36d5dce
Updating documentation settings
genevievestarke Feb 27, 2024
3a795a1
[BUGFIX] Reenable AMR-Wind by setting up empty power_setpoints (#85)
misi9170 Feb 27, 2024
3983659
Final documentation setup change
genevievestarke Feb 27, 2024
d7f199e
Feature/update example 6 (#84)
paulf81 Feb 27, 2024
26aeeca
remove file suffix
paulf81 Feb 28, 2024
94c095b
Use symlinks for example docs
paulf81 Feb 28, 2024
f3f815e
Adda few more lines
paulf81 Feb 28, 2024
d59814e
force rebuild
paulf81 Feb 28, 2024
8293ecb
Direct copy
paulf81 Feb 28, 2024
8da5425
Back to soft link
paulf81 Feb 28, 2024
9c9a10d
Copy again
paulf81 Feb 28, 2024
32e9976
Adding PV module unit tests and documentation (#79)
brookeslawski Mar 4, 2024
f598a1a
Merge remote-tracking branch 'upstream/main' into develop
misi9170 Mar 7, 2024
bcee3c3
Refactor example 7 (#87)
paulf81 Mar 12, 2024
e552a8b
Smooth output of FlorisStandin to prevent oscilations in closed-loop …
misi9170 Mar 25, 2024
db5e959
[BUGFIX] Create outputs folder in examples to avoid error when output…
misi9170 Mar 26, 2024
070423f
Feature/battery cell model (#91)
ZackTully Mar 28, 2024
0940dc8
Bugfix/floris standin (#101)
brookeslawski Apr 9, 2024
320315d
Feature/floris electrolyzer example (#77)
genevievestarke Apr 11, 2024
a128bd4
Change FLORIS to a "regular" requirement (#103)
misi9170 Apr 12, 2024
6f9f4e3
Adding solar controller and replacing AMR-Wind standin with FLORIS st…
brookeslawski Apr 16, 2024
7f2d024
Fix bug in documentation build
genevievestarke Apr 16, 2024
f18af0c
Added AMR-Wind+OpenFAST example (including batch script) (#89)
jfrederik-nrel Apr 18, 2024
f7c07f5
rebuild pages
genevievestarke Apr 18, 2024
cf41f6d
Fix deploy-pages typo?
genevievestarke Apr 18, 2024
6dd0d1d
Updating toc file for docs
genevievestarke Apr 18, 2024
ce73790
Fixing typos in toc and deploy pages files
genevievestarke Apr 18, 2024
d013dd9
Update readme for Examples 08 and 09
genevievestarke Apr 18, 2024
cb6e99a
updated installation docs (#106)
achenry Apr 29, 2024
ad29cf8
Add external controls for solar PySAM module (#107)
misi9170 May 16, 2024
446ca31
[BUGFIX] Force `yaw_angles` to zero in `FlorisStandin` when `power_se…
misi9170 Jul 30, 2024
ec97c75
Improving indexing of solar weather file based on dt in input .yaml f…
brookeslawski Aug 31, 2024
69ed95c
Enable heterogeneous inflow in `FlorisStandin` (#112)
misi9170 Sep 20, 2024
8eb579e
Fix solar pysam bug for when an external signal is defined (#115)
genevievestarke Sep 20, 2024
6330d15
Update to version 1.1
misi9170 Sep 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/check-working-examples.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Check Examples APIs

on: [push, pull_request]

jobs:

examples-check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
os: [ubuntu-latest] #, macos-latest, windows-latest]
fail-fast: False

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[develop]"
pip install git+https://github.com/NREL/electrolyzer.git
pip install https://github.com/NREL/SEAS/blob/main/SEAS.tar.gz?raw=true
pip install git+https://github.com/NREL/floris.git@v4
- name: Run example 06_amr_wind_standin_and_battery
# Run all examples and test that they finish successfully. Do not evaluate the results.
# Copy the examples to a new directory outside of the repo to ensure that there is no
# reliance on the repo directory structure.
run: |

#mkdir -p temp1/temp2/temp3
#cp -rv example_case_folders/06_amr_wind_standin_and_battery/ temp1/temp2/temp3/.
# cd temp1/temp2/temp3/06_amr_wind_standin_and_battery/
cd example_case_folders/06_amr_wind_standin_and_battery/

error_found=0 # 0 is false
error_results="Error in example:"

# Try running the bash script
if ! bash batch_script.sh; then
error_results="${error_results}"$'\n'" - run_example.sh"
error_found=1
fi

if [[ ! $error_found ]]; then
echo "${error_results}"
fi

exit $error_found
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: False
matrix:
python-version: ["3.9", "3.10", "3.11"]
os: [ubuntu-latest]
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v3
Expand All @@ -27,7 +27,7 @@ jobs:
# - uses: pre-commit/[email protected]
- name: Run ruff
run: |
ruff .
ruff check .
# ruff format
- name: Run tests and collect coverage
run: |
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/deploy-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ jobs:
- name: Install dependencies
run: |
pip install -e ".[docs]"

- name: Make copies of example docs
run: |
mkdir -vp docs/examples
cp -v example_case_folders/05_floris_wind_standin_and_electrolyzer/README.md docs/examples/05_floris_wind_standin_and_electrolyzer.md
cp -v example_case_folders/06_amr_wind_standin_and_battery/README.md docs/examples/06_amr_wind_standin_and_battery.md
cp -v example_case_folders/07_floris_standin_and_solar_pysam/README.md docs/examples/07_floris_standin_and_solar_pysam.md
cp -v example_case_folders/08_floris_only/README.md docs/examples/08_floris_only.md
cp -v example_case_folders/09_amr_wind_openfast/README.md docs/examples/09_amr_wind_openfast.md
ls -l docs/examples

# Build the book
- name: Build the book
Expand Down
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,17 @@ hercules/local_amr_wind_demo/sample_copy.nc

#Ignore csv files
*.csv
!tests/test_inputs/*.csv
!example_case_folders/10_heterogeneous_wind/floris_standin_data.csv
!example_case_folders/10_heterogeneous_wind/wind_power_reference_data.csv

# Some output files to ignore
t_00*
logdummy
loghercules
logstandin
loghelics
loghercules*
logstandin*
logfloris*
*echo
*out-example.json

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# README

# hercules
Hercules, based on the acronym "Hybrid Energy and Control Using Large Eddy Simulations", is an open-source tool for wind-based hybrid plant simulation in real time. Hercules is based around high fidelity wind farm flow simulations through AMR-Wind, co-simulated with a hybrid plant that includes solar, storage, and generation. The entire hybrid plant can be controlled using the Wind Hybrid Open Controller (WHOC).
Hercules, based on the acronym "Hybrid Energy and Control Using Large Eddy Simulations", is an open-source tool for wind-based hybrid plant simulation in real time. Hercules is based around high fidelity wind farm flow simulations through AMR-Wind, co-simulated with a hybrid plant that includes solar, storage, and generation. The entire hybrid plant can be controlled using the [Wind Hybrid Open Controller (WHOC)](https://github.com/nrel/wind-hybrid-open-controller).

# Documentation

Expand Down
37 changes: 2 additions & 35 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
title: HERCULES
author: National Renewable Energy Laboratory
logo: herc.png
copyright: '2023'
copyright: '2024'
only_build_toc_files: false

# Force re-execution of notebooks on each build.
Expand All @@ -25,7 +25,7 @@ bibtex_bibfiles:
repository:
url: https://github.com/NREL/hercules
path_to_book: docs
branch: main
branch: develop

# Add GitHub buttons to your book
# See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository
Expand All @@ -36,37 +36,4 @@ html:
google_analytics_id: G-3V1BDK8KEJ


# Sphinx for API doc generation
sphinx:
extra_extensions:
- 'sphinx.ext.autodoc'
- 'sphinx.ext.autosummary'
- 'sphinx.ext.viewcode'
- 'sphinx_autodoc_typehints'
- 'sphinxcontrib.autoyaml'
- 'sphinx.ext.napoleon' # Formats google and numpy docstring styles
- 'sphinxcontrib.mermaid'
config:
html_theme: sphinx_book_theme
templates_path:
- '_templates'
language: 'python'
autoyaml_level: 3
autosummary_generate: true

# Autodoc config reference
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#configuration
autodoc_default_options:
members: true
member-order: bysource
undoc-members: true
private-members: true
# special-members: true
# inherited-members
# show-inheritance
# ignore-module-all
# imported-members: true
# exclude-members
# class-doc-from
# no-value
autodoc_typehints: both
34 changes: 0 additions & 34 deletions docs/_templates/custom-class-template.rst

This file was deleted.

66 changes: 0 additions & 66 deletions docs/_templates/custom-module-template.rst

This file was deleted.

24 changes: 22 additions & 2 deletions docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,30 @@ parts:
- caption: Installation
chapters:
- file: install_instructions
- file: install_old
- file: install_local
- file: install_on_kestrel
- file: install_spack
- caption: Usage
chapters:
- file: examples
- file: order_of_op
- caption: Technologies
chapters:
- file: wind
- file: battery
- file: solar_pv
- caption: Examples
chapters:
- file: examples_overview
- file: examples/05_floris_wind_standin_and_electrolyzer
- file: examples/06_amr_wind_standin_and_battery
- file: examples/07_floris_standin_and_solar_pysam
- file: examples/08_floris_only
- file: examples/09_amr_wind_openfast








53 changes: 53 additions & 0 deletions docs/battery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Battery

There are two battery models currently implemented in Hercules: `SimpleBattery` and `LIB`. Both interact with Hercules through a simple wrapper class: `Battery`.

### Parameters

Battery parameters are defined in the hercules input yaml file used to initialize `emulator`.

- `py_sim_type`: `"SimpleBattery"` or `"LIB"`
- `energy_capacity`: [kWh]
- `charge_rate`: [kW]
- `max_SOC`: between 0 and 1
- `min_SOC`: between 0 and 1
- `initial_conditions`
- `SOC`: between `min_SOC` and `max_SOC`


Once initialized, the battery is only interacted with using the `step` method.

### Inputs
Inputs are passed to `step()` as a dict named `inputs`, which must have the following fields:

```
{py_sims:{inputs:{battery_signal: ____,
available_power: ____
}}}
```

### Outputs
Outputs are returned as a dict containing the following values
- `power` The charging/discharging power of the battery
- `reject` The amount of charging/discharging requested of the battery that it could not fulfill. Can be positive or negative.
- `soc` The battery state of charge


## `SimpleBattery`

`SimpleBattery` is defined by $E_t = \sum_{k=0}^t P_k \Delta t$, where $E_t$ is the energy stored and $P_t$ is the charging/discharging power at time $t$. Both $E$ and $P$ are constrained by upper and lower limits.

$\underline{E} \leq E \leq \overline{E}$

$\underline{P} \leq P \leq \overline{P}$


## `LIB`

`LIB` models a lithium ion battery based on the lithium ion cell model presented in [1.]. The main difference between `LIB` and `SimpleBattery` is that `LIB` includes diffusion transients and losses both of which are modeled as an equivalent circuit model following the approach in [1.].



### References

1. M.-K. Tran et al., “A comprehensive equivalent circuit model for lithium-ion batteries, incorporating the effects of state of health, state of charge, and temperature on model parameters,” Journal of Energy Storage, vol. 43, p. 103252, Nov. 2021, doi: 10.1016/j.est.2021.103252.
2 changes: 0 additions & 2 deletions docs/examples.md

This file was deleted.

4 changes: 4 additions & 0 deletions docs/examples_overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Examples Overview

Hercules includes several examples to demonstrate usage for a number of key configurations.

4 changes: 2 additions & 2 deletions docs/install_instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Still a work in progress but currently there are 3 sets of installation instructions

[Installing on kestrel](install_on_kestrel)
[Local installation instructions](install_local)

[Old installation instructions](install_old)
[Installing on Kestrel](install_on_kestrel)

[Install via spack](install_spack)
Loading
Loading