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

Merge branch 'L2SS-917-beam-weight-sign' into 'master'

L2SS-917: Digital beamweights need to be negative

Closes L2SS-917

See merge request !404
parents ac25d4e9 c50691aa
Branches
Tags
1 merge request!404L2SS-917: Digital beamweights need to be negative
{ {
"servers": { "servers": {
"TileBeam": {
"STAT": {
"TileBeam": {
"STAT/TileBeam/1": {
"properties": {
"Tracking_enabled_RW_default": [ "True" ]
}
}
}
}
},
"Observation": { "Observation": {
"STAT": { "STAT": {
"Observation": { "Observation": {
......
...@@ -245,9 +245,9 @@ class Beamlet(opcua_device): ...@@ -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 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: where 'frequency' is the subband frequency:
...@@ -321,7 +321,9 @@ class Beamlet(opcua_device): ...@@ -321,7 +321,9 @@ class Beamlet(opcua_device):
""" """
# compute the phases # 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 # convert to weights
bf_weights = Beamlet._phases_to_bf_weights(beamlet_phases) bf_weights = Beamlet._phases_to_bf_weights(beamlet_phases)
......
...@@ -65,15 +65,21 @@ class TestBeamletDevice(base.TestCase): ...@@ -65,15 +65,21 @@ class TestBeamletDevice(base.TestCase):
self.assertEqual(to_complex(bf_weights[1][2]), -1 + 0j, msg=f"bf_weights = {bf_weights}") self.assertEqual(to_complex(bf_weights[1][2]), -1 + 0j, msg=f"bf_weights = {bf_weights}")
def test_calculate_bf_weights_actual_numbers(self): 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. # 2 beamlets, 3 antennas. The antennas are 1 second apart.
delays = numpy.array([ 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([ beamlet_frequencies = numpy.array([
[200e6, 200e6, 200e6] [200e6, 200e6, 200e6, 200e6, 200e6]
]) ])
bf_weights = Beamlet._calculate_bf_weights(delays, beamlet_frequencies) bf_weights = Beamlet._calculate_bf_weights(delays, beamlet_frequencies)
...@@ -81,8 +87,10 @@ class TestBeamletDevice(base.TestCase): ...@@ -81,8 +87,10 @@ class TestBeamletDevice(base.TestCase):
self.assertEqual(delays.shape, bf_weights.shape) 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][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][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][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): def test_subband_frequencies(self):
subbands = numpy.array([ subbands = numpy.array([
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment