Skip to content

Commit

Permalink
Break up if statement in open loop pitch (#100)
Browse files Browse the repository at this point in the history
* Break up if statement in open loop pitch

* Make torque and yaw consistent with pitch: can start after some time
  • Loading branch information
dzalkind authored Jan 5, 2022
1 parent 6c1e4db commit 93dceb7
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions ROSCO/src/Controllers.f90
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,13 @@ SUBROUTINE PitchControl(avrSWAP, CntrPar, LocalVar, objInst, DebugVar, ErrVar)
END DO

! Open Loop control, use if
! Open loop mode active Using OL blade pitch control Time > first open loop breakpoint
IF ((CntrPar%OL_Mode == 1) .AND. (CntrPar%Ind_BldPitch > 0) .AND. (LocalVar%Time >= CntrPar%OL_Breakpoints(1))) THEN
DO K = 1,LocalVar%NumBl ! Loop through all blades
LocalVar%PitCom(K) = interp1d(CntrPar%OL_Breakpoints,CntrPar%OL_BldPitch,LocalVar%Time, ErrVar)
END DO
! Open loop mode active Using OL blade pitch control
IF ((CntrPar%OL_Mode == 1) .AND. (CntrPar%Ind_BldPitch > 0)) THEN
IF (LocalVar%Time >= CntrPar%OL_Breakpoints(1)) THEN ! Time > first open loop breakpoint
DO K = 1,LocalVar%NumBl ! Loop through all blades
LocalVar%PitCom(K) = interp1d(CntrPar%OL_Breakpoints,CntrPar%OL_BldPitch,LocalVar%Time, ErrVar)
END DO
ENDIF
ENDIF

! Command the pitch demanded from the last
Expand Down Expand Up @@ -202,7 +204,9 @@ SUBROUTINE VariableSpeedControl(avrSWAP, CntrPar, LocalVar, objInst, ErrVar)

! Open loop torque control
IF ((CntrPar%OL_Mode == 1) .AND. (CntrPar%Ind_GenTq > 0)) THEN
LocalVar%GenTq = interp1d(CntrPar%OL_Breakpoints,CntrPar%OL_GenTq,LocalVar%Time,ErrVar)
IF (LocalVar%Time >= CntrPar%OL_Breakpoints(1)) THEN
LocalVar%GenTq = interp1d(CntrPar%OL_Breakpoints,CntrPar%OL_GenTq,LocalVar%Time,ErrVar)
ENDIF
ENDIF

! Reset the value of LocalVar%VS_LastGenTrq to the current values:
Expand Down Expand Up @@ -263,7 +267,9 @@ SUBROUTINE YawRateControl(avrSWAP, CntrPar, LocalVar, objInst, ErrVar)
! If using open loop yaw rate control, overwrite controlled output
! Open loop torque control
IF ((CntrPar%OL_Mode == 1) .AND. (CntrPar%Ind_YawRate > 0)) THEN
avrSWAP(48) = interp1d(CntrPar%OL_Breakpoints,CntrPar%OL_YawRate,LocalVar%Time, ErrVar)
IF (LocalVar%Time >= CntrPar%OL_Breakpoints(1)) THEN
avrSWAP(48) = interp1d(CntrPar%OL_Breakpoints,CntrPar%OL_YawRate,LocalVar%Time, ErrVar)
ENDIF
ENDIF

! Add RoutineName to error message
Expand Down

0 comments on commit 93dceb7

Please sign in to comment.