Skip to content

Commit

Permalink
Updates and cleanup for readability and code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhar-abbas committed Mar 2, 2020
1 parent a3c39eb commit ee55f78
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 101 deletions.
24 changes: 13 additions & 11 deletions Examples/example_01.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# ----------- Example_01 --------------
# Load and save a turbine model
# -------------------------------------
# In this example:
# - Read .yaml input file
# - Load an openfast turbine model
# - Read text file with rotor performance properties
# - Print some basic turbine properties
# - Save the turbine as a picklle
#
# Note: Uses the NREL 5MW included in the Test Cases and is a part of the OpenFAST distribution
'''
----------- Example_01 --------------
Load and save a turbine model
-------------------------------------
In this example:
- Read .yaml input file
- Load an openfast turbine model
- Read text file with rotor performance properties
- Print some basic turbine properties
- Save the turbine as a picklle
Note: Uses the NREL 5MW included in the Test Cases and is a part of the OpenFAST distribution
'''

# Python Modules
import yaml
Expand Down
16 changes: 9 additions & 7 deletions Examples/example_02.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# ----------- Example_02 --------------
# Load a turbine model from saved pickle, make a quick cp plot
# -------------------------------------
#
# In this example:
# - Load a turbine from a saved pickle
# - Plot Cp Surface
'''
----------- Example_02 --------------
Load a turbine model from saved pickle, make a quick cp plot
-------------------------------------
In this example:
- Load a turbine from a saved pickle
- Plot Cp Surface
'''

# Python modules
import matplotlib.pyplot as plt
Expand Down
19 changes: 10 additions & 9 deletions Examples/example_03.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# ----------- Example_03 --------------
# Run CCblade, save a rotor performance text file
# -------------------------------------
#
# In this example:
# - Read .yaml input file
# - Load an openfast turbine model
# - Run ccblade to get rotor performance properties
# - Write a text file with rotor performance properties
'''
----------- Example_03 --------------
Run CCblade, save a rotor performance text file
-------------------------------------
In this example:
- Read .yaml input file
- Load an openfast turbine model
- Run ccblade to get rotor performance properties
- Write a text file with rotor performance properties
'''
# Python modules
import yaml
# ROSCO toolbox modules
Expand Down
23 changes: 12 additions & 11 deletions Examples/example_04.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# ----------- Example_04 --------------
# Load a turbine model and tune the controller
# -------------------------------------
#
# In this example:
# - Read a .yaml file
# - Load a turbine model from OpenFAST
# - Tune a controller
# - Write a controller input file
# - Plot gain schedule

'''
----------- Example_04 --------------
Load a turbine model and tune the controller
-------------------------------------
In this example:
- Read a .yaml file
- Load a turbine model from OpenFAST
- Tune a controller
- Write a controller input file
- Plot gain schedule
'''
# Python modules
import matplotlib.pyplot as plt
import yaml
Expand Down
33 changes: 19 additions & 14 deletions Examples/example_05.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# ----------- Example_05 --------------
# Run and plot a simple simple step wind simulation
# -------------------------------------
#
# In this example:
# - Load turbine from saved pickle
# - Tune a controller
# - Run and plot a simple step wind simulation
#
# Note - you will need to have a compiled controller in ROSCO, and
# properly point to it in the `controller_path` variable

'''
----------- Example_05 --------------
Run and plot a simple simple step wind simulation
-------------------------------------
In this example:
- Load turbine from saved pickle
- Tune a controller
- Run and plot a simple step wind simulation
Notes - You will need to have a compiled controller in ROSCO, and
properly point to it in the `lib_name` variable.
- The complex nature of the wind speed estimators implemented in ROSCO
make using them for simulations is known to cause problems for
the simple simulator. We suggesting using WE_Mode = 0 in DISCON.IN.
'''
# Python modules
import matplotlib.pyplot as plt
import numpy as np
Expand All @@ -22,14 +26,15 @@
from ROSCO_toolbox import control_interface as ROSCO_ci

# Specify controller dynamic library path and name
lib_name = ('../ROSCO/build/libdiscon.dylib')
lib_name = '../ROSCO/build/libdiscon.dylib'
param_filename = 'DISCON.IN'

# Load turbine model from saved pickle
turbine = ROSCO_turbine.Turbine
turbine = turbine.load('NREL5MW_saved.p')

# Load controller library
controller_int = ROSCO_ci.ControllerInterface(lib_name)
controller_int = ROSCO_ci.ControllerInterface(lib_name,param_filename=param_filename)

# Load the simulator
sim = ROSCO_sim.Sim(turbine,controller_int)
Expand Down
23 changes: 12 additions & 11 deletions Examples/example_06.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# ----------- Example_06 --------------
# Load a turbine, tune a controller, run OpenFAST simulation
# -------------------------------------
#
# In this example:
# - Load a turbine from OpenFAST
# - Tune a controller
# - Run an OpenFAST simulation

# Note - you will need to have a compiled controller in ROSCO/build/

'''
----------- Example_06 --------------
Load a turbine, tune a controller, run OpenFAST simulation
-------------------------------------
In this example:
- Load a turbine from OpenFAST
- Tune a controller
- Run an OpenFAST simulation
Note - you will need to have a compiled controller in ROSCO/build/
'''
# Python Modules
import yaml
# ROSCO toolbox modules
Expand Down
21 changes: 11 additions & 10 deletions Examples/example_07.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# ----------- Example_07 --------------
# Load saved turbine, tune controller, plot minimum pitch schedule
# -------------------------------------
#
# In this example:
# - Load a yaml file
# - Load a turbine from openfast
# - Tune a controller
# - Plot minimum pitch schedule

'''
----------- Example_07 --------------
Load saved turbine, tune controller, plot minimum pitch schedule
-------------------------------------
In this example:
- Load a yaml file
- Load a turbine from openfast
- Tune a controller
- Plot minimum pitch schedule
'''

# Python modules
import matplotlib.pyplot as plt
Expand Down
26 changes: 15 additions & 11 deletions Examples/example_08.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# ----------- Example_08 --------------
# Plot some OpenFAST output data
# -------------------------------------
#
# In this example:
# - Load openfast output data
# - Trim the time series
# - Plot some available channels
'''
----------- Example_08 --------------
Plot some OpenFAST output data
-------------------------------------
In this example:
- Load openfast output data
- Trim the time series
- Plot some available channels
Note: need to run openfast model in '../Test_Cases/5MW_Land_DLL_WTurb/' to plot
'''

# Python Modules
import numpy as np
Expand All @@ -19,9 +23,9 @@
# Define openfast output filenames
# filenames = ["../Test_Cases/5MW_Land/5MW_Land.outb"]

# ---- Note: Could plot multiple cases, and binaries...
filenames = ["../Test_Cases/5MW_Land/5MW_Land.out",
"../Test_Cases/5MW_Land/5MW_Land.outb"]
# ---- Note: Could plot multiple cases, textfiles, and binaries...
filenames = "../Test_Cases/5MW_Land_DLL_WTurb/5MW_Land_DLL_WTurb.out",
"../Test_Cases/5MW_Land_DLL_WTurb/5MW_Land_DLL_WTurb.outb"]

# Load output info and data
allinfo, alldata = fast_io.load_output(filenames)
Expand Down
14 changes: 8 additions & 6 deletions Examples/example_09.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# ----------- Example_09 --------------
# Run TurbSim to create binary
# -------------------------------------
#
# In this example:
# - Leverage the run_openfast functionality to compile a turbsim binary
'''
----------- Example_09 --------------
Run TurbSim to create wind field binary
-------------------------------------
In this example:
- Leverage the run_openfast functionality to compile a turbsim binary
'''

# Python Modules
import numpy as np
Expand Down
23 changes: 12 additions & 11 deletions Examples/example_10.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# ----------- Example_10 --------------
# Tune a controller for distributed aerodynamic control
# -------------------------------------
# In this example:
# - Read .yaml input file
# - Load an openfast turbine model
# - Read text file with rotor performance properties
# - Load blade information
# - Tune controller with flap actuator
#
# Note: Uses the NREL 5MW included in the Test Cases and is a part of the OpenFAST distribution
'''
----------- Example_10 --------------
Tune a controller for distributed aerodynamic control
-------------------------------------
In this example:
- Read .yaml input file
- Load an openfast turbine model
- Read text file with rotor performance properties
- Load blade information
- Tune controller with flap actuator
'''

# Python Modules
import yaml
Expand Down

0 comments on commit ee55f78

Please sign in to comment.