Skip to content

Commit

Permalink
Merge remote-tracking branch 'nrel/master' into dev/refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
bayc committed Jul 12, 2023
2 parents c00d894 + 3d53f84 commit b89d3fe
Show file tree
Hide file tree
Showing 190 changed files with 507,173 additions and 38,656 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
env:
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True
run: |
pip install scikit-learn
sudo apt-get update && sudo apt-get install -y libglpk-dev glpk-utils coinor-cbc
Expand Down
44 changes: 26 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,35 @@ __pycache__/
*$py.class

log/
examples/HOPP_examples/
HOPP_examples/
HOPP-demos/
tests/analysis/results/
# needed for h2 test inputs: tests/analysis/results/
examples/H2 Analysis/results/reopt_precomputes/

tests/hybrid/REoptResultsNoExportAboveLoad.json

# Results
examples/analysis/results/*.csv
resource_files/wind
resource_files/solar

# clean up after merge
examples/Powerflow Analysis
examples/analysis/Engie
examples/As_Built_Analysis_Blue Creek.csv
examples/Blue_Creek_Analysis.py
examples/dudgeon_wind_extraction_validation.py
examples/powerflow_details.csv
examples/reopt_load.py
examples/data


.idea/*
.idea/workspace.xml
.vscode/

.vscode/
.vscode/*

# Distribution / packaging
.Python
Expand Down Expand Up @@ -109,22 +128,11 @@ ENV/
*.png
*.xlsx

# Results
examples/analysis/results/*.csv
resource_files/wind
resource_files/solar
*.pkl

.DS_Store
*.val
*.db
*.db-shm
*.gz
*.db-wal

examples/HOPP_examples/

examples/Powerflow Analysis
examples/analysis/Engie
examples/As_Built_Analysis_Blue Creek.csv
examples/Blue_Creek_Analysis.py
examples/dudgeon_wind_extraction_validation.py
examples/powerflow_details.csv
examples/reopt_load.py
examples/data
tests/hybrid/REoptResultsNoExportAboveLoad.json
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2019, Alliance for Sustainable Energy, LLC
Copyright (c) 2020, Alliance for Sustainable Energy, LLC
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ solar and storage.

4. Install requirements:
```
conda install -c conda-forge glpk -y
conda install -c conda-forge coin-or-cbc -y
conda install -c conda-forge shapely==1.7.1 -y
pip install -r requirements.txt
```

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

5. Run install script:
```
Expand Down
37 changes: 36 additions & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
# Release Notes

## Version 0.1.0, ~
## Version 1.0.0, Upcoming
* Add Wind + PV + Battery + PEM Electrolyzer analysis to examples in `H2_Analysis`
* Add default scenario inputs for hydrogen as end product with result files
* Add files for simulating, optimizing and plotting Wind + PV + Battery + PEM Electrolyzer hybrids
* Add a PEM electrolyzer model to hybrid (not integrated into HybridSimulation)
* Separate power and financial simulations for PowerSoures and HybridSimulation
* Fix multiprocessing issues
* Updates to integrate FLORIS v3

## Version 0.1.0.dev3, Mar. 11, 2022
* Include CBC package data for Windows

## Version 0.1.0.dev2, Mar. 11, 2022
* Add CBC open-source dispatch solver as default (faster than GLPK)
* Add Xpress and Gurobi AMPL commercial dispatch solvers
* Add clustering of simulation days with some tuning (use with caution)
* Remove taxes from grid dispatch model
* Add weighting of hybrid financials by production or cost ratio
* Update to csp dispatch cost parameters for absolute grid prices
* Add csv file output option to driver
* Add PV charging only and grid charging options for dispatch
* Add key parameter scaling when scaling CSP tower capacities
* Add capacity credit payment calculations based on dispatch
* Reformulate grid dispatch model
* Add desired schedule option to dispatch model to follow schedule at least cost
* Improve class documentation
* Fix general bugs and clean-up code

## Version 0.1.0.dev1, Oct. 11, 2021
* Updated requirements
* Added presolve to GLPK LP solver

## Version 0.1.0.dev, Oct. 10, 2021
* Battery dispatch and simulation with example in examples/simulate_hybrid_wbattery_dispatch.py
* Separate layout-related functions from optimization code into Layout classes
* Refactor Optimizer classes to use HybridSimulation with examples in examples/optimization/hybrid_npv.py and examples/optimization/hybrid_sizing_problem.py
Expand All @@ -9,6 +41,9 @@
* Rename "Solar" classes to "PV"
* Add ElectricityPrices class with some example input files in resource_files/grid
* Add storage costs to CostCalculator
* Add concentrating solar power (CSP) tower and trough configurations through pySSC wrapper
* Add dispatch optimization model for CSP models
* Add design evaluation methods to iterate on design variables through space sampling, single objective derivative-free optimization, and multi-objective optimization

## Version 0.0.5, Apr 30, 2021
* Update PySAM requirements
Expand Down
147 changes: 147 additions & 0 deletions alt_dev/Price Stats.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "4dbcf4e7",
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets as widgets\n",
"from ipywidgets import interact, Layout\n",
"import plotly.express as px\n",
"import pandas as pd\n",
"import numpy as np\n",
"import os\n",
"\n",
"# Plotting imports\n",
"import plotly.graph_objects as go\n",
"from plotly.subplots import make_subplots\n",
"\n",
"import plotly.io as pio\n",
"PAPER_LAYOUT=dict(font=dict(family=\"Computer Modern\", size=18),\n",
" margin=dict(t=40))\n",
"pio.templates[\"paper\"] = go.layout.Template(layout=PAPER_LAYOUT)\n",
"pio.templates.default = \"paper\"\n",
"\n",
"def chunks(lst, n):\n",
" for i in range(0, len(lst), n):\n",
" yield lst[i:i + n]\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "3998d12c",
"metadata": {},
"outputs": [],
"source": [
"path = '../resource_files/grid'\n",
"\n",
"options = os.listdir(path)\n",
"data = [pd.read_csv(os.path.join(path, file), header=None)[0] for file in options]\n",
"\n",
"def dayPlot(x):\n",
" idx = options.index(x)\n",
" xvals = np.arange(24)\n",
" y = data[idx]\n",
" s = None\n",
" \n",
" fig = go.Figure()\n",
" \n",
" for chunk in chunks(y, 24):\n",
" d = np.array(chunk, ndmin=2)\n",
" \n",
" if s is None:\n",
" s = d \n",
" else:\n",
" s = np.concatenate([s, d], axis=0)\n",
" \n",
" fig.add_trace(go.Scatter(x=xvals, y=chunk, line=dict(color='gray'), showlegend=False))\n",
" \n",
" fig.add_trace(go.Scatter(x=xvals, y=s.min(axis=0), line=dict(color='black', dash='dash'), showlegend=False))\n",
" fig.add_trace(go.Scatter(x=xvals, y=s.max(axis=0), line=dict(color='black', dash='dash'), showlegend=False))\n",
" fig.add_trace(go.Scatter(x=xvals, y=s.mean(axis=0), line=dict(color='black'), showlegend=False))\n",
" \n",
" fig.update_layout(title=x)\n",
" fig.show()\n",
" \n",
" for i in range(2):\n",
" print('hour', ''.join([f\"{i:7.0f}\" for i in xvals[i*12:12+i*12]]))\n",
" print(' max', ''.join([f\"{i:7.0f}\" for i in s[:,i*12:12+i*12].max(axis=0)]))\n",
" print('mean', ''.join([f\"{i:7.0f}\" for i in s[:,i*12:12+i*12].mean(axis=0)]))\n",
"# print('mode', ''.join([f\"{i:7.0f}\" for i in s[:,i*12:12+i*12].mode(axis=0)]))\n",
" print(' min', ''.join([f\"{i:7.0f}\" for i in s[:,i*12:12+i*12].min(axis=0)]))\n",
" print()\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "34ade27e",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f3a2047c82ae4733aff8ad6a6cddad5a",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(Dropdown(description='x', options=('pricing-data-2020-IronMtn-002.csv', 'test_prices.csv…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<function __main__.dayPlot(x)>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"interact(dayPlot, x=options) #('test_prices.csv')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ca3ac299",
"metadata": {},
"outputs": [],
"source": [
"[np.isnan(d).sum() for d in data]"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit b89d3fe

Please sign in to comment.