Skip to content

Commit

Permalink
WS estimator bug fixed, need to update DTU10MW parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown committed Oct 5, 2018
1 parent d3c5e58 commit 4d19aa4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
7 changes: 7 additions & 0 deletions Parameter_files/DTU10MW/ControllerParameters.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
1 ! VS_n - Number of controller gains
-27338.24 ! VS_KP - Proportional gain for generator PI torque controller, used in the transitional 2.5 region, [1/(rad/s) Nm]
-6134.68 ! VS_KI - Integral gain for generator PI torque controller, used in the transitional 2.5 region, [1/rad Nm]
89.166 ! WE_BladeRadius - Blade length [m]
4 ! WE_CP_n - Amount of parameters in the Cp array
XXX XXX XXX XXX ! WE_CP - Parameters that define the parameterized CP(\lambda) function
20 ! WE_Gamma - Adaption gain of the wind speed estimator algorithm [m/rad]
50 ! WE_GearboxRatio - Gearbox ratio, >=1 [-]
2.0E+08 ! WE_Jtot - Total drivetrain inertia, including blades, hub and casted generator inertia to LSS [kg m^2]
1.225 ! WE_RhoAir - Air density [kg m^-3]
0 ! Y_ControlMode - Yaw control mode: (0 = no yaw control, 1 = yaw rate control, 2 = yaw-by-IPC)
1.745329252 ! Y_ErrThresh - Yaw error threshold. Turbine begins to yaw when it passes this. [rad^2 s]
0.17453 ! Y_IPC_IntSat - Integrator saturation (maximum signal amplitude contrbution to pitch from yaw-by-IPC), [rad]
Expand Down
34 changes: 20 additions & 14 deletions Source/Functions.f90
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,17 @@ SUBROUTINE Debug(LocalVar, CntrPar, avrSWAP, RootName, size_avcOUTNAME)
IF (LocalVar%iStatus == 0) THEN ! .TRUE. if we're on the first call to the DLL
! If we're debugging, open the debug file and write the header:
IF (CntrPar%LoggingLevel > 0) THEN
OPEN(UnDb, FILE=TRIM(RootName)//'.dbg', STATUS='REPLACE')
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) '
!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%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

IF (CntrPar%LoggingLevel > 1) THEN
OPEN(UnDb2, FILE=TRIM(RootName)//'.dbg2', STATUS='REPLACE')
!OPEN(UnDb2, FILE=TRIM(RootName)//'.dbg2', STATUS='REPLACE')
OPEN(unit=UnDb, FILE='DEBUG2.dbg')
WRITE(UnDb2,'(/////)')
WRITE(UnDb2,'(A,85("'//Tab//'AvrSWAP(",I2,")"))') 'LocalVar%Time ', (i,i=1,85)
WRITE(UnDb2,'(A,85("'//Tab//'(-)"))') '(s)'
Expand All @@ -243,11 +247,12 @@ SUBROUTINE Debug(LocalVar, CntrPar, avrSWAP, RootName, size_avcOUTNAME)
WRITE(*, 100) LocalVar%GenSpeedF*RPS2RPM, LocalVar%BlPitch(1)*R2D, avrSWAP(15)/1000.0, LocalVar%WE_Vw ! LocalVar%Time !/1000.0
100 FORMAT('Generator speed: ', f6.1, ' RPM, Pitch angle: ', f5.1, ' deg, Power: ', f7.1, ' kW, Wind Speed: ', f5.1, ' m/s')
! PRINT *, LocalVar%PC_State, LocalVar%VS_State, CntrPar%VS_Rgn3Pitch, CntrPar%PC_FinePit, CntrPar%PC_Switch, LocalVar%BlPitch(1) ! Additional debug info
PRINT *, LocalVar%RotSpeed
END IF

! Output debugging information if requested:
IF (CntrPar%LoggingLevel > 0) THEN
WRITE (UnDb,FmtDat) LocalVar%Time, LocalVar%Y_MErr, LocalVar%Y_AccErr, CntrPar%Y_ErrThresh, LocalVar%Y_ErrLPFFast, LocalVar%Y_ErrLPFSlow, avrSWAP(48)
WRITE (UnDb,FmtDat) LocalVar%Time, LocalVar%WE_Vw
END IF

IF (CntrPar%LoggingLevel > 1) THEN
Expand Down Expand Up @@ -335,7 +340,7 @@ REAL FUNCTION CPfunction(CP, lambda)
END FUNCTION CPfunction
!-------------------------------------------------------------------------------------------------------------------------------
!Function for computing the aerodynamic torque, divided by the effective rotor torque of the turbine, for use in wind speed estimation
REAL FUNCTION IntertiaSpecAeroDynTorque(LocalVar, CntrPar)
REAL FUNCTION AeroDynTorque(LocalVar, CntrPar)
USE DRC_Types, ONLY : LocalVariables, ControlParameters
IMPLICIT NONE

Expand All @@ -352,10 +357,10 @@ REAL FUNCTION IntertiaSpecAeroDynTorque(LocalVar, CntrPar)
Lambda = LocalVar%RotSpeed*CntrPar%WE_BladeRadius/LocalVar%WE_Vw
Cp = CPfunction(CntrPar%WE_CP, Lambda)

IntertiaSpecAeroDynTorque = (CntrPar%WE_RhoAir*RotorArea)/(2*CntrPar%WE_Jtot)*(LocalVar%WE_Vw**3/LocalVar%RotSpeed)*Cp*Lambda
IntertiaSpecAeroDynTorque = MAX(IntertiaSpecAeroDynTorque, 0.0)
AeroDynTorque = 0.5*(CntrPar%WE_RhoAir*RotorArea)*(LocalVar%WE_Vw**3/LocalVar%RotSpeed)*Cp
AeroDynTorque = MAX(AeroDynTorque, 0.0)

END FUNCTION IntertiaSpecAeroDynTorque
END FUNCTION AeroDynTorque
!-------------------------------------------------------------------------------------------------------------------------------
SUBROUTINE WindSpeedEstimator(LocalVar, CntrPar)
USE DRC_Types, ONLY : LocalVariables, ControlParameters
Expand All @@ -365,12 +370,13 @@ SUBROUTINE WindSpeedEstimator(LocalVar, CntrPar)
TYPE(ControlParameters), INTENT(IN) :: CntrPar
TYPE(LocalVariables), INTENT(INOUT) :: LocalVar

LocalVar%WE_VwIdot = CntrPar%WE_Gamma*(LocalVar%GenTqMeas*CntrPar%WE_GearboxRatio/CntrPar%WE_Jtot - IntertiaSpecAeroDynTorque(LocalVar, CntrPar))
!LocalVar%WE_VwIdot = CntrPar%WE_Gamma/CntrPar%WE_Jtot*(LocalVar%GenTqMeas*CntrPar%WE_GearboxRatio - AeroDynTorque(LocalVar, CntrPar))
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
!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

0 comments on commit 4d19aa4

Please sign in to comment.