Skip to content

Commit

Permalink
Yaw Rate Bug Fix (NREL#239)
Browse files Browse the repository at this point in the history
* Add back open loop yaw rate control

* Check OL outputs in example

* Update CI to use mamba, first attempt

* Install extras when environment first set up

* Remove potential libpython typo

* Remove more potential typos

* Use mamba in compile, too

* Use environment.yml file

* Remove conda installs from rosco-compile

* Clean up CI scripts

* Update mamba install in CI

* Remove petsc and mpi

* Revert CI back to conda
  • Loading branch information
dzalkind authored Jun 9, 2023
1 parent 5fd97e2 commit e5b1af5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Examples/14_open_loop_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,22 @@
fastout = op.load_fast_out(out_file, tmin=0)
fig, ax = op.plot_fast_out(cases=cases,showplot=False)

# Check that open loop commands are close to control outputs from OpenFAST
fo = fastout[0]
tt = fo['Time']
valid_ind = tt > 2 # first few timesteps can differ, depending on OpenFAST solve config

# Computer errors
nacelle_yaw_diff = fo['NacYaw'][valid_ind] - np.degrees(np.interp(tt[valid_ind],olc.ol_timeseries['time'],olc.ol_timeseries['nacelle_yaw']))
bld_pitch_diff = fo['BldPitch1'][valid_ind] - np.degrees(np.interp(tt[valid_ind],olc.ol_timeseries['time'],olc.ol_timeseries['blade_pitch']))
gen_tq_diff = fo['GenTq'][valid_ind] - np.interp(tt[valid_ind],olc.ol_timeseries['time'],olc.ol_timeseries['generator_torque'])/1e3

# Check diff timeseries
np.testing.assert_allclose(nacelle_yaw_diff, 0, atol = 1e-1) # yaw has dynamics and integration error, tolerance higher
np.testing.assert_allclose(bld_pitch_diff, 0, atol = 1e-3)
np.testing.assert_allclose(gen_tq_diff, 0, atol = 1e-3)


if False:
plt.show()
else:
Expand Down
8 changes: 8 additions & 0 deletions ROSCO/src/Controllers.f90
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,14 @@ SUBROUTINE YawRateControl(avrSWAP, CntrPar, LocalVar, objInst, zmqVar, DebugVar,
! Output yaw rate command in rad/s
avrSWAP(48) = YawRateCom * D2R

! 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
IF (LocalVar%Time >= CntrPar%OL_Breakpoints(1)) THEN
avrSWAP(48) = interp1d(CntrPar%OL_Breakpoints,CntrPar%OL_YawRate,LocalVar%Time, ErrVar)
ENDIF
ENDIF

! Save for debug
DebugVar%YawRateCom = YawRateCom
DebugVar%NacHeadingTarget = NacHeadingTarget
Expand Down

0 comments on commit e5b1af5

Please sign in to comment.