Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various Bug Fixes #376

Merged
merged 18 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rosco/controller/src/ControllerBlocks.f90
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ SUBROUTINE RefSpeedExclusion(LocalVar, CntrPar, objInst, DebugVar)
LocalVar%TRA_LastRefSpd = CntrPar%TRA_ExclSpeed - CntrPar%TRA_ExclBand / 2
ENDIF
ELSE
LocalVar%TRA_LastRefSpd = LocalVar%VS_RefSpd
LocalVar%TRA_LastRefSpd = VS_RefSpeed_LSS
END IF
END IF

Expand Down
7 changes: 6 additions & 1 deletion rosco/controller/src/ReadSetParameters.f90
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ SUBROUTINE SetParameters(avrSWAP, accINFILE, size_avcMSG, CntrPar, LocalVar, obj
ENDIF
LocalVar%VS_LastGenTrq = LocalVar%GenTq
LocalVar%VS_MaxTq = CntrPar%VS_MaxTq
LocalVar%VS_GenPwr = LocalVar%GenTq * LocalVar%GenSpeed
LocalVar%VS_GenPwr = LocalVar%GenTq * LocalVar%GenSpeed * CntrPar%VS_GenEff/100.0

! Initialize variables
LocalVar%CC_DesiredL = 0
Expand Down Expand Up @@ -1499,6 +1499,11 @@ SUBROUTINE CheckInputs(LocalVar, CntrPar, avrSWAP, ErrVar, size_avcMSG)
ErrVar%ErrMsg = 'Pitch offset fault enabled (PF_Mode = 1), but Ptch_Cntrl in ServoDyn has a value of 0. Set it to 1 for individual pitch control.'
ENDIF

IF (NINT(avrSWAP(28)) == 0 .AND. (CntrPar%AWC_Mode > 1)) THEN
ErrVar%aviFAIL = -1
ErrVar%ErrMsg = 'AWC enabled, but Ptch_Cntrl in ServoDyn has a value of 0. Set it to 1 for individual pitch control.'
ENDIF

! DT
IF (LocalVar%DT <= 0.0) THEN
ErrVar%aviFAIL = -1
Expand Down
10 changes: 8 additions & 2 deletions rosco/toolbox/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,14 @@ def tune_controller(self, turbine):
self.vs_gain_schedule.second_order_PI(self.zeta_vs, self.omega_vs,A_vs,B_tau[0:len(v_below_rated)],linearize=False,v=v_below_rated)

# -- Find K for Komega_g^2 --
self.vs_rgn2K = (pi*rho*R**5.0 * turbine.Cp.max * turbine.GBoxEff/100 * turbine.GenEff/100) / \
(2.0 * turbine.Cp.TSR_opt**3 * Ng**3) * self.controller_params['rgn2k_factor']
# Careful handling of different efficiencies
# P_lss = 1/2 * Cp * rho * pi * R^5 / (TSR^3 * Ng^3)
# P_hss = GBoxEff * P_lss = tau_gen * omega_gen = K * omega_gen^3
# P_gen = GenEff * P_hss
# Generator efficiency is not included in K here, but gearbox efficiency is
# Note that this differs from the
self.vs_rgn2K = (pi*rho*R**5.0 * turbine.Cp.max * turbine.GBoxEff/100) / (2.0 * turbine.Cp.TSR_opt**3 * Ng**3) * self.controller_params['rgn2k_factor']

self.vs_refspd = min(turbine.TSR_operational * turbine.v_rated/R, turbine.rated_rotor_speed) * Ng

# -- Define some setpoints --
Expand Down
3 changes: 1 addition & 2 deletions rosco/toolbox/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def sim_ws_series(self, t_array, ws_array, rotor_rpm_init=10, init_pitch=0.0,
# Update the turbine state
# -- 1DOF model: rotor speed and generator speed (scaled by Ng)
aero_torque[i] = 0.5 * self.turbine.rho * (np.pi * R**3) * (cp/tsr) * ws**2
rot_speed[i] = rot_speed[i-1] + (dt/self.turbine.J)*(aero_torque[i]
* self.turbine.GenEff/100 - self.turbine.Ng * gen_torque[i-1])
rot_speed[i] = rot_speed[i-1] + (dt/self.turbine.J)*(aero_torque[i] - self.turbine.Ng * gen_torque[i-1] / (self.turbine.GBoxEff/100))
gen_speed[i] = rot_speed[i] * self.turbine.Ng
# -- Simple nacelle model
nac_yawerr[i] = wd - nac_yaw[i-1]
Expand Down
4 changes: 4 additions & 0 deletions rosco/toolbox/tune.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ def update_discon_version(file,tuning_yaml,new_discon_filename):
if original_vt['F_NotchType'] == 2 or original_vt['F_NotchType'] == 3:
new_discon['F_TwrTopNotch_N'] = 1
new_discon['F_TwrTopNotch_Ind'] = [1]

# OL blade pitch changed to array
if ('Ind_BldPitch' in original_vt) and (not hasattr(original_vt['Ind_BldPitch'],'__len__')):
new_discon['Ind_BldPitch'] = [original_vt['Ind_BldPitch']] * 3


# Make the DISCON
Expand Down
Loading