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

L2SS-1501: Fixes from busy day 2012-09-07

parent 213bc9d5
No related branches found
No related tags found
1 merge request!724L2SS-1501: Fixes from busy day 2012-09-07
...@@ -501,6 +501,9 @@ ...@@ -501,6 +501,9 @@
], ],
"OPC_Time_Out": [ "OPC_Time_Out": [
"5.0" "5.0"
],
"Firmware_Boot_timeout": [
"1.0"
] ]
} }
}, },
...@@ -514,6 +517,9 @@ ...@@ -514,6 +517,9 @@
], ],
"OPC_Time_Out": [ "OPC_Time_Out": [
"5.0" "5.0"
],
"Firmware_Boot_timeout": [
"1.0"
] ]
} }
}, },
...@@ -527,6 +533,9 @@ ...@@ -527,6 +533,9 @@
], ],
"OPC_Time_Out": [ "OPC_Time_Out": [
"5.0" "5.0"
],
"Firmware_Boot_timeout": [
"1.0"
] ]
} }
} }
......
...@@ -84,7 +84,7 @@ N_point_prop = 3 ...@@ -84,7 +84,7 @@ N_point_prop = 3
N_latlong = 2 N_latlong = 2
# default subband we use because of its low RFI # default subband we use because of its low RFI
DEFAULT_SUBBAND = 102 DEFAULT_SUBBAND = 300
# Maximum array size to allocate for beam_device pointings, # Maximum array size to allocate for beam_device pointings,
MAX_POINTINGS = N_beamlets_max MAX_POINTINGS = N_beamlets_max
......
...@@ -1083,8 +1083,12 @@ class AntennaField(LOFARDevice): ...@@ -1083,8 +1083,12 @@ class AntennaField(LOFARDevice):
# Enable controlling all antennas # Enable controlling all antennas
self.proxy.write_attribute("ANT_mask_RW", [True] * len(ANT_mask_RW)) self.proxy.write_attribute("ANT_mask_RW", [True] * len(ANT_mask_RW))
try:
# Turn off power to all antennas # Turn off power to all antennas
self.proxy.write_attribute("RCU_PWR_ANT_on_RW", [True] * len(ANT_mask_RW)) self.proxy.write_attribute("RCU_PWR_ANT_on_RW", [False] * len(ANT_mask_RW))
finally:
# Restore original mask
self.proxy.write_attribute("ANT_mask_RW", ANT_mask_RW)
# -------- # --------
# Commands # Commands
......
...@@ -198,11 +198,7 @@ class APSCT(OPCUADevice): ...@@ -198,11 +198,7 @@ class APSCT(OPCUADevice):
def _power_hardware_on(self): def _power_hardware_on(self):
"""Turns on the 200MHz clock.""" """Turns on the 200MHz clock."""
# Cycle clock # Turn on 200 MHz clock
self.APSCT_off()
self.wait_attribute(
"APSCTTR_translator_busy_R", False, self.APSCT_On_Off_timeout
)
self.APSCT_200MHz_on() self.APSCT_200MHz_on()
self.wait_attribute( self.wait_attribute(
"APSCTTR_translator_busy_R", False, self.APSCT_On_Off_timeout "APSCTTR_translator_busy_R", False, self.APSCT_On_Off_timeout
...@@ -242,6 +238,11 @@ class APSCT(OPCUADevice): ...@@ -242,6 +238,11 @@ class APSCT(OPCUADevice):
@only_in_states(DEFAULT_COMMAND_STATES) @only_in_states(DEFAULT_COMMAND_STATES)
def APSCT_off(self): def APSCT_off(self):
""" """
Turn off the clock.
Warning: This stops the user image in SDP, making
it unresponsive. The factory image is
not affected.
:return:None :return:None
""" """
...@@ -252,6 +253,7 @@ class APSCT(OPCUADevice): ...@@ -252,6 +253,7 @@ class APSCT(OPCUADevice):
@only_in_states(DEFAULT_COMMAND_STATES) @only_in_states(DEFAULT_COMMAND_STATES)
def APSCT_200MHz_on(self): def APSCT_200MHz_on(self):
""" """
Set the clock to 200 MHz.
:return:None :return:None
""" """
......
...@@ -163,7 +163,7 @@ class AbstractHierarchyDevice: ...@@ -163,7 +163,7 @@ class AbstractHierarchyDevice:
""" """
if not self._proxies.get(device): if not self._proxies.get(device):
self._proxies[device] = create_device_proxy(device, 30000) self._proxies[device] = create_device_proxy(device, 60_000)
return self._proxies[device] return self._proxies[device]
......
...@@ -17,7 +17,6 @@ from attribute_wrapper.attribute_wrapper import AttributeWrapper ...@@ -17,7 +17,6 @@ from attribute_wrapper.attribute_wrapper import AttributeWrapper
from tango import ( from tango import (
AttrDataFormat, AttrDataFormat,
Attribute, Attribute,
AttrWriteType,
DebugIt, DebugIt,
DeviceProxy, DeviceProxy,
DevState, DevState,
...@@ -88,12 +87,24 @@ class LOFARDevice(Device): ...@@ -88,12 +87,24 @@ class LOFARDevice(Device):
# ---------- # ----------
version_R = attribute( version_R = attribute(
dtype=str, access=AttrWriteType.READ, fget=lambda self: version doc="Version of this software device", dtype=str, fget=lambda self: version
)
uptime_R = attribute(
doc="How long this software device has been running (wall-clock time, in seconds)",
unit="s",
dtype=numpy.int64,
fget=lambda self: numpy.int64(time.time() - self._device_start_time),
)
access_count_R = attribute(
doc="How often this software device was accessed for commands or attributes",
dtype=numpy.int64,
fget=lambda self: numpy.int64(self._access_count),
) )
hardware_powered_R = attribute( hardware_powered_R = attribute(
dtype=bool, dtype=bool,
access=AttrWriteType.READ,
fget=lambda self: self._read_hardware_powered_R(), fget=lambda self: self._read_hardware_powered_R(),
) )
...@@ -229,6 +240,15 @@ class LOFARDevice(Device): ...@@ -229,6 +240,15 @@ class LOFARDevice(Device):
elif not mask[idx]: elif not mask[idx]:
merge_values[idx] = current_values[idx] merge_values[idx] = current_values[idx]
def __init__(self, cl, name):
super().__init__(cl, name)
# record how many time this device was accessed
self._access_count = 0
# record when this device was started
self._device_start_time = time.time()
def _init_device(self): def _init_device(self):
logger.debug("[LOFARDevice] init_device") logger.debug("[LOFARDevice] init_device")
...@@ -424,8 +444,10 @@ class LOFARDevice(Device): ...@@ -424,8 +444,10 @@ class LOFARDevice(Device):
pass pass
def always_executed_hook(self): def always_executed_hook(self):
"""Method always executed before any TANGO command is executed.""" """Method always executed before any TANGO command is executed or attribute is accessed."""
pass
# increase the number of accesses
self._access_count += 1
def _read_hardware_powered_R(self): def _read_hardware_powered_R(self):
"""Overloadable function called in read attribute hardware_powered_R""" """Overloadable function called in read attribute hardware_powered_R"""
...@@ -519,6 +541,7 @@ class LOFARDevice(Device): ...@@ -519,6 +541,7 @@ class LOFARDevice(Device):
self._set_defaults_for(self.TRANSLATOR_DEFAULT_SETTINGS) self._set_defaults_for(self.TRANSLATOR_DEFAULT_SETTINGS)
@only_in_states(INITIALISED_STATES)
@command() @command()
@DebugIt() @DebugIt()
@log_exceptions() @log_exceptions()
...@@ -529,7 +552,6 @@ class LOFARDevice(Device): ...@@ -529,7 +552,6 @@ class LOFARDevice(Device):
self._power_hardware_on() self._power_hardware_on()
@only_in_states(INITIALISED_STATES) @only_in_states(INITIALISED_STATES)
@fault_on_error()
@command() @command()
@DebugIt() @DebugIt()
@log_exceptions() @log_exceptions()
......
...@@ -49,6 +49,15 @@ class SDPFirmware(OPCUADevice): ...@@ -49,6 +49,15 @@ class SDPFirmware(OPCUADevice):
dtype="DevULong", mandatory=False, default_value=CLK_200_MHZ dtype="DevULong", mandatory=False, default_value=CLK_200_MHZ
) )
# ----- Timing values
Firmware_Boot_timeout = device_property(
doc="Maximum amount of time to wait for FPGAs to boot.",
dtype="DevFloat",
mandatory=False,
default_value=60.0,
)
TRANSLATOR_DEFAULT_SETTINGS = ["TR_fpga_mask_RW"] TRANSLATOR_DEFAULT_SETTINGS = ["TR_fpga_mask_RW"]
# ---------- # ----------
...@@ -264,16 +273,24 @@ class SDPFirmware(OPCUADevice): ...@@ -264,16 +273,24 @@ class SDPFirmware(OPCUADevice):
def _boot_to_image(self, image_nr): def _boot_to_image(self, image_nr):
# FPGAs that are actually reachable and we care about # FPGAs that are actually reachable and we care about
wait_for = ~( wait_for = self.read_attribute("TR_fpga_mask_R")
self.read_attribute("TR_fpga_communication_error_R")
) & self.read_attribute("TR_fpga_mask_R") # Wait for the current image to be booted (in case we connected to SDPTR before even the current
# image finished booting).
self.wait_attribute(
"TR_fpga_communication_error_R",
lambda attr: (~attr | ~wait_for).all(),
self.Firmware_Boot_timeout,
)
# Order the correct firmare to be loaded # Order the correct firmare to be loaded
self.proxy.FPGA_boot_image_RW = [image_nr] * N_pn self.proxy.FPGA_boot_image_RW = [image_nr] * N_pn
# Wait for the firmware to be loaded (ignoring masked out elements) # Wait for the firmware to be loaded (ignoring masked out elements)
self.wait_attribute( self.wait_attribute(
"FPGA_boot_image_R", lambda attr: ((attr == 1) | ~wait_for).all(), 60 "FPGA_boot_image_R",
lambda attr: ((attr == image_nr) | ~wait_for).all(),
self.Firmware_Boot_timeout,
) )
def _power_hardware_on(self): def _power_hardware_on(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment