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

Merge branch 'master' into 'L2SS-412-replace-opcua-by-asyncua'

# Conflicts:
#   devices/devices/hardware_device.py
parents dde2bbb1 1e3a1c21
No related branches found
No related tags found
1 merge request!142L2SS-412: Use asyncio for opcua and other clients
#!/bin/bash
git submodule update --init
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
ABSOLUTE_PATH=$(realpath $(dirname ${BASH_SOURCE})) ABSOLUTE_PATH=$(realpath $(dirname ${BASH_SOURCE}))
export LOFAR20_DIR=${1:-$(realpath ${ABSOLUTE_PATH}/../..)} export LOFAR20_DIR=${1:-$(realpath ${ABSOLUTE_PATH}/../..)}
if [ ! -f "${LOFAR20_DIR}/.git/hooks/post-checkout" ]; then
alias git="cp ${LOFAR20_DIR}/bin/update_submodules.sh ${LOFAR20_DIR}/.git/hooks/post-checkout; cp ${LOFAR20_DIR}/bin/update_submodules.sh ${LOFAR20_DIR}/.git/hooks/post-merge; unalias git; git"
fi
# This needs to be modified for a development environment. # This needs to be modified for a development environment.
# In case you run multiple Docker networks on the same host in parallel, you need to specify a unique # In case you run multiple Docker networks on the same host in parallel, you need to specify a unique
# network name for each of them. # network name for each of them.
......
...@@ -60,6 +60,9 @@ class hardware_device(Device, metaclass=AbstractDeviceMetas): ...@@ -60,6 +60,9 @@ class hardware_device(Device, metaclass=AbstractDeviceMetas):
version_R = attribute(dtype=str, access=AttrWriteType.READ, fget=lambda self: get_version()) version_R = attribute(dtype=str, access=AttrWriteType.READ, fget=lambda self: get_version())
# list of property names too be set first by set_defaults
first_default_settings = []
@classmethod @classmethod
def attr_list(cls): def attr_list(cls):
""" Return a list of all the attribute_wrapper members of this class. """ """ Return a list of all the attribute_wrapper members of this class. """
...@@ -207,6 +210,11 @@ class hardware_device(Device, metaclass=AbstractDeviceMetas): ...@@ -207,6 +210,11 @@ class hardware_device(Device, metaclass=AbstractDeviceMetas):
A hardware point XXX is set to the value of the object member named XXX_default, if it exists. A hardware point XXX is set to the value of the object member named XXX_default, if it exists.
XXX_default can be f.e. a constant, or a device_property. XXX_default can be f.e. a constant, or a device_property.
The points are set in the following order:
1) The python class property 'first_default_settings' is read, as an array of strings denoting property names. Each property
is set in that order.
2) Any remaining default properties are set.
""" """
# we cannot write directly to our attribute, as that would not # we cannot write directly to our attribute, as that would not
...@@ -215,11 +223,18 @@ class hardware_device(Device, metaclass=AbstractDeviceMetas): ...@@ -215,11 +223,18 @@ class hardware_device(Device, metaclass=AbstractDeviceMetas):
# obtain a proxy to myself, to write values # obtain a proxy to myself, to write values
proxy = DeviceProxy(self.get_name()) proxy = DeviceProxy(self.get_name())
# for all my members # collect all attributes for which defaults are provided
for name in dir(self): attributes_with_defaults = [name for name in dir(self)
attr = getattr(self, name) # collect all attribute members
# check if it's an attribute, and there is a default value available if isinstance(getattr(self, name), Attribute)
if isinstance(attr, Attribute) and hasattr(self, f"{name}_default"): # with a default set
and hasattr(self, f"{name}_default")]
# determine the order: first do the ones mentioned in default_settings_order
attributes_to_set = self.first_default_settings + [name for name in attributes_with_defaults if name not in self.first_default_settings]
# set them all
for name in attributes_to_set:
try: try:
default_value = getattr(self, f"{name}_default") default_value = getattr(self, f"{name}_default")
......
...@@ -40,6 +40,24 @@ class RECV(opcua_device): ...@@ -40,6 +40,24 @@ class RECV(opcua_device):
# Device Properties # Device Properties
# ----------------- # -----------------
Ant_mask_RW_default = device_property(
dtype='DevVarBooleanArray',
mandatory=False,
default_value=[[True] * 3] * 32
)
RCU_mask_RW_default = device_property(
dtype='DevVarBooleanArray',
mandatory=False,
default_value=[True] * 32
)
first_default_settings = [
# set the masks first, as those filter any subsequent settings
'Ant_mask_RW',
'RCU_mask_RW'
]
# ---------- # ----------
# Attributes # Attributes
# ---------- # ----------
......
...@@ -39,6 +39,12 @@ class SDP(opcua_device): ...@@ -39,6 +39,12 @@ class SDP(opcua_device):
# Device Properties # Device Properties
# ----------------- # -----------------
TR_fpga_mask_RW_default = device_property(
dtype='DevVarBooleanArray',
mandatory=False,
default_value=[True] * 16
)
FPGA_processing_enable_RW_default = device_property( FPGA_processing_enable_RW_default = device_property(
dtype='DevVarBooleanArray', dtype='DevVarBooleanArray',
mandatory=False, mandatory=False,
...@@ -62,6 +68,11 @@ class SDP(opcua_device): ...@@ -62,6 +68,11 @@ class SDP(opcua_device):
default_value=[[8192] * 12 * 512] * 16 default_value=[[8192] * 12 * 512] * 16
) )
first_default_settings = [
# set the masks first, as those filter any subsequent settings
'TR_fpga_mask_RW'
]
# ---------- # ----------
# Attributes # Attributes
# ---------- # ----------
......
...@@ -57,12 +57,29 @@ class SST(Statistics): ...@@ -57,12 +57,29 @@ class SST(Statistics):
mandatory=True mandatory=True
) )
FPGA_sst_offload_enable_RW_default = device_property(
dtype='DevVarBooleanArray',
mandatory=False,
default_value=[True] * 16
)
FPGA_sst_offload_weighted_subbands_RW_default = device_property( FPGA_sst_offload_weighted_subbands_RW_default = device_property(
dtype='DevVarBooleanArray', dtype='DevVarBooleanArray',
mandatory=False, mandatory=False,
default_value=[True] * 16 default_value=[True] * 16
) )
first_default_settings = [
'FPGA_sst_offload_hdr_eth_destination_mac_RW',
'FPGA_sst_offload_hdr_ip_destination_address_RW',
'FPGA_sst_offload_hdr_udp_destination_port_RW',
'FPGA_sst_offload_weighted_subbands_RW',
# enable only after the offloading is configured correctly
'FPGA_sst_offload_enable_RW'
]
# ---------- # ----------
# Attributes # Attributes
# ---------- # ----------
......
...@@ -72,6 +72,23 @@ class XST(Statistics): ...@@ -72,6 +72,23 @@ class XST(Statistics):
default_value=[[0,102,0,0,0,0,0,0]] * 16 default_value=[[0,102,0,0,0,0,0,0]] * 16
) )
FPGA_xst_offload_enable_RW_default = device_property(
dtype='DevVarBooleanArray',
mandatory=False,
default_value=[True] * 16
)
first_default_settings = [
'FPGA_xst_offload_hdr_eth_destination_mac_RW',
'FPGA_xst_offload_hdr_ip_destination_address_RW',
'FPGA_xst_offload_hdr_udp_destination_port_RW',
'FPGA_xst_subband_select_RW',
# enable only after the offloading is configured correctly
'FPGA_xst_offload_enable_RW'
]
# ---------- # ----------
# Attributes # Attributes
# ---------- # ----------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment