Skip to content
Snippets Groups Projects
Commit e527eee5 authored by Stefano Di Frischia's avatar Stefano Di Frischia
Browse files

L2SS-643: add calculate_bf_weights function

parent fe4900f7
No related branches found
No related tags found
1 merge request!294Resolve L2SS-643 "Calculate beamlet bfweights"
...@@ -92,14 +92,6 @@ class Beamlet(opcua_device): ...@@ -92,14 +92,6 @@ class Beamlet(opcua_device):
FPGA_beamlet_output_scale_R = attribute_wrapper(comms_annotation=["FPGA_beamlet_output_scale_R"], datatype=numpy.double, dims=(16,)) FPGA_beamlet_output_scale_R = attribute_wrapper(comms_annotation=["FPGA_beamlet_output_scale_R"], datatype=numpy.double, dims=(16,))
FPGA_beamlet_output_scale_RW = attribute_wrapper(comms_annotation=["FPGA_beamlet_output_scale_RW"], datatype=numpy.double, dims=(16,), access=AttrWriteType.READ_WRITE) FPGA_beamlet_output_scale_RW = attribute_wrapper(comms_annotation=["FPGA_beamlet_output_scale_RW"], datatype=numpy.double, dims=(16,), access=AttrWriteType.READ_WRITE)
# List of OPC-UA CP for BF beamlets
S_pn = SDP.S_pn
N_pn = SDP.N_pn
A_pn = 6
N_pol = 2
N_beamlets_ctrl = 488
N_pol_bf = 2
FPGA_beamlet_output_nof_packets_R = attribute_wrapper(comms_annotation=["FPGA_beamlet_output_nof_packets_R"], datatype=numpy.int32, dims=(N_beamlets_ctrl, N_pn)) FPGA_beamlet_output_nof_packets_R = attribute_wrapper(comms_annotation=["FPGA_beamlet_output_nof_packets_R"], datatype=numpy.int32, dims=(N_beamlets_ctrl, N_pn))
FPGA_beamlet_output_nof_valid_R = attribute_wrapper(comms_annotation=["FPGA_beamlet_output_nof_valid_R"], datatype=numpy.int32, dims=(N_beamlets_ctrl, N_pn)) FPGA_beamlet_output_nof_valid_R = attribute_wrapper(comms_annotation=["FPGA_beamlet_output_nof_valid_R"], datatype=numpy.int32, dims=(N_beamlets_ctrl, N_pn))
...@@ -152,7 +144,17 @@ class Beamlet(opcua_device): ...@@ -152,7 +144,17 @@ class Beamlet(opcua_device):
# internal functions # internal functions
# -------- # --------
def _calculate_bf_weights(self, phases: numpy.ndarray): def _calculate_bf_weights(self, phases: numpy.ndarray):
pass """ Helper function that converts a difference in phase (in radiants)
to a FPGA weight (in complex number) """
# Convert array values in complex numbers
unit = numpy.power(2,14)
real = numpy.array(unit * numpy.sin(phases), dtype=numpy.short)
imag = numpy.array(unit * numpy.cos(phases), dtype=numpy.short)
# join 16 bits of imaginary part (MSB) with 16 bits of real part (LSB)
bf_weights = numpy.array( numpy.frombuffer( b''.join(imag,real), dtype=numpy.uint32 ) )
return bf_weights
# -------- # --------
# Commands # Commands
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment