Skip to content

Commit

Permalink
Fix setpoint smoother to use last gen pwr (NREL#43)
Browse files Browse the repository at this point in the history
* fix setpoint smoother to use last gen pwr

* fix setpoint smoother to use last gen pwr

* revert accidentally committed flap controller debug code =
  • Loading branch information
nikhar-abbas authored Apr 22, 2021
1 parent 365d820 commit a275d37
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ControllerBlocks.f90
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ SUBROUTINE SetpointSmoother(LocalVar, CntrPar, objInst)
! ------ Setpoint Smoothing ------
IF ( CntrPar%SS_Mode == 1) THEN
! Find setpoint shift amount
DelOmega = ((LocalVar%PC_PitComT - CntrPar%PC_MinPit)/0.524) * CntrPar%SS_VSGain - ((LocalVar%VS_GenPwr - LocalVar%VS_LastGenTrq))/CntrPar%VS_RtPwr * CntrPar%SS_PCGain ! Normalize to 30 degrees for now
DelOmega = ((LocalVar%PC_PitComT - CntrPar%PC_MinPit)/0.524) * CntrPar%SS_VSGain - ((LocalVar%VS_GenPwr - LocalVar%VS_LastGenPwr))/CntrPar%VS_RtPwr * CntrPar%SS_PCGain ! Normalize to 30 degrees for now
DelOmega = DelOmega * CntrPar%PC_RefSpd
! Filter
LocalVar%SS_DelOmegaF = LPFilter(DelOmega, LocalVar%DT, CntrPar%F_SSCornerFreq, LocalVar%iStatus, .FALSE., objInst%instLPF)
Expand Down
1 change: 1 addition & 0 deletions src/Controllers.f90
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ SUBROUTINE VariableSpeedControl(avrSWAP, CntrPar, LocalVar, objInst)

! Reset the value of LocalVar%VS_LastGenTrq to the current values:
LocalVar%VS_LastGenTrq = LocalVar%GenTq
LocalVar%VS_LastGenPwr = LocalVar%VS_GenPwr

! Set the command generator torque (See Appendix A of Bladed User's Guide):
avrSWAP(47) = MAX(0.0, LocalVar%VS_LastGenTrq) ! Demanded generator torque, prevent negatives.
Expand Down
1 change: 1 addition & 0 deletions src/ROSCO_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ MODULE ROSCO_Types
REAL(8) :: TestType ! Test variable, no use
REAL(8) :: VS_MaxTq ! Maximum allowable generator torque [Nm].
REAL(8) :: VS_LastGenTrq ! Commanded electrical generator torque the last time the controller was called [Nm].
REAL(8) :: VS_LastGenPwr ! Commanded electrical generator torque the last time the controller was called [Nm].
REAL(8) :: VS_MechGenPwr ! Mechanical power on the generator axis [W]
REAL(8) :: VS_SpdErrAr ! Current speed error for region 2.5 PI controller (generator torque control) [rad/s].
REAL(8) :: VS_SpdErrBr ! Current speed error for region 1.5 PI controller (generator torque control) [rad/s].
Expand Down

0 comments on commit a275d37

Please sign in to comment.