Skip to content

Commit

Permalink
Openfast io (#417)
Browse files Browse the repository at this point in the history
* Switch to openfast_io and update to OpenFAST v4.0.0

* Remove old IEA-UMaineSemi, move linearizations

* Revert ROSCO_Testing exes

* Start updating NREL-5MW model

* Examples working except 5,7,14,17,26

* working example 26

* Enable yaw control

* Add openfast_io to pip installs

* Install openfast 4.0 in CI

* Install openfast_io in toml

* Print pytest outputs

* Update IEA-15 Semi paths

* Search for servodyn files recursively

* Fix paths in tests, update discon script

* Update discons

* Increase tolerance on check, checkpoint not perfect

* Skip python 3.9

* Fix path in notebook

* try newer conda packages

* add zmq explicitly

* another try

* more debug

* Try m2-pkg-config

* Update install.rst

---------

Co-authored-by: Mayank Chetan <mayankchetan@gmail.com>
Co-authored-by: Garrett Barter <garrett.barter@nrel.gov>
  • Loading branch information
3 people authored Jan 28, 2025
1 parent 975ffac commit cadd555
Show file tree
Hide file tree
Showing 509 changed files with 132,640 additions and 42,782 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/CI_rosco-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false #true
matrix:
os: ["ubuntu-latest", "macOS-latest", "windows-latest"] #mac-13 intel, mac-14 arm
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12"]

steps:
- name: Setup GNU Fortran
Expand Down Expand Up @@ -108,29 +108,33 @@ jobs:
strategy:
fail-fast: false #true
matrix:
os: ["ubuntu-latest", "macOS-13", "windows-latest"] #mac-13 intel, mac-14 arm
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: ["ubuntu-latest", "macOS-13", "macOS-14", "windows-latest"] #mac-13 intel, mac-14 arm
python-version: ["3.10", "3.11", "3.12"]

steps:
- name: checkout repository
uses: actions/checkout@v4

- uses: conda-incubator/setup-miniconda@v2
- uses: conda-incubator/setup-miniconda@v3
# https://github.com/marketplace/actions/setup-miniconda
with:
#mamba-version: "*"
miniforge-version: "latest"
auto-update-conda: true
python-version: ${{ matrix.python-version }}
environment-file: environment.yml
activate-environment: test
auto-activate-base: false

- name: Install OpenFAST
run: |
conda install openfast>=4.0
- name: Add dependencies windows specific
if: contains( matrix.os, 'windows')
run: |
conda install -y m2w64-toolchain libpython
conda install -y gfortran gcc libpython m2-pkg-config
gfortran --version
ls C:/Users/runneradmin/miniconda3/envs/test/Library/lib/*zmq*
- name: Add dependencies mac specific
if: contains( matrix.os, 'mac')
Expand All @@ -142,15 +146,11 @@ jobs:
- name: Debug
run: |
conda list
printenv
printenv | sort
- name: Conda Install ROSCO
run: |
python -m pip install -e .
- name: Install OpenFAST
run: |
conda install openfast==3.5.3
python -m pip install -e . --no-build-isolation
- name: Generate Registry
run: |
Expand All @@ -175,7 +175,7 @@ jobs:
if: contains( matrix.os, 'ubuntu')
run: |
cd rosco/test
pytest .
pytest -s .
- name: Test walkthrough notebook
if: contains( matrix.os, 'ubuntu')
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Examples/*.p
# Exclude testing results
ROSCO_testing/results/
ROSCO_testing/testing
rosco/test/testing

# Simulink/Matlab temp files
*.slxc
Expand Down
5 changes: 3 additions & 2 deletions Examples/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Cp_Ct_Cq.*.txt
*.p
examples_out/
examples_out/
11_robust_tuning_out
*.10
4 changes: 4 additions & 0 deletions Examples/05_openfast_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from rosco.toolbox import turbine as ROSCO_turbine
from rosco.toolbox.utilities import write_DISCON, run_openfast
from rosco.toolbox.inputs.validation import load_rosco_yaml
from rosco import discon_lib_path

def main():
this_dir = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -48,6 +49,9 @@ def main():
txt_filename=os.path.join(tune_dir,path_params['rotor_performance_filename'])
)

# Setting up the location of ROSCO library
turbine.fast.fst_vt['ServoDyn']['DLL_FileName'] = discon_lib_path

# Tune controller
controller.tune_controller(turbine)

Expand Down
2 changes: 1 addition & 1 deletion Examples/07_openfast_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def main():
os.makedirs(example_out_dir)

# Define openfast output filenames
filenames = ["Test_Cases/IEA-15-240-RWT-UMaineSemi/IEA-15-240-RWT-UMaineSemi.outb"]
filenames = ["Test_Cases/IEA-15-240-RWT/IEA-15-240-RWT-UMaineSemi/IEA-15-240-RWT-UMaineSemi.outb"]
# ---- Note: Could load and plot multiple cases, textfiles, and binaries...
# filenames = ["../Test_Cases/NREL-5MW/NREL-5MW.outb",
# "../Test_Cases/NREL-5MW/NREL-5MW_ex8.outb"]
Expand Down
5 changes: 5 additions & 0 deletions Examples/14_open_loop_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ def main():
### Run OpenFAST using aeroelasticse tools
case_inputs = {}
case_inputs[('ServoDyn','DLL_FileName')] = {'vals': [discon_lib_path], 'group': 0}
case_inputs[('ServoDyn','Ptch_Cntrl')] = {'vals': [1], 'group': 0}
case_inputs[('ServoDyn','YCMode')] = {'vals': [5], 'group': 0}
case_inputs[('ServoDyn','TYCOn')] = {'vals': [0], 'group': 0}
case_inputs[('ElastoDyn','YawDOF')] = {'vals': ['True'], 'group': 0}


# Apply all discon variables as case inputs
discon_vt = ROSCO_utilities.DISCON_dict(
Expand Down
2 changes: 1 addition & 1 deletion Examples/22_cable_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from rosco.toolbox.ofTools.case_gen import CaseLibrary as cl
from rosco.toolbox.ofTools.fast_io import output_processing
import numpy as np
from rosco.toolbox.ofTools.fast_io.FAST_reader import InputReader_OpenFAST
from openfast_io.FAST_reader import InputReader_OpenFAST
from rosco.toolbox.inputs.validation import load_rosco_yaml
import matplotlib.pyplot as plt
from rosco.toolbox.controller import OpenLoopControl
Expand Down
4 changes: 2 additions & 2 deletions Examples/23_structural_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from rosco.toolbox.ofTools.case_gen.run_FAST import run_FAST_ROSCO
from rosco.toolbox.ofTools.case_gen import CaseLibrary as cl
#import numpy as np
from rosco.toolbox.ofTools.fast_io.FAST_reader import InputReader_OpenFAST
from openfast_io.FAST_reader import InputReader_OpenFAST
from rosco.toolbox.inputs.validation import load_rosco_yaml
from rosco.toolbox.controller import OpenLoopControl

Expand Down Expand Up @@ -47,7 +47,7 @@ def main():
reader.execute()

reader.fst_vt['ServoDyn']['NumSStC'] = 3
reader.fst_vt['ServoDyn']['SStCfiles'] = ['StC-Force-Col1.dat', 'StC-Force-Col2.dat', 'StC-Force-Col3.dat']
reader.fst_vt['ServoDyn']['SStCfiles'] = ['../StC-Force-Col1.dat', '../StC-Force-Col2.dat', '../StC-Force-Col3.dat']
# Add SStC file inputs
for StC_file in reader.fst_vt['ServoDyn']['SStCfiles']:
reader.fst_vt['SStC'].append(reader.read_StC(StC_file))
Expand Down
2 changes: 1 addition & 1 deletion Examples/28_tower_resonance.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from rosco.toolbox.ofTools.case_gen.run_FAST import run_FAST_ROSCO
from rosco.toolbox.ofTools.case_gen import CaseLibrary as cl
#from rosco.toolbox.ofTools.fast_io import output_processing
from rosco.toolbox.ofTools.fast_io.FAST_reader import InputReader_OpenFAST
from openfast_io.FAST_reader import InputReader_OpenFAST
from rosco.toolbox.inputs.validation import load_rosco_yaml

import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion Examples/ROSCO_walkthrough.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@
"\n",
"# Define openfast output filenames, please fill in your own .outb\n",
"# filenames = [\"../Test_Cases/5MW_Step/5MW_Step.outb\"]\n",
"filenames = ['Test_Cases/IEA-15-240-RWT-UMaineSemi/IEA-15-240-RWT-UMaineSemi.outb']\n",
"filenames = ['Test_Cases/IEA-15-240-RWT/IEA-15-240-RWT-UMaineSemi/IEA-15-240-RWT-UMaineSemi.outb']\n",
"# Load output info and data\n",
"fast_out = op.load_fast_out(filenames)\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ DEFAULT InterpOrd ! Interpolation order to use for quasi-stea
1 NonDimArea ! The non-dimensional area of the airfoil (area/chord^2) (set to 1.0 if unsure or unneeded)
@"AF00_Coords.txt" NumCoords ! The number of coordinates in the airfoil shape file. Set to zero if coordinates not included.
AF00_BL.txt BL_file ! The file name including the boundary layer characteristics of the profile. Ignored if the aeroacoustic module is not called.
1 NumTabs ! Number of airfoil tables in this file. Each table must have lines for Re and Ctrl.
1 NumTabs ! Number of airfoil tables in this file. Each table must have lines for Re and UserProp.
! ------------------------------------------------------------------------------
! data for table 1
! ------------------------------------------------------------------------------
0.754030 Re ! Reynolds number in millions
0 Ctrl ! Control setting (must be 0 for current AirfoilInfo)
0 UserProp ! Control setting (must be 0 for current AirfoilInfo)
True InclUAdata ! Is unsteady aerodynamics data included in this table? If TRUE, then include 30 UA coefficients below this line
!........................................
29.393939 alpha0 ! 0-lift angle of attack, depends on airfoil.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ DEFAULT InterpOrd ! Interpolation order to use for quasi-stea
1 NonDimArea ! The non-dimensional area of the airfoil (area/chord^2) (set to 1.0 if unsure or unneeded)
@"AF01_Coords.txt" NumCoords ! The number of coordinates in the airfoil shape file. Set to zero if coordinates not included.
AF01_BL.txt BL_file ! The file name including the boundary layer characteristics of the profile. Ignored if the aeroacoustic module is not called.
1 NumTabs ! Number of airfoil tables in this file. Each table must have lines for Re and Ctrl.
1 NumTabs ! Number of airfoil tables in this file. Each table must have lines for Re and UserProp.
! ------------------------------------------------------------------------------
! data for table 1
! ------------------------------------------------------------------------------
1.626654 Re ! Reynolds number in millions
0 Ctrl ! Control setting (must be 0 for current AirfoilInfo)
0 UserProp ! Control setting (must be 0 for current AirfoilInfo)
True InclUAdata ! Is unsteady aerodynamics data included in this table? If TRUE, then include 30 UA coefficients below this line
!........................................
2.107816 alpha0 ! 0-lift angle of attack, depends on airfoil.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ DEFAULT InterpOrd ! Interpolation order to use for quasi-stea
1 NonDimArea ! The non-dimensional area of the airfoil (area/chord^2) (set to 1.0 if unsure or unneeded)
@"AF02_Coords.txt" NumCoords ! The number of coordinates in the airfoil shape file. Set to zero if coordinates not included.
AF02_BL.txt BL_file ! The file name including the boundary layer characteristics of the profile. Ignored if the aeroacoustic module is not called.
1 NumTabs ! Number of airfoil tables in this file. Each table must have lines for Re and Ctrl.
1 NumTabs ! Number of airfoil tables in this file. Each table must have lines for Re and UserProp.
! ------------------------------------------------------------------------------
! data for table 1
! ------------------------------------------------------------------------------
2.538528 Re ! Reynolds number in millions
0 Ctrl ! Control setting (must be 0 for current AirfoilInfo)
0 UserProp ! Control setting (must be 0 for current AirfoilInfo)
True InclUAdata ! Is unsteady aerodynamics data included in this table? If TRUE, then include 30 UA coefficients below this line
!........................................
1.985575 alpha0 ! 0-lift angle of attack, depends on airfoil.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ DEFAULT InterpOrd ! Interpolation order to use for quasi-stea
1 NonDimArea ! The non-dimensional area of the airfoil (area/chord^2) (set to 1.0 if unsure or unneeded)
@"AF03_Coords.txt" NumCoords ! The number of coordinates in the airfoil shape file. Set to zero if coordinates not included.
AF03_BL.txt BL_file ! The file name including the boundary layer characteristics of the profile. Ignored if the aeroacoustic module is not called.
1 NumTabs ! Number of airfoil tables in this file. Each table must have lines for Re and Ctrl.
1 NumTabs ! Number of airfoil tables in this file. Each table must have lines for Re and UserProp.
! ------------------------------------------------------------------------------
! data for table 1
! ------------------------------------------------------------------------------
3.518213 Re ! Reynolds number in millions
0 Ctrl ! Control setting (must be 0 for current AirfoilInfo)
0 UserProp ! Control setting (must be 0 for current AirfoilInfo)
True InclUAdata ! Is unsteady aerodynamics data included in this table? If TRUE, then include 30 UA coefficients below this line
!........................................
1.807510 alpha0 ! 0-lift angle of attack, depends on airfoil.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ DEFAULT InterpOrd ! Interpolation order to use for quasi-stea
1 NonDimArea ! The non-dimensional area of the airfoil (area/chord^2) (set to 1.0 if unsure or unneeded)
@"AF04_Coords.txt" NumCoords ! The number of coordinates in the airfoil shape file. Set to zero if coordinates not included.
AF04_BL.txt BL_file ! The file name including the boundary layer characteristics of the profile. Ignored if the aeroacoustic module is not called.
1 NumTabs ! Number of airfoil tables in this file. Each table must have lines for Re and Ctrl.
1 NumTabs ! Number of airfoil tables in this file. Each table must have lines for Re and UserProp.
! ------------------------------------------------------------------------------
! data for table 1
! ------------------------------------------------------------------------------
4.575668 Re ! Reynolds number in millions
0 Ctrl ! Control setting (must be 0 for current AirfoilInfo)
0 UserProp ! Control setting (must be 0 for current AirfoilInfo)
True InclUAdata ! Is unsteady aerodynamics data included in this table? If TRUE, then include 30 UA coefficients below this line
!........................................
1.678026 alpha0 ! 0-lift angle of attack, depends on airfoil.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ DEFAULT InterpOrd ! Interpolation order to use for quasi-stea
1 NonDimArea ! The non-dimensional area of the airfoil (area/chord^2) (set to 1.0 if unsure or unneeded)
@"AF05_Coords.txt" NumCoords ! The number of coordinates in the airfoil shape file. Set to zero if coordinates not included.
AF05_BL.txt BL_file ! The file name including the boundary layer characteristics of the profile. Ignored if the aeroacoustic module is not called.
1 NumTabs ! Number of airfoil tables in this file. Each table must have lines for Re and Ctrl.
1 NumTabs ! Number of airfoil tables in this file. Each table must have lines for Re and UserProp.
! ------------------------------------------------------------------------------
! data for table 1
! ------------------------------------------------------------------------------
5.700528 Re ! Reynolds number in millions
0 Ctrl ! Control setting (must be 0 for current AirfoilInfo)
0 UserProp ! Control setting (must be 0 for current AirfoilInfo)
True InclUAdata ! Is unsteady aerodynamics data included in this table? If TRUE, then include 30 UA coefficients below this line
!........................................
1.619305 alpha0 ! 0-lift angle of attack, depends on airfoil.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ DEFAULT InterpOrd ! Interpolation order to use for quasi-stea
1 NonDimArea ! The non-dimensional area of the airfoil (area/chord^2) (set to 1.0 if unsure or unneeded)
@"AF06_Coords.txt" NumCoords ! The number of coordinates in the airfoil shape file. Set to zero if coordinates not included.
AF06_BL.txt BL_file ! The file name including the boundary layer characteristics of the profile. Ignored if the aeroacoustic module is not called.
1 NumTabs ! Number of airfoil tables in this file. Each table must have lines for Re and Ctrl.
1 NumTabs ! Number of airfoil tables in this file. Each table must have lines for Re and UserProp.
! ------------------------------------------------------------------------------
! data for table 1
! ------------------------------------------------------------------------------
6.865415 Re ! Reynolds number in millions
0 Ctrl ! Control setting (must be 0 for current AirfoilInfo)
0 UserProp ! Control setting (must be 0 for current AirfoilInfo)
True InclUAdata ! Is unsteady aerodynamics data included in this table? If TRUE, then include 30 UA coefficients below this line
!........................................
1.063866 alpha0 ! 0-lift angle of attack, depends on airfoil.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ DEFAULT InterpOrd ! Interpolation order to use for quasi-stea
1 NonDimArea ! The non-dimensional area of the airfoil (area/chord^2) (set to 1.0 if unsure or unneeded)
@"AF07_Coords.txt" NumCoords ! The number of coordinates in the airfoil shape file. Set to zero if coordinates not included.
AF07_BL.txt BL_file ! The file name including the boundary layer characteristics of the profile. Ignored if the aeroacoustic module is not called.
1 NumTabs ! Number of airfoil tables in this file. Each table must have lines for Re and Ctrl.
1 NumTabs ! Number of airfoil tables in this file. Each table must have lines for Re and UserProp.
! ------------------------------------------------------------------------------
! data for table 1
! ------------------------------------------------------------------------------
8.026545 Re ! Reynolds number in millions
0 Ctrl ! Control setting (must be 0 for current AirfoilInfo)
0 UserProp ! Control setting (must be 0 for current AirfoilInfo)
True InclUAdata ! Is unsteady aerodynamics data included in this table? If TRUE, then include 30 UA coefficients below this line
!........................................
-0.252813 alpha0 ! 0-lift angle of attack, depends on airfoil.
Expand Down
Loading

0 comments on commit cadd555

Please sign in to comment.