diff --git a/CDB/test_environment_ConfigDb.json b/CDB/test_environment_ConfigDb.json index eaa786547743f368a4a1b8333d89d127f4b3b829..fb2911cb9e07fddf61219872ec7610e859149a42 100644 --- a/CDB/test_environment_ConfigDb.json +++ b/CDB/test_environment_ConfigDb.json @@ -1,5 +1,16 @@ { "servers": { + "TileBeam": { + "STAT": { + "TileBeam": { + "STAT/TileBeam/1": { + "properties": { + "Tracking_enabled_RW_default": [ "True" ] + } + } + } + } + }, "Observation": { "STAT": { "Observation": { @@ -8,4 +19,4 @@ } } } -} \ No newline at end of file +} diff --git a/tangostationcontrol/tangostationcontrol/devices/sdp/beamlet.py b/tangostationcontrol/tangostationcontrol/devices/sdp/beamlet.py index 3a302239c317b83d1f1598a27b8fe1a5222d3858..79afeacfe41c314d63a59396ceae2b4f7d523c15 100644 --- a/tangostationcontrol/tangostationcontrol/devices/sdp/beamlet.py +++ b/tangostationcontrol/tangostationcontrol/devices/sdp/beamlet.py @@ -245,9 +245,9 @@ class Beamlet(opcua_device): """ The SDP FPGAs correct for signal-delay differences by rotating the phases of the antenna signals. A delay - is converted to a phase difference as follows: + is converted to a phase difference as follows (NB: applying a delay means rotating the signal backwards): - phase = 2 * pi * frequency * delay + phase = -2 * pi * frequency * delay where 'frequency' is the subband frequency: @@ -321,7 +321,9 @@ class Beamlet(opcua_device): """ # compute the phases - beamlet_phases = (2.0 * numpy.pi) * beamlet_frequencies * delays + + # applying a delay means rotating *backwards* + beamlet_phases = (-2.0 * numpy.pi) * beamlet_frequencies * delays # convert to weights bf_weights = Beamlet._phases_to_bf_weights(beamlet_phases) diff --git a/tangostationcontrol/tangostationcontrol/test/devices/test_beamlet_device.py b/tangostationcontrol/tangostationcontrol/test/devices/test_beamlet_device.py index 81b34f00e8135563b22af10bb72d53ea7fceab13..e7b82ec29ccd1e83abb481ed63db897b1a98f2d2 100644 --- a/tangostationcontrol/tangostationcontrol/test/devices/test_beamlet_device.py +++ b/tangostationcontrol/tangostationcontrol/test/devices/test_beamlet_device.py @@ -65,15 +65,21 @@ class TestBeamletDevice(base.TestCase): self.assertEqual(to_complex(bf_weights[1][2]), -1 + 0j, msg=f"bf_weights = {bf_weights}") def test_calculate_bf_weights_actual_numbers(self): + # we test phase offsets with 90 degree increments to weed out: + # - sign errors (-1-2j instead of 1+2j == 180 degree offset) + # - complex conjugation errors (1-2j instead of 1+2j == 180 degree offset) + # - real/imaginary swap errors (2+1j instead of 1+2j == 90 degree offset) + # + # NB: -180 degree rotation == +180 degree rotation, so we need 90 degree + # offsets to detect 180 degree errors as well. + # 2 beamlets, 3 antennas. The antennas are 1 second apart. delays = numpy.array([ - [0.0, 2.5e-9, 5.0e-9] + [0.0, 1.25e-9, 2.5e-9, 3.75e-9, 5.0e-9] ]) - # the frequency of the signal is 1.0 Hz and 0.5 Hz respectively, - # so the antennas will be either in phase or in opposite phase beamlet_frequencies = numpy.array([ - [200e6, 200e6, 200e6] + [200e6, 200e6, 200e6, 200e6, 200e6] ]) bf_weights = Beamlet._calculate_bf_weights(delays, beamlet_frequencies) @@ -81,8 +87,10 @@ class TestBeamletDevice(base.TestCase): self.assertEqual(delays.shape, bf_weights.shape) self.assertEqual(to_complex(bf_weights[0][0]), 1 + 0j, msg=f"bf_weights = {bf_weights}") - self.assertEqual(to_complex(bf_weights[0][1]), -1 + 0j, msg=f"bf_weights = {bf_weights}") - self.assertEqual(to_complex(bf_weights[0][2]), 1 + 0j, msg=f"bf_weights = {bf_weights}") + self.assertEqual(to_complex(bf_weights[0][1]), 0 - 1j, msg=f"bf_weights = {bf_weights}") + self.assertEqual(to_complex(bf_weights[0][2]), -1 + 0j, msg=f"bf_weights = {bf_weights}") + self.assertEqual(to_complex(bf_weights[0][3]), 0 + 1j, msg=f"bf_weights = {bf_weights}") + self.assertEqual(to_complex(bf_weights[0][4]), 1 + 0j, msg=f"bf_weights = {bf_weights}") def test_subband_frequencies(self): subbands = numpy.array([