-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding solar controller and replacing AMR-Wind standin with FLORIS st…
…andin in example 07 (#104) * created dummy example for amr wind dummy + solar * final commit before creating feature branch * standalone solar pysam example * working standalone example of solar pysam model * removed time as explicit input in step * working example of solar pysam and hercules (but pysam has a bug) * changing hardcoded stoptime of 100 s to 1000 s to demo solar module * cleaning before pull request review of misha's changes * working solar pysam example with test amr wind * adding updated results in jupyter notebook * trying to run after git pull of develop * solar model runs successfully, but there is a time issue * correcting irradiance field and removing unnecessary comments * removing unnecessary files * removing test amr wind and solar example, saving for separate PR * adding environment yaml file needed for pysam * updating setup and docs to include pysam and restrict python version * adding missing csv weather file * Minor changes for running the code * Minor cleanup in example. * remove environment.yml * adding solar module unit tests * adding relative path for pytest functionality * correcting ruff formatting and except * more ruff formatting * adding skeleton files for solar pv * adding solar pysam description * removing documentation changes, saving for a separate PR * removing documentation changes, saving for a separate PR * removing documentation changes, saving for a separate PR * adding comments to the tests * fix comments for PV * adding documentation, moving lat long to input file, correcting irradiance output * doc updates, code clean up * docs updates * minor cleanup * ruff formatting and minor cleanup * saving files before switching branches * adding default inputs - not working yet * calc max power for controls feedback optimization * cleaning up code * more code cleanup * refactored to remove nested for loop, but no speed up * fixing github vis * starting setpoints feature, not working yet * working initial pv plant controller * first attempt at feeding in setpoints via external_data_file * replacing amr wind standin with floris standin due to error in amrwind * trying to run without external_data_file but getting zeros and floris is hanging * hercules is hanging * working version of floris and solar example * working but messy version of solar controller * adding the external data file * cleaning up emulator.py * cleaning up emulator.py * working floris stand in and pv plant controller * cleanup * Ruff compatibility. * cleaning up files * fixing errors in tests * fixing standalone example * ruff changes * removing amr_wind standin run script * adding external_data_file solar_power_reference.csv * clarifing controller input in README and fixing dc_power_mw error in test_read_output.ipynb * Handling for when power_setpoints not available. * Remove & on second call so that script terminates as expected. * Updating units for results plots * Make ruff compliant * Make ruff compliant 2 --------- Co-authored-by: Genevieve Starke <Genevieve.Starke@nrel.gov> Co-authored-by: misi9170 <michael.sinner@nrel.gov>
- Loading branch information
1 parent
a128bd4
commit 6f9f4e3
Showing
20 changed files
with
41,950 additions
and
619 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
example_case_folders/07_amr_wind_standin_and_solar_pysam/README.md
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
example_case_folders/07_amr_wind_standin_and_solar_pysam/hercules_runscript_amr_standin.py
This file was deleted.
Oops, something went wrong.
512 changes: 0 additions & 512 deletions
512
example_case_folders/07_amr_wind_standin_and_solar_pysam/test_read_output.ipynb
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 30 additions & 0 deletions
30
example_case_folders/07_floris_standin_and_solar_pysam/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Example 07: FLORIS Standin and Solar PySAM | ||
|
||
## Description | ||
|
||
This example demonstrates how to use the FLORIS Standin and a solar model using pysam. | ||
|
||
## Running | ||
|
||
To run the example, execute the following command in the terminal: | ||
|
||
```bash | ||
bash batch_script.sh | ||
``` | ||
|
||
|
||
To run `hercules` using the PV plant controller, which provides power setpoints and adjusts the PV power output accordingly, ensure the following line is uncommented in `batch_script.sh`: | ||
|
||
``` | ||
python3 hercules_runscript.py hercules_controller_input_000.yaml >> outputs/loghercules.log 2>&1 & | ||
``` | ||
|
||
To run `hercules` without the PV plant controller, ensure the folling line is uncommented `batch_script.sh`: | ||
|
||
``` | ||
python3 hercules_runscript.py hercules_input_000.yaml >> outputs/loghercules.log 2>&1 & | ||
``` | ||
|
||
## Notes | ||
|
||
Make sure hercules conda or venv is activated before running the example. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
example_case_folders/07_floris_standin_and_solar_pysam/floris_runscript.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import sys | ||
|
||
from hercules.floris_standin import launch_floris | ||
|
||
# Check that one command line argument was given | ||
if len(sys.argv) != 2: | ||
raise Exception("Usage: python floris_runscript.py <amr_input_file>") | ||
|
||
# # Get the first command line argument | ||
# This is the name of the file to read | ||
amr_input_file = sys.argv[1] | ||
print(f"Running FLORIS standin with input file: {amr_input_file}") | ||
|
||
|
||
launch_floris(amr_input_file) |
63 changes: 63 additions & 0 deletions
63
example_case_folders/07_floris_standin_and_solar_pysam/hercules_controller_input_000.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Input YAML for emy_python | ||
|
||
# Name | ||
name: example_000 | ||
|
||
### | ||
# Describe this emulator setup | ||
description: Floris and Solar PV | ||
|
||
dt: 0.5 | ||
|
||
hercules_comms: | ||
|
||
amr_wind: | ||
|
||
wind_farm_0: | ||
type: amr_wind_local #options are amr_wind or amr_wind_local | ||
amr_wind_input_file: amr_input.inp | ||
|
||
helics: | ||
|
||
config: | ||
name: hercules # What is the purpose of this name | ||
use_dash_frontend: False | ||
KAFKA: False | ||
KAFKA_topics: EMUV1py | ||
helics: | ||
# deltat: 1 # This will be assigned in software | ||
subscription_topics: [status] | ||
publication_topics: [control] | ||
endpoints: [] | ||
helicsport: 32000 | ||
publication_interval: 1 | ||
endpoint_interval: 1 | ||
starttime: 0 | ||
stoptime: 100 # must be at least 2*dt smaller than last timestep in weather file | ||
Agent: ControlCenter | ||
|
||
py_sims: | ||
|
||
solar_farm_0: # The name of py_sim object 1 | ||
|
||
py_sim_type: SolarPySAM | ||
weather_file_name: NonAnnualSimulation-sample_data-interpolated-daytime.csv | ||
system_info_file_name: 100MW_1axis_pvsamv1.json | ||
lat: 39.7442 | ||
lon: -105.1778 | ||
elev: 1829 | ||
|
||
# capacity: 100 # MW | ||
|
||
initial_conditions: | ||
|
||
power: 25 # MW | ||
dni: 1000 | ||
|
||
controller: | ||
|
||
external_data_file: solar_power_reference.csv | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.