Skip to content

Commit

Permalink
Merge pull request #28 from nikhar-abbas/weis
Browse files Browse the repository at this point in the history
WEIS - flap control fixes
  • Loading branch information
nikhar-abbas authored Jan 26, 2021
2 parents 096f1e9 + 71565e1 commit b730428
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "ROSCO"]
path = ROSCO
url = https://github.com/NREL/ROSCO
branch = develop
2 changes: 1 addition & 1 deletion ROSCO
18 changes: 9 additions & 9 deletions ROSCO_toolbox/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ def tune_controller(self, turbine):
TSR_rated = rated_rotor_speed*R/turbine.v_rated # TSR at rated

# separate wind speeds by operation regions
v_below_rated = np.arange(turbine.v_min,turbine.v_rated,0.5) # below rated
v_above_rated = np.arange(turbine.v_rated,turbine.v_max,0.5) # above rated
v_below_rated = np.linspace(turbine.v_min,turbine.v_rated, num=30) # below rated
v_above_rated = np.linspace(turbine.v_rated,turbine.v_max, num=30)[1:] # above rated
v = np.concatenate((v_below_rated, v_above_rated))

# separate TSRs by operations regions
Expand Down Expand Up @@ -273,7 +273,7 @@ def tune_controller(self, turbine):
self.v = v # Wind speed (m/s)
self.v_below_rated = v_below_rated
self.pitch_op = pitch_op
self.pitch_op_pc = pitch_op[len(v_below_rated):len(v)]
self.pitch_op_pc = pitch_op[len(v_below_rated):]
self.TSR_op = TSR_op
self.A = A
self.B_beta = B_beta
Expand Down Expand Up @@ -397,13 +397,13 @@ def tune_flap_controller(self,turbine):
Kcd = (Cdp - Cd0)/( (Ctrl_flp-Ctrl)*deg2rad )

# Find integrated constants
kappa = np.zeros(len(v_rel))
self.kappa = np.zeros(len(v_rel))
C1 = np.zeros(len(v_rel))
C2 = np.zeros(len(v_rel))
for i, (v_sec,phi) in enumerate(zip(v_rel, phi_vec)):
C1[i] = integrate.trapz(0.5 * turbine.rho * turbine.chord * v_sec[0]**2 * turbine.span * Kcl * np.cos(phi))
C2[i] = integrate.trapz(0.5 * turbine.rho * turbine.chord * v_sec[0]**2 * turbine.span * Kcd * np.sin(phi))
kappa[i]=C1[i]+C2[i]
self.kappa[i]=C1[i]+C2[i]

# ------ Controller tuning -------
# Open loop blade response
Expand All @@ -418,8 +418,8 @@ def tune_flap_controller(self,turbine):
if (self.zeta_flp == 0 or self.omega_flp == 0) or (not self.zeta_flp or not self.omega_flp):
sys.exit('ERROR! --- Zeta and Omega flap must be nonzero for Flp_Mode >= 1 ---')

self.Kp_flap = (2*self.zeta_flp*self.omega_flp - 2*zetaf*omegaf)/(kappa*omegaf**2)
self.Ki_flap = (self.omega_flp**2 - omegaf**2)/(kappa*omegaf**2)
self.Kp_flap = (2*self.zeta_flp*self.omega_flp - 2*zetaf*omegaf)/(self.kappa*omegaf**2)
self.Ki_flap = (self.omega_flp**2 - omegaf**2)/(self.kappa*omegaf**2)

class ControllerBlocks():
'''
Expand Down Expand Up @@ -495,9 +495,9 @@ def peak_shaving(self,controller, turbine):
def min_pitch_saturation(self, controller, turbine):

# Find TSR associated with minimum rotor speed
TSR_at_minspeed = (controller.pc_minspd/turbine.Ng) * turbine.rotor_radius / controller.v_below_rated
TSR_at_minspeed = (controller.vs_minspd/turbine.Ng) * turbine.rotor_radius / controller.v_below_rated
for i in range(len(TSR_at_minspeed)):
if TSR_at_minspeed[i] > controller.TSR_op[i]:
if TSR_at_minspeed[i] > turbine.Cp.TSR_opt:
controller.TSR_op[i] = TSR_at_minspeed[i]

# Initialize some arrays
Expand Down
2 changes: 1 addition & 1 deletion ROSCO_toolbox/turbine.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ def load_blade_info(self):
self.span = r
self.chord = chord
self.twist = theta
self.bld_flapwise_damp = self.fast.fst_vt['ElastoDynBlade']['BldFlDmp1']/100 * 0.7
self.bld_flapwise_damp = self.fast.fst_vt['ElastoDynBlade']['BldFlDmp1']/100

class RotorPerformance():
'''
Expand Down

0 comments on commit b730428

Please sign in to comment.