Skip to content

Commit

Permalink
Squashed 'ROSCO/' changes from e86b860d..40a4edc9
Browse files Browse the repository at this point in the history
40a4edc9 F/zmq (WISDEM#145)
b45fb430 External Control Interface (WISDEM#141)
9ca75e1e Robust control updates (WISDEM#139)
0bf504ee Pass through (WISDEM#136)
75e7fb8d RAAW Updates (WISDEM#133)
50a2f90e Add OpenFAST channels that Simulink reads (WISDEM#135)
5cdb0b5f Pitch Actuator and IPC updates (WISDEM#123)
e035a7d9 Flip Ct and Cq table allocation (WISDEM#130)
bd0562cd sigma + ipc (WISDEM#125)
d5201923 Update docs to reflect CI process
e9c9378e Merge remote-tracking branch 'upstream/develop' into develop
4126adbf Bladed readthedocs (WISDEM#117)
d7d15b04 Update version in API change docs
8c312875 Bladed docs (WISDEM#116)
5f18bf8c Increment version number
9b5499d7 ipc (WISDEM#105)
a857211f Allow default inputs (WISDEM#110)
REVERT: e86b860d delete extra F_FlpCornerFrerq
REVERT: e7e10e66 Merge remote-tracking branch 'origin/f/ipc' into f/ipc
REVERT: bee2e8e5 improved flap controller filtering
REVERT: 427f2ac5 refactor flap tuning for normalization methods
REVERT: de5ebc1c Update ROSCO Simulink model with IPC example
REVERT: 77dcc15a Revert "Print OL inputs"
REVERT: f6bea78d Print shape
REVERT: ec401f37 Print more stuf
REVERT: 69e87c49 Make example shorter
REVERT: 8623c86e Print OL inputs
REVERT: 4e2dac46 Allow logging level 3
REVERT: 8e2a642b Print OL inputs
REVERT: 58573a71 Disable other examples
REVERT: bf72b14f Revert "Use PriPath and RootName to name dbg files"
REVERT: ad4409db Merge remote-tracking branch 'nja/f/ipc' into f/ipc
REVERT: 285f7b0e Print AvrSWAP
REVERT: 062fcaa5 Use PriPath and RootName to name dbg files
REVERT: 38a13da4 add control packageg
REVERT: a9f43b94 Print when finished with ROSCO
REVERT: 58b4e1b5 Update discons - resolve conflict
REVERT: c8b23371 Merge remote-tracking branch 'upstream/develop' into f/ipc
REVERT: 480c7c4a Disable logging level
REVERT: 3beca3eb Clean up, hone in on debug call
REVERT: 5692ab84 Add more debugging lines 2
REVERT: a568be6a Add more debugging lines
REVERT: e119569f Debug OL reading
REVERT: 0971f300 Set wind speed, rotor speed IC in example 14
REVERT: a362dc47 Fix OL_Input reading
REVERT: b4c75584 Update DISCONs again
REVERT: db919993 Fix Material parameter path
REVERT: 1dc03765 shorten simulation time
REVERT: 5cb3725e Allow IPC to command pitch value below peak shaving saturation limit
REVERT: 07753d8c Add IPC tuning vars
REVERT: 6caf61ed cleanup and streaamline run_examples
REVERT: 1e5398f9 add examples to readme
REVERT: 26bd784e Update cp surfaces and DISCONS
REVERT: 7f3d89a3 Add example 13 for IPC
REVERT: e35f20a1 expand pitch_initial to 30 degrees
REVERT: 7760bcd7 update coord reader/writer
REVERT: c1d7908d Add IEA15MW_OL.yaml
REVERT: 9a75c711 ignore dbg2 files
REVERT: 28099671 Update Polars to point to coord files
REVERT: b6ba2535 make sure IPC_KP is positive
REVERT: 03f2b761 fix ipc gain printing bug
REVERT: 9bc06254 fix variable names
REVERT: 02e08f7d add IPC gains to schema for pass-through ability
REVERT: 86f3a9c4 numerical qualifiers for error handling
REVERT: abd83d73 Add IPC_KP to api changes
REVERT: 844b0693 add CMakeFiles to gitignore
REVERT: 2ade0153 add mutichannel plotting with tuples
REVERT: 7e5e2a3d Error checking foro flp or ipc
REVERT: 79e5d540 Addd IPC_KP to DISCON.IN
REVERT: 0111087a Fix comments in ColemanTransformInverse
REVERT: fded9d42 Add cyclic flap conrol
REVERT: dbd81afd Better logic for filtering RootMOOP and fix notch filter slopes bug
REVERT: 5e40ac40 Add IPC and filtered RootMyc to registry
REVERT: 823f5f00 Add proportional control and cleanup IPC
REVERT: 065befa7 Fix performance table paths
REVERT: afca92fc Update surface and DISCON.INs
REVERT: 262d3f6f rename aerodynblade inputs
REVERT: ee00f678 remove interpolation of blade chord and twist

git-subtree-dir: ROSCO
git-subtree-split: 40a4edc9fc15430d7bd21f895c00a7bf7455add6
  • Loading branch information
nikhar-abbas committed Jun 28, 2022
1 parent d3ac52c commit 3b8a5af
Show file tree
Hide file tree
Showing 90 changed files with 6,464 additions and 2,952 deletions.
10 changes: 10 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ _Select the appropriate type(s) that describe this PR_
- [ ] Maintenance update
- [ ] Other (please describe)

TODO Items General:
- [ ] Add example/test for new feature
- [ ] Update registry
- [ ] Run testing

TODO Items API Change:
- [ ] Update docs with API change
- [ ] Run update_discons.py
- [ ] Update DISCON schema

## Github issues addressed, if one exists

## Examples/Testing, if applicable
Expand Down
69 changes: 52 additions & 17 deletions .github/workflows/CI_rosco-pytools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [push, pull_request]

# Specify FORTRAN compiler
env:
FC: gfortran
FC: gfortran-10

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand Down Expand Up @@ -42,14 +42,25 @@ jobs:
if: true == contains( matrix.os, 'windows')
run: |
conda install -y m2w64-toolchain libpython
env:
FC: gfortran


- name: Add dependencies macOS specific
if: true == contains( matrix.os, 'macOS')
run: |
conda install compilers
# - name: Add dependencies macOS specific
# if: true == contains( matrix.os, 'macOS')
# run: |
# conda install compilers

# Install ROSCO toolbox
- name: Install ROSCO toolbox on Windows
if: true == contains( matrix.os, 'windows')
env:
FC: gfortran
run: |
python setup.py develop --compile-rosco
- name: Install ROSCO toolbox
if: false == contains( matrix.os, 'windows')
run: |
python setup.py develop --compile-rosco
Expand Down Expand Up @@ -81,35 +92,60 @@ jobs:
python-version: 3.8
environment-file: environment.yml

# setup cmake
- name: Setup Workspace
run: cmake -E make_directory ${{runner.workspace}}/ROSCO/ROSCO/build

# Install dependencies of ROSCO toolbox
- name: Add dependencies ubuntu specific
if: false == contains( matrix.os, 'windows')
run: |
conda install -y wisdem
- name: Add dependencies windows specific
if: true == contains( matrix.os, 'windows')
- name: Add pyFAST dependency
run: |
conda install -y m2w64-toolchain libpython
conda install -y wisdem
git clone http://github.com/OpenFAST/python-toolbox
cd python-toolbox
python -m pip install -e .
# Install ZeroMQ
- name: Install ZeroMQ
run: sudo apt-get install libzmq3-dev

# Install ROSCO toolbox
- name: Install ROSCO toolbox
run: |
python setup.py install --compile-rosco
python setup.py develop
- name: Configure and Build ROSCO - unix
working-directory: ${{runner.workspace}}/ROSCO/ROSCO/build
run: |
cmake \
-DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/ROSCO/ROSCO/install \
-DZMQ_CLIENT=ON \
-DCMAKE_Fortran_COMPILER:STRING=${{env.FORTRAN_COMPILER}} \
..
cmake --build . --target install
# Install OpenFAST
- name: Install OpenFAST
run: |
conda install openfast==3.0.0
conda install openfast==3.1.0
# Run examples
- name: Run examples
run: |
cd Examples
python run_examples.py
# Archive artifacts
- name: Archive production artifacts
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: ROSCO-artifacts
path: |
${{runner.workspace}}
run_testing:
name: Run Testing
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -139,21 +175,20 @@ jobs:


# Install dependencies of ROSCO toolbox
- name: Add dependencies ubuntu specific
if: false == contains( matrix.os, 'windows')
- name: Add dependencies
run: |
conda install -y wisdem
# Install ROSCO toolbox
- name: Install ROSCO toolbox
run: |
python setup.py develop --compile-rosco
python setup.py install --compile-rosco
# Install OpenFAST
- name: Install OpenFAST
run: |
conda install openfast==3.0.0
conda install openfast==3.1.0
# Run ROSCO Testing
- name: Run ROSCO testing
Expand All @@ -165,4 +200,4 @@ jobs:
- name: Run regression testing
run: |
cd ROSCO_testing
python regtest.py
python test_checkpoint.py
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ examples/cp_ct_cq_lut.p

# Files Generated in Examples
Examples/DISCON.IN
Examples/DISCON_zmq.IN
Examples/*.p

# Exclude testing results
Expand All @@ -86,3 +87,6 @@ ROSCO_testing/results/
*.autosave
*.mat

# OpenFAST outputs
outputs/

2 changes: 1 addition & 1 deletion Examples/example_01.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
path_params['FAST_InputFile'],
os.path.join(tune_dir,path_params['FAST_directory']),
dev_branch=True,
rot_source='txt',txt_filename=os.path.join(tune_dir,path_params['rotor_performance_filename'])
rot_source='txt',txt_filename=os.path.join(tune_dir,path_params['FAST_directory'],path_params['rotor_performance_filename'])
)

# Print some basic turbine info
Expand Down
8 changes: 6 additions & 2 deletions Examples/example_04.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,23 @@
controller = ROSCO_controller.Controller(controller_params)

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

# Tune controller
controller.tune_controller(turbine)

# Write parameter input file
param_file = os.path.join(this_dir,'DISCON.IN')
write_DISCON(turbine,controller,param_file=param_file, txt_filename=os.path.join(tune_dir,path_params['rotor_performance_filename']))
write_DISCON(turbine,controller,
param_file=param_file,
txt_filename=cp_filename
)

# Plot gain schedule
fig, ax = plt.subplots(2,2,constrained_layout=True,sharex=True)
Expand Down
9 changes: 7 additions & 2 deletions Examples/example_05.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@
# controller = ROSCO_controller.Controller(controller_params)

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

# Tune controller
Expand All @@ -68,7 +69,11 @@

# Write parameter input file
param_filename = os.path.join(this_dir,'DISCON.IN')
write_DISCON(turbine,controller,param_file=param_filename, txt_filename=os.path.join(tune_dir,path_params['rotor_performance_filename']))
write_DISCON(
turbine,controller,
param_file=param_filename,
txt_filename=cp_filename
)


# Load controller library
Expand Down
2 changes: 1 addition & 1 deletion Examples/example_07.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
path_params['FAST_InputFile'],
os.path.join(tune_dir,path_params['FAST_directory']),
dev_branch=True,
rot_source='txt',txt_filename=os.path.join(tune_dir,path_params['rotor_performance_filename'])
rot_source='txt',txt_filename=os.path.join(tune_dir,path_params['FAST_directory'],path_params['rotor_performance_filename'])
)
# Tune controller
controller.tune_controller(turbine)
Expand Down
1 change: 0 additions & 1 deletion Examples/example_10.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

# Load turbine data from openfast model
turbine = ROSCO_turbine.Turbine(turbine_params)
# turbine.load_from_fast(path_params['FAST_InputFile'],path_params['FAST_directory'],dev_branch=True,rot_source='txt',txt_filename=path_params['rotor_performance_filename'])
turbine.load_from_fast(path_params['FAST_InputFile'], \
os.path.join(this_dir,path_params['FAST_directory']),dev_branch=True)

Expand Down
2 changes: 1 addition & 1 deletion Examples/example_11.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
os.path.join(this_dir,path_params['FAST_directory']),
dev_branch=True,
rot_source='txt',
txt_filename=os.path.join(tune_dir,path_params['rotor_performance_filename'])
txt_filename=os.path.join(tune_dir,path_params['FAST_directory'],path_params['rotor_performance_filename'])
)

# Tune controller
Expand Down
12 changes: 9 additions & 3 deletions Examples/example_12.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ def run_example():
controller = ROSCO_controller.Controller(controller_params)
turbine.load_from_fast(
path_params['FAST_InputFile'],
os.path.join(tune_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(tune_dir, path_params['rotor_performance_filename'])
)
rot_source='txt', txt_filename=os.path.join(this_dir,path_params['FAST_directory'],path_params['rotor_performance_filename'])
)

# Fix path params for robust setup
path_params['FAST_directory'] = os.path.join(this_dir, path_params['FAST_directory'])

controller.tune_controller(turbine)
k_float = controller.Kp_float

Expand All @@ -74,6 +78,8 @@ def run_example():
options['path_options'] = path_options
options['opt_options'] = opt_options

options['linturb_options']['linfile_path'] = os.path.join(this_dir, options['linturb_options']['linfile_path'])

# Run robust scheduling
sd = rsched_driver(options)
sd.setup()
Expand Down
5 changes: 2 additions & 3 deletions Examples/example_13.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
'''
# Python Modules
import yaml, os, platform
import numpy as np
import os, platform
import matplotlib.pyplot as plt

# ROSCO toolbox modules
Expand Down Expand Up @@ -85,7 +84,7 @@
channels['BldPitch3'] = True

# Run FAST cases
fastBatch = runFAST_pywrapper_batch(FAST_ver='OpenFAST',dev_branch = True)
fastBatch = runFAST_pywrapper_batch()

fastBatch.FAST_directory = os.path.realpath(os.path.join(rosco_dir,'Tune_Cases',path_params['FAST_directory']))
fastBatch.FAST_InputFile = path_params['FAST_InputFile']
Expand Down
2 changes: 1 addition & 1 deletion Examples/example_14.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
channels = set_channels()

# Run FAST cases
fastBatch = runFAST_pywrapper_batch(FAST_ver='OpenFAST',dev_branch = True)
fastBatch = runFAST_pywrapper_batch()

fastBatch.FAST_directory = os.path.realpath(os.path.join(rosco_dir,'Tune_Cases',path_params['FAST_directory']))
fastBatch.FAST_InputFile = path_params['FAST_InputFile']
Expand Down
45 changes: 45 additions & 0 deletions Examples/example_15.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
'''
----------- Example_15 --------------
Use the runFAST scripts to set up an example, use pass through in yaml
-------------------------------------
In this example:
- use run_FAST_ROSCO class to set up a test case
'''

import os
from ROSCO_toolbox.ofTools.case_gen.run_FAST import run_FAST_ROSCO
from ROSCO_toolbox.ofTools.case_gen import CaseLibrary as cl


#directories
this_dir = os.path.dirname(os.path.abspath(__file__))
rosco_dir = os.path.dirname(this_dir)
example_out_dir = os.path.join(this_dir,'examples_out')
os.makedirs(example_out_dir,exist_ok=True)


def main():
# Simulation config
r = run_FAST_ROSCO()

parameter_filename = os.path.join(rosco_dir,'Tune_Cases/NREL5MW_PassThrough.yaml')
run_dir = os.path.join(example_out_dir,'15_PassThrough')
os.makedirs(run_dir,exist_ok=True)

# Step wind simulation
r.tuning_yaml = parameter_filename
r.wind_case_fcn = cl.simp_step
r.wind_case_opts = {
'U_start': [10],
'U_end': [15],
'wind_dir': run_dir
}
r.save_dir = run_dir

r.run_FAST()


if __name__=="__main__":
main()
Loading

0 comments on commit 3b8a5af

Please sign in to comment.