Skip to content

Commit

Permalink
[ROSCO] Add soft cut-in
Browse files Browse the repository at this point in the history
  • Loading branch information
dzalkind committed Nov 22, 2023
1 parent d9b3f90 commit 5153978
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
11 changes: 9 additions & 2 deletions ROSCO/ROSCO/src/ControllerBlocks.f90
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,19 @@ MODULE ControllerBlocks
CONTAINS
! -----------------------------------------------------------------------------------
! Calculate setpoints for primary control actions
SUBROUTINE ComputeVariablesSetpoints(CntrPar, LocalVar, objInst)
USE ROSCO_Types, ONLY : ControlParameters, LocalVariables, ObjectInstances
SUBROUTINE ComputeVariablesSetpoints(CntrPar, LocalVar, ErrVar, objInst)
USE ROSCO_Types, ONLY : ControlParameters, LocalVariables, ObjectInstances, ErrorVariables
USE Constants
! Allocate variables
TYPE(ControlParameters), INTENT(INOUT) :: CntrPar
TYPE(LocalVariables), INTENT(INOUT) :: LocalVar
TYPE(ErrorVariables), INTENT(INOUT) :: ErrVar
TYPE(ObjectInstances), INTENT(INOUT) :: objInst

REAL(DbKi) :: VS_RefSpd ! Referece speed for variable speed torque controller, [rad/s]
REAL(DbKi) :: PC_RefSpd ! Referece speed for pitch controller, [rad/s]
REAL(DbKi) :: Omega_op ! Optimal TSR-tracking generator speed, [rad/s]
REAL(DbKi) :: sig ! Optimal TSR-tracking generator speed, [rad/s]

! ----- Pitch controller speed and power error -----
! Implement setpoint smoothing
Expand All @@ -58,6 +60,11 @@ SUBROUTINE ComputeVariablesSetpoints(CntrPar, LocalVar, objInst)
LocalVar%VS_RefSpd = CntrPar%VS_RefSpd
ENDIF


sig = sigma(LocalVar%Time, 0.0, 20.0, 1.0, 0.0, ErrVar)
! WRITE(400,*) "sig: ", sig
LocalVar%VS_RefSpd = CntrPar%VS_RefSpd * sig + LocalVar%VS_RefSpd * (1-sig)

LocalVar%VS_RefSpd = saturate(LocalVar%VS_RefSpd,CntrPar%VS_MinOMSpd, CntrPar%VS_RefSpd)

! Implement setpoint smoothing
Expand Down
2 changes: 1 addition & 1 deletion ROSCO/ROSCO/src/DISCON.F90
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ SUBROUTINE DISCON(avrSWAP, aviFAIL, accINFILE, avcOUTNAME, avcMSG) BIND (C, NAME
ENDIF

CALL WindSpeedEstimator(LocalVar, CntrPar, objInst, PerfData, DebugVar, ErrVar)
CALL ComputeVariablesSetpoints(CntrPar, LocalVar, objInst)
CALL ComputeVariablesSetpoints(CntrPar, LocalVar, ErrVar, objInst)
CALL StateMachine(CntrPar, LocalVar)
CALL SetpointSmoother(LocalVar, CntrPar, objInst)
CALL VariableSpeedControl(avrSWAP, CntrPar, LocalVar, objInst, ErrVar)
Expand Down
20 changes: 10 additions & 10 deletions ROSCO/ROSCO/src/ReadSetParameters.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1096,17 +1096,17 @@ SUBROUTINE CheckInputs(LocalVar, CntrPar, avrSWAP, ErrVar, size_avcMSG)
ErrVar%ErrMsg = 'VS_RtTq must not be negative.'
ENDIF

! VS_KP
IF (CntrPar%VS_KP(1) > 0.0) THEN
ErrVar%aviFAIL = -1
ErrVar%ErrMsg = 'VS_KP must be less than zero.'
ENDIF
! ! VS_KP
! IF (CntrPar%VS_KP(1) > 0.0) THEN
! ErrVar%aviFAIL = -1
! ErrVar%ErrMsg = 'VS_KP must be less than zero.'
! ENDIF

! VS_KI
IF (CntrPar%VS_KI(1) > 0.0) THEN
ErrVar%aviFAIL = -1
ErrVar%ErrMsg = 'VS_KI must be less than zero.'
ENDIF
! ! VS_KI
! IF (CntrPar%VS_KI(1) > 0.0) THEN
! ErrVar%aviFAIL = -1
! ErrVar%ErrMsg = 'VS_KI must be less than zero.'
! ENDIF

! VS_TSRopt
IF (CntrPar%VS_TSRopt < 0.0) THEN
Expand Down

0 comments on commit 5153978

Please sign in to comment.