Skip to content

Commit

Permalink
filter blade pitch angle for gain scheduling
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhar-abbas committed Dec 7, 2020
1 parent f4e946a commit 467f52e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Controllers.f90
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ SUBROUTINE PitchControl(avrSWAP, CntrPar, LocalVar, objInst, DebugVar)
REAL(C_FLOAT), INTENT(INOUT) :: avrSWAP(*) ! The swap array, used to pass data to, and receive data from the DLL controller.
INTEGER(4) :: K ! Index used for looping through blades.
REAL(8), Save :: PitComT_Last
REAL(8), Save :: PC_PitComT_F

! ------- Blade Pitch Controller --------
! Load PC State
Expand All @@ -59,11 +60,13 @@ SUBROUTINE PitchControl(avrSWAP, CntrPar, LocalVar, objInst, DebugVar)
LocalVar%PC_MaxPit = CntrPar%PC_FinePit
END IF

PC_PitComT_F = LPFilter(LocalVar%PC_PitComT, LocalVar%DT, CntrPar%F_LPFCornerFreq, LocalVar%iStatus, .FALSE., objInst%instLPF)

! Compute (interpolate) the gains based on previously commanded blade pitch angles and lookup table:
LocalVar%PC_KP = interp1d(CntrPar%PC_GS_angles, CntrPar%PC_GS_KP, LocalVar%PC_PitComT) ! Proportional gain
LocalVar%PC_KI = interp1d(CntrPar%PC_GS_angles, CntrPar%PC_GS_KI, LocalVar%PC_PitComT) ! Integral gain
LocalVar%PC_KD = interp1d(CntrPar%PC_GS_angles, CntrPar%PC_GS_KD, LocalVar%PC_PitComT) ! Derivative gain
LocalVar%PC_TF = interp1d(CntrPar%PC_GS_angles, CntrPar%PC_GS_TF, LocalVar%PC_PitComT) ! TF gains (derivative filter) !NJA - need to clarify
LocalVar%PC_KP = interp1d(CntrPar%PC_GS_angles, CntrPar%PC_GS_KP, PC_PitComT_F) ! Proportional gain
LocalVar%PC_KI = interp1d(CntrPar%PC_GS_angles, CntrPar%PC_GS_KI, PC_PitComT_F) ! Integral gain
LocalVar%PC_KD = interp1d(CntrPar%PC_GS_angles, CntrPar%PC_GS_KD, PC_PitComT_F) ! Derivative gain
LocalVar%PC_TF = interp1d(CntrPar%PC_GS_angles, CntrPar%PC_GS_TF, PC_PitComT_F) ! TF gains (derivative filter) !NJA - need to clarify

! Compute the collective pitch command associated with the proportional and integral gains:
IF (LocalVar%iStatus == 0) THEN
Expand Down

0 comments on commit 467f52e

Please sign in to comment.