Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Break up if statement in open loop pitch #100

Merged
merged 2 commits into from
Jan 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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