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

Adding solar controller and replacing AMR-Wind standin with FLORIS standin in example 07 #104

Merged
merged 81 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
31705ee
created dummy example for amr wind dummy + solar
brookeslawski Nov 27, 2023
471cb76
final commit before creating feature branch
brookeslawski Nov 28, 2023
dead7ce
standalone solar pysam example
brookeslawski Dec 11, 2023
97f0a60
working standalone example of solar pysam model
brookeslawski Dec 12, 2023
79f16e6
removed time as explicit input in step
brookeslawski Dec 12, 2023
58ec136
working example of solar pysam and hercules (but pysam has a bug)
brookeslawski Dec 12, 2023
0957591
changing hardcoded stoptime of 100 s to 1000 s to demo solar module
brookeslawski Dec 12, 2023
19299db
cleaning before pull request review of misha's changes
brookeslawski Dec 13, 2023
14c4e38
working solar pysam example with test amr wind
brookeslawski Dec 14, 2023
46e161e
adding updated results in jupyter notebook
brookeslawski Dec 14, 2023
cc4ee8c
merging NREL/develop into local branch
brookeslawski Dec 14, 2023
466bbd3
trying to run after git pull of develop
brookeslawski Dec 14, 2023
95618db
solar model runs successfully, but there is a time issue
brookeslawski Dec 14, 2023
1c94d37
correcting irradiance field and removing unnecessary comments
brookeslawski Dec 14, 2023
36e105a
removing unnecessary files
brookeslawski Dec 14, 2023
44a7c6e
removing test amr wind and solar example, saving for separate PR
brookeslawski Dec 14, 2023
bc67bcf
adding environment yaml file needed for pysam
brookeslawski Dec 15, 2023
4e43583
updating setup and docs to include pysam and restrict python version
brookeslawski Dec 15, 2023
41e5a47
adding missing csv weather file
brookeslawski Dec 18, 2023
1b07044
Minor changes for running the code
genevievestarke Dec 18, 2023
c4289bb
Minor cleanup in example.
misi9170 Dec 18, 2023
f8f76c0
remove environment.yml
genevievestarke Dec 18, 2023
a2d73ce
Merge in Misha's changes
genevievestarke Dec 18, 2023
68ab725
merging NREL/hercules:develop into local branch
brookeslawski Feb 19, 2024
c575011
Merge branch 'solar-pysam' of github.com:brookeslawski/hercules into …
brookeslawski Feb 19, 2024
0be7f2a
adding solar module unit tests
brookeslawski Feb 19, 2024
74acc0a
adding relative path for pytest functionality
brookeslawski Feb 26, 2024
1e38644
correcting ruff formatting and except
brookeslawski Feb 26, 2024
724112c
more ruff formatting
brookeslawski Feb 26, 2024
ad52112
Merge branch 'develop' of github.com:NREL/hercules into solar-pysam
brookeslawski Feb 26, 2024
3f8ff21
adding skeleton files for solar pv
brookeslawski Feb 26, 2024
22a0051
adding solar pysam description
brookeslawski Feb 26, 2024
83c84bf
removing documentation changes, saving for a separate PR
brookeslawski Feb 26, 2024
829fd49
removing documentation changes, saving for a separate PR
brookeslawski Feb 26, 2024
c9b6b38
removing documentation changes, saving for a separate PR
brookeslawski Feb 26, 2024
6c546a2
adding comments to the tests
brookeslawski Feb 26, 2024
6095ba3
fix comments for PV
brookeslawski Feb 26, 2024
1ad79a7
adding documentation, moving lat long to input file, correcting irrad…
brookeslawski Feb 27, 2024
5fde32a
doc updates, code clean up
brookeslawski Feb 27, 2024
5e905d5
docs updates
brookeslawski Feb 27, 2024
d2ab941
fixing merge conflicts
brookeslawski Feb 27, 2024
a914853
minor cleanup
brookeslawski Feb 28, 2024
5fba773
merging develop branch into local feature branch
brookeslawski Feb 28, 2024
f819252
ruff formatting and minor cleanup
brookeslawski Feb 28, 2024
b7adac6
saving files before switching branches
brookeslawski Mar 4, 2024
9d37846
adding default inputs - not working yet
brookeslawski Mar 5, 2024
9731d41
merging upstream develop into local branch
brookeslawski Mar 12, 2024
6c07727
calc max power for controls feedback optimization
brookeslawski Mar 19, 2024
a2666da
cleaning up code
brookeslawski Mar 19, 2024
2a62a40
more code cleanup
brookeslawski Mar 19, 2024
b11abf8
refactored to remove nested for loop, but no speed up
brookeslawski Mar 19, 2024
7542eba
fixing github vis
brookeslawski Mar 19, 2024
f05b8bc
starting setpoints feature, not working yet
brookeslawski Mar 20, 2024
e097b4b
Merge branch 'develop' of github.com:NREL/hercules into solar-pysam
brookeslawski Apr 3, 2024
1d86e56
working initial pv plant controller
brookeslawski Apr 5, 2024
13f1c53
first attempt at feeding in setpoints via external_data_file
brookeslawski Apr 5, 2024
6acadc3
replacing amr wind standin with floris standin due to error in amrwind
brookeslawski Apr 8, 2024
34c972a
trying to run without external_data_file but getting zeros and floris…
brookeslawski Apr 9, 2024
5ab9a6a
Merge branch 'develop' of github.com:NREL/hercules into solar-pysam
brookeslawski Apr 9, 2024
a6ed26b
hercules is hanging
brookeslawski Apr 10, 2024
ae47268
working version of floris and solar example
brookeslawski Apr 11, 2024
20c5f25
working but messy version of solar controller
brookeslawski Apr 11, 2024
b45ae28
adding the external data file
brookeslawski Apr 11, 2024
1d4660c
cleaning up emulator.py
brookeslawski Apr 11, 2024
e4e2dc3
cleaning up emulator.py
brookeslawski Apr 11, 2024
8cbecb9
working floris stand in and pv plant controller
brookeslawski Apr 12, 2024
42ebbd7
cleanup
brookeslawski Apr 12, 2024
d6e4616
Ruff compatibility.
misi9170 Apr 15, 2024
2dc720f
cleaning up files
brookeslawski Apr 15, 2024
e50904e
Merge branch 'solar-pysam' of github.com:brookeslawski/hercules into …
brookeslawski Apr 15, 2024
d8aa1f2
fixing errors in tests
brookeslawski Apr 15, 2024
908ca7a
fixing standalone example
brookeslawski Apr 15, 2024
43895cc
ruff changes
brookeslawski Apr 15, 2024
b018ada
removing amr_wind standin run script
brookeslawski Apr 15, 2024
757490d
adding external_data_file solar_power_reference.csv
brookeslawski Apr 15, 2024
67cbc22
clarifing controller input in README and fixing dc_power_mw error in …
brookeslawski Apr 15, 2024
10f36fa
Handling for when power_setpoints not available.
misi9170 Apr 15, 2024
67e6f94
Remove & on second call so that script terminates as expected.
misi9170 Apr 15, 2024
6f9bed1
Updating units for results plots
genevievestarke Apr 15, 2024
1972e79
Make ruff compliant
genevievestarke Apr 16, 2024
b739314
Make ruff compliant 2
genevievestarke Apr 16, 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
2 changes: 1 addition & 1 deletion docs/solar_pv.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The `SolarPySAM` module uses [PySAM](https://nrel-pysam.readthedocs.io/en/main/o
2. A JSON file that specifies the PV plant system design (e.g. 100MW_1axis_pvsamv1.json).
The system location (latitude, longitude, and elevation) is specified in the input `yaml` file.

The example folder `07_amr_wind_standin_and_solar_pysam` specifies:
The example folder `07_floris_standin_and_solar_pysam` specifies:
- weather conditions on May 10, 2018 (from [this PySAM example](https://github.com/NREL/pysam/blob/main/Examples/NonAnnualSimulation.ipynb))
- latitude, longitude, and elevation of Golden, CO
- system design information for a 100 MW single-axis PV tracking system generated using the SAM GUI
Expand Down
17 changes: 0 additions & 17 deletions example_case_folders/07_amr_wind_standin_and_solar_pysam/README.md

This file was deleted.

This file was deleted.

This file was deleted.

30 changes: 30 additions & 0 deletions example_case_folders/07_floris_standin_and_solar_pysam/README.md
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.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# SIMULATION STOP #
#.......................................#
time.stop_time = 500.0 # Max (simulated) time to evolve
time.stop_time = 100.0 # Max (simulated) time to evolve
time.max_step = -1 # Max number of time steps

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
Expand Down Expand Up @@ -149,33 +149,17 @@ samplingLine.z_line.end = 5.0 5.0 1275.0
Actuator.type = UniformCtDisk
Actuator.UniformCtDisk.rotor_diameter = 126.0
Actuator.UniformCtDisk.hub_height = 90.0
Actuator.UniformCtDisk.thrust_coeff = 0.0 0.7 1.2
Actuator.UniformCtDisk.wind_speed = 0.0 10.0 12.0
Actuator.UniformCtDisk.thrust_coeff = 0.0 0.0 1.132034888 0.999470963 0.917697381 0.860849503 0.815371198 0.811614904 0.807939328 0.80443352 0.800993851 0.79768116 0.794529244 0.791495834 0.788560434 0.787217182 0.787127977 0.785839257 0.783812219 0.783568108 0.783328285 0.781194418 0.777292539 0.773464375 0.769690236 0.766001924 0.762348072 0.758760824 0.755242872 0.751792927 0.748434131 0.745113997 0.717806682 0.672204789 0.63831272 0.610176496 0.585456847 0.563222111 0.542912273 0.399312061 0.310517829 0.248633226 0.203543725 0.169616419 0.143478955 0.122938861 0.106515296 0.093026095 0.081648606 0.072197368 0.064388275 0.057782745 0.0 0.0
Actuator.UniformCtDisk.wind_speed = 0.0 2.9 3.0 4.0 5.0 6.0 7.0 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 8.0 9.0 10.0 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 11.0 11.1 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 25.1 50.0
Actuator.UniformCtDisk.epsilon = 10.0
Actuator.UniformCtDisk.density = 1.225
Actuator.UniformCtDisk.diameters_to_sample = 1.0
Actuator.UniformCtDisk.num_points_r = 20
Actuator.UniformCtDisk.num_points_t = 5


Actuator.labels = T00 T01
# T02 T03 T04 T05 T06 T07
Actuator.JoukowskyDisk.thrust_coeff = 8.1672e-01 7.9044e-01 7.8393e-01 7.8624e-01 7.8824e-01 7.8942e-01 7.8902e-01 7.8740e-01 7.8503e-01 7.8237e-01 7.7955e-01 7.7583e-01 7.7583e-01 7.7583e-01 7.7583e-01 7.7583e-01 7.7583e-01 7.7583e-01 7.7583e-01 7.7583e-01 7.7583e-01 7.7583e-01 7.7583e-01 7.7583e-01 7.7583e-01 7.7583e-01 7.7583e-01 7.7583e-01 7.6922e-01 7.4270e-01 5.5949e-01 4.6163e-01 3.8786e-01 3.2901e-01 2.8093e-01 2.4114e-01 2.0795e-01 1.8010e-01 1.5663e-01 1.3679e-01 1.1995e-01 1.0562e-01 9.3384e-02 8.2908e-02 7.3910e-02 6.6159e-02 5.9463e-02 5.3662e-02 4.8622e-02 4.4230e-02
Actuator.JoukowskyDisk.wind_speed = 3.0000e+00 3.5495e+00 4.0679e+00 4.5539e+00 5.0064e+00 5.4244e+00 5.8069e+00 6.1530e+00 6.4619e+00 6.7330e+00 6.9655e+00 7.1589e+00 7.3128e+00 7.4269e+00 7.5009e+00 7.5345e+00 7.5412e+00 7.5883e+00 7.6757e+00 7.8031e+00 7.9702e+00 8.1767e+00 8.4221e+00 8.7059e+00 9.0273e+00 9.3856e+00 9.7800e+00 1.0210e+01 1.0659e+01 1.0673e+01 1.1170e+01 1.1699e+01 1.2259e+01 1.2848e+01 1.3465e+01 1.4109e+01 1.4778e+01 1.5471e+01 1.6185e+01 1.6921e+01 1.7674e+01 1.8445e+01 1.9231e+01 2.0030e+01 2.0841e+01 2.1661e+01 2.2489e+01 2.3323e+01 2.4160e+01 2.5000e+01
Actuator.JoukowskyDisk.rpm = 5.0000e+00 5.0000e+00 5.0000e+00 5.0000e+00 5.0000e+00 5.0000e+00 5.0000e+00 5.0000e+00 5.0000e+00 5.0000e+00 5.0000e+00 5.0861e+00 5.1954e+00 5.2765e+00 5.3290e+00 5.3529e+00 5.3577e+00 5.3912e+00 5.4532e+00 5.5437e+00 5.6625e+00 5.8092e+00 5.9836e+00 6.1851e+00 6.4135e+00 6.6681e+00 6.9483e+00 7.2535e+00 7.4992e+00 7.4992e+00 7.4992e+00 7.4992e+00 7.4992e+00 7.4992e+00 7.4992e+00 7.4992e+00 7.4992e+00 7.4992e+00 7.4992e+00 7.4992e+00 7.4992e+00 7.4992e+00 7.4992e+00 7.4992e+00 7.4992e+00 7.4992e+00 7.4992e+00 7.4992e+00 7.4992e+00 7.4992e+00
Actuator.JoukowskyDisk.rotor_diameter = 240.0
Actuator.JoukowskyDisk.hub_height = 150.0
Actuator.JoukowskyDisk.output_frequency = 100
Actuator.JoukowskyDisk.diameters_to_sample = 1.0
Actuator.JoukowskyDisk.num_points_r = 40
Actuator.JoukowskyDisk.num_points_t = 5
Actuator.JoukowskyDisk.num_blades = 3
Actuator.JoukowskyDisk.use_tip_correction = true
Actuator.JoukowskyDisk.use_root_correction = true
Actuator.JoukowskyDisk.epsilon = 5.0
Actuator.JoukowskyDisk.vortex_core_size = 24.0

Actuator.UniformCtDisk.yaw = 240.0

Actuator.labels = T00 T01

Actuator.T00.base_position = 2000.0 2000.0 0.0
Actuator.T01.base_position = 2500.0 2500.0 0.0
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ mkdir -p outputs
helics_broker -t zmq -f 2 --loglevel="debug" --local_port=$HELICS_PORT &
# For debugging add --consoleloglevel=trace

# Start the amr_standin
echo "Starting amr stand-in"
python3 hercules_runscript_amr_standin.py amr_input.inp >> outputs/logstandin.log 2>&1 &

# Start the controller center and pass in input file
echo "Starting hercules"
python3 hercules_runscript.py hercules_input_000.yaml >> outputs/loghercules.log 2>&1
# python3 hercules_runscript.py hercules_input_000.yaml >> outputs/loghercules.log 2>&1 &
python3 hercules_runscript.py hercules_controller_input_000.yaml >> outputs/loghercules.log 2>&1 &

# Start the floris standin
echo "Starting floris"
python3 floris_runscript.py amr_input.inp >> outputs/logfloris.log 2>&1

# If everything is successful
echo "Finished running hercules"
Expand Down
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)
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is missing from the repo, I think

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added!





Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: example_000

###
# Describe this emulator setup
description: AMR Wind (Dummy) and Solar PV
description: Floris and Solar PV

dt: 0.5

Expand Down Expand Up @@ -33,7 +33,7 @@ hercules_comms:
publication_interval: 1
endpoint_interval: 1
starttime: 0
stoptime: 500
stoptime: 100
Agent: ControlCenter

py_sims:
Expand Down
Loading
Loading