Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev/refactor' into dev/refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredthomas68 committed Oct 2, 2024
2 parents c94c1b6 + 9c7377d commit 9accf5e
Show file tree
Hide file tree
Showing 178 changed files with 155,769 additions and 2,928 deletions.
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,24 @@ ENV/
*.gz
*.db-wal

# GreenHEART structure specific
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/*
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# Hybrid Optimization and Performance Platform
# Packages

## HOPP: Hybrid Optimization and Performance Platform

![CI Tests](https://github.com/NREL/HOPP/actions/workflows/ci.yml/badge.svg)

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.

## 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.

## 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
Expand All @@ -17,7 +24,7 @@ solar and storage.
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
Expand Down Expand Up @@ -76,6 +83,19 @@ solar and storage.
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
```
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
```

## 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/).
Expand Down
81 changes: 44 additions & 37 deletions examples/04-load-following-battery.ipynb

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion examples/Wind_Floris/simulate_hybrid_custom_wind_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from hopp.simulation.technologies.sites import SiteInfo, flatirons_site
from hopp.simulation.hybrid_simulation import HybridSimulation
from hopp.utilities.keys import set_nrel_key_dot_env
from hopp import ROOT_DIR

# ADD CUSTOM WIND MODULE
# download FLORIS at www.github.com/NREL/FLORIS
Expand All @@ -31,7 +32,7 @@
# Get resource
lat = flatirons_site['lat']
lon = flatirons_site['lon']
prices_file = Path(__file__).parent.absolute().parent.parent / 'resource_files' / 'grid' / 'pricing-data-2015-IronMtn-002_factors.csv'
prices_file = ROOT_DIR / "simulation" / 'resource_files' / 'grid' / 'pricing-data-2015-IronMtn-002_factors.csv'
site = SiteInfo(flatirons_site, grid_resource_file=prices_file)

# initialize custom model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from hopp.simulation.hybrid_simulation import HybridSimulation

from hopp.simulation.technologies.dispatch.plot_tools import plot_battery_output, plot_battery_dispatch_error, plot_generation_profile

from hopp import ROOT_DIR

from hopp.utilities.keys import set_developer_nrel_gov_key
import yaml
Expand Down Expand Up @@ -48,7 +48,7 @@
# Get resource
lat = flatirons_site['lat']
lon = flatirons_site['lon']
prices_file = Path(__file__).parent.absolute().parent.parent / 'resource_files' / 'grid' / 'pricing-data-2015-IronMtn-002_factors.csv'
prices_file = ROOT_DIR / "simulation" / 'resource_files' / 'grid' / 'pricing-data-2015-IronMtn-002_factors.csv'
site = SiteInfo(flatirons_site, grid_resource_file=prices_file)

# Create model
Expand Down
6 changes: 4 additions & 2 deletions examples/alt_dev/run_alt.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from hopp.simulation.technologies.sites import make_circular_site, make_irregular_site, SiteInfo, locations

from hopp.utilities.keys import set_nrel_key_dot_env
from hopp import ROOT_DIR

set_nrel_key_dot_env()


Expand All @@ -37,8 +39,8 @@ def init_simulation():
else:
raise Exception("Unknown site '" + site + "'")

solar_file = examples_dir.parent / "resource_files" / "solar" / "Beni_Miha" / "659265_32.69_10.90_2019.csv"
grid_file = examples_dir.parent / "resource_files" / "grid" / "tunisia_est_grid_prices.csv"
solar_file = ROOT_DIR / "simulation" / "resource_files" / "solar" / "Beni_Miha" / "659265_32.69_10.90_2019.csv"
grid_file = ROOT_DIR / "simulation" / "resource_files" / "grid" / "tunisia_est_grid_prices.csv"

site_info = SiteInfo(site_data, solar_resource_file=solar_file, grid_resource_file=grid_file)

Expand Down
6 changes: 3 additions & 3 deletions examples/analysis/main_usa_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

from hopp.tools.analysis import create_cost_calculator
from hopp.tools.resource import *
from hopp import ROOT_DIR


def establish_save_output_dict():
Expand Down Expand Up @@ -540,9 +541,8 @@ def run_all_hybrid_calcs(site_details, scenario_descriptions, results_dir, load_
os.mkdir(results_dir)

# directory to resource_files
main_dir = Path(__file__).parent.parent.parent
resource_dir = main_dir / 'resource_files'
print("Resource Dir:", resource_dir)
resource_dir = ROOT_DIR / "simulation/resource_files/"
print("Resource Dir: ", str(resource_dir))
npy_dir = resource_dir / 'npy_files/'

# *** START OF ANALYSIS ***#
Expand Down
4 changes: 2 additions & 2 deletions examples/analysis/multi_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
from hopp.tools.analysis import create_cost_calculator
from hopp.tools.resource import *
from hopp.tools.resource.resource_loader import site_details_creator

resource_dir = Path(__file__).parent.parent.parent / "resource_files"
from hopp import ROOT_DIR
resource_dir = ROOT_DIR / "simulation" / "resource_files"

pd.set_option("display.max_rows", None, "display.max_columns", None)

Expand Down
3 changes: 2 additions & 1 deletion examples/analysis/single_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
from hopp.simulation.hybrid_simulation import HybridSimulation
from hopp.tools.analysis import create_cost_calculator
from hopp.tools.resource import *
from hopp import ROOT_DIR

resource_dir = Path(__file__).parent.parent.parent / "resource_files"
resource_dir = ROOT_DIR / "simulation" / "resource_files"

pd.set_option("display.max_rows", None, "display.max_columns", None)

Expand Down
23 changes: 16 additions & 7 deletions examples/greenheart/05-offshore-h2/greenheart-h2-offshore.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@

# # yaml imports
import yaml
from yamlinclude import YamlIncludeConstructor
from pathlib import Path

PATH = Path(__file__).parent
YamlIncludeConstructor.add_to_loader_class(loader_class=yaml.FullLoader, base_dir=PATH / './input/floris/')
YamlIncludeConstructor.add_to_loader_class(loader_class=yaml.FullLoader, base_dir=PATH / './input/turbines/')

# ORBIT imports
from ORBIT.core.library import initialize_library
initialize_library(os.path.join(os.getcwd(), "./input/"))

# HOPP imports
from greenheart.tools.eco.hybrid_system import run_simulation
from greenheart.simulation.greenheart_simulation import run_simulation, GreenHeartSimulationConfig

# run the stuff
if __name__ == "__main__":
Expand All @@ -29,4 +24,18 @@
filename_hopp_config = "./input/plant/hopp_config.yaml"
filename_greenheart_config = "./input/plant/greenheart_config.yaml"

run_simulation(filename_hopp_config, filename_greenheart_config, filename_turbine_config, filename_orbit_config, filename_floris_config, verbose=True, show_plots=False, save_plots=True, use_profast=True, incentive_option=1, plant_design_scenario=1)
config = GreenHeartSimulationConfig(
filename_hopp_config,
filename_greenheart_config,
filename_turbine_config,
filename_floris_config,
filename_orbit_config,
verbose=True,
show_plots=False,
save_plots=True,
use_profast=True,
incentive_option=1,
plant_design_scenario=1
)

run_simulation(config)
Loading

0 comments on commit 9accf5e

Please sign in to comment.