Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
211 commits
Select commit Hold shift + click to select a range
43443c5
first commit
locascio-m May 16, 2022
183e673
project completed
locascio-m May 25, 2022
f99f867
before debugging floris optimization
Jun 24, 2022
1fc74f8
floris optimization working
Jun 27, 2022
3bb1ef6
updating multistart code for eagle
Jun 27, 2022
47b2105
eagle setup
Jun 29, 2022
9dcd3d3
eagle output
Jun 29, 2022
939b8bf
parallel multistart
Jun 29, 2022
13dc28e
multistart setup
Jun 30, 2022
42096b4
new setup
Jul 1, 2022
b5dc63b
adjust multistart inputs
Jul 5, 2022
118612f
Merge branch 'main' of https://github.com/locascio-m/flowers
Jul 5, 2022
7088ed2
clean up folders
Jul 5, 2022
1b6b790
initial results completed
Jul 7, 2022
672b440
Merge branch 'main'
Jul 7, 2022
7df8071
adjusted inputs
Jul 7, 2022
1dbbcde
delete folder
Jul 7, 2022
9c3932d
fixed input path
Jul 7, 2022
82a5d7a
SNOPT configuration
Jul 8, 2022
713a611
fixes
Jul 11, 2022
e0548fb
split optimizations
Jul 13, 2022
37f49cc
scaling analysis setup
Jul 13, 2022
a12fd9a
added time limit
Jul 14, 2022
ab3dbbb
gauss optimization setup
Jul 18, 2022
f6e4bf2
added constraint scaling
Jul 26, 2022
2a6116e
fixes
Jul 26, 2022
d8fdb99
Merge branch 'main' of https://github.com/locascio-m/flowers into main
Jul 26, 2022
48d0305
new wind roses
locascio-m Jul 28, 2022
25b4572
added wind roses
locascio-m Jul 28, 2022
4934066
added aep comparison after vectorization
Jul 28, 2022
2d3fcf6
new code organization
Aug 2, 2022
6a688c9
scaling analysis
Aug 2, 2022
141aca4
snopt scaling
Aug 3, 2022
9af9ace
include verbose file
Aug 3, 2022
b32d127
flowers multistart
Aug 5, 2022
c8201d5
fix model
Aug 5, 2022
2bdff8f
boundary constraint fix
Aug 5, 2022
fa5fe43
working on multistart comparison
Aug 8, 2022
8f48914
stash model
Aug 8, 2022
858b179
Merge branch 'main' of https://github.com/locascio-m/flowers into main
Aug 8, 2022
924e45e
clean up multistart
Aug 8, 2022
78993ee
updated ignore
Aug 8, 2022
cb4fe92
adjusted floris opt setup
Aug 9, 2022
e294231
Merge branch 'main' of https://github.com/locascio-m/flowers into main
Aug 9, 2022
8d6250f
added file documentation
Aug 9, 2022
f54e646
merge conflict
Aug 10, 2022
29e3458
after multistart bug
Aug 11, 2022
44c7db6
Merge branch 'main' of https://github.com/locascio-m/flowers into main
Aug 11, 2022
5e13b5e
added resolution analysis
Aug 11, 2022
ed98a4b
Merge branch 'main' of https://github.com/locascio-m/flowers
Aug 11, 2022
39f6b1c
pyoptsparse debugging
Aug 11, 2022
f81d170
fourier resolution plots
Aug 11, 2022
7c878b4
testing branch
Aug 11, 2022
e029b19
testing branch again
Aug 11, 2022
87b2f5b
removed floris pyoptsparse wrapper
Aug 11, 2022
9762376
updated documentation
Aug 11, 2022
aa9be2c
multi analysis
Aug 25, 2022
ecd90fc
constraint visualization
Aug 25, 2022
666be3e
separate spacing constraint
Aug 25, 2022
6f78a4a
snopt workaround
Aug 25, 2022
501ea8f
Merge branch 'main' of https://github.com/locascio-m/flowers into main
Aug 25, 2022
b6f1088
snopt workaround
Aug 25, 2022
600c757
separating spacing constraint and setting up debug
Aug 25, 2022
6155c4e
update gitignore
Aug 25, 2022
5b73678
fixing discontinuity in aep
Aug 25, 2022
bae190d
troubleshoot
Aug 25, 2022
fc1b43b
model adjustment within rotor area
Aug 25, 2022
24458aa
update ignore
Aug 26, 2022
4d09261
constraint troubleshooting
Aug 30, 2022
cab64cf
Merge branch 'main' of https://github.com/locascio-m/flowers
Aug 30, 2022
5fce4b2
new multistart study with improved convergence
Aug 30, 2022
2b2c6d2
working on figures
Sep 5, 2022
1e2b000
working on figures
Sep 8, 2022
1493433
periodic fourier transform
locascio-m Nov 29, 2022
3963e2a
Merge branch 'feature/pyopt'
locascio-m Nov 29, 2022
b10f4b2
new power calculation
locascio-m Dec 6, 2022
7ad52c8
new power formulation and calibration
locascio-m Jan 23, 2023
ee889ba
found issue with power integral
locascio-m Feb 28, 2023
bf92999
park comparisons
locascio-m Mar 17, 2023
1f01e86
added new comparison
locascio-m Mar 20, 2023
49463ca
fixed case 4
locascio-m Mar 20, 2023
a90ab45
aep solution space visualization
locascio-m Apr 10, 2023
de958a8
Merge branch 'feature/power' of https://github.com/locascio-m/flowers…
locascio-m Apr 10, 2023
dc3d9f6
modified Park comparisons
locascio-m Apr 18, 2023
44ae7f8
new feature plots
locascio-m Apr 18, 2023
6af91ab
Merge branch 'feature/power' of https://github.com/locascio-m/flowers…
locascio-m Apr 18, 2023
77bbf22
updated plotting
locascio-m Apr 20, 2023
13f5896
new aep comparisons
locascio-m May 4, 2023
6de3982
new aep comparisons
locascio-m May 4, 2023
32389f3
updated aep comparison plots
locascio-m May 17, 2023
229e798
larger range of conditions
locascio-m Jun 22, 2023
51525c5
fixed saving
locascio-m Jun 23, 2023
f0ae803
changed gauss superposition
locascio-m Jul 16, 2023
04a006d
Merge branch 'feature/power' of https://github.com/locascio-m/flowers…
locascio-m Jul 16, 2023
c23d29e
changed gauss superposition
locascio-m Jul 16, 2023
b00843e
validation/comparison work
locascio-m Sep 6, 2023
c8d2232
added flowers gradients, rebuilt code interface
locascio-m Sep 20, 2023
b9fa6c3
implemented analytic grads
locascio-m Sep 27, 2023
bfad3c8
snopt working and fixed constraint bugs
locascio-m Sep 28, 2023
ae85d65
optimization multistart
locascio-m Oct 22, 2023
e89fda5
clean up files and merge branches
locascio-m Oct 23, 2023
b1dd252
debugging floris imports
locascio-m Oct 23, 2023
f24047f
hpc multistart workflow
locascio-m Oct 25, 2023
7861a7f
eagle multistart code
Oct 26, 2023
811c5fb
small, medium, large cases
locascio-m Oct 26, 2023
d8ca55e
fixed optimization convergence, added layouts
locascio-m Nov 10, 2023
0b8c574
fixed slurm time limit
locascio-m Nov 10, 2023
a9f4c5c
deleted testing output files
locascio-m Nov 10, 2023
f4163e6
opt results plots
locascio-m Nov 11, 2023
c31011c
fixed stored layouts
locascio-m Nov 11, 2023
1755fe3
locally copy layouts
locascio-m Nov 11, 2023
a8b61ec
delete layouts
locascio-m Nov 11, 2023
2901822
new layouts
Nov 11, 2023
e487197
fixed time series flag
locascio-m Nov 11, 2023
0d0ad3a
small convergence tolerance
locascio-m Nov 11, 2023
6e5456d
medium tolerance and scaling
locascio-m Nov 12, 2023
299ff28
multistart typo
locascio-m Nov 12, 2023
04482a3
parameter sweep setup
locascio-m Nov 12, 2023
ed36d7a
large case scaling
locascio-m Nov 12, 2023
77105e9
faster opt post-processing
locascio-m Nov 14, 2023
46de06a
added aep and opt figs
locascio-m Feb 16, 2024
dcb729f
updated figures
locascio-m May 22, 2024
ee2cf8f
updated scripts for paper figures
locascio-m Jan 27, 2025
da5523e
convert FLOWERS project repo into python package
bayc Feb 4, 2025
2c23f76
add initial aep test
bayc Feb 4, 2025
ddd7cbc
WIP: adding flowers
bayc Sep 9, 2025
29f191b
Merge branch 'develop' into feature/flowers
cfrontin Sep 9, 2025
4a79859
some changes to make the turbine more malleable
cfrontin Sep 9, 2025
03cd371
working python interface when connected to cfrontin/flowers@4a798599e…
cfrontin Sep 9, 2025
4ba408b
add example
cfrontin Sep 9, 2025
70d1728
black reformat and gradients turned on for flowers
cfrontin Sep 9, 2025
42efe9d
making density something that can be specified
cfrontin Sep 9, 2025
3978fdb
use windIO parser
cfrontin Sep 9, 2025
5c4f8c9
brought an adjustment in
cfrontin Sep 10, 2025
735f16c
cherrypick some improvements for beta out of offshore-development
cfrontin Sep 11, 2025
9fa8446
black update
cfrontin Sep 11, 2025
fe8c976
Merge branch 'develop' into feature/flowers
cfrontin Sep 11, 2025
a7e9d98
black reformat
cfrontin Sep 11, 2025
f18787a
Merge branch 'develop' into feature/flowers
cfrontin Sep 11, 2025
199210d
Merge branch 'develop' into feature/flowers
cfrontin Sep 15, 2025
5d8c1c7
update flowers stuff
cfrontin Sep 23, 2025
121a6f0
fix to floris reference height
cfrontin Sep 23, 2025
1b125b4
Merge remote-tracking branch 'upstream/develop' into develop
cfrontin Sep 23, 2025
59a1633
Merge branch 'develop' into feature/flowers
cfrontin Sep 23, 2025
3e318af
add test script
cfrontin Sep 23, 2025
8443e60
update after floris ref height and density fix
cfrontin Sep 23, 2025
4867e5f
Merge branch 'develop' into feature/flowers
cfrontin Sep 23, 2025
96a19ff
add resampling
cfrontin Sep 23, 2025
696e22c
remove extraneous wrg file
cfrontin Sep 23, 2025
ca400bb
black reformat
cfrontin Sep 23, 2025
c8c7f93
Merge branch 'develop' into feature/flowers
cfrontin Sep 23, 2025
fde45a7
equilibriate wind rose resampling
cfrontin Sep 23, 2025
bf825c7
update to resampler
cfrontin Sep 23, 2025
5954e68
fix lookup for resample
cfrontin Sep 23, 2025
88d9815
add a little more
cfrontin Sep 23, 2025
0f7d3e2
Merge pull request #147 from WISDEM/develop
jaredthomas68 Oct 21, 2025
1d81242
Bump version from 0.1.0-beta0 to 0.1.0-beta1
cfrontin Oct 21, 2025
bcc1be4
Merge pull request #151 from WISDEM/develop
jaredthomas68 Oct 22, 2025
49b12da
Bump version from 0.1.0-beta1 to 0.1.0-beta2
cfrontin Oct 22, 2025
01f9b56
Merge branch 'develop' of github.com:WISDEM/Ard into feature/flowers
cfrontin Oct 28, 2025
d6f0e38
my changes
cfrontin Jan 7, 2026
f24221a
move files into a configuration compatible with ard
cfrontin Jan 7, 2026
b429750
prep for flowers combination
cfrontin Jan 7, 2026
92cb237
Merge remote-tracking branch 'flowers_for_merge/prep_for_ard_move' in…
cfrontin Jan 7, 2026
efadd40
adjust pyproject.toml to ensure flowers is installable
cfrontin Jan 7, 2026
7ba6793
reorganize old tests to prepare for new ones
cfrontin Jan 7, 2026
aa8504d
black reformat plus refactoring test/example structure
cfrontin Jan 7, 2026
e4e1ccd
black reformat of the test problem
cfrontin Jan 8, 2026
2f96007
reconfigure testing, add FLOWERS/FLORIS comparison sandbox for system…
cfrontin Jan 15, 2026
3361bc5
added statistical test for FLORIS comparison to FLOWERS system tests.
cfrontin Jan 16, 2026
fb637a2
rename for nicer test printout
cfrontin Jan 16, 2026
817ba02
Merge branch 'main' of github.com:WISDEM/Ard into develop
cfrontin Jan 16, 2026
b16bdaf
update for WISDEM/ORBIT pyrite standard value changes
cfrontin Jan 16, 2026
58468d8
Merge branch 'develop' of github.com:WISDEM/Ard into develop
cfrontin Jan 20, 2026
3046222
black v2026 reformat
cfrontin Jan 20, 2026
3ffc6a6
Merge branch 'develop' of github.com:WISDEM/Ard into feature/full_flo…
cfrontin Jan 20, 2026
de6f004
Merge branch 'develop' into feature/full_flowers_integration
cfrontin Jan 20, 2026
60c4737
get unit tests renamed w/ files and update unit testing script
cfrontin Jan 20, 2026
923d7b8
updated unit test bonus script
cfrontin Jan 20, 2026
8c26d82
Merge branch 'develop' of github.com:WISDEM/Ard into feature/full_flo…
cfrontin Jan 21, 2026
d96e6c4
clean unit test script
cfrontin Jan 21, 2026
6fb0602
Merge branch 'develop' of github.com:WISDEM/Ard into feature/full_flo…
cfrontin Jan 21, 2026
cbbd4fd
add system test too now
cfrontin Jan 21, 2026
abcc0d9
update coverage omits and comments to pull legacy FLOWERS code out of…
cfrontin Jan 21, 2026
a44084b
black reformat
cfrontin Jan 21, 2026
56a5749
add tools test but it doesn't do anything and errors out ha
cfrontin Jan 21, 2026
16d6a27
testing progress
cfrontin Jan 21, 2026
2cabc52
tools tested
cfrontin Jan 21, 2026
e9d8030
remove old github actions runner
cfrontin Jan 21, 2026
ee2b078
add derivative test to iea3.4mw
cfrontin Jan 21, 2026
28712c8
break out the derivative test
cfrontin Jan 21, 2026
87c0931
consolidated derivative test
cfrontin Jan 21, 2026
63246f3
black reformat...
cfrontin Jan 21, 2026
151c931
first tranche of copilot suggestions
cfrontin Jan 21, 2026
dfb02d4
second tranche of copilot suggestions
cfrontin Jan 21, 2026
f5dac07
adjust consolidated test script to run again, no new changes except m…
cfrontin Jan 22, 2026
703de40
added flowers unit and system test to gh action
cfrontin Jan 22, 2026
ae98712
add wind rose pickle
cfrontin Jan 22, 2026
11c75e5
adjust gha script for correct dependencies
cfrontin Jan 22, 2026
50b3a3d
attempt fix for copilot import space pollution suggestion
cfrontin Jan 22, 2026
76b10ce
remove == where isclose is more appropriate...
cfrontin Jan 22, 2026
25f0cf2
remove legacy viz from coverage
cfrontin Jan 22, 2026
e707fe5
actually viz was already set aside...
cfrontin Jan 22, 2026
b676fe8
improved system tests
cfrontin Jan 22, 2026
75b9b97
black reformat...
cfrontin Jan 22, 2026
6cc86f4
cleanup system test
cfrontin Jan 22, 2026
c1e6c01
Merge branch 'develop' of github.com:WISDEM/Ard into feature/flowers
cfrontin Jan 23, 2026
2adc1b8
walk back the house_style change which is now in its own branch
cfrontin Jan 23, 2026
711dfeb
Merge branch 'feature/full_flowers_integration' into feature/flowers
cfrontin Jan 23, 2026
4d2ca48
black reformat
cfrontin Jan 23, 2026
cef90cb
small changes, remove accidental un-deletion
cfrontin Jan 23, 2026
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
6 changes: 4 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[run]
omit =
omit =
ard/utils/test_utils.py
ard/farm_aero/placeholder.py

flowers/visualization.py
flowers/optimization/optimization_interface.py
flowers/optimization/model_interface.py
101 changes: 91 additions & 10 deletions .github/workflows/python-tests-consolidated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ jobs:
run: |
pip install .[dev]

test-unit:
name: Run unit tests
test-ard-unit:
name: Run Ard unit tests
needs: setup-install
strategy:
matrix:
Expand Down Expand Up @@ -86,9 +86,9 @@ jobs:
run: |
pytest --cov=ard --cov-fail-under=80 test/ard/unit

test-system:
name: Run system tests
needs: test-unit
test-ard-system:
name: Run Ard system tests
needs: test-ard-unit
strategy:
matrix:
python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"]
Expand Down Expand Up @@ -127,9 +127,90 @@ jobs:
pytest --cov=ard --cov-fail-under=50 test/ard/system
# pytest --cov=ard --cov-fail-under=80 test/ard/system

test-flowers-unit:
name: Run FLOWERS unit tests
needs: setup-install
strategy:
matrix:
python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"]
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
path: ~/.cache/pip
- os: macos-latest
path: ~/Library/Caches/pip
- os: windows-latest
path: ~\AppData\Local\pip\Cache
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Get cache dependencies
id: cache
uses: actions/cache@v4
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys:
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Install Ard
run: |
pip install .[dev]
- name: Run unit tests with coverage
run: |
pytest --cov=flowers --cov-fail-under=80 test/flowers/unit

test-flowers-system:
name: Run FLOWERS system tests
needs: test-flowers-unit
strategy:
matrix:
python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"]
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
path: ~/.cache/pip
- os: macos-latest
path: ~/Library/Caches/pip
- os: windows-latest
path: ~\AppData\Local\pip\Cache
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Get cache dependencies
id: cache
uses: actions/cache@v4
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys:
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Install Ard
run: |
pip install .[dev]
- name: Run system tests with coverage
run: |
pytest --cov=flowers --cov-fail-under=50 test/flowers/system
# pytest --cov=flowers --cov-fail-under=80 test/flowers/system

find-examples:
name: Find all examples
needs: [test-unit, test-system]
needs: [test-ard-unit, test-ard-system, test-flowers-unit, test-flowers-system]
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -142,7 +223,7 @@ jobs:
id: find_scripts
run: |
echo "scripts<<EOF" >> $GITHUB_OUTPUT
find examples -mindepth 2 -maxdepth 2 -name "*.py" | jq -R -s -c 'split("\n")[:-1]' >> $GITHUB_OUTPUT
find examples -mindepth 3 -maxdepth 3 -name "*.py" | jq -R -s -c 'split("\n")[:-1]' >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
outputs:
scripts: ${{ steps.find_scripts.outputs.scripts }}
Expand Down Expand Up @@ -207,7 +288,7 @@ jobs:

find-examples_nb:
name: Find all example notebooks
needs: [test-unit, test-system]
needs: [test-ard-unit, test-ard-system, test-flowers-unit, test-flowers-system]
if: needs.find-examples_nb.outputs.scripts != '[]' # skip empty
runs-on: ubuntu-latest
steps:
Expand All @@ -221,10 +302,10 @@ jobs:
id: find_notebooks
run: |
echo "scripts<<EOF"
find examples -mindepth 2 -maxdepth 2 -name "*.ipynb" | jq -R -s -c 'split("\n")[:-1]'
find examples -mindepth 3 -maxdepth 3 -name "*.ipynb" | jq -R -s -c 'split("\n")[:-1]'
echo "EOF"
echo "scripts<<EOF" >> $GITHUB_OUTPUT
find examples -mindepth 2 -maxdepth 2 -name "*.ipynb" | jq -R -s -c 'split("\n")[:-1]' >> $GITHUB_OUTPUT
find examples -mindepth 3 -maxdepth 3 -name "*.ipynb" | jq -R -s -c 'split("\n")[:-1]' >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
outputs:
scripts: ${{ steps.find_notebooks.outputs.scripts }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

### ARD DEVELOPMENT IGNORES
### ARD DEVELOPMENT IGNORES

.vscode
case_files
Expand Down
169 changes: 169 additions & 0 deletions ard/farm_aero/flowers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
import os

import numpy as np
import pandas as pd

from ard.farm_aero.floris import create_FLORIS_turbine_from_windIO
from flowers import FlowersModel

import ard.farm_aero.templates as templates


class FLOWERSAEP(templates.FarmAEPTemplate):
"""
Component class for computing an AEP analysis using FLOWERS.

A component class that evaluates a series of farm power and associated
quantities using FLOWERS with a wind rose to make an AEP estimate. Inherits
the interface from `templates.FarmAEPTemplate`.

Options
-------
modeling_options : dict
a modeling options dictionary (inherited via
`templates.FarmAEPTemplate`)
data_path: str
not used for FLOWERS (inherited via `templates.FarmAEPTemplate`)

Inputs
------
x_turbines : np.ndarray
a 1D numpy array indicating the x-dimension locations of the turbines,
with length `N_turbines` (inherited via `templates.FarmAEPTemplate`)
y_turbines : np.ndarray
a 1D numpy array indicating the y-dimension locations of the turbines,
with length `N_turbines` (inherited via `templates.FarmAEPTemplate`)
yaw_turbines : np.ndarray
not used for FLOWERS (inherited via `templates.FarmAEPTemplate`)

Outputs
-------
AEP_farm : float
the AEP of the farm given by the analysis (inherited from
`templates.FarmAEPTemplate`)
power_farm : np.ndarray
an array of the farm power for each of the wind conditions that have
been queried (inherited from `templates.FarmAEPTemplate`)
# power_turbines : np.ndarray
# an array of the farm power for each of the turbines in the farm across
# all of the conditions that have been queried on the wind rose
# (`N_turbines`, `N_wind_conditions`) (inherited from
# `templates.FarmAEPTemplate`)
# thrust_turbines : np.ndarray
# an array of the wind turbine thrust for each of the turbines in the farm
# across all of the conditions that have been queried on the wind rose
# (`N_turbines`, `N_wind_conditions`) (inherited from
# `templates.FarmAEPTemplate`)
"""

def initialize(self):
super().initialize() # run super class script first!

def setup(self):

# override template to allow for input omission

# load modeling options
self.modeling_options = self.options["modeling_options"]
self.windIO = self.modeling_options["windIO_plant"]
self.N_turbines = self.modeling_options["layout"]["N_turbines"]

# set up inputs and outputs for farm layout
self.add_input("x_turbines", np.zeros((self.N_turbines,)), units="m")
self.add_input("y_turbines", np.zeros((self.N_turbines,)), units="m")
self.add_output("AEP_farm", 0.0, units="W*h")

# grab the windrose from the windIO data
windrose_floris = templates.create_windresource_from_windIO(
self.windIO,
resource_type="probability",
)
windrose_resample = self.modeling_options.get("flowers", {}).get(
"windrose_resample",
self.modeling_options.get("wind_rose", {}).get("windrose_resample"),
)
if windrose_resample is not None:
windrose_floris.resample_by_interpolation(
**windrose_resample,
inplace=True,
)
# extract to a dataframe
self.wind_data = pd.DataFrame(
{
"wd": windrose_floris.wd_flat,
"ws": windrose_floris.ws_flat,
"freq_val": windrose_floris.freq_table_flat,
}
)

def setup_partials(self):
self.declare_partials("AEP_farm", ["x_turbines", "y_turbines"], method="exact")

def compute(self, inputs, outputs):

# extract the key inputs
layout_x = inputs["x_turbines"]
layout_y = inputs["y_turbines"]
num_terms = self.modeling_options["flowers"]["num_terms"]
k_wake_expansion = self.modeling_options["flowers"]["k"]

# use the floris turbine as an intermediary to cover off windIO variants
self.floris_turbine = create_FLORIS_turbine_from_windIO(self.windIO)

rho_density_air = self.floris_turbine["power_thrust_table"][
"ref_air_density"
] # kg/m^3
area_rotor = np.pi / 4 * self.floris_turbine["rotor_diameter"] ** 2 # m^2
V_table = np.array(self.floris_turbine["power_thrust_table"]["wind_speed"])
P_table = 1.0e3 * np.array(self.floris_turbine["power_thrust_table"]["power"])
CT_table = np.array(
self.floris_turbine["power_thrust_table"]["thrust_coefficient"]
)
CP_table = np.where(
V_table == 0.0,
0.0,
P_table / (0.5 * rho_density_air * area_rotor * V_table**3),
)

turbine_type = {
"D": self.windIO["wind_farm"]["turbine"]["rotor_diameter"],
"U": self.windIO["wind_farm"]["turbine"]["performance"].get(
"cutout_wind_speed", 25.0
),
"ct": CT_table,
"u_ct": V_table,
"cp": CP_table,
"u_cp": V_table,
}

# create the flowers model
self.flowers_model = FlowersModel(
self.wind_data,
layout_x,
layout_y,
num_terms,
k_wake_expansion,
turbine_type,
)

# FLOWERS computes the powers
outputs["AEP_farm"] = self.flowers_model.calculate_aep(
rho_density=rho_density_air
)
# outputs["power_farm"] = FLOWERSFarmComponent.get_power_farm(self)
# outputs["power_turbines"] = FLOWERSFarmComponent.get_power_turbines(self)
# outputs["thrust_turbines"] = FLOWERSFarmComponent.get_thrust_turbines(self)

def compute_partials(self, inputs, partials):

# grab dependencies
rho_density_air = self.floris_turbine["power_thrust_table"][
"ref_air_density"
] # kg/m^3

# compute the gradients and extract to the right places
_, gradient = self.flowers_model.calculate_aep(
rho_density=rho_density_air, gradient=True
)
partials["AEP_farm", "x_turbines"] = gradient[:, 0]
partials["AEP_farm", "y_turbines"] = gradient[:, 1]
10 changes: 10 additions & 0 deletions ard/farm_aero/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,16 @@ def setup(self):
"probability",
)

# if requested, resample the wind rose
windrose_resample = self.modeling_options.get("wind_rose", {}).get(
"windrose_resample"
)
if windrose_resample is not None:
self.wind_query.resample_by_interpolation(
**windrose_resample,
inplace=True,
)

if data_path is None:
data_path = ""

Expand Down
4 changes: 2 additions & 2 deletions assets/logomaker/inputs/windio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3303,7 +3303,7 @@ site:
- 511.7766126774107
energy_resource:
name: Example energy resource
wind_resource: !include ../../../examples/data/windIO-plant_wind-resource_wrg-example.yaml
wind_resource: !include ../../../examples/ard/data/windIO-plant_wind-resource_wrg-example.yaml
wind_farm:
name: LogoFarm
layouts:
Expand All @@ -3322,7 +3322,7 @@ wind_farm:
1250.0, 1250.0, 1250.0, 1250.0, 1250.0,
2500.0, 2500.0, 2500.0, 2500.0, 2500.0
]
turbine: !include ../../../examples/data/windIO-plant_turbine_IEA-3.4MW-130m-RWT.yaml
turbine: !include ../../../examples/ard/data/windIO-plant_turbine_IEA-3.4MW-130m-RWT.yaml
electrical_substations:
- electrical_substation:
coordinates:
Expand Down
23 changes: 23 additions & 0 deletions examples/flowers/_archive/compute_AEP.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import numpy as np
import pandas as pd

from flowers import FlowersModel

# Create generic layout
D = 126.0
layout_x = D * np.array(
[0.0, 0.0, 0.0, 7.0, 7.0, 7.0, 14.0, 14.0, 14.0, 21.0, 21.0, 21.0, 28.0, 28.0, 28.0]
)
layout_y = D * np.array(
[0.0, 7.0, 14.0, 0.0, 7.0, 14.0, 0.0, 7.0, 14.0, 0.0, 7.0, 14.0, 0.0, 7.0, 14.0]
)

# Load in wind data
df = pd.read_csv("../data/HKW_wind_rose.csv")

# Setup FLOWERS model
flowers_model = FlowersModel(df, layout_x, layout_y)

# Calculate the AEP
aep = flowers_model.calculate_aep()
print(aep)
Loading
Loading