Skip to content
Snippets Groups Projects
Commit 8b5caada authored by Taya Snijder's avatar Taya Snijder
Browse files

renamed some constants

parent f4fd215a
Branches
No related tags found
1 merge request!465added constants.py and replaced most magic numbers
......@@ -6,7 +6,6 @@ class constants:
A good source for a good chunk of the constants can be found here: https://support.astron.nl/confluence/display/L2M/L2+STAT+Decision%3A+SC+-+SDP+OPC-UA+interface
"""
# TODO FIX
# number of dual polarization antennas in the band.
N_ant = 48
......@@ -16,12 +15,10 @@ class constants:
# number of polarisations per antenna (X and y polarisations)
N_pol = 2
# TODO FIX
# Single polarization signal inputs ( N_ant * N_pol)
S_ant = 96
# number of polarisations for beamforming
# TODO: this is used alongside N_pol, but its not clear to me whats the difference
N_pol_bf = 2
# antennas per FPGA
......@@ -40,48 +37,51 @@ class constants:
# number of RCU's per subrack
N_rcu = 32
# Number of antenna inputs per RCU
N_rcu_inp = 3
# number of hops that the data of the stream has traveled to reach the BSN aligner on this node
P_sum = 2
# the number of square correlator cells produced per FPGA for XST's (P_sq := N_pn // 2 + 1)
P_sq = 9
# total number of beamsets
N_beamsets_sdp = 2
# number of beamsets we control
N_beamsets_ctrl = 1
# The maximum amount of beamlets the SDP (and we) support
N_beamlets_max = 976
# number of actively controlled beamlets
N_beamlets_ctrl = 488
N_beamlets_out = 488
# Maximum number of subbands we support
N_sub = 512
# Number of points per subband
N_fft = 1024
# Maximum array size to allocate for beam_device pointings,
MAX_POINTINGS = 1024
N_sub_pts = 1024
# Maximum number of antenna inputs we support (used to determine array sizes)
MAX_INPUTS = 192
# main clock frequency's are 200MHz and 160MHz
CLK_200 = 200_000_000
CLK_160 = 160_000_000
# Maximum number of subbands for which we collect XSTs simultaneously
MAX_PARALLEL_SUBBANDS = 8
# Expected block for XST's
BLOCK_LENGTH = 12
# Complex values are (real, imag). A bit silly, but we don't want magical
# Complex values are (real, imag).
VALUES_PER_COMPLEX = 2
# Max blocks for the BST statistics
MAX_BLOCKS = 2
BST_MAX_BLOCKS = 2
# number of sockets the psoc has
PSOC_SOCKETS = 8
# main clock frequency of the subrack is 200MHz NOTE: type is a float here
CLK_200 = 200_000_000
CLK_160 = 160_000_000
# default subband we use because of its low RFI
DEFAULT_SUBBAND = 102
# UNB2 constants
# number of uniboards in a subrack
......@@ -93,6 +93,18 @@ class constants:
# number of QSFP tranceivers per uniboard
N_qsfp = 24
# the three spatial dimensions XYZ used a lot for pointing directions and ITRF coordinates.
N_xyz = 3
# number of values for latitude/longitude coordinates
N_coord = 2
# default subband we use because of its low RFI
DEFAULT_SUBBAND = 102
# Maximum array size to allocate for beam_device pointings,
MAX_POINTINGS = 1024
# max size for a statistic packet
MAX_PACKET_SIZE = 9000
......@@ -108,11 +120,6 @@ class constants:
# The default polling period for polled attributes
DEFAULT_POLLING_PERIOD = 1000
# the three spatial dimensions XYZ used a lot for pointing directions and ITRF coordinates.
N_xyz = 3
# number of values for latitude/longitude coordinates
N_coord = 2
"""
These classes for now exist for future use
......
......@@ -226,7 +226,7 @@ class RECV(opcua_device):
return (self.read_attribute("ANT_mask_RW") & (
self.alarm_val("RCU_PWR_ANT_VIN_R")
| self.alarm_val("RCU_PWR_ANT_VOUT_R")
)).reshape(constants.N_rcu,3).any(axis=1) | (self.read_attribute("RCU_mask_RW") & (
)).reshape(constants.N_rcu,constants.N_rcu_inp).any(axis=1) | (self.read_attribute("RCU_mask_RW") & (
self.alarm_val("RCU_PWR_1V8_R")
| self.alarm_val("RCU_PWR_2V5_R")
| self.alarm_val("RCU_PWR_3V3_R")
......
......@@ -293,7 +293,7 @@ class Beamlet(opcua_device):
def _subband_frequencies(subbands: numpy.ndarray, clock: int, nyquist_zone: int) -> numpy.ndarray:
""" Obtain the frequencies of each subband, given a clock and an antenna type. """
subband_width = clock / constants.N_fft
subband_width = clock / constants.N_sub_pts
base_subband = nyquist_zone * constants.N_sub
# broadcast clock across frequencies
......
......@@ -88,10 +88,10 @@ class BST(Statistics):
# number of packets with invalid payloads
nof_payload_errors_R = attribute_wrapper(comms_id=StatisticsClient, comms_annotation={"type": "statistics", "parameter": "nof_payload_errors"}, dims=(constants.N_pn,), datatype=numpy.uint64)
# latest BSTs
bst_R = attribute_wrapper(comms_id=StatisticsClient, comms_annotation={"type": "statistics", "parameter": "bst_values"}, dims=(constants.MAX_BLOCKS, constants.N_beamlets_max), datatype=numpy.uint64)
bst_R = attribute_wrapper(comms_id=StatisticsClient, comms_annotation={"type": "statistics", "parameter": "bst_values"}, dims=(constants.BST_MAX_BLOCKS, constants.N_beamlets_max), datatype=numpy.uint64)
# reported timestamp
# for each row in the latest BSTs
bst_timestamp_R = attribute_wrapper(comms_id=StatisticsClient, comms_annotation={"type": "statistics", "parameter": "bst_timestamps"}, dims=(constants.MAX_BLOCKS,), datatype=numpy.uint64)
bst_timestamp_R = attribute_wrapper(comms_id=StatisticsClient, comms_annotation={"type": "statistics", "parameter": "bst_timestamps"}, dims=(constants.BST_MAX_BLOCKS,), datatype=numpy.uint64)
# ----------
# Summarising Attributes
......
......@@ -76,7 +76,7 @@ class SDP(opcua_device):
dtype='DevVarDoubleArray',
mandatory=False,
# Emit a signal on subband 102
default_value=[[constants.DEFAULT_SUBBAND * float(constants.CLK_200) / constants.N_fft] * S_pn] * N_pn
default_value=[[constants.DEFAULT_SUBBAND * float(constants.CLK_200) / constants.N_sub_pts] * S_pn] * N_pn
)
FPGA_wg_phase_RW_default = device_property(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment