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

Update control interface #366

Merged
merged 10 commits into from
Jul 11, 2024
15 changes: 11 additions & 4 deletions rosco/toolbox/control_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def __init__(self, lib_name, param_filename="DISCON.IN", **kwargs):
self.char_buffer = 500
self.avr_size = 500
self.sim_name = "simDEBUG"
self.pitch = 0 # option to provid initial blade pitch value

# Set kwargs, like DT
for k, w in kwargs.items():
Expand All @@ -89,7 +90,7 @@ def __init__(self, lib_name, param_filename="DISCON.IN", **kwargs):

def init_discon(self):
# Initialize
self.pitch = 0

self.torque = 0
# -- discon
self.discon = cdll.LoadLibrary(self.lib_name)
Expand All @@ -104,9 +105,9 @@ def init_discon(self):
self.avrSWAP[26] = 10 # HARD CODE initial wind speed = 10 m/s

# Blade pitch initial conditions
self.avrSWAP[3] = 0 * np.deg2rad(1)
self.avrSWAP[32] = 0 * np.deg2rad(1)
self.avrSWAP[33] = 0 * np.deg2rad(1)
self.avrSWAP[3] = self.pitch * np.deg2rad(1)
self.avrSWAP[32] = self.pitch * np.deg2rad(1)
self.avrSWAP[33] = self.pitch * np.deg2rad(1)

self.avrSWAP[27] = 1 # IPC

Expand Down Expand Up @@ -212,6 +213,12 @@ def call_controller(self, turbine_state, end=False):
except KeyError:
self.avrSWAP[82] = 0

# pass translational acceleration
try:
self.avrSWAP[52] = turbine_state['FA_Acc']
except KeyError:
self.avrSWAP[52] = 0

# call controller
self.call_discon()

Expand Down
Loading