Skip to content

Commit

Permalink
Included a tower fore-aft damping controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown committed Dec 21, 2018
1 parent 2111e0a commit 609c927
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 25 deletions.
3 changes: 3 additions & 0 deletions Parameter_files/DTU10MW/DICON.IN
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
2 ! F_FilterType - 1 = first-order low-pass filter, 2 = second-order low-pass filter
2.5132741 ! F_CornerFreq - Corner frequency (-3dB point) in the low-pass filters, filtering generator speed and pitch control signals, [rad/s]
0.7 ! F_Damping - Damping coefficient if F_FilterType = 2, unused otherwise
0.1 ! FA_HPF_CornerFreq - Corner frequency (-3dB point) in the high-pass filter on the fore-aft acceleration signal [rad/s]
0.087266 ! FA_IntSat - Integrator saturation (maximum signal amplitude contrbution to pitch from FA damper), [rad]
-1 ! FA_KI - Integral gain for the fore-aft tower damper controller, -1 = off / >0 = on [rad s/m]
0 ! IPC_ControlMode - Turn Individual Pitch Control (IPC) for fatigue load reductions (pitch contribution) 0 = off / 1 = (1P reductions) / 2 = (1P+2P reductions)
0.087266 ! IPC_IntSat - Integrator saturation (maximum signal amplitude contrbution to pitch from IPC), [rad]
8E-10 0 ! IPC_KI - Integral gain for the individual pitch controller: first parameter for 1P reductions, second for 2P reductions [-]
Expand Down
3 changes: 3 additions & 0 deletions Parameter_files/NREL5MW/DISCON.IN
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
1 ! F_FilterType - 1 = first-order low-pass filter, 2 = second-order low-pass filter
1.570796326 ! F_CornerFreq - Corner frequency (-3dB point) in the low-pass filters, filtering generator speed and pitch control signals, [rad/s]
0 ! F_Damping - Damping coefficient if F_FilterType = 2, unused otherwise
0.1 ! FA_HPF_CornerFreq - Corner frequency (-3dB point) in the high-pass filter on the fore-aft acceleration signal [rad/s]
0.087266 ! FA_IntSat - Integrator saturation (maximum signal amplitude contrbution to pitch from FA damper), [rad]
-1 ! FA_KI - Integral gain for the fore-aft tower damper controller, -1 = off / >0 = on [rad s/m]
0 ! IPC_ControlMode - Turn Individual Pitch Control (IPC) for fatigue load reductions (pitch contribution) 0 = off / 1 = (1P reductions) / 2 = (1P+2P reductions)
0.087266 ! IPC_IntSat - Integrator saturation (maximum signal amplitude contrbution to pitch from IPC), [rad]
1E-8 0 ! IPC_KI - Integral gain for the individual pitch controller: first parameter for 1P reductions, second for 2P reductions [-]
Expand Down
47 changes: 37 additions & 10 deletions Source/Controllers.f90
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ SUBROUTINE PitchControl(avrSWAP, CntrPar, LocalVar, objInst)
LocalVar%Y_MErr = LocalVar%Y_M + CntrPar%Y_MErrSet ! Yaw-alignment error

! Compute the pitch commands associated with the proportional and integral
! gains:
! gains:
IF (LocalVar%iStatus == 0) THEN
LocalVar%PC_PitComT = PIController(LocalVar%PC_SpdErr, LocalVar%PC_KP, LocalVar%PC_KI, CntrPar%PC_FinePit, LocalVar%PC_MaxPitVar, LocalVar%DT, LocalVar%PitCom(1), .TRUE., objInst%instPI)
ELSE
Expand All @@ -58,15 +58,19 @@ SUBROUTINE PitchControl(avrSWAP, CntrPar, LocalVar, objInst)
ELSE
LocalVar%IPC_PitComF = 0.0 ! THIS IS AN ARRAY!!
END IF

! Fore-aft tower vibration damping control
IF ((CntrPar%FA_KI > 0.0) .OR. (CntrPar%Y_ControlMode == 2)) THEN
CALL ForeAftDamping(CntrPar, LocalVar, objInst)
ELSE
LocalVar%FA_PitCom = 0.0 ! THIS IS AN ARRAY!!
END IF

! Combine and saturate all pitch commands:
DO K = 1,LocalVar%NumBl ! Loop through all blades, add IPC contribution and limit pitch rate
LocalVar%PC_PitComT_IPC(K) = LocalVar%PC_PitComT + LocalVar%IPC_PitComF(K) ! Add the individual pitch command
LocalVar%PC_PitComT_IPC(K) = saturate(LocalVar%PC_PitComT_IPC(K), CntrPar%PC_MinPit, CntrPar%PC_MaxPit) ! Saturate the overall command using the pitch angle limits

! PitCom(K) = ratelimit(LocalVar%PC_PitComT_IPC(K), LocalVar%BlPitch(K), PC_MinRat, PC_MaxRat, LocalVar%DT) ! Saturate the overall command of blade K using the pitch rate limit
LocalVar%PitCom(K) = saturate(LocalVar%PC_PitComT, CntrPar%PC_MinPit, CntrPar%PC_MaxPit) ! Saturate the overall command using the pitch angle limits
LocalVar%PitCom(K) = LocalVar%PitCom(K) + LocalVar%IPC_PitComF(K)
LocalVar%PitCom(K) = LocalVar%PitCom(K) + LocalVar%IPC_PitComF(K) + LocalVar%FA_PitCom(K)
END DO

! Command the pitch demanded from the last
Expand Down Expand Up @@ -181,7 +185,8 @@ END SUBROUTINE YawRateControl
SUBROUTINE IPC(CntrPar, LocalVar, objInst)
!-------------------------------------------------------------------------------------------------------------------------------
! Individual pitch control subroutine
!
! Calculates the commanded pitch angles for IPC employed for blade fatigue load reductions at 1P and 2P
!
! Variable declaration and initialization
!------------------------------------------------------------------------------------------------------------------------------
USE DRC_Types, ONLY : ControlParameters, LocalVariables, ObjectInstances
Expand All @@ -200,11 +205,7 @@ SUBROUTINE IPC(CntrPar, LocalVar, objInst)
TYPE(LocalVariables), INTENT(INOUT) :: LocalVar
TYPE(ObjectInstances), INTENT(INOUT) :: objInst

!------------------------------------------------------------------------------------------------------------------------------
! Body
!------------------------------------------------------------------------------------------------------------------------------
! Calculates the commanded pitch angles for IPC employed for blade fatigue load reductions at 1P and 2P
!------------------------------------------------------------------------------------------------------------------------------
! Initialization
! Set integrals to be 0 in the first time step
IF (LocalVar%iStatus==0) THEN
Expand Down Expand Up @@ -261,4 +262,30 @@ SUBROUTINE IPC(CntrPar, LocalVar, objInst)
LocalVar%IPC_PitComF(K) = PitComIPC(K)
END DO
END SUBROUTINE IPC

SUBROUTINE ForeAftDamping(CntrPar, LocalVar, objInst)
!-------------------------------------------------------------------------------------------------------------------------------
! Fore-aft damping controller, reducing the tower fore-aft vibrations using pitch
!
! Variable declaration and initialization
!------------------------------------------------------------------------------------------------------------------------------
USE DRC_Types, ONLY : ControlParameters, LocalVariables, ObjectInstances

! Local variables
INTEGER(4) :: K ! Integer used to loop through turbine blades

TYPE(ControlParameters), INTENT(INOUT) :: CntrPar
TYPE(LocalVariables), INTENT(INOUT) :: LocalVar
TYPE(ObjectInstances), INTENT(INOUT) :: objInst

! Body
LocalVar%FA_AccHPF = HPFilter( LocalVar%FA_Acc, LocalVar%DT, CntrPar%FA_HPF_CornerFreq, LocalVar%iStatus, .FALSE., objInst%instHPF )
LocalVar%FA_AccHPFI = PIController(LocalVar%FA_AccHPF, 0.0, CntrPar%FA_KI, -CntrPar%FA_IntSat, CntrPar%FA_IntSat, LocalVar%DT, 0.0, .FALSE., objInst%instPI)

! Store the fore-aft pitch contribution to LocalVar data type
DO K = 1,LocalVar%NumBl
LocalVar%FA_PitCom(K) = LocalVar%FA_AccHPFI
END DO

END SUBROUTINE ForeAftDamping
END MODULE Controllers
10 changes: 9 additions & 1 deletion Source/DRC_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ MODULE DRC_Types
INTEGER(4) :: F_FilterType ! 1 = first-order low-pass filter, 2 = second-order low-pass filter
REAL(4) :: F_CornerFreq ! Corner frequency (-3dB point) in the first-order low-pass filter, [rad/s]
REAL(4) :: F_Damping ! Damping coefficient if F_FilterType = 2, unused otherwise

REAL(4) :: FA_HPF_CornerFreq ! Corner frequency (-3dB point) in the high-pass filter on the fore-aft acceleration signal [rad/s]
REAL(4) :: FA_IntSat ! Integrator saturation (maximum signal amplitude contrbution to pitch from FA damper), [rad]
REAL(4) :: FA_KI ! Integral gain for the fore-aft tower damper controller, -1 = off / >0 = on [rad s/m]

INTEGER(4) :: IPC_ControlMode ! Turn Individual Pitch Control (IPC) for fatigue load reductions (pitch contribution) 0 = off / 1 = (1P reductions) / 2 = (1P+2P reductions)
REAL(4) :: IPC_IntSat ! Integrator saturation (maximum signal amplitude contrbution to pitch from IPC)
Expand Down Expand Up @@ -86,13 +90,17 @@ MODULE DRC_Types
INTEGER(4) :: NumBl

! Internal controller variables
REAL(4) :: FA_Acc ! Tower fore-aft acceleration [m/s^2]
REAL(4) :: FA_AccHPF ! High-pass filtered fore-aft acceleration [m/s^2]
REAL(4) :: FA_AccHPFI ! Tower velocity, high-pass filtered and integrated fore-aft acceleration [m/s]
REAL(4) :: FA_PitCom(3) ! Tower fore-aft vibration damping pitch contribution [rad]
REAL(4) :: GenSpeedF ! Filtered HSS (generator) speed [rad/s].
REAL(4) :: GenTq ! Electrical generator torque, [Nm].
REAL(4) :: GenTqMeas ! Measured generator torque [Nm]
REAL(4) :: GenArTq ! Electrical generator torque, for above-rated PI-control [Nm].
REAL(4) :: GenBrTq ! Electrical generator torque, for below-rated PI-control [Nm].
INTEGER(4) :: GlobalState ! Current global state to determine the behavior of the different controllers [-].
REAL(4) :: IPC_PitComF(3) ! Commanded pitch of each blade as calculated by the individual pitch controller, F stands for low pass filtered, [rad].
REAL(4) :: IPC_PitComF(3) ! Commanded pitch of each blade as calculated by the individual pitch controller, F stands for low-pass filtered, [rad].
REAL(4) :: PC_KP ! Proportional gain for pitch controller at rated pitch (zero), [s].
REAL(4) :: PC_KI ! Integral gain for pitch controller at rated pitch (zero), [-].
REAL(4) :: PC_KD ! Differential gain for pitch controller at rated pitch (zero), [-].
Expand Down
15 changes: 5 additions & 10 deletions Source/Functions.f90
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ SUBROUTINE Debug(LocalVar, CntrPar, avrSWAP, RootName, size_avcOUTNAME)
IF (CntrPar%LoggingLevel > 0) THEN
!OPEN(unit=UnDb, FILE=TRIM(RootName)//'.dbg', STATUS='NEW')
OPEN(unit=UnDb, FILE='DEBUG.dbg')
WRITE (UnDb,'(A)') ' LocalVar%Time ' //Tab//'LocalVar%WE_Vw '
WRITE (UnDb,'(A)') ' (sec) ' //Tab//'(m/s) '
WRITE (UnDb,'(A)') ' LocalVar%Time ' //Tab//'LocalVar%FA_Acc '//Tab//'LocalVar%FA_AccHPF '//Tab//'LocalVar%FA_AccHPFI '//Tab//'LocalVar%PitCom '
WRITE (UnDb,'(A)') ' (sec) ' //Tab//'(m/s^2) ' //Tab//'(m/s^2) ' //Tab//'(m/s) ' //Tab//'(rad) '
!WRITE (UnDb,'(A)') ' LocalVar%Time ' //Tab//'LocalVar%PC_PitComT ' //Tab//'LocalVar%PC_SpdErr ' //Tab//'LocalVar%PC_KP ' //Tab//'LocalVar%PC_KI ' //Tab//'LocalVar%Y_M ' //Tab//'LocalVar%rootMOOP(1) '//Tab//'VS_RtPwr '//Tab//'LocalVar%GenTq'
!WRITE (UnDb,'(A)') ' (sec) ' //Tab//'(rad) ' //Tab//'(rad/s) '//Tab//'(-) ' //Tab//'(-) ' //Tab//'(rad) ' //Tab//'(?) ' //Tab//'(W) '//Tab//'(Nm) '
END IF
Expand All @@ -252,7 +252,7 @@ SUBROUTINE Debug(LocalVar, CntrPar, avrSWAP, RootName, size_avcOUTNAME)

! Output debugging information if requested:
IF (CntrPar%LoggingLevel > 0) THEN
WRITE (UnDb,FmtDat) LocalVar%Time, LocalVar%WE_Vw
WRITE (UnDb,FmtDat) LocalVar%Time, LocalVar%FA_Acc, LocalVar%FA_AccHPF, LocalVar%FA_AccHPFI, LocalVar%PitCom
END IF

IF (CntrPar%LoggingLevel > 1) THEN
Expand Down Expand Up @@ -366,18 +366,13 @@ SUBROUTINE WindSpeedEstimator(LocalVar, CntrPar)
USE DRC_Types, ONLY : LocalVariables, ControlParameters
IMPLICIT NONE

! Inputs
! Inputs
TYPE(ControlParameters), INTENT(IN) :: CntrPar
TYPE(LocalVariables), INTENT(INOUT) :: LocalVar

!LocalVar%WE_VwIdot = CntrPar%WE_Gamma/CntrPar%WE_Jtot*(LocalVar%GenTqMeas*CntrPar%WE_GearboxRatio - AeroDynTorque(LocalVar, CntrPar))
! Body
LocalVar%WE_VwIdot = CntrPar%WE_Gamma/CntrPar%WE_Jtot*(LocalVar%VS_LastGenTrq*CntrPar%WE_GearboxRatio - AeroDynTorque(LocalVar, CntrPar))

!IF (MODULO(LocalVar%Time, 5.0) == 0.0) THEN
! PRINT *, LocalVar%GenTqMeas*CntrPar%WE_GearboxRatio/CntrPar%WE_Jtot
! PRINT *, IntertiaSpecAeroDynTorque(LocalVar, CntrPar)
!END IF

LocalVar%WE_VwI = LocalVar%WE_VwI + LocalVar%WE_VwIdot*LocalVar%DT
LocalVar%WE_Vw = LocalVar%WE_VwI + CntrPar%WE_Gamma*LocalVar%RotSpeed

Expand Down
13 changes: 9 additions & 4 deletions Source/ReadSetParameters.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ MODULE ReadSetParameters
!..............................................................................................................................
! Read all constant control parameters from DISCON.IN parameter file
!..............................................................................................................................
SUBROUTINE ReadControlParameterFileSub(CntrPar, LocalVar)
USE DRC_Types, ONLY : ControlParameters, LocalVariables
SUBROUTINE ReadControlParameterFileSub(CntrPar)
USE DRC_Types, ONLY : ControlParameters

INTEGER(4), PARAMETER :: UnControllerParameters = 89
TYPE(ControlParameters), INTENT(INOUT) :: CntrPar
TYPE(LocalVariables), INTENT(IN) :: LocalVar

OPEN(unit=UnControllerParameters, file='DISCON.IN', status='old', action='read')

Expand All @@ -21,6 +20,11 @@ SUBROUTINE ReadControlParameterFileSub(CntrPar, LocalVar)
READ(UnControllerParameters, *) CntrPar%F_FilterType
READ(UnControllerParameters, *) CntrPar%F_CornerFreq
READ(UnControllerParameters, *) CntrPar%F_Damping

!------------ FORE-AFT TOWER DAMPER CONSTANTS ------------
READ(UnControllerParameters, *) CntrPar%FA_HPF_CornerFreq
READ(UnControllerParameters, *) CntrPar%FA_IntSat
READ(UnControllerParameters, *) CntrPar%FA_KI

!------------------- IPC CONSTANTS -----------------------
READ(UnControllerParameters, *) CntrPar%IPC_ControlMode
Expand Down Expand Up @@ -141,6 +145,7 @@ SUBROUTINE ReadAvrSWAP(avrSWAP, LocalVar)
LocalVar%rootMOOP(3) = avrSWAP(32)
LocalVar%BlPitch(2) = avrSWAP(33)
LocalVar%BlPitch(3) = avrSWAP(34)
LocalVar%FA_Acc = avrSWAP(53)
LocalVar%Azimuth = avrSWAP(60)
LocalVar%NumBl = NINT(avrSWAP(61))
END SUBROUTINE ReadAvrSWAP
Expand Down Expand Up @@ -338,7 +343,7 @@ SUBROUTINE SetParameters(avrSWAP, aviFAIL, ErrMsg, size_avcMSG, CntrPar, LocalVa
'Visit our GitHub-page to contribute to this project: '//NEW_LINE('A')// &
'https://github.com/TUDelft-DataDrivenControl '

CALL ReadControlParameterFileSub(CntrPar, LocalVar)
CALL ReadControlParameterFileSub(CntrPar)

! Initialize testValue (debugging variable)
LocalVar%TestType = 0
Expand Down
Binary file modified bin/DISCON_x64.dll
Binary file not shown.
Binary file modified bin/DISCON_x86.dll
Binary file not shown.

0 comments on commit 609c927

Please sign in to comment.