Skip to content

Commit

Permalink
Make Flp and Fl filter variables consistent with others
Browse files Browse the repository at this point in the history
Clean up parsing echo for arrays
  • Loading branch information
dzalkind committed May 7, 2021
1 parent d0fe8b1 commit 039389a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 22 deletions.
8 changes: 4 additions & 4 deletions src/Controllers.f90
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,9 @@ SUBROUTINE FlapControl(avrSWAP, CntrPar, LocalVar, objInst)
LocalVar%Flp_Angle(2) = CntrPar%Flp_Angle
LocalVar%Flp_Angle(3) = CntrPar%Flp_Angle
! Initialize filter
RootMOOP_F(1) = SecLPFilter(LocalVar%rootMOOP(1),LocalVar%DT, CntrPar%F_FlpCornerFreq, CntrPar%F_FlpDamping, LocalVar%iStatus, .FALSE.,objInst%instSecLPF)
RootMOOP_F(2) = SecLPFilter(LocalVar%rootMOOP(2),LocalVar%DT, CntrPar%F_FlpCornerFreq, CntrPar%F_FlpDamping, LocalVar%iStatus, .FALSE.,objInst%instSecLPF)
RootMOOP_F(3) = SecLPFilter(LocalVar%rootMOOP(3),LocalVar%DT, CntrPar%F_FlpCornerFreq, CntrPar%F_FlpDamping, LocalVar%iStatus, .FALSE.,objInst%instSecLPF)
RootMOOP_F(1) = SecLPFilter(LocalVar%rootMOOP(1),LocalVar%DT, CntrPar%F_FlpCornerFreq(1), CntrPar%F_FlpCornerFreq(2), LocalVar%iStatus, .FALSE.,objInst%instSecLPF)
RootMOOP_F(2) = SecLPFilter(LocalVar%rootMOOP(2),LocalVar%DT, CntrPar%F_FlpCornerFreq(1), CntrPar%F_FlpCornerFreq(2), LocalVar%iStatus, .FALSE.,objInst%instSecLPF)
RootMOOP_F(3) = SecLPFilter(LocalVar%rootMOOP(3),LocalVar%DT, CntrPar%F_FlpCornerFreq(1), CntrPar%F_FlpCornerFreq(2), LocalVar%iStatus, .FALSE.,objInst%instSecLPF)
! Initialize controller
IF (CntrPar%Flp_Mode == 2) THEN
LocalVar%Flp_Angle(K) = PIIController(RootMyb_VelErr(K), 0 - LocalVar%Flp_Angle(K), CntrPar%Flp_Kp, CntrPar%Flp_Ki, 0.05, -CntrPar%Flp_MaxPit , CntrPar%Flp_MaxPit , LocalVar%DT, 0.0, .TRUE., objInst%instPI)
Expand All @@ -428,7 +428,7 @@ SUBROUTINE FlapControl(avrSWAP, CntrPar, LocalVar, objInst)
ELSEIF (CntrPar%Flp_Mode == 2) THEN
DO K = 1,LocalVar%NumBl
! LPF Blade root bending moment
RootMOOP_F(K) = SecLPFilter(LocalVar%rootMOOP(K),LocalVar%DT, CntrPar%F_FlpCornerFreq, CntrPar%F_FlpDamping, LocalVar%iStatus, .FALSE.,objInst%instSecLPF)
RootMOOP_F(K) = SecLPFilter(LocalVar%rootMOOP(K),LocalVar%DT, CntrPar%F_FlpCornerFreq(1), CntrPar%F_FlpCornerFreq(2), LocalVar%iStatus, .FALSE.,objInst%instSecLPF)

! Find derivative and derivative error of blade root bending moment
RootMyb_Vel(K) = (RootMOOP_F(K) - RootMyb_Last(K))/LocalVar%DT
Expand Down
5 changes: 2 additions & 3 deletions src/Filters.f90
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,11 @@ SUBROUTINE PreFilterMeasuredSignals(CntrPar, LocalVar, objInst)
IF (CntrPar%Fl_Mode == 1) THEN
! Force to start at 0
IF (LocalVar%iStatus == 0) THEN
LocalVar%NacIMU_FA_AccF = SecLPFilter(0., LocalVar%DT, CntrPar%F_FlCornerFreq, CntrPar%F_FlDamping, LocalVar%iStatus, .FALSE., objInst%instSecLPF) ! Fixed Damping
LocalVar%NacIMU_FA_AccF = SecLPFilter(0., LocalVar%DT, CntrPar%F_FlCornerFreq(1), CntrPar%F_FlCornerFreq(2), LocalVar%iStatus, .FALSE., objInst%instSecLPF) ! Fixed Damping
ELSE
LocalVar%NacIMU_FA_AccF = SecLPFilter(LocalVar%NacIMU_FA_Acc, LocalVar%DT, CntrPar%F_FlCornerFreq, CntrPar%F_FlDamping, LocalVar%iStatus, .FALSE., objInst%instSecLPF) ! Fixed Damping
LocalVar%NacIMU_FA_AccF = SecLPFilter(LocalVar%NacIMU_FA_Acc, LocalVar%DT, CntrPar%F_FlCornerFreq(1), CntrPar%F_FlCornerFreq(2), LocalVar%iStatus, .FALSE., objInst%instSecLPF) ! Fixed Damping
ENDIF
LocalVar%NacIMU_FA_AccF = HPFilter(LocalVar%NacIMU_FA_AccF, LocalVar%DT, 0.0167, LocalVar%iStatus, .FALSE., objInst%instHPF)
! LocalVar%NacIMU_FA_AccF = NotchFilterSlopes(LocalVar%NacIMU_FA_Acc, LocalVar%DT, CntrPar%F_FlCornerFreq, CntrPar%F_FlDamping, LocalVar%iStatus, .FALSE., objInst%instNotchSlopes) ! Fixed Damping

IF (CntrPar%F_NotchType >= 2) THEN
LocalVar%NACIMU_FA_AccF = NotchFilter(LocalVar%NacIMU_FA_AccF, LocalVar%DT, CntrPar%F_NotchCornerFreq, CntrPar%F_NotchBetaNumDen(1), CntrPar%F_NotchBetaNumDen(2), LocalVar%iStatus, .FALSE., objInst%instNotch) ! Fixed Damping
Expand Down
6 changes: 2 additions & 4 deletions src/ROSCO_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ MODULE ROSCO_Types
REAL(8) :: F_NotchCornerFreq ! Natural frequency of the notch filter, [rad/s]
REAL(8), DIMENSION(:), ALLOCATABLE :: F_NotchBetaNumDen ! These two notch damping values (numerator and denominator) determines the width and depth of the notch
REAL(8) :: F_SSCornerFreq ! Setpoint Smoother mode {0: no setpoint smoothing, 1: introduce setpoint smoothing}
REAL(8) :: F_FlCornerFreq ! Corner frequency (-3dB point) in the second order low pass filter of the tower-top fore-aft motion for floating feedback control [rad/s].
REAL(8) :: F_FlDamping ! Damping constant in the first order low pass filter of the tower-top fore-aft motion for floating feedback control [-].
REAL(8) :: F_FlpCornerFreq ! Corner frequency (-3dB point) in the second order low pass filter of the blade root bending moment for flap control [rad/s].
REAL(8) :: F_FlpDamping ! Damping constant in the first order low pass filter of the blade root bending moment for flap control[-].
REAL(8), DIMENSION(:), ALLOCATABLE :: F_FlCornerFreq ! Corner frequency (-3dB point) in the second order low pass filter of the tower-top fore-aft motion for floating feedback control [rad/s].
REAL(8), DIMENSION(:), ALLOCATABLE :: F_FlpCornerFreq ! Corner frequency (-3dB point) in the second order low pass filter of the blade root bending moment for flap control [rad/s].

REAL(8) :: FA_HPFCornerFreq ! Corner frequency (-3dB point) in the high-pass filter on the fore-aft acceleration signal [rad/s]
REAL(8) :: FA_IntSat ! Integrator saturation (maximum signal amplitude contrbution to pitch from FA damper), [rad]
Expand Down
29 changes: 18 additions & 11 deletions src/ReadSetParameters.f90
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ MODULE ReadSetParameters
IMPLICIT NONE

! Global Variables
LOGICAL, PARAMETER :: DEBUG_PARSING = .FALSE. ! debug flag to output parsing information, set up Echo file later
LOGICAL, PARAMETER :: DEBUG_PARSING = .TRUE. ! debug flag to output parsing information, set up Echo file later

INTERFACE ParseInput ! Parses a character variable name and value from a string.
MODULE PROCEDURE ParseInput_Str ! Parses a character string from a string.
Expand Down Expand Up @@ -98,13 +98,10 @@ SUBROUTINE ReadControlParameterFileSub(CntrPar, accINFILE, accINFILE_size,ErrVar
CALL ParseInput(UnControllerParameters,CurLine,'F_LPFCornerFreq',accINFILE(1),CntrPar%F_LPFCornerFreq,ErrVar)
CALL ParseInput(UnControllerParameters,CurLine,'F_LPFDamping',accINFILE(1),CntrPar%F_LPFDamping,ErrVar)
CALL ParseInput(UnControllerParameters,CurLine,'F_NotchCornerFreq',accINFILE(1),CntrPar%F_NotchCornerFreq,ErrVar)
! ALLOCATE(CntrPar%F_NotchBetaNumDen(2))
! READ(UnControllerParameters,*) CntrPar%F_NotchBetaNumDen ; CurLine=CurLine+1
CALL ParseAry(UnControllerParameters, CurLine, 'F_NotchBetaNumDen', CntrPar%F_NotchBetaNumDen, 2, accINFILE(1), ErrVar )
! Print *, 'CntrPar%F_NotchBetaNumDen:', CntrPar%F_NotchBetaNumDen
CALL ParseInput(UnControllerParameters,CurLine,'F_SSCornerFreq',accINFILE(1),CntrPar%F_SSCornerFreq,ErrVar)
READ(UnControllerParameters,*) CntrPar%F_FlCornerFreq, CntrPar%F_FlDamping ; CurLine=CurLine+1
READ(UnControllerParameters,*) CntrPar%F_FlpCornerFreq, CntrPar%F_FlpDamping ; CurLine=CurLine+1
CALL ParseAry(UnControllerParameters, CurLine, 'F_FlCornerFreq', CntrPar%F_FlCornerFreq, 2, accINFILE(1), ErrVar )
CALL ParseAry(UnControllerParameters, CurLine, 'F_FlpCornerFreq', CntrPar%F_FlpCornerFreq, 2, accINFILE(1), ErrVar )
CALL ReadEmptyLine(UnControllerParameters,CurLine)

!----------- BLADE PITCH CONTROLLER CONSTANTS -----------
Expand Down Expand Up @@ -520,25 +517,25 @@ SUBROUTINE CheckInputs(LocalVar, CntrPar, avrSWAP, ErrVar, size_avcMSG)
ENDIF

! F_FlCornerFreq(1) (frequency)
IF (CntrPar%F_FlCornerFreq <= 0.0) THEN
IF (CntrPar%F_FlCornerFreq(1) <= 0.0) THEN
ErrVar%aviFAIL = -1
ErrVar%ErrMsg = 'F_FlCornerFreq(1) must be greater than zero.'
ENDIF

! F_FlCornerFreq(2) (damping)
IF (CntrPar%F_FlDamping <= 0.0) THEN
IF (CntrPar%F_FlCornerFreq(2) <= 0.0) THEN
ErrVar%aviFAIL = -1
ErrVar%ErrMsg = 'F_FlCornerFreq(2) must be greater than zero.'
ENDIF

! F_FlpCornerFreq(1) (frequency)
IF (CntrPar%F_FlCornerFreq <= 0.0) THEN
IF (CntrPar%F_FlpCornerFreq(1) <= 0.0) THEN
ErrVar%aviFAIL = -1
ErrVar%ErrMsg = 'F_FlpCornerFreq(1) must be greater than zero.'
ENDIF

! F_FlpCornerFreq(2) (damping)
IF (CntrPar%F_FlDamping <= 0.0) THEN
IF (CntrPar%F_FlpCornerFreq(2) <= 0.0) THEN
ErrVar%aviFAIL = -1
ErrVar%ErrMsg = 'F_FlpCornerFreq(2) must be greater than zero.'
ENDIF
Expand Down Expand Up @@ -1292,8 +1289,10 @@ SUBROUTINE ParseDbAry ( Un, LineNum, AryName, Ary, AryLen, FileName, ErrVar )

CHARACTER(512) :: Line
INTEGER(4) :: ErrStatLcl ! Error status local to this routine.
INTEGER(4) :: i

CHARACTER(200), ALLOCATABLE :: Words_Ary (:) ! The array "words" parsed from the line.
CHARACTER(1024) :: Debug_String
CHARACTER(*), PARAMETER :: RoutineName = 'ParseDbAry'

! Read the whole line as a string
Expand Down Expand Up @@ -1323,8 +1322,16 @@ SUBROUTINE ParseDbAry ( Un, LineNum, AryName, Ary, AryLen, FileName, ErrVar )
! Separate line string into AryLen + 1 words, should include variable name
CALL GetWords ( Line, Words_Ary, AryLen + 1 )

! Debug Output
IF (DEBUG_PARSING) THEN
print *, 'Read: '//Words_Ary(AryLen:AryLen+1)//' on line ', LineNum
Debug_String = ''
DO i = 1,AryLen+1
Debug_String = TRIM(Debug_String)//TRIM(Words_Ary(i))
IF (i < AryLen + 1) THEN
Debug_String = TRIM(Debug_String)//','
END IF
END DO
print *, 'Read: '//TRIM(Debug_String)//' on line ', LineNum
END IF

! Check that Variable Name is at the end of Words, will also check length of array
Expand Down

0 comments on commit 039389a

Please sign in to comment.