Skip to content
Snippets Groups Projects
Commit e7ab011e authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-769: Fix interface to BeamTracker

parent 887269a8
No related branches found
No related tags found
1 merge request!317Resolve L2SS-769 "Implement digital beam"
...@@ -174,7 +174,7 @@ class beam_device(lofar_device): ...@@ -174,7 +174,7 @@ class beam_device(lofar_device):
self._tracking_enabled_rw = True self._tracking_enabled_rw = True
# Create a thread object to update beam weights # Create a thread object to update beam weights
self.Beam_tracker = BeamTracker(self.update_pointing, self.Fault) self.Beam_tracker = BeamTracker(self.Beam_tracking_interval, self.Beam_tracking_preparation_period, self.update_pointing, self.Fault)
@log_exceptions() @log_exceptions()
def configure_for_on(self): def configure_for_on(self):
...@@ -309,8 +309,10 @@ class BeamTracker(): ...@@ -309,8 +309,10 @@ class BeamTracker():
DISCONNECT_TIMEOUT = 3.0 DISCONNECT_TIMEOUT = 3.0
""" Object that encapsulates a Thread, resposible for beam tracking operations """ """ Object that encapsulates a Thread, resposible for beam tracking operations """
def __init__(self, update_pointing_callback, fault_callback): def __init__(self, interval, preparation_period, update_pointing_callback, fault_callback):
self.thread = None self.thread = None
self.interval = interval
self.preparation_period = preparation_period
self.update_pointing_callback = update_pointing_callback self.update_pointing_callback = update_pointing_callback
self.fault_callback = fault_callback self.fault_callback = fault_callback
...@@ -374,13 +376,13 @@ class BeamTracker(): ...@@ -374,13 +376,13 @@ class BeamTracker():
now = datetime.datetime.now().timestamp() now = datetime.datetime.now().timestamp()
# Computes the left seconds before the next update # Computes the left seconds before the next update
next_update_in = self.device.Beam_tracking_interval - (now % self.device.Beam_tracking_interval) next_update_in = self.interval - (now % self.interval)
# Computes the needed sleep time before the next update # Computes the needed sleep time before the next update
sleep_time = next_update_in - self.device.Beam_tracking_preparation_period sleep_time = next_update_in - self.preparation_period
# If sleep time is negative, add the tracking interval for the next update # If sleep time is negative, add the tracking interval for the next update
if sleep_time < 0: if sleep_time < 0:
return sleep_time + self.device.Beam_tracking_interval return sleep_time + self.interval
else: else:
return sleep_time return sleep_time
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment