Skip to content

Commit

Permalink
Move pitch saturation filter, make minpitch a subroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhar-abbas committed Aug 11, 2020
1 parent d694143 commit c9f00c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
15 changes: 5 additions & 10 deletions src/ControllerBlocks.f90
Original file line number Diff line number Diff line change
Expand Up @@ -263,27 +263,22 @@ SUBROUTINE SetpointSmoother(LocalVar, CntrPar, objInst)

END SUBROUTINE SetpointSmoother
!-------------------------------------------------------------------------------------------------------------------------------
REAL FUNCTION PitchSaturation(LocalVar, CntrPar, objInst)
SUBROUTINE PitchSaturation(LocalVar, CntrPar, objInst, DebugVar)
! PitchSaturation defines a minimum blade pitch angle based on a lookup table provided by DISCON.IN
! SS_Mode = 0, No setpoint smoothing
! SS_Mode = 1, Implement pitch saturation
USE ROSCO_Types, ONLY : LocalVariables, ControlParameters, ObjectInstances
USE ROSCO_Types, ONLY : LocalVariables, ControlParameters, ObjectInstances, DebugVariables
IMPLICIT NONE
! Inputs
TYPE(ControlParameters), INTENT(IN) :: CntrPar
TYPE(LocalVariables), INTENT(INOUT) :: LocalVar
TYPE(ObjectInstances), INTENT(INOUT) :: objInst
! Allocate Variables
REAL(4) :: Vhat ! Estimated wind speed without towertop motion [m/s]
REAL(4) :: Vhatf ! 30 second low pass filtered Estimated wind speed without towertop motion [m/s]
TYPE(DebugVariables), INTENT(INOUT) :: DebugVar

Vhat = LocalVar%WE_Vw_F
Vhatf = SecLPFilter(Vhat,LocalVar%DT,0.21,0.7,LocalVar%iStatus,.FALSE.,objInst%instSecLPF) ! 30 second time constant

! Define minimum blade pitch angle as a function of estimated wind speed
PitchSaturation = interp1d(CntrPar%PS_WindSpeeds, CntrPar%PS_BldPitchMin, Vhatf)
LocalVar%PC_MinPit = interp1d(CntrPar%PS_WindSpeeds, CntrPar%PS_BldPitchMin, LocalVar%WE_Vw_F)

END FUNCTION PitchSaturation
END SUBROUTINE PitchSaturation
!-------------------------------------------------------------------------------------------------------------------------------
REAL FUNCTION Shutdown(LocalVar, CntrPar, objInst)
! PeakShaving defines a minimum blade pitch angle based on a lookup table provided by DISON.IN
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers.f90
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ SUBROUTINE PitchControl(avrSWAP, CntrPar, LocalVar, objInst)

! Pitch Saturation
IF (CntrPar%PS_Mode == 1) THEN
LocalVar%PC_MinPit = PitchSaturation(LocalVar,CntrPar,objInst)
CALL PitchSaturation(LocalVar,CntrPar,objInst,DebugVar)
LocalVar%PC_MinPit = max(LocalVar%PC_MinPit, CntrPar%PC_FinePit)
ELSE
LocalVar%PC_MinPit = CntrPar%PC_FinePit
Expand Down

0 comments on commit c9f00c4

Please sign in to comment.