Skip to content

Commit

Permalink
Add phase to sine_timeseries
Browse files Browse the repository at this point in the history
  • Loading branch information
dzalkind committed Dec 30, 2024
1 parent 62f3c04 commit 689ecc6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rosco/toolbox/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,8 @@ def interp_series(self,control,breakpoints,values,method='sigma'):
self.compute_yaw_rate()


def sine_timeseries(self,control,amplitude,period,offset=0):
def sine_timeseries(self,control,amplitude,period,offset=0,phase=0):
# phase in radians

if period <= 0:
raise Exception('Open loop sine input period is <= 0')
Expand All @@ -862,7 +863,7 @@ def sine_timeseries(self,control,amplitude,period,offset=0):
if control not in self.allowed_controls:
raise Exception(f'Open loop control of {control} is not allowed')
else:
self.ol_series[control] = amplitude * np.sin(2 * np.pi * self.ol_series['time'] / period) + offset
self.ol_series[control] = amplitude * np.sin(2 * np.pi * self.ol_series['time'] / period + phase) + offset

if control == 'nacelle_yaw':
self.compute_yaw_rate()
Expand Down

0 comments on commit 689ecc6

Please sign in to comment.