Skip to content

Commit

Permalink
Merge pull request NREL#7 from NREL/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
nikhar-abbas authored Mar 3, 2020
2 parents efa2c0a + be8b903 commit 69545dc
Show file tree
Hide file tree
Showing 62 changed files with 4,476 additions and 548 deletions.
35 changes: 16 additions & 19 deletions Examples/DISCON.IN
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Controller parameter input file for the 5MW_Land wind turbine
! - File written using ROSCO Controller tuning logic on 01/22/20
! Controller parameter input file for the 5MW_Land_DLL_WTurb wind turbine
! - File written using ROSCO Controller tuning logic on 03/01/20

!------- DEBUG ------------------------------------------------------------
1 ! LoggingLevel - {0: write no debug files, 1: write standard output .dbg-file, 2: write standard output .dbg-file and complete avrSWAP-array .dbg2-file}
Expand All @@ -13,7 +13,7 @@
0 ! Y_ControlMode - Yaw control mode {0: no yaw control, 1: yaw rate control, 2: yaw-by-IPC}
1 ! SS_Mode - Setpoint Smoother mode {0: no setpoint smoothing, 1: introduce setpoint smoothing}
0 ! WE_Mode - Wind speed estimator mode {0: One-second low pass filtered hub height wind speed, 1: Immersion and Invariance Estimator, 2: Extended Kalman Filter}
1 ! PS_Mode - Pitch saturation mode {0: no pitch saturation, 1: implement pitch saturation}
0 ! PS_Mode - Pitch saturation mode {0: no pitch saturation, 1: implement pitch saturation}
0 ! SD_Mode - Shutdown mode {0: no shutdown procedure, 1: pitch to max pitch at shutdown}
0 ! Fl_Mode - Floating specific feedback mode {0: no nacelle velocity feedback, 1: nacelle velocity feedback}
0 ! Flp_Mode - Flap control mode {0: no flap control, 1: steady state flap angle, 2: Proportional flap control}
Expand All @@ -24,8 +24,8 @@
0.44990 ! F_NotchCornerFreq - Natural frequency of the notch filter, [rad/s]
0.00000 0.25000 ! F_NotchBetaNumDen - Two notch damping values (numerator and denominator, resp) - determines the width and depth of the notch, [-]
0.628320000000 ! F_SSCornerFreq - Corner frequency (-3dB point) in the first order low pass filter for the setpoint smoother, [rad/s].
0.23250 1.00000 ! F_FlCornerFreq - Corner frequency and damping in the second order low pass filter of the tower-top fore-aft motion for floating feedback control [rad/s, -].
0.87200 1.00000 ! F_FlpCornerFreq - Corner frequency and damping in the second order low pass filter of the blade root bending moment for flap control [rad/s, -].
0.23250 1.00000 ! F_FlCornerFreq - Natural frequency and damping in the second order low pass filter of the tower-top fore-aft motion for floating feedback control [rad/s, -].
0.00000 1.00000 ! F_FlpCornerFreq - Corner frequency and damping in the second order low pass filter of the blade root bending moment for flap control [rad/s, -].

!------- BLADE PITCH CONTROL ----------------------------------------------
27 ! PC_GS_n - Amount of gain-scheduling table entries
Expand All @@ -35,15 +35,12 @@
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ! PC_GS_KD - Gain-schedule table: pitch controller kd gains
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ! PC_GS_TF - Gain-schedule table: pitch controller tf gains (derivative filter)
1.570800000000 ! PC_MaxPit - Maximum physical pitch limit, [rad].
-0.00873000000 ! PC_MinPit - Minimum physical pitch limit, [rad].
0.000000000000 ! PC_MinPit - Minimum physical pitch limit, [rad].
0.174500000000 ! PC_MaxRat - Maximum pitch rate (in absolute value) in pitch controller, [rad/s].
-0.17450000000 ! PC_MinRat - Minimum pitch rate (in absolute value) in pitch controller, [rad/s].
122.9096700000 ! PC_RefSpd - Desired (reference) HSS speed for pitch controller, [rad/s].
-0.00873000000 ! PC_FinePit - Record 5: Below-rated pitch angle set-point, [rad]
0.000000000000 ! PC_FinePit - Record 5: Below-rated pitch angle set-point, [rad]
0.017450000000 ! PC_Switch - Angle above lowest minimum pitch angle for switch, [rad]
0 ! Z_EnableSine - Enable/disable sine pitch excitation, used to validate for dynamic induction control, will be removed later, [-]
0.000000000000 ! Z_PitchAmplitude - Amplitude of sine pitch excitation, [rad]
0.000000000000 ! Z_PitchFrequency - Frequency of sine pitch excitation, [rad/s]

!------- INDIVIDUAL PITCH CONTROL -----------------------------------------
0.0 ! IPC_IntSat - Integrator saturation (maximum signal amplitude contribution to pitch from IPC), [rad]
Expand All @@ -57,15 +54,15 @@
1500000.000000 ! VS_MaxRat - Maximum torque rate (in absolute value) in torque controller, [Nm/s].
47402.87063000 ! VS_MaxTq - Maximum generator torque in Region 3 (HSS side), [Nm].
0.000000000000 ! VS_MinTq - Minimum generator (HSS side), [Nm].
34.66095000000 ! VS_MinOMSpd - Optimal mode minimum speed, cut-in speed towards optimal mode gain path, [rad/s]
2.390870000000 ! VS_Rgn2K - Generator torque constant in Region 2 (HSS side), [N-m/(rad/s)^2]
34.68909000000 ! VS_MinOMSpd - Optimal mode minimum speed, cut-in speed towards optimal mode gain path, [rad/s]
2.385060000000 ! VS_Rgn2K - Generator torque constant in Region 2 (HSS side), [N-m/(rad/s)^2]
5000000.000000 ! VS_RtPwr - Wind turbine rated power [W]
43093.51876000 ! VS_RtTq - Rated torque, [Nm].
122.9096700000 ! VS_RefSpd - Rated generator speed [rad/s]
1 ! VS_n - Number of generator PI torque controller gains
-999.249170000 ! VS_KP - Proportional gain for generator PI torque controller [1/(rad/s) Nm]. (Only used in the transitional 2.5 region if VS_ControlMode =/ 2)
-999.026780000 ! VS_KP - Proportional gain for generator PI torque controller [1/(rad/s) Nm]. (Only used in the transitional 2.5 region if VS_ControlMode =/ 2)
-185.790360000 ! VS_KI - Integral gain for generator PI torque controller [1/rad Nm]. (Only used in the transitional 2.5 region if VS_ControlMode =/ 2)
7.50 ! VS_TSRopt - Power-maximizing region 2 tip-speed-ratio [rad].
7.51 ! VS_TSRopt - Power-maximizing region 2 tip-speed-ratio [rad].

!------- SETPOINT SMOOTHER ---------------------------------------------
1.00000 ! SS_VSGain - Variable speed torque controller setpoint smoother gain, [-].
Expand All @@ -83,7 +80,7 @@
52 24 ! PerfTableSize - Size of rotor performance tables, first number refers to number of blade pitch angles, second number referse to number of tip-speed ratios
44 ! WE_FOPoles_N - Number of first-order system poles used in EKF
3.00 3.50 4.00 4.50 5.00 5.50 6.00 6.50 7.00 7.50 8.00 8.50 9.00 9.50 10.00 10.50 11.00 11.90 12.40 12.90 13.40 13.90 14.40 14.90 15.40 15.90 16.40 16.90 17.40 17.90 18.40 18.90 19.40 19.90 20.40 20.90 21.40 21.90 22.40 22.90 23.40 23.90 24.40 24.90 ! WE_FOPoles_v - Wind speeds corresponding to first-order system poles [m/s]
-0.01769052 -0.02063894 -0.02358736 -0.02653578 -0.02948420 -0.03243262 -0.03538104 -0.03832946 -0.04127787 -0.04422629 -0.04717471 -0.05012313 -0.05307155 -0.05601997 -0.05896839 -0.06191681 -0.06486523 -0.05663600 -0.06760328 -0.07958282 -0.09338576 -0.10660375 -0.12219164 -0.13633634 -0.15187319 -0.16971407 -0.18449677 -0.20097910 -0.21989102 -0.23853320 -0.25398015 -0.27191112 -0.29238174 -0.31524365 -0.33079361 -0.34730696 -0.36620087 -0.38763778 -0.41161251 -0.43863651 -0.46960731 -0.50322805 -0.53955583 -0.57860701 ! WE_FOPoles - First order system poles
-0.01770358 -0.02065417 -0.02360477 -0.02655536 -0.02950596 -0.03245656 -0.03540715 -0.03835775 -0.04130834 -0.04425894 -0.04720953 -0.05016013 -0.05311073 -0.05606132 -0.05901192 -0.06196251 -0.06491311 -0.05663600 -0.06760328 -0.07958282 -0.09338576 -0.10660375 -0.12219164 -0.13633634 -0.15187319 -0.16971407 -0.18449677 -0.20097910 -0.21989102 -0.23853320 -0.25398015 -0.27191112 -0.29238174 -0.31524365 -0.33079361 -0.34730696 -0.36620087 -0.38763778 -0.41161251 -0.43863651 -0.46960731 -0.50322805 -0.53955583 -0.57860701 ! WE_FOPoles - First order system poles

!------- YAW CONTROL ------------------------------------------------------
0.0 ! Y_ErrThresh - Yaw error threshold. Turbine begins to yaw when it passes this. [rad^2 s]
Expand All @@ -105,14 +102,14 @@

!------- MINIMUM PITCH SATURATION -------------------------------------------
44 ! PS_BldPitchMin_N - Number of values in minimum blade pitch lookup table (should equal number of values in PS_WindSpeeds and PS_BldPitchMin)
3.00 3.50 4.00 4.50 5.00 5.50 6.00 6.50 7.00 7.50 8.00 8.50 9.00 9.50 10.00 10.50 11.00 11.90 12.40 12.90 13.40 13.90 14.40 14.90 15.40 15.90 16.40 16.90 17.40 17.90 18.40 18.90 19.40 19.90 20.40 20.90 21.40 21.90 22.40 22.90 23.40 23.90 24.40 24.90 ! PS_WindSpeeds - Wind speeds corresponding to minimum blade pitch angles [m/s]
-0.01745329 -0.01745329 -0.01745329 -0.01745329 -0.01745329 -0.01745329 -0.01745329 -0.01745329 -0.01745329 -0.01745329 -0.01745329 -0.01745329 -0.01745329 -0.01745329 0.00074125 0.02518723 0.04429189 0.06483986 0.07731764 0.08911796 0.10090686 0.11199467 0.12339803 0.13400056 0.14465035 0.15570849 0.16561909 0.17569242 0.18619063 0.19643771 0.20565005 0.21528873 0.22536468 0.23587372 0.24455259 0.25332677 0.26249366 0.27206222 0.28203149 0.29186687 0.29970910 0.30786724 0.31635795 0.32519097 ! PS_BldPitchMin - Minimum blade pitch angles [rad]
3.00 3.50 4.00 4.50 5.00 5.50 6.00 6.50 7.00 7.50 8.00 8.50 9.00 9.50 10.00 10.50 11.00 11.90 12.40 12.90 13.40 13.90 14.40 14.90 15.40 15.90 16.40 16.90 17.40 17.90 18.40 18.90 19.40 19.90 20.40 20.90 21.40 21.90 22.40 22.90 23.40 23.90 24.40 24.90 ! PS_WindSpeeds - Wind speeds corresponding to minimum blade pitch angles [m/s]
0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 ! PS_BldPitchMin - Minimum blade pitch angles [rad]

!------- SHUTDOWN -------------------------------------------
!------- SHUTDOWN -----------------------------------------------------------
0.436300000000 ! SD_MaxPit - Maximum blade pitch angle to initiate shutdown, [rad]
0.418880000000 ! SD_CornerFreq - Cutoff Frequency for first order low-pass filter for blade pitch angle, [rad/s]

!------- Floating -------------------------------------------
!------- Floating -----------------------------------------------------------
0.000000000000 ! Fl_Kp - Nacelle velocity proportional feedback gain [s]

!------- FLAP ACTUATION -----------------------------------------------------
Expand Down
10 changes: 5 additions & 5 deletions Examples/NREL5MW_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# Turbine: NREL 5MW Reference Wind Turbine
# ------------------------------ OpenFAST PATH DEFINITIONS ------------------------------
path_params:
FAST_InputFile: '5MW_Land.fst' # Name of *.fst file
FAST_directory: '../Test_Cases/5MW_Land' # Main OpenFAST model directory, where the *.fst lives
# Optional
FAST_InputFile: '5MW_Land_DLL_WTurb.fst' # Name of *.fst file
FAST_directory: '../Test_Cases/5MW_Land_DLL_WTurb' # Main OpenFAST model directory, where the *.fst lives
# Optional
rotor_performance_filename: 'Cp_Ct_Cq.NREL5MW.txt' # Filename for rotor performance text file (if it has been generated by ccblade already)

# -------------------------------- TURBINE PARAMETERS -----------------------------------
Expand Down Expand Up @@ -36,8 +36,8 @@ controller_params:
PC_ControlMode: 1 # Blade pitch control mode {0: No pitch, fix to fine pitch, 1: active PI blade pitch control}
Y_ControlMode: 0 # Yaw control mode {0: no yaw control, 1: yaw rate control, 2: yaw-by-IPC}
SS_Mode: 1 # Setpoint Smoother mode {0: no setpoint smoothing, 1: introduce setpoint smoothing}
WE_Mode: 2 # Wind speed estimator mode {0: One-second low pass filtered hub height wind speed, 1: Immersion and Invariance Estimator (Ortega et al.)}
PS_Mode: 1 # Pitch saturation mode {0: no pitch saturation, 1: peak shaving, 2: Cp-maximizing pitch saturation, 3: peak shaving and Cp-maximizing pitch saturation}
WE_Mode: 0 # Wind speed estimator mode {0: One-second low pass filtered hub height wind speed, 1: Immersion and Invariance Estimator (Ortega et al.)}
PS_Mode: 0 # Pitch saturation mode {0: no pitch saturation, 1: peak shaving, 2: Cp-maximizing pitch saturation, 3: peak shaving and Cp-maximizing pitch saturation}
SD_Mode: 0 # Shutdown mode {0: no shutdown procedure, 1: pitch to max pitch at shutdown}
Fl_Mode: 0 # Floating specific feedback mode {0: no nacelle velocity feedback, 1: nacelle velocity feedback}
Flp_Mode: 0 # Flap control mode {0: no flap control, 1: steady state flap angle, 2: Proportional flap control}
Expand Down
Binary file modified Examples/NREL5MW_saved.p
Binary file not shown.
3 changes: 2 additions & 1 deletion Examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ Examples:
6. Load a turbine, tune a controller, run an OpenFAST simulation.
7. Load saved turbine, tune controller, plot minimum pitch schedule.
8. Plot some OpenFAST output data.
9. Run turbsim to compile binary.
9. Run turbsim to compile binary.
10. Tune a controller for distributed aerodynamic control.
2 changes: 1 addition & 1 deletion Examples/ROSCO_walkthrough.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@
"# Write parameter input file\n",
"file_processing = ROSCO_utilities.FileProcessing()\n",
"param_file = 'DISCON.IN' # This must be named DISCON.IN to be seen by the compiled controller binary. \n",
"file_processing.write_param_file(turbine,controller,param_file=param_file, txt_filename=path_params['rotor_performance_filename'])"
"file_processing.write_DISCON(turbine,controller,param_file=param_file, txt_filename=path_params['rotor_performance_filename'])"
]
},
{
Expand Down
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
25 changes: 13 additions & 12 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 Expand Up @@ -38,7 +39,7 @@

# Write parameter input file
param_file = 'DISCON.IN'
file_processing.write_param_file(turbine,controller,param_file=param_file, txt_filename=path_params['rotor_performance_filename'])
file_processing.write_DISCON(turbine,controller,param_file=param_file, txt_filename=path_params['rotor_performance_filename'])

# Plot gain schedule
plt.figure(0)
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
Loading

0 comments on commit 69545dc

Please sign in to comment.