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

IPC Saturation Fix [RAAW] #210

Merged
merged 120 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
aa888a1
FOCAL Updates (#64)
dzalkind Nov 19, 2021
6f16a9d
update listcheck method for numpy arrays
nikhar-abbas Dec 7, 2021
f57ee45
Merge pull request #97 from nikhar-abbas/b/listcheck
nikhar-abbas Dec 8, 2021
50f686d
Open Loop Control (#98)
dzalkind Dec 14, 2021
337ecf6
Convert WE saved variables to WE type
nikhar-abbas Dec 17, 2021
ab46545
Put restart flag in localvars
nikhar-abbas Dec 17, 2021
9d67547
Use saved filter params from LocalVar
nikhar-abbas Dec 17, 2021
ed81a23
save pitcomt last
nikhar-abbas Dec 17, 2021
3bbaf86
Move IPC saved variables to localvars
nikhar-abbas Dec 17, 2021
30e98d6
Saved pi controller variables to localvar
nikhar-abbas Dec 17, 2021
38dff08
Save RootMyb_Last to localvar
nikhar-abbas Dec 17, 2021
fc1c9ec
ROSCO_IO - initial commit. Include restart and debug functions
nikhar-abbas Dec 17, 2021
2025565
Use ROSCO IO and call restart functions
nikhar-abbas Dec 17, 2021
915922a
Remove debug from function.f90
nikhar-abbas Dec 17, 2021
6800344
Save ACC Infile info
nikhar-abbas Dec 17, 2021
92e27bb
update for restart capabilities
nikhar-abbas Dec 17, 2021
3ff3800
add rosco_io with restart and debug functions
nikhar-abbas Dec 21, 2021
15eb73d
cleanup debug call
nikhar-abbas Dec 21, 2021
5e2eb07
use registry generate types and IO
nikhar-abbas Dec 21, 2021
24fa6b7
delete DFController
nikhar-abbas Dec 21, 2021
9149b12
fix timestep mismatch
nikhar-abbas Dec 21, 2021
3c9c89d
remove unnecessaray istatus check
nikhar-abbas Dec 21, 2021
492348c
close files
nikhar-abbas Dec 21, 2021
7897a83
add reg test for restart
nikhar-abbas Dec 21, 2021
969beb6
add restart option to run_openfast
nikhar-abbas Dec 21, 2021
ace827d
add testing to CI, ignore generate files
nikhar-abbas Dec 21, 2021
1347767
fix fastcall
nikhar-abbas Dec 21, 2021
67ada29
remove extra commas
nikhar-abbas Dec 21, 2021
4c31544
specify gfortran-10
nikhar-abbas Dec 21, 2021
6f29556
testing flag cleanup
nikhar-abbas Dec 21, 2021
3e43206
Use lv_strings to generate debug output
dzalkind Dec 21, 2021
b1607e0
Revert "testing flag cleanup"
nikhar-abbas Dec 21, 2021
24e5daf
Revert "specify gfortran-10"
nikhar-abbas Dec 21, 2021
76caca3
minor cleanup
nikhar-abbas Dec 21, 2021
4b6041a
Use kind from constants
nikhar-abbas Dec 22, 2021
878b143
Add some comments for clarity
nikhar-abbas Dec 22, 2021
59519a1
put debug in if statements
nikhar-abbas Dec 22, 2021
8749713
separate reg tests from oother tests
nikhar-abbas Dec 22, 2021
b5ac62d
Fl_Mode>0
nikhar-abbas Dec 22, 2021
3fdbdad
Remove hard coded values
nikhar-abbas Dec 22, 2021
52492d3
Add filtered signals and WE_Vw to debug varrs
nikhar-abbas Dec 22, 2021
7cb1151
cd for regtest
nikhar-abbas Dec 22, 2021
a2d6de4
Check logging level before calling debug
nikhar-abbas Dec 22, 2021
2ab7de6
add fl_pitcom and pc_minpit to debugvars
nikhar-abbas Dec 22, 2021
1f68bd5
Turn runFAST into a class
dzalkind Dec 22, 2021
1b0b1c3
Refactor/simplify CaseLibrary
dzalkind Dec 22, 2021
6c1e4db
Restart & registry (#99)
nikhar-abbas Jan 3, 2022
7fec13b
Implement initial pitch actuator
dzalkind Jan 5, 2022
a034086
Set up steps case
dzalkind Jan 5, 2022
93dceb7
Break up if statement in open loop pitch (#100)
dzalkind Jan 5, 2022
5d5a9ba
add bld edgewise freq to robust dict_inputs
nikhar-abbas Jan 6, 2022
aad7396
Merge pull request #103 from nikhar-abbas/hf/robust
nikhar-abbas Jan 6, 2022
3d696e6
Add actuator variable
dzalkind Jan 7, 2022
7042b49
Print first time step in debug outs
dzalkind Jan 7, 2022
8c7949e
Fix FOCAL yaml
dzalkind Jan 7, 2022
1a0e59a
Set actuator to 0.25 Hz bandwidth
dzalkind Jan 7, 2022
41e0dc6
Fix ccrotor inputs (#104)
nikhar-abbas Jan 14, 2022
a857211
Allow default inputs (#110)
dzalkind Feb 25, 2022
9b5499d
ipc (#105)
nikhar-abbas Mar 18, 2022
5f18bf8
Increment version number
dzalkind Mar 21, 2022
8c31287
Bladed docs (#116)
dzalkind Mar 21, 2022
d7d15b0
Update version in API change docs
dzalkind Mar 22, 2022
4126adb
Bladed readthedocs (#117)
dzalkind Mar 22, 2022
e9c9378
Merge remote-tracking branch 'upstream/develop' into develop
dzalkind Mar 22, 2022
d520192
Update docs to reflect CI process
dzalkind Mar 30, 2022
f53a49e
Merge remote-tracking branch 'upstream/main' into develop
dzalkind Apr 7, 2022
31d7250
Merge branch 'develop' into f/pitch_act
dzalkind Apr 7, 2022
eab381a
Regenerate types, IO with registry
dzalkind Apr 7, 2022
ad36ab9
Update registry so first timestep is printed
dzalkind Apr 7, 2022
d15bc7c
Update inverted notch to move frequency properly
dzalkind Apr 8, 2022
5a9b44d
Saturate inv notch corner frequency at 0
dzalkind Apr 8, 2022
a898f9d
Add tower damper mode flag
dzalkind Apr 14, 2022
c965339
Add Azimuth tracking controller in Simulink
dzalkind Apr 22, 2022
bdbc940
Always enable GenDOF, add options for simp_step
dzalkind Apr 22, 2022
6bb9c6b
Add sweep for IPC gains and FA damper
dzalkind Apr 22, 2022
c2ec84d
Fix NumCoords in FAST_writer
dzalkind Apr 22, 2022
bd0562c
sigma + ipc (#125)
nikhar-abbas Apr 25, 2022
97aae35
Add turbulent case to runFAST/CaseLibrary
dzalkind Apr 25, 2022
899750a
Merge remote-tracking branch 'upstream/develop' into raaw
dzalkind Apr 25, 2022
2ab0190
Add peak shaving sweep function
dzalkind Apr 26, 2022
e33631d
Increase default IPC_IntSat, make input parameter in future
dzalkind Apr 26, 2022
1b00cca
Flip Ct and Cq table allocation
dzalkind Apr 26, 2022
e035a7d
Flip Ct and Cq table allocation (#130)
dzalkind Apr 27, 2022
3f059d1
Merge remote-tracking branch 'origin/develop' into f/pitch_act
dzalkind Apr 27, 2022
379b6d2
Regen types
dzalkind Apr 27, 2022
747fcaa
Remove print statements used for debugging
dzalkind Apr 27, 2022
bba2816
Update input files: IEA model has pitch actuator
dzalkind Apr 27, 2022
5db820e
Merge branch 'develop' into f/pitch_act
dzalkind Apr 29, 2022
5612797
Merge remote-tracking branch 'origin/f/pitch_act' into f/pitch_act
dzalkind Apr 29, 2022
f6643b9
Add back flap control (no idea when it was deleted)
dzalkind Apr 29, 2022
7051a99
Update discons, docs with API change
dzalkind Apr 29, 2022
0eff188
Merge branch 'f/pitch_act' into raaw
dzalkind May 2, 2022
1ff7c11
Add user-defined hh case
dzalkind May 3, 2022
d8724f4
Fix AddF0 and RayleighDamp in FAST_reader
dzalkind May 4, 2022
5cdb0b5
Pitch Actuator and IPC updates (#123)
dzalkind May 6, 2022
155c132
Merge remote-tracking branch 'upstream/main' into raaw
dzalkind May 10, 2022
fc44a4a
Merge remote-tracking branch 'upstream/develop' into raaw
dzalkind May 10, 2022
f4094ea
Add max_torque_factor for constant power control, flexible upper limit
dzalkind May 11, 2022
f8c1dbe
Make update discons relative to tuning yaml
dzalkind May 11, 2022
97e2fe7
Update AddF0 and NumCoords in FAST_reader/writer
dzalkind May 11, 2022
e2bca61
Remove matlab/rotor position control stuff
dzalkind May 13, 2022
50a2f90
Add OpenFAST channels that Simulink reads (#135)
dzalkind May 20, 2022
3b97e4c
Merge remote-tracking branch 'upstream/develop' into raaw
dzalkind May 20, 2022
0f77676
Merge remote-tracking branch 'upstream/develop' into raaw
dzalkind Oct 5, 2022
e67ca0d
Add collective blade pitch signal for WSE, shutdown
dzalkind Oct 6, 2022
5622fd3
Clean up merge: two sigma functions, finish adding collective BP
dzalkind Oct 6, 2022
74c392c
Use IPC always in IEA-15MW case
dzalkind Oct 6, 2022
da6ecec
Add IPC_SatMode input
dzalkind Jul 14, 2022
44d2a83
Force IPC_SatMode to be an int in writer
dzalkind Jul 15, 2022
d96a96b
Fix IPC_SatMode cherry pick
dzalkind Oct 6, 2022
6593f41
Fix IPC_SatMode/IntSat description, update DISCONs
dzalkind Oct 6, 2022
a2e4619
Add new IPC_SatModes
dzalkind Oct 6, 2022
feb7b2b
Merge remote-tracking branch 'upstream/raaw' into raaw
dzalkind Oct 6, 2022
b1f761c
Rate limit blade pitch on first time step
dzalkind Oct 14, 2022
0b959e1
Merge remote-tracking branch 'upstream/develop' into raaw
dzalkind Jan 18, 2023
e0143a8
Update discons, registry
dzalkind Jan 18, 2023
d6ce5d5
Move BlPitchC -> BlPitchCMeas(ured)
dzalkind Jan 18, 2023
3d97084
Update registry description
dzalkind Jan 23, 2023
e2438e9
Remove old update_discons
dzalkind Jan 23, 2023
516d16a
Merge remote-tracking branch 'upstream/develop' into raaw
dzalkind Jan 25, 2023
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
9 changes: 9 additions & 0 deletions ROSCO/rosco_registry/rosco_types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ ControlParameters:
IPC_IntSat:
<<: *real
description: Integrator saturation (maximum signal amplitude contrbution to pitch from IPC)
IPC_SatMode:
<<: *integer
description: IPC Saturation method IPC Saturation method (0 - no saturation (except by PC_MinPit), 1 - saturate by PS_BldPitchMin, 2 - saturate sotfly (full IPC cycle) by PC_MinPit, 3 - saturate softly by PS_BldPitchMin)
IPC_KP:
<<: *real
description: Integral gain for the individual pitch controller, [-].
Expand Down Expand Up @@ -723,6 +726,9 @@ LocalVariables:
<<: *real
description: Blade pitch [rad]
size: 3
BlPitchCMeas:
<<: *real
description: Mean (collective) blade pitch [rad]
Azimuth:
<<: *real
description: Rotor aziumuth angle [rad]
Expand Down Expand Up @@ -824,6 +830,9 @@ LocalVariables:
<<: *real
description: Proportional gain for IPC, after ramp [-]
size: 2
IPC_IntSat:
<<: *real
description: Integrator saturation (maximum signal amplitude contrbution to pitch from IPC)
PC_State:
<<: *integer
description: State of the pitch control system
Expand Down
8 changes: 4 additions & 4 deletions ROSCO/src/ControllerBlocks.f90
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,10 @@ SUBROUTINE WindSpeedEstimator(LocalVar, CntrPar, objInst, PerfData, DebugVar, Er
WE_Inp_Speed = LocalVar%RotSpeedF
END IF

IF (LocalVar%BlPitch(1) < CntrPar%PC_MinPit) THEN
IF (LocalVar%BlPitchCMeas < CntrPar%PC_MinPit) THEN
WE_Inp_Pitch = CntrPar%PC_MinPit
ELSE
WE_Inp_Pitch = LocalVar%BlPitch(1)
WE_Inp_Pitch = LocalVar%BlPitchCMeas
END IF

IF (LocalVar%VS_LastGenTrqF < 0.0001 * CntrPar%VS_RtTq) THEN
Expand All @@ -228,7 +228,7 @@ SUBROUTINE WindSpeedEstimator(LocalVar, CntrPar, objInst, PerfData, DebugVar, Er
! Inversion and Invariance Filter implementation
IF (CntrPar%WE_Mode == 1) THEN
! Compute AeroDynTorque
Tau_r = AeroDynTorque(LocalVar%RotSpeedF, LocalVar%BlPitch(1), LocalVar, CntrPar, PerfData, ErrVar)
Tau_r = AeroDynTorque(LocalVar%RotSpeedF, LocalVar%BlPitchCMeas, LocalVar, CntrPar, PerfData, ErrVar)

LocalVar%WE_VwIdot = CntrPar%WE_Gamma/CntrPar%WE_Jtot*(LocalVar%VS_LastGenTrq*CntrPar%WE_GearboxRatio - Tau_r)
LocalVar%WE_VwI = LocalVar%WE_VwI + LocalVar%WE_VwIdot*LocalVar%DT
Expand Down Expand Up @@ -413,7 +413,7 @@ REAL(DbKi) FUNCTION Shutdown(LocalVar, CntrPar, objInst)

! Pitch Blades to 90 degrees at max pitch rate if in shutdown mode
IF (LocalVar%SD) THEN
Shutdown = LocalVar%BlPitch(1) + CntrPar%PC_MaxRat*LocalVar%DT
Shutdown = LocalVar%BlPitchCMeas + CntrPar%PC_MaxRat*LocalVar%DT
IF (MODULO(LocalVar%Time, 10.0_DbKi) == 0) THEN
print *, ' ** SHUTDOWN MODE **'
ENDIF
Expand Down
37 changes: 27 additions & 10 deletions ROSCO/src/Controllers.f90
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,23 @@ SUBROUTINE PitchControl(avrSWAP, CntrPar, LocalVar, objInst, DebugVar, ErrVar)

! Saturate collective pitch commands:
LocalVar%PC_PitComT = saturate(LocalVar%PC_PitComT, LocalVar%PC_MinPit, CntrPar%PC_MaxPit) ! Saturate the overall command using the pitch angle limits
LocalVar%PC_PitComT = ratelimit(LocalVar%PC_PitComT, CntrPar%PC_MinRat, CntrPar%PC_MaxRat, LocalVar%DT, LocalVar%restart, LocalVar%rlP,objInst%instRL) ! Saturate the overall command of blade K using the pitch rate limit
LocalVar%PC_PitComT = ratelimit(LocalVar%PC_PitComT, CntrPar%PC_MinRat, CntrPar%PC_MaxRat, LocalVar%DT, LocalVar%restart, LocalVar%rlP,objInst%instRL,LocalVar%BlPitchCMeas) ! Saturate the overall command of blade K using the pitch rate limit
LocalVar%PC_PitComT_Last = LocalVar%PC_PitComT

! Combine and saturate all individual pitch commands in software
DO K = 1,LocalVar%NumBl ! Loop through all blades, add IPC contribution and limit pitch rate
LocalVar%PitCom(K) = LocalVar%PC_PitComT + LocalVar%FA_PitCom(K)
LocalVar%PitCom(K) = saturate(LocalVar%PitCom(K), LocalVar%PC_MinPit, CntrPar%PC_MaxPit) ! Saturate the command using the pitch satauration limits
LocalVar%PitCom(K) = LocalVar%PitCom(K) + LocalVar%IPC_PitComF(K) ! Add IPC
LocalVar%PitCom(K) = saturate(LocalVar%PitCom(K), LocalVar%PC_MinPit, CntrPar%PC_MaxPit) ! Saturate the command using the absolute pitch angle limits
LocalVar%PitCom(K) = ratelimit(LocalVar%PitCom(K), CntrPar%PC_MinRat, CntrPar%PC_MaxRat, LocalVar%DT, LocalVar%restart, LocalVar%rlP,objInst%instRL) ! Saturate the overall command of blade K using the pitch rate limit
END DO

! Hard IPC saturation by peak shaving limit
IF (CntrPar%IPC_SatMode == 1) THEN
LocalVar%PitCom(K) = saturate(LocalVar%PitCom(K), LocalVar%PC_MinPit, CntrPar%PC_MaxPit)
END IF

! Rate limit
LocalVar%PitCom(K) = ratelimit(LocalVar%PitCom(K), CntrPar%PC_MinRat, CntrPar%PC_MaxRat, LocalVar%DT, LocalVar%restart, LocalVar%rlP,objInst%instRL,LocalVar%BlPitch(K)) ! Saturate the overall command of blade K using the pitch rate limit
END DO

! Open Loop control, use if
! Open loop mode active Using OL blade pitch control
Expand Down Expand Up @@ -134,9 +140,9 @@ SUBROUTINE PitchControl(avrSWAP, CntrPar, LocalVar, objInst, DebugVar, ErrVar)
! Hardware saturation: using CntrPar%PC_MinPit
DO K = 1,LocalVar%NumBl ! Loop through all blades, add IPC contribution and limit pitch rate
! Saturate the pitch command using the overall (hardware) limit
LocalVar%PitComAct(K) = saturate(LocalVar%PitComAct(K), LocalVar%PC_MinPit, CntrPar%PC_MaxPit)
LocalVar%PitComAct(K) = saturate(LocalVar%PitComAct(K), CntrPar%PC_MinPit, CntrPar%PC_MaxPit)
! Saturate the overall command of blade K using the pitch rate limit
LocalVar%PitComAct(K) = ratelimit(LocalVar%PitComAct(K), CntrPar%PC_MinRat, CntrPar%PC_MaxRat, LocalVar%DT, LocalVar%restart, LocalVar%rlP,objInst%instRL) ! Saturate the overall command of blade K using the pitch rate limit
LocalVar%PitComAct(K) = ratelimit(LocalVar%PitComAct(K), CntrPar%PC_MinRat, CntrPar%PC_MaxRat, LocalVar%DT, LocalVar%restart, LocalVar%rlP,objInst%instRL,LocalVar%BlPitch(K)) ! Saturate the overall command of blade K using the pitch rate limit
END DO

! Add pitch actuator fault for blade K
Expand Down Expand Up @@ -413,15 +419,26 @@ SUBROUTINE IPC(CntrPar, LocalVar, objInst, DebugVar, ErrVar)
LocalVar%IPC_KP(i) = sigma(LocalVar%WE_Vw, CntrPar%IPC_Vramp(1), CntrPar%IPC_Vramp(2), 0.0_DbKi, CntrPar%IPC_KP(i), ErrVar)
LocalVar%IPC_KI(i) = sigma(LocalVar%WE_Vw, CntrPar%IPC_Vramp(1), CntrPar%IPC_Vramp(2), 0.0_DbKi, CntrPar%IPC_KI(i), ErrVar)
END DO

! Handle saturation limit, depends on IPC_SatMode
IF (CntrPar%IPC_SatMode == 2) THEN
! Saturate to min allowed pitch angle, softly using IPC_IntSat
LocalVar%IPC_IntSat = min(CntrPar%IPC_IntSat,LocalVar%BlPitchCMeas - CntrPar%PC_MinPit)
ELSEIF (CntrPar%IPC_SatMode == 3) THEN
! Saturate to peak shaving, softly using IPC_IntSat
LocalVar%IPC_IntSat = min(CntrPar%IPC_IntSat,LocalVar%BlPitchCMeas - LocalVar%PC_MinPit)
ELSE
LocalVar%IPC_IntSat = CntrPar%IPC_IntSat
ENDIF

! Integrate the signal and multiply with the IPC gain
IF ((CntrPar%IPC_ControlMode >= 1) .AND. (CntrPar%Y_ControlMode /= 2)) THEN
LocalVar%IPC_axisTilt_1P = PIController(axisTilt_1P, LocalVar%IPC_KP(1), LocalVar%IPC_KI(1), -CntrPar%IPC_IntSat, CntrPar%IPC_IntSat, LocalVar%DT, 0.0_DbKi, LocalVar%piP, LocalVar%restart, objInst%instPI)
LocalVar%IPC_axisYaw_1P = PIController(axisYawF_1P, LocalVar%IPC_KP(1), LocalVar%IPC_KI(1), -CntrPar%IPC_IntSat, CntrPar%IPC_IntSat, LocalVar%DT, 0.0_DbKi, LocalVar%piP, LocalVar%restart, objInst%instPI)
LocalVar%IPC_axisTilt_1P = PIController(axisTilt_1P, LocalVar%IPC_KP(1), LocalVar%IPC_KI(1), -LocalVar%IPC_IntSat, LocalVar%IPC_IntSat, LocalVar%DT, 0.0_DbKi, LocalVar%piP, LocalVar%restart, objInst%instPI)
LocalVar%IPC_axisYaw_1P = PIController(axisYawF_1P, LocalVar%IPC_KP(1), LocalVar%IPC_KI(1), -LocalVar%IPC_IntSat, LocalVar%IPC_IntSat, LocalVar%DT, 0.0_DbKi, LocalVar%piP, LocalVar%restart, objInst%instPI)

IF (CntrPar%IPC_ControlMode >= 2) THEN
LocalVar%IPC_axisTilt_2P = PIController(axisTilt_2P, LocalVar%IPC_KP(2), LocalVar%IPC_KI(2), -CntrPar%IPC_IntSat, CntrPar%IPC_IntSat, LocalVar%DT, 0.0_DbKi, LocalVar%piP, LocalVar%restart, objInst%instPI)
LocalVar%IPC_axisYaw_2P = PIController(axisYawF_2P, LocalVar%IPC_KP(2), LocalVar%IPC_KI(2), -CntrPar%IPC_IntSat, CntrPar%IPC_IntSat, LocalVar%DT, 0.0_DbKi, LocalVar%piP, LocalVar%restart, objInst%instPI)
LocalVar%IPC_axisTilt_2P = PIController(axisTilt_2P, LocalVar%IPC_KP(2), LocalVar%IPC_KI(2), -LocalVar%IPC_IntSat, LocalVar%IPC_IntSat, LocalVar%DT, 0.0_DbKi, LocalVar%piP, LocalVar%restart, objInst%instPI)
LocalVar%IPC_axisYaw_2P = PIController(axisYawF_2P, LocalVar%IPC_KP(2), LocalVar%IPC_KI(2), -LocalVar%IPC_IntSat, LocalVar%IPC_IntSat, LocalVar%DT, 0.0_DbKi, LocalVar%piP, LocalVar%restart, objInst%instPI)
END IF
ELSE
LocalVar%IPC_axisTilt_1P = 0.0
Expand Down
12 changes: 9 additions & 3 deletions ROSCO/src/Functions.f90
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ REAL(DbKi) FUNCTION saturate(inputValue, minValue, maxValue)
END FUNCTION saturate

!-------------------------------------------------------------------------------------------------------------------------------
REAL(DbKi) FUNCTION ratelimit(inputSignal, minRate, maxRate, DT, reset, rlP, inst)
REAL(DbKi) FUNCTION ratelimit(inputSignal, minRate, maxRate, DT, reset, rlP, inst, ResetValue)
! Saturates inputValue. Makes sure it is not smaller than minValue and not larger than maxValue
USE ROSCO_Types, ONLY : rlParams

Expand All @@ -62,13 +62,18 @@ REAL(DbKi) FUNCTION ratelimit(inputSignal, minRate, maxRate, DT, reset, rlP, ins
LOGICAL, INTENT(IN) :: reset
TYPE(rlParams), INTENT(INOUT) :: rlP
INTEGER(IntKi), INTENT(INOUT) :: inst
REAL(DbKi), OPTIONAL, INTENT(IN) :: ResetValue ! Value to base rate limit off if restarting

! Local variables
REAL(DbKi) :: rate
REAL(DbKi) :: ResetValue_

ResetValue_ = inputSignal
IF (PRESENT(ResetValue)) ResetValue_ = ResetValue

IF (reset) THEN
rlP%LastSignal(inst) = inputSignal
ratelimit = inputSignal
rlP%LastSignal(inst) = ResetValue_
ratelimit = ResetValue_

ELSE
rate = (inputSignal - rlP%LastSignal(inst))/DT ! Signal rate (unsaturated)
Expand Down Expand Up @@ -594,6 +599,7 @@ REAL(DbKi) FUNCTION sigma(x, x0, x1, y0, y1, ErrVar)
END FUNCTION sigma



!-------------------------------------------------------------------------------------------------------------------------------
! Copied from NWTC_IO.f90
!> This function returns a character string encoded with today's date in the form dd-mmm-ccyy.
Expand Down
Loading