Skip to content

Commit

Permalink
Merge pull request #105 from WISDEM/strainsOF
Browse files Browse the repository at this point in the history
Blade strains OpenFAST
  • Loading branch information
gbarter authored May 12, 2021
2 parents 08cfb27 + 1377d7b commit 401da3e
Show file tree
Hide file tree
Showing 112 changed files with 12,015 additions and 8,894 deletions.
19 changes: 19 additions & 0 deletions ROSCO_toolbox/.github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Description and Purpose

## Type of change
What types of change is it?
_Select the appropriate type(s) that describe this PR_

- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (non-backwards-compatible fix or feature)
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no API changes)
- [ ] Documentation update
- [ ] Maintenance update
- [ ] Other (please describe)

## Github issues addressed, if one exists

## Examples/Testing, if applicable

106 changes: 106 additions & 0 deletions ROSCO_toolbox/.github/workflows/CI_rosco-toolbox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: CI_rosco-toolbox

# We run CI on push commits on all branches
on: [push, pull_request]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest", "macOS-latest", "windows-latest"]
python-version: ["3.8"]
defaults:
run:
shell: bash -l {0}

steps:
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive

- name: Setup environment
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
channels: conda-forge, general
auto-update-conda: true
python-version: 3.8
environment-file: environment.yml


# Install dependencies of ROSCO toolbox
- name: Add dependencies ubuntu specific
if: false == contains( matrix.os, 'windows')
run: |
conda install -y compilers
conda install -y wisdem
- name: Add dependencies windows specific
if: true == contains( matrix.os, 'windows')
run: |
conda install -y m2w64-toolchain libpython
conda install -y wisdem
# Install ROSCO toolbox
- name: Install ROSCO toolbox
run: |
python setup.py develop --compile-rosco
run_examples:
name: Run Examples
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest"] #, "macOS-latest"]
python-version: ["3.8"]
defaults:
run:
shell: bash -l {0}

steps:
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive

- name: Setup environment
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
channels: conda-forge, general
auto-update-conda: true
python-version: 3.8
environment-file: environment.yml


# Install dependencies of ROSCO toolbox
- name: Add dependencies ubuntu specific
if: false == contains( matrix.os, 'windows')
run: |
conda install -y compilers
conda install -y wisdem
# Install ROSCO toolbox
- name: Install ROSCO toolbox
run: |
python setup.py develop --compile-rosco
# Install OpenFAST
- name: Install OpenFAST
run: |
conda install openfast==2.5.0
# Run examples
- name: Run examples
run: |
cd Examples
python run_examples.py
2 changes: 1 addition & 1 deletion ROSCO_toolbox/.gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "ROSCO"]
path = ROSCO
url = https://github.com/NREL/ROSCO
branch = main
branch = main
17 changes: 5 additions & 12 deletions ROSCO_toolbox/Examples/example_06.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@
from ROSCO_toolbox import turbine as ROSCO_turbine
from ROSCO_toolbox.utilities import write_DISCON, run_openfast
from ROSCO_toolbox import sim as ROSCO_sim
from ROSCO_toolbox.ofTools.fast_io import output_processing

this_dir = os.path.dirname(os.path.abspath(__file__))
rt_dir = os.path.dirname(this_dir)

# Load yaml file
parameter_filename = os.path.join(os.path.dirname(this_dir), 'Tune_Cases', 'IEA15MW.yaml')
Expand All @@ -36,26 +34,21 @@

# Load turbine data from OpenFAST and rotor performance text file
turbine.load_from_fast(path_params['FAST_InputFile'], \
os.path.join(rt_dir,path_params['FAST_directory']), \
os.path.join(this_dir,path_params['FAST_directory']), \
dev_branch=True,rot_source='txt',\
txt_filename=os.path.join(rt_dir,path_params['FAST_directory'],path_params['rotor_performance_filename']))
txt_filename=os.path.join(this_dir,path_params['FAST_directory'],path_params['rotor_performance_filename']))

# Tune controller
controller.tune_controller(turbine)

# Write parameter input file
param_file = os.path.join(rt_dir,'Test_Cases/IEA-15-240-RWT-UMaineSemi/ServoData/DISCON-UMaineSemi.IN') # This must be named DISCON.IN to be seen by the compiled controller binary.
param_file = os.path.join(this_dir,'DISCON.IN') # This must be named DISCON.IN to be seen by the compiled controller binary.
write_DISCON(turbine,controller,param_file=param_file, txt_filename=path_params['rotor_performance_filename'])

# Run OpenFAST
# --- May need to change fastcall if you use a non-standard command to call openfast
fastcall = '/Users/dzalkind/Tools/WEIS-1/build/temp.macosx-10.9-x86_64-3.8_rosco_openfast/glue-codes/openfast/openfast'
run_openfast(
os.path.join(rt_dir,path_params['FAST_directory']),
fastcall=fastcall,
fastfile=path_params['FAST_InputFile'],
chdir=True
)
fastcall = 'openfast'
run_openfast(path_params['FAST_directory'], fastcall=fastcall, fastfile=path_params['FAST_InputFile'], chdir=True)



Expand Down
11 changes: 6 additions & 5 deletions ROSCO_toolbox/Examples/example_07.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@
controller.tune_controller(turbine)

# Plot minimum pitch schedule
plt.plot(controller.v, controller.pitch_op,label='Steady State Operation')
plt.plot(controller.v, controller.ps_min_bld_pitch, label='Minimum Pitch Schedule')
plt.legend()
plt.xlabel('Wind speed (m/s)')
plt.ylabel('Blade pitch (rad)')
fig, ax = plt.subplots(1,1)
ax.plot(controller.v, controller.pitch_op,label='Steady State Operation')
ax.plot(controller.v, controller.ps_min_bld_pitch, label='Minimum Pitch Schedule')
ax.legend()
ax.set_xlabel('Wind speed (m/s)')
ax.set_ylabel('Blade pitch (rad)')

if False:
plt.show()
Expand Down
9 changes: 3 additions & 6 deletions ROSCO_toolbox/Examples/example_09.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
wind_directory = os.path.join(this_dir,'../Test_Cases/Wind/')
turbsim_infile = '90m_12mps_twr.inp'

run_openfast(
wind_directory,
fastcall='/Users/dzalkind/Tools/WEIS-1/build/temp.macosx-10.9-x86_64-3.8_rosco_openfast/modules/turbsim/turbsim',
fastfile=turbsim_infile,
chdir=False
)
run_openfast(wind_directory, fastcall='turbsim',
fastfile=os.path.join(wind_directory, turbsim_infile), chdir=False)

print('test')
8 changes: 1 addition & 7 deletions ROSCO_toolbox/Examples/example_11.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@

import numpy as np

this_dir = os.path.dirname(os.path.abspath(__file__))
rt_dir = os.path.dirname(this_dir)

# Load yaml file
parameter_filename = os.path.join( os.path.dirname( os.path.dirname( os.path.realpath(__file__) )),
'Tune_Cases', 'IEA15MW.yaml')
Expand All @@ -43,10 +40,7 @@
controller = ROSCO_controller.Controller(controller_params)

# Load turbine data from OpenFAST and rotor performance text file
turbine.load_from_fast(path_params['FAST_InputFile'], \
os.path.join(rt_dir,path_params['FAST_directory']), \
dev_branch=True,rot_source='txt',\
txt_filename=os.path.join(rt_dir,path_params['FAST_directory'],path_params['rotor_performance_filename']))
turbine.load_from_fast(path_params['FAST_InputFile'],path_params['FAST_directory'],dev_branch=True,rot_source=None,txt_filename=path_params['rotor_performance_filename'])

# Tune controller
controller.tune_controller(turbine)
Expand Down
4 changes: 3 additions & 1 deletion ROSCO_toolbox/Examples/run_examples.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import unittest
import sys
from time import time
import importlib

Expand Down Expand Up @@ -100,4 +101,5 @@ def suite():


if __name__ == "__main__":
unittest.TextTestRunner().run(suite())
result = unittest.TextTestRunner().run(suite())
sys.exit(not result.wasSuccessful())
54 changes: 0 additions & 54 deletions ROSCO_toolbox/HISTORY.md

This file was deleted.

Loading

0 comments on commit 401da3e

Please sign in to comment.