Skip to content

Commit

Permalink
Merge pull request #2 from NREL/f/shutdown
Browse files Browse the repository at this point in the history
F/shutdown
  • Loading branch information
ptrbortolotti authored Apr 8, 2020
2 parents e3eef35 + bd966ea commit 7cb1654
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Second, you will need to compile the controller. From the ROSCO home directory:
mkdir build
cd build
cmake ..
make install
make
```
A dynamic link library will be compiled into the directory with the title `libdiscon.*`, where the file extension is `.so`, `.dll`, or `.dylib`, depending on the user's operating system.

Expand Down
41 changes: 28 additions & 13 deletions src/ControllerBlocks.f90
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ REAL FUNCTION Shutdown(LocalVar, CntrPar, objInst)
REAL(4) :: MaxYaw
REAL(4) :: SD_slope
REAL(4), Save :: SD_time = 0.0
Logical :: downwind=.TRUE.

! Initialize Shutdown Varible
IF (LocalVar%iStatus == 0) THEN
Expand All @@ -326,7 +327,9 @@ REAL FUNCTION Shutdown(LocalVar, CntrPar, objInst)

! Shutdown?
IF (LocalVar%Time > 30.0) THEN
IF (SD_BlPitchF > CntrPar%SD_MaxPit) THEN
! IF (SD_BlPitchF > CntrPar%SD_MaxPit) THEN
! LocalVar%SD = .TRUE.
IF (LocalVar%GenSpeedF > CntrPar%PC_RefSpd*1.2) THEN
LocalVar%SD = .TRUE.
ELSEIF (ABS(SD_YawErrF) > MaxYaw*D2R) THEN
LocalVar%SD = .TRUE.
Expand All @@ -338,18 +341,30 @@ REAL FUNCTION Shutdown(LocalVar, CntrPar, objInst)

! Pitch Blades to 90 degrees at max pitch rate if in shutdown mode
IF (LocalVar%SD) THEN
! "e-stop"
! Shutdown = LocalVar%BlPitch(1) + CntrPar%PC_MaxRat*LocalVar%DT

! If Pitch-to-stall
! Shutdown = LocalVar%BlPitch(1) - CntrPar%PC_MaxRat*LocalVar%DT
! LocalVar%PC_MinPit = -90*R2D

! "Normal" shutdown
SD_time = SD_time + LocalVar%DT
SD_slope = - (CntrPar%VS_RefSpd / 60.0)
CntrPar%PC_RefSpd = SD_slope*SD_time + CntrPar%VS_RefSpd
CntrPar%PC_RefSpd = max(CntrPar%PC_RefSpd, 0.0)

! E-stop - Pitch-to-stall (downwind, Below Rated)
IF ( (downwind) .AND. (LocalVar%GenTq <= CntrPar%VS_ArSatTq) .AND. (LocalVar%PC_PitComT < 2.0) ) THEN
Shutdown = LocalVar%BlPitch(1) - CntrPar%PC_MaxRat*LocalVar%DT
LocalVar%PC_MinPit = -90*D2R

! SD_time = SD_time + LocalVar%DT
! SD_slope = - (CntrPar%PC_RefSpd / 30.0)
! LocalVar%SD_RefSpd = SD_slope*SD_time + CntrPar%PC_RefSpd
! LocalVar%SD_RefSpd = max(LocalVar%SD_RefSpd, 0.0)

! E-stop - Pitch-to-feather (Upwind)
ELSEIF (LocalVar%BlPitch(1) > CntrPar%SD_MaxPit) THEN
Shutdown = LocalVar%BlPitch(1) + CntrPar%PC_MaxRat*LocalVar%DT

ELSE
! "Normal" shutdown
SD_time = SD_time + LocalVar%DT
SD_slope = - (CntrPar%PC_RefSpd / 30.0)
LocalVar%SD_RefSpd = SD_slope*SD_time + CntrPar%PC_RefSpd
LocalVar%SD_RefSpd = max(LocalVar%SD_RefSpd, 0.0)

Shutdown = LocalVar%PC_PitComT
ENDIF

IF (MODULO(LocalVar%Time, 10.0) == 0) THEN
print *, ' ** SHUTDOWN MODE **'
Expand Down
3 changes: 2 additions & 1 deletion src/ROSCO_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ MODULE ROSCO_Types
REAL(4) :: Y_MErr ! Measured yaw error, measured + setpoint [rad].
REAL(4) :: Y_YawEndT ! Yaw end time [s]. Indicates the time up until which yaw is active with a fixed rate
LOGICAL(1) :: SD ! Shutdown, .FALSE. if inactive, .TRUE. if active
REAL(4) :: Fl_PitCom ! Shutdown, .FALSE. if inactive, .TRUE. if active
REAL(4) :: SD_RefSpd ! Generator reference speed during shutdown
REAL(4) :: Fl_PitCom ! Floating pitch command
REAL(4) :: NACIMU_FA_AccF
REAL(4) :: Flp_Angle(3) ! Flap Angle (rad)
END TYPE LocalVariables
Expand Down
7 changes: 6 additions & 1 deletion src/ReadSetParameters.f90
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ SUBROUTINE ComputeVariablesSetpoints(CntrPar, LocalVar, objInst)
PC_RefSpd = CntrPar%PC_RefSpd
ENDIF

IF (LocalVar%SD) THEN
PC_RefSpd = LocalVar%SD_RefSpd
ENDIF

LocalVar%PC_SpdErr = PC_RefSpd - LocalVar%GenSpeedF ! Speed error
LocalVar%PC_PwrErr = CntrPar%VS_RtPwr - LocalVar%VS_GenPwr ! Power error

Expand All @@ -273,6 +277,7 @@ SUBROUTINE ComputeVariablesSetpoints(CntrPar, LocalVar, objInst)
! Force zero torque in shutdown mode
IF (LocalVar%SD) THEN
VS_RefSpd = CntrPar%VS_MinOMSpd
! VS_RefSpd = LocalVar%SD_RefSpd
ENDIF

! Force minimum rotor speed
Expand All @@ -282,7 +287,7 @@ SUBROUTINE ComputeVariablesSetpoints(CntrPar, LocalVar, objInst)
IF (CntrPar%VS_ControlMode == 2) THEN
LocalVar%VS_SpdErr = VS_RefSpd - LocalVar%GenSpeedF
ENDIF

! Define transition region setpoint errors
LocalVar%VS_SpdErrAr = VS_RefSpd - LocalVar%GenSpeedF ! Current speed error - Region 2.5 PI-control (Above Rated)
LocalVar%VS_SpdErrBr = CntrPar%VS_MinOMSpd - LocalVar%GenSpeedF ! Current speed error - Region 1.5 PI-control (Below Rated)
Expand Down

0 comments on commit 7cb1654

Please sign in to comment.