Skip to content

Commit

Permalink
Fixed a bug introduced in the wind speed estimator
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown committed Jul 3, 2019
1 parent 45e9888 commit 9e960fc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
7 changes: 2 additions & 5 deletions Source/Filters.f90
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,10 @@ REAL FUNCTION NotchFilter(InputSignal, DT, omega, betaNum, betaDen, iStatus, res
P4 = (2*omega**2 - 2*K**2) / (K**2 + 2*omega*BetaDen*K + omega**2)
P5 = (K**2 - 2*omega*BetaDen*K + omega**2)/ (K**2 + 2*omega*BetaDen*K + omega**2)

! Body


! Body
NotchFilter = P1*InputSignal + P2*InputSignalLast1(inst) + P3*InputSignalLast2(inst) - P4*OutputSignalLast1(inst) - P5*OutputSignalLast2(inst)

! Save signals for next time step

! Save signals for next time step
InputSignalLast2(inst) = InputSignalLast1(inst)
InputSignalLast1(inst) = InputSignal !Save input signal for next time step
OutputSignalLast2(inst) = OutputSignalLast1(inst) !Save input signal for next time step
Expand Down
32 changes: 16 additions & 16 deletions Source/ReadSetParameters.f90
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,6 @@ SUBROUTINE ComputeVariablesSetpoints(CntrPar, LocalVar)
TYPE(ControlParameters), INTENT(INOUT) :: CntrPar
TYPE(LocalVariables), INTENT(INOUT) :: LocalVar

! Initialize testValue (debugging variable)
LocalVar%TestType = 0

! Initialize the SAVEd variables:
! NOTE: LocalVar%VS_LastGenTrq, though SAVEd, is initialized in the torque controller
! below for simplicity, not here.
! DO K = 1,LocalVar%NumBl
LocalVar%PitCom = LocalVar%BlPitch ! This will ensure that the variable speed controller picks the correct control region and the pitch controller picks the correct gain on the first call
! END DO
LocalVar%Y_AccErr = 0.0 ! This will ensure that the accumulated yaw error starts at zero
LocalVar%Y_YawEndT = -1.0 ! This will ensure that the initial yaw end time is lower than the actual time to prevent initial yawing

! Wind speed estimator initialization, we always assume an initial wind speed of 10 m/s
LocalVar%WE_Vw = 10
LocalVar%WE_VwI = LocalVar%WE_Vw - CntrPar%WE_Gamma*LocalVar%RotSpeed

! Calculate yaw misalignment error
LocalVar%Y_MErr = LocalVar%Y_M + CntrPar%Y_MErrSet ! Yaw-alignment error

Expand Down Expand Up @@ -400,6 +384,22 @@ SUBROUTINE SetParameters(avrSWAP, aviFAIL, ErrMsg, size_avcMSG, CntrPar, LocalVa

CALL ReadControlParameterFileSub(CntrPar)

! Initialize testValue (debugging variable)
LocalVar%TestType = 0

! Initialize the SAVED variables:

! DO K = 1,LocalVar%NumBl
LocalVar%PitCom = LocalVar%BlPitch ! This will ensure that the variable speed controller picks the correct control region and the pitch controller picks the correct gain on the first call
! END DO

LocalVar%Y_AccErr = 0.0 ! This will ensure that the accumulated yaw error starts at zero
LocalVar%Y_YawEndT = -1.0 ! This will ensure that the initial yaw end time is lower than the actual time to prevent initial yawing

! Wind speed estimator initialization, we always assume an initial wind speed of 10 m/s
LocalVar%WE_Vw = 10
LocalVar%WE_VwI = LocalVar%WE_Vw - CntrPar%WE_Gamma*LocalVar%RotSpeed

! Check validity of input parameters:
CALL Assert(LocalVar, CntrPar, avrSWAP, aviFAIL, ErrMsg, size_avcMSG)

Expand Down

0 comments on commit 9e960fc

Please sign in to comment.