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

Merge branch 'master' into L2SS-641-add-defaults-to-beamweights-xy-yx

parents 67446576 1bb8b8c2
No related branches found
No related tags found
1 merge request!284Resolve L2SS-641 "Add defaults to beamweights xy yx"
{
"servers": {
"APSCT": {
"STAT": {
"APSCT": {
"STAT/APSCT/1": {
"properties": {
"OPC_Server_Name": [
"apsct-sim"
],
"OPC_Server_Port": [
"4843"
],
"OPC_Time_Out": [
"5.0"
]
}
}
}
}
},
"APSPU": {
"STAT": {
"APSPU": {
"STAT/APSPU/1": {
"properties": {
"OPC_Server_Name": [
"apspu-sim"
],
"OPC_Server_Port": [
"4843"
],
"OPC_Time_Out": [
"5.0"
]
}
}
}
}
},
"RECV": {
"STAT": {
"RECV": {
"STAT/RECV/1": {
"properties": {
"OPC_Server_Name": [
"recv-sim"
],
"OPC_Server_Port": [
"4840"
],
"OPC_Time_Out": [
"5.0"
]
}
}
}
}
},
"SDP": {
"STAT": {
"SDP": {
"STAT/SDP/1": {
"properties": {
"OPC_Server_Name": [
"sdptr-sim"
],
"OPC_Server_Port": [
"4840"
],
"OPC_Time_Out": [
"5.0"
],
"FPGA_sdp_info_station_id_RW_default": [
"901",
"901",
"901",
"901",
"901",
"901",
"901",
"901",
"901",
"901",
"901",
"901",
"901",
"901",
"901",
"901"
],
"polled_attr": [
"fpga_temp_r",
"1000",
"state",
"1000",
"status",
"1000",
"fpga_mask_rw",
"1000",
"fpga_scrap_r",
"1000",
"fpga_scrap_rw",
"1000",
"fpga_status_r",
"1000",
"fpga_version_r",
"1000",
"fpga_weights_r",
"1000",
"fpga_weights_rw",
"1000",
"tr_busy_r",
"1000",
"tr_reload_rw",
"1000",
"tr_tod_r",
"1000",
"tr_uptime_r",
"1000"
]
}
}
}
}
},
"SST": {
"STAT": {
"SST": {
"STAT/SST/1": {
"properties": {
"Statistics_Client_UDP_Port": [
"5001"
],
"Statistics_Client_TCP_Port": [
"5101"
],
"OPC_Server_Name": [
"sdptr-sim"
],
"OPC_Server_Port": [
"4840"
],
"OPC_Time_Out": [
"5.0"
],
"FPGA_sst_offload_hdr_eth_destination_mac_RW_default": [
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd"
],
"FPGA_sst_offload_hdr_ip_destination_address_RW_default": [
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250"
],
"FPGA_sst_offload_hdr_udp_destination_port_RW_default": [
"5001",
"5001",
"5001",
"5001",
"5001",
"5001",
"5001",
"5001",
"5001",
"5001",
"5001",
"5001",
"5001",
"5001",
"5001",
"5001"
]
}
}
}
}
},
"XST": {
"STAT": {
"XST": {
"STAT/XST/1": {
"properties": {
"Statistics_Client_UDP_Port": [
"5002"
],
"Statistics_Client_TCP_Port": [
"5102"
],
"OPC_Server_Name": [
"sdptr-sim"
],
"OPC_Server_Port": [
"4840"
],
"OPC_Time_Out": [
"5.0"
],
"FPGA_xst_offload_hdr_eth_destination_mac_RW_default": [
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd",
"6c:2b:59:97:be:dd"
],
"FPGA_xst_offload_hdr_ip_destination_address_RW_default": [
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250",
"10.99.250.250"
],
"FPGA_xst_offload_hdr_udp_destination_port_RW_default": [
"5002",
"5002",
"5002",
"5002",
"5002",
"5002",
"5002",
"5002",
"5002",
"5002",
"5002",
"5002",
"5002",
"5002",
"5002",
"5002"
]
}
}
}
}
},
"UNB2": {
"STAT": {
"UNB2": {
"STAT/UNB2/1": {
"properties": {
"OPC_Server_Name": [
"unb2-sim"
],
"OPC_Server_Port": [
"4841"
],
"OPC_Time_Out": [
"5.0"
]
}
}
}
}
}
}
}
This diff is collapsed.
......@@ -52,3 +52,9 @@ make up integration-test
# Run the default integration tests
make run integration-test default
# Configure integration test for recv_cluster module
bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/integrations/recvcluster_ConfigDb.json
make restart device-recv device-tilebeam
sleep 5
make run integration-test recv_cluster
......@@ -228,15 +228,19 @@ class lofar_device(Device, metaclass=DeviceMeta):
# functions that can or must be overloaded
def configure_for_fault(self):
"""Overloadable function called in Fault after state is set to FAULT"""
pass
def configure_for_off(self):
"""Overloadable function called in Off after state is set to OFF"""
pass
def configure_for_on(self):
"""Overloadable function called in On BEFORE state is set to ON"""
pass
def configure_for_initialise(self):
"""Overloadable function called in initialise with state INIT, STANDBY after call"""
pass
def always_executed_hook(self):
......
......@@ -11,9 +11,10 @@ import numpy
import datetime
from json import loads
from tango.server import attribute, command, device_property
from tango import AttrWriteType, DebugIt, DevState, DeviceProxy, DevVarStringArray, DevVarDoubleArray, DevString, DevSource
from threading import Thread, Lock, Condition
from tango import AttrWriteType, DebugIt, DevState, DeviceProxy, DevVarStringArray, DevVarDoubleArray, DevString, DevSource
from tango.server import attribute, command, device_property
from tango import Util
# Additional import
from tangostationcontrol.common.entrypoint import entry
......@@ -106,8 +107,11 @@ class TileBeam(lofar_device):
# Initialise tracking control
self._hbat_tracking_enabled_rw = True
# Set a reference of RECV device
self.recv_proxy = DeviceProxy("STAT/RECV/1")
# Set a reference of RECV device that is correlated to this BEAM device
util = Util.instance()
instance_number = self.get_name().split('/')[2]
self.recv_proxy = DeviceProxy(
f"{util.get_ds_inst_name()}/RECV/{instance_number}")
self.recv_proxy.set_source(DevSource.DEV)
# Retrieve positions from RECV device
......@@ -254,7 +258,7 @@ class TileBeam(lofar_device):
@command(dtype_in=DevVarStringArray, dtype_out=DevVarDoubleArray)
@DebugIt()
@log_exceptions()
@only_in_states([DevState.ON])
@only_in_states([DevState.ON, DevState.STANDBY])
def HBAT_delays(self, pointing_direction: numpy.array, timestamp: datetime.datetime = None):
"""
Calculate the delays (in seconds) based on the pointing list and the timestamp
......@@ -275,7 +279,7 @@ class TileBeam(lofar_device):
@command(dtype_in=DevVarStringArray)
@DebugIt()
@log_exceptions()
@only_in_states([DevState.ON])
@only_in_states([DevState.ON, DevState.STANDBY])
def HBAT_set_pointing(self, pointing_direction: list, timestamp: datetime.datetime = None):
"""
Uploads beam weights based on a given pointing direction 2D array (96 tiles x 3 parameters)
......@@ -293,7 +297,7 @@ class TileBeam(lofar_device):
@command(dtype_in = DevString)
@DebugIt()
@only_in_states([DevState.ON])
@only_in_states([DevState.ON, DevState.STANDBY])
def HBAT_set_pointing_for_specific_time(self, parameters: DevString = None):
"""
Uploads beam weights based on a given pointing direction 2D array (96 tiles x 3 parameters)
......@@ -361,9 +365,9 @@ class BeamTracker():
""" Force the pointing to be updated. """
self.stale_pointing = True
self.unlock_thread()
self.notify_thread()
def unlock_thread(self):
def notify_thread(self):
# inform the thread to stop waiting
with self.update_lock:
self.update_condition.notify()
......
......@@ -67,6 +67,7 @@ class TestDeviceTileBeam(AbstractTestBases.TestDeviceBase):
# Verify writing operation does not lead to errors
self.proxy.HBAT_set_pointing(self.pointing_direction) # write values to RECV
HBAT_delays_r2 = numpy.array(recv_proxy.read_attribute('HBAT_BF_delay_steps_RW').value)
self.assertIsNotNone(HBAT_delays_r2)
# Verify delays changed (to be discussed)
......
# -*- coding: utf-8 -*-
#
# This file is part of the LOFAR 2.0 Station Software
#
#
#
# Distributed under the terms of the APACHE license.
# See LICENSE.txt for more info.
import logging
from tangostationcontrol.integration_test import base
logger = logging.getLogger()
class TestDemo(base.IntegrationTestCase):
""" This test will not be run until L2SS-484 is merged.
It serves as a trivial example of test exclusion since the unit tests pass
even though assertTrue(False) can trivially be determined to never succeed.
"""
def setUp(self):
super(TestDemo, self).setUp()
def test_fail(self):
self.assertTrue(False)
# -*- coding: utf-8 -*-
#
# This file is part of the LOFAR 2.0 Station Software
#
#
#
# Distributed under the terms of the APACHE license.
# See LICENSE.txt for more info.
import time
import numpy
import logging
import statistics
from tango import DevState
from tangostationcontrol.integration_test import base
from tangostationcontrol.integration_test.device_proxy import TestDeviceProxy
logger = logging.getLogger()
class TestRecvCluster(base.IntegrationTestCase):
pointing_direction = numpy.array([["J2000", "0deg", "0deg"]] * 96).flatten()
def setUp(self):
super(TestRecvCluster, self).setUp()
def test_recv_cluster_performance(self):
beam_proxies = []
recv_proxies = []
# Beam / Recv 1,2,3,4
for i in range(1, 5):
recv_proxies.append(TestDeviceProxy(f"STAT/RECV/{i}"))
beam_proxies.append(TestDeviceProxy(f"STAT/TileBeam/{i}"))
# Recv devices must be ready before TileBeam
for proxy in recv_proxies:
proxy.off()
self.assertTrue(proxy.state() is DevState.OFF)
proxy.initialise()
self.assertTrue(proxy.state() is DevState.STANDBY)
proxy.set_defaults()
proxy.on()
self.assertTrue(proxy.state() is DevState.ON)
for proxy in beam_proxies:
proxy.off()
self.assertTrue(proxy.state() is DevState.OFF)
proxy.initialise()
self.assertTrue(proxy.state() is DevState.STANDBY)
proxy.on()
self.assertTrue(proxy.state() is DevState.ON)
results = []
for _i in range(25):
start_time = time.monotonic_ns()
for proxy in beam_proxies:
proxy.HBAT_set_pointing(self.pointing_direction)
stop_time = time.monotonic_ns()
results.append(stop_time - start_time)
logging.error(f"Median {statistics.median(results) / 1.e9} Stdev "
f"{statistics.stdev(results) / 1.e9}")
......@@ -31,7 +31,7 @@ commands = {envpython} -m stestr run {posargs}
passenv = TANGO_HOST
setenv = TESTS_DIR=./tangostationcontrol/integration_test/{posargs}
commands =
{envpython} -m stestr run --serial
{envpython} -m stestr run --serial {posargs}
[testenv:cover]
; stestr does not natively support generating coverage reports use
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment