diff --git a/tangostationcontrol/tangostationcontrol/devices/beam.py b/tangostationcontrol/tangostationcontrol/devices/beam.py index cd08d50e58cf2cd932c1d7149bf86e4a78faf8ca..ba86ec94a23b9f74526830c91465b5fcee474297 100644 --- a/tangostationcontrol/tangostationcontrol/devices/beam.py +++ b/tangostationcontrol/tangostationcontrol/devices/beam.py @@ -36,18 +36,6 @@ class Beam(lofar_device): # ----------------- # Device Properties # ----------------- - reference_itrf = device_property( - dtype='DevVarFloatArray', - mandatory=False, - default_value = numpy.tile(numpy.array([3826577.066, 461022.948, 5064892.786]),(96,1)) # CS002LBA, in ITRF2005 timestamp 2012.5 - ) - - antenna_itrf = device_property( - dtype='DevVarFloatArray', - mandatory=False, - default_value = numpy.tile(numpy.array([3826923.546, 460915.441, 5064643.489]),(96,16,1)) # CS001LBA, in ITRF2005 timestamp 2012.5 - ) - HBAT_signal_input_delays = device_property( dtype='DevVarFloatArray', mandatory=False, @@ -83,6 +71,10 @@ class Beam(lofar_device): # Set a reference of RECV device self.recv_proxy = DeviceProxy("STAT/RECV/1") + # Retrieve positions from RECV device + self.hbat_reference_itrf = self.recv_proxy.get_hbat_reference_itrf().reshape(96,3) + self.hbat_antenna_itrf = self.recv_proxy.get_hbat_antenna_itrf().reshape(96,16,3) + # -------- # internal functions # -------- @@ -97,11 +89,11 @@ class Beam(lofar_device): for tile in range(96): # initialise delay calculator - d = delay_calculator(self.reference_itrf[tile]) + d = delay_calculator(self.hbat_reference_itrf[tile]) d.set_measure_time(timestamp) # calculate the delays based on the set reference position, the set time and now the set direction and antenna positions - delays[tile] = d.convert(pointing_direction[tile], self.antenna_itrf[tile]) + delays[tile] = d.convert(pointing_direction[tile], self.hbat_antenna_itrf[tile]) return delays @@ -206,6 +198,7 @@ class Beam(lofar_device): """ Uploads beam weights based on a given pointing direction 2D array (96 tiles x 3 parameters) """ + # Reshape the flatten input array pointing_direction = numpy.array(pointing_direction).reshape(96,3) self._HBAT_set_pointing(pointing_direction, timestamp) diff --git a/tangostationcontrol/tangostationcontrol/devices/recv.py b/tangostationcontrol/tangostationcontrol/devices/recv.py index 64bcfcc8264403e0f92f9a629bca5f1bafc22e28..e8dc823f17fb439ae5c673fe2df868dcb2198578 100644 --- a/tangostationcontrol/tangostationcontrol/devices/recv.py +++ b/tangostationcontrol/tangostationcontrol/devices/recv.py @@ -15,7 +15,7 @@ from tango import DebugIt from tango.server import command from tango.server import device_property, attribute -from tango import AttrWriteType, DevState +from tango import AttrWriteType, DevState, DevVarFloatArray import numpy # Additional import @@ -47,7 +47,6 @@ class RECV(opcua_device): # ----------------- # Device Properties # ----------------- - ANT_mask_RW_default = device_property( dtype='DevVarBooleanArray', mandatory=False, @@ -74,6 +73,18 @@ class RECV(opcua_device): # 14.9781E-9, 15.5063E-9 # ],dtype=numpy.float64) # ) + + hbat_reference_itrf = device_property( + dtype='DevVarFloatArray', + mandatory=False, + default_value = numpy.tile(numpy.array([3826577.066, 461022.948, 5064892.786]),(96,1)) # CS002LBA, in ITRF2005 timestamp 2012.5 + ) + + hbat_antenna_itrf = device_property( + dtype='DevVarFloatArray', + mandatory=False, + default_value = numpy.tile(numpy.array([3826923.546, 460915.441, 5064643.489]),(96,16,1)) # CS001LBA, in ITRF2005 timestamp 2012.5 + ) first_default_settings = [ # set the masks first, as those filter any subsequent settings @@ -143,6 +154,20 @@ class RECV(opcua_device): # -------- # Commands # -------- + @command(dtype_out=DevVarFloatArray) + @DebugIt() + @only_in_states([DevState.ON]) + def get_hbat_reference_itrf(self): + """ Return the property hbat_reference_itrf (96x3) into a flatten array """ + return self.hbat_reference_itrf.flatten() + + @command(dtype_out=DevVarFloatArray) + @DebugIt() + @only_in_states([DevState.ON]) + def get_hbat_antenna_itrf(self): + """ Return the property hbat_antenna_itrf (96x16x3) into a flatten array """ + return self.hbat_antenna_itrf.flatten() + @command() @DebugIt() @only_in_states([DevState.STANDBY, DevState.ON])