Tile Component Manager
This module implements component management for tiles.
- class TileComponentManager(simulation_mode, test_mode, logger, poll_rate, tile_id, station_id, tpm_ip, tpm_cpld_port, preadu_levels, static_time_delays, subrack_fqdn, subrack_tpm_id, preadu_present, communication_state_changed_callback, component_state_changed_callback, update_attribute_callback, _tile=None, event_serialiser=None, default_lock_timeout=0.4, poll_timeout=6.0, power_callback_timeout=6.0)
A component manager for a Tile (simulator or driver) and its power supply.
- __init__(simulation_mode, test_mode, logger, poll_rate, tile_id, station_id, tpm_ip, tpm_cpld_port, preadu_levels, static_time_delays, subrack_fqdn, subrack_tpm_id, preadu_present, communication_state_changed_callback, component_state_changed_callback, update_attribute_callback, _tile=None, event_serialiser=None, default_lock_timeout=0.4, poll_timeout=6.0, power_callback_timeout=6.0)
Initialise a new instance.
- Parameters:
simulation_mode (
SimulationMode) – the simulation mode of this component manager. If SimulationMode.TRUE, then this component manager will launch an internal TPM simulator and interact with it; if SimulationMode.FALSE, this component manager will attempt to connect with an external TPM at the configured IP address and port.test_mode (
TestMode) – the test mode of this component manager. This has no effect when the device is in SimulationMode.FALSE. But when the simulation mode is SimulationMode.TRUE, then this determines some properties of the simulator: if the test mode is TestMode.TEST, then the simulator will return static “canned” values that are easy to assert against during testing; if TestMode.NONE, the simulator will return dynamically changing values for attributes such as temperatures and voltages, making for a nice demo but not so easy to test against.logger (
Logger) – a logger for this object to usepoll_rate (
float) – the poll ratetile_id (
int) – the unique ID for the tilestation_id (
int) – the unique ID for the station to which this tile belongs.tpm_ip (
str) – the IP address of the tiletpm_cpld_port (
int) – the port at which the tile is accessed for controlpreadu_levels (
Optional[list[float]]) – preADU gain attenuation settings to apply for this TPM.static_time_delays (
list[float]) – Delays in nanoseconds to account for static delay missmatches.subrack_fqdn (
str) – FQDN of the subrack that controls power to this tilesubrack_tpm_id (
int) – This tile’s position in its subrackpreadu_present (
list[bool]) – A list representing if the PreAdu is attached.communication_state_changed_callback (
Callable[[CommunicationStatus],None]) – callback to be called when the status of the communications channel between the component manager and its component changesupdate_attribute_callback (
Callable[...,None]) – Callback to call when attribute is updated.component_state_changed_callback (
Callable[...,None]) – callback to be called when the component state changesevent_serialiser (
Optional[EventSerialiser]) – serialiser for events_tile (
Optional[TileSimulator]) – Optional tile to inject.default_lock_timeout (
float) – default timeout for hardware serialisation lock.poll_timeout (
float) – max time for a poll to wait on hardware serialisation lock before giving up.power_callback_timeout (
float) – max time for power callback to wait for hardware serialisation lock to determine if initialisation is required.
- property alarms: dict[str, Any]
Return the alarms status in the TPM.
- Returns:
alarms status in the TPM
- apply_calibration(load_time='')
Load the calibration coefficients at the specified time delay.
- apply_pointing_delays(load_time='')
Load the pointing delays at the specified time delay.
- Parameters:
load_time (
str) – switch time as ISO formatted time- Raises:
ValueError – invalid time
- Return type:
tuple[list[ResultCode],list[str]]- Returns:
Result code and message
- property arp_table: dict[int, list[int]] | None
Check that ARP table has been populated in for all used cores 40G interfaces.
Use cores 0 (fpga0) and 1(fpga1) and ARP ID 0 for beamformer, 1 for LMC 10G interfaces use cores 0,1 (fpga0) and 4,5 (fpga1) for beamforming, and 2, 6 for LMC with only one ARP.
- Returns:
list of core id and arp table populated
- beamformer_running_for_channels(channel_groups)
Check if the beamformer is running in a list of channel blocks.
- property board_temperature: float
Return the temperature of the TPM.
- Returns:
the temperature of the TPM
- property broadband_rfi_factor: float
Return the broadband RFI factor.
- Returns:
the broadband RFI factor
- property channeliser_truncation: list[int] | None
Read the value for the channeliser truncation.
- Returns:
value for the channeliser truncation
- property clock_present: NoReturn
Check if 10 MHz clock signal is present.
- Raises:
NotImplementedError – not implemented in ska-low-sps-tpm-api.
- configure_40g_core(core_id=0, arp_table_entry=0, source_mac=None, source_ip=None, source_port=None, destination_ip=None, destination_port=None, rx_port_filter=None, netmask=None, gateway_ip=None)
Configure the 40G code.
- configure_integrated_beam_data(integration_time=0.5, first_channel=0, last_channel=191)
Configure and start the transmission of integrated channel data.
Configure with the provided integration time, first channel and last channel. Data are sent continuously until the StopIntegratedData command is run.
- configure_integrated_channel_data(integration_time=0.5, first_channel=0, last_channel=511)
Configure and start the transmission of integrated channel data.
Configure with the provided integration time, first channel and last channel. Data are sent continuously until the StopIntegratedData command is run.
- configure_pattern_generator(stage, pattern, adders, start=False, shift=0, zero=0, ramp1=None, ramp2=None)
Configure the TPM pattern generator.
- Parameters:
stage (
str) – The stage in the signal chain where the pattern is injected. Options are: ‘jesd’ (output of ADCs), ‘channel’ (output of channelizer), or ‘beamf’ (output of tile beamformer) or ‘all’ for all stages.pattern (
list[int]) – The data pattern in time order. This must be a list of integers with a length between 1 and 1024. The pattern represents values in time order (not antennas or polarizations).adders (
list[int]) – A list of 32 integers that expands the pattern to cover 16 antennas and 2 polarizations in hardware. This list maps the pattern to the corresponding signals for the antennas and polarizations.start (
bool) – Boolean flag indicating whether to start the pattern immediately. If False, the pattern will need to be started manually later.shift (
int) – Optional bit shift (divides the pattern by 2^shift). This must not be used in the ‘beamf’ stage, where it is always overridden to 4. The default value is 0.zero (
int) – An integer (0-65535) used as a mask to disable the pattern on specific antennas and polarizations. The same mask is applied to both FPGAs, supporting up to 8 antennas and 2 polarizations. The default value is 0.ramp1 (
Optional[dict[str,int]]) – if defined a ramp will be applied for ramp1 after the pattern is set. A mandatory kwarg polarisation is used a configuration. This must be 0, 1 or -1 to use all stages.ramp2 (
Optional[dict[str,int]]) – if defined a ramp will be applied for ramp2 after the pattern is set. A mandatory kwarg polarisation is used a configuration. This must be 0, 1 or -1 to use all stages.
- Return type:
- configure_test_generator(frequency0, amplitude0, frequency1, amplitude1, amplitude_noise, pulse_code, amplitude_pulse, delays=None, load_time=None)
Test generator setting.
- Parameters:
frequency0 (
float) – Tone frequency in Hz of DDC 0amplitude0 (
float) – Tone peak amplitude, normalized to 31.875 ADC units, resolution 0.125 ADUfrequency1 (
float) – Tone frequency in Hz of DDC 1amplitude1 (
float) – Tone peak amplitude, normalized to 31.875 ADC units, resolution 0.125 ADUamplitude_noise (
float) – Amplitude of pseudorandom noise normalized to 26.03 ADC units, resolution 0.102 ADUpulse_code (
int) – Code for pulse frequency. Range 0 to 7: 16,12,8,6,4,3,2 times frame frequencyamplitude_pulse (
float) – pulse peak amplitude, normalized to 127.5 ADC units, resolution 0.5 ADUdelays (
Optional[list[float]]) – delays to load into the test generator, list of 32 floats.load_time (
Optional[str]) – Time to start the generator. in UTC ISO formatted string.
- Raises:
ValueError – invalid time specified
ValueError – if the tpm is value None.
- Return type:
- connect()
Check we can connect to the TPM.
- Raises:
ConnectionError – when unable to connect to TPM
- Return type:
- property csp_rounding: list[int]
Read the cached value for the final rounding in the CSP samples.
Need to be specfied only for the last tile :return: Final rounding for the CSP samples. Up to 384 values
- property csp_spead_format: str
Get CSP SPEAD format.
CSP format is: AAVS for the format used in AAVS2-AAVS3 system, using a reference Unix time specified in the header. SKA for the format defined in SPS-CBF ICD, based on TAI2000 epoch.
- Returns:
CSP Spead format. AAVS or SKA
- property current_tile_beamformer_frame: int
Return current tile beamformer frame, in units of 256 ADC frames.
- Returns:
current tile beamformer frame
- property data_router_discarded_packets: dict
Return the data router values.
- Returns:
The number of discarded packets
- disable_broadband_rfi_blanking(antennas)
Disable broadband RFI blanking for a list of antennas.
- download_firmware(argin, task_callback)
Submit the download_firmware slow task.
This method returns immediately after it is submitted for execution.
- Parameters:
- Return type:
tuple[list[ResultCode],list[str]]- Returns:
A tuple containing a result code and a unique id string to identify the command
- enable_broadband_rfi_blanking(antennas)
Enable broadband RFI blanking for a list of antennas.
- property firmware_available: List[dict[str, Any]]
Return the list of the firmware loaded in the system.
- Returns:
the firmware list
- property firmware_name: str
Return the name of the firmware that this TPM simulator is running.
- Returns:
firmware name
- property firmware_version: str
Return the name of the firmware that this TPM simulator is running.
- Returns:
firmware version (major.minor)
- property flagged_packets: dict
Return the total number of flagged packets by the TPM.
- Returns:
the total number of flagged packets by the TPM
- property formatted_fpga_reference_time: str
Return FPGA reference time in UTC format.
Reference time is set as part of start_observation. It represents the timestamp for the first frame
- Returns:
FPGA reference time
- property fpga1_temperature: float
Return the temperature of FPGA 1.
- Returns:
the temperature of FPGA 1
- property fpga2_temperature: float
Return the temperature of FPGA 2.
- Returns:
the temperature of FPGA 2
- property fpga_current_frame: int
Return the FPGA current frame counter.
- Returns:
the FPGA_1 current frame counter
- Raises:
ConnectionError – if communication with tile failed
- property fpga_frame_time: str
Return FPGA frame time in UTC format.
frame time is the timestamp for the current frame being processed. Value reported here refers to the ADC frames, but the total processing delay is < 1ms and thus irrelevant on the timescales of MCCS response time
- Returns:
FPGA reference time
- property fpga_reference_time: int
Return the FPGA reference time.
Required to map the FPGA timestamps, expressed in frames to UTC time
- Returns:
the FPGA_1 reference time, in Unix seconds
- property fpgas_time: list[int]
Return the FPGAs clock time.
Useful for detecting clock skew, propagation delays, contamination delays, etc.
- Returns:
the FPGAs clock time
- Raises:
ConnectionError – if communication with tile failed
- frame_from_utc_time(utc_time)
Return the frame from utc time.
- get_40g_configuration(core_id=-1, arp_table_entry=0)
Return a 40G configuration.
- get_40g_packet_counts()
Get 40G packet counts.
The return value depends on how many 40G cores are active. Typically, only one core is active.
Example:
# 0 cores active {} # 1 core active { 'FPGA0': { 'rx_received': 2921, 'rx_forwarded': 0, 'tx_transmitted': 6973024 } } # 2 cores active { 'FPGA0': { 'rx_received': 3881, 'rx_forwarded': 0, 'tx_transmitted': 7321460 }, 'FPGA1': { 'rx_received': 1, 'rx_forwarded': 0, 'tx_transmitted': 3122 } }
- Returns:
Packet counts per active 40G core. Returns an empty dictionary if no 40G cores are active.
- Return type:
- get_all_pointing_delays()
Read pointing delays from the TPM for all beams.
- Return type:
- Returns:
pointing delays for all beams as (8, 32) ndarray.
- get_current_warning_thresholds(current='')
Get the current warning thresholds.
- get_request()
Return the action/s to be taken in the next poll.
- Raises:
AssertionError – if the request provider is not initialised i.e has a None value.
- Return type:
- Returns:
request to be to be executed in the next poll.
- get_static_delays()
Read the cached value for the static delays, in sample.
- get_tpm_temperature_thresholds()
Return the temperature thresholds in firmware.
- get_voltage_warning_thresholds(voltage='')
Get the voltage warning thresholds.
- property global_reference_time: str | None
Return the Unix time used as global synchronization time.
- Returns:
Unix time used as global synchronization time
- initialise(task_callback=None, force_reprogramming=True)
Submit the initialise slow task.
This method returns immediately after it is submitted for polling.
- Parameters:
- Return type:
tuple[list[ResultCode],list[str]]- Returns:
A tuple containing a task status and a unique id string to identify the command
- initialise_beamformer(start_channel, nof_channels, is_first, is_last)
Initialise the beamformer.
- property is_beamformer_running: bool | None
Check if the beamformer is running.
- Returns:
True if the beamformer is running
- property is_programmed: bool
Return whether this TPM is programmed (i.e. firmware has been downloaded to it).
- Returns:
whether this TPM is programmed
- property is_station_beam_flagging_enabled: list
Return station beam data flagging state for each fpga.
- Returns:
a list of bool values corresponding to the fpgas
- load_calibration_coefficients(antenna, calibration_coefficients)
Load calibration coefficients.
These may include any rotation matrix (e.g. the parallactic angle), but do not include the geometric delay.
- load_calibration_coefficients_for_channels(start_channel, calibration_coefficients)
Load calibration coefficients for all antennas and a subset of channels.
These may include any rotation matrix (e.g. the parallactic angle), but do not include the geometric delay.
- load_pointing_delays(delay_array, beam_index)
Specify the delay in seconds and the delay rate in seconds/second.
The delay_array specifies the delay and delay rate for each antenna. beam_index specifies which beam is desired (range 0-7)
- max_broadband_rfi(antennas)
Read the maximum broadband RFI levels for a list of antennas.
- off(task_callback=None)
Tell the upstream power supply proxy to turn the tpm off.
- on(task_callback=None)
Tell the upstream power supply proxy to turn the tpm on.
- Parameters:
task_callback (
Optional[Callable]) – Update task state, defaults to None- Return type:
- Returns:
a result code and a unique_id or message.
- Raises:
AssertionError – request_provider is not yet initialised.
- property pending_data_requests: bool | None
Check for pending data requests.
- Returns:
whether there are pending send data requests
- poll(poll_request)
Poll request for TileComponentManager.
Execute a command or read some values.
- Parameters:
poll_request (
TileRequest|TileLRCRequest) – specification of the actions to be taken in this poll.- Return type:
- Returns:
responses to queries in this poll
- poll_failed(exception)
Handle a failed poll.
This is a hook called by the poller when an exception was raised.
NOTE: This implementation may be a bit simplistic as of MCCS-1507. The exception code can be used to give more information to user. And potentially inform the poll prioritisation.
- poll_succeeded(poll_response)
Handle the receipt of new polling values.
This is a hook called by the poller when values have been read during a poll.
- Parameters:
poll_response (
TileResponse) – response to the pool, including any values read.- Return type:
- property pps_delay: int | None
Return the pps delay from the TPM.
- Returns:
the pps_delay from the TPM.
- property pps_present: bool
Check if PPS signal is present.
- Returns:
True if PPS is present. Checked in poll loop, cached
- read_address(address, nvalues)
Return a list of values from a given address.
- read_all_live_calibration_coefficients()
Read all live calibration coefficients from the TPM.
- read_all_staged_calibration_coefficients()
Read all staged calibration coefficients from the TPM.
- read_broadband_rfi(antennas)
Read the broadband RFI levels for a list of antennas.
- read_firmware_thresholds()
Read all thresholds from firmware and save in cache.
- Return type:
- Returns:
the firmwareThesholds.
- read_register(register_name)
Read the values in a named register.
- Parameters:
register_name (
str) – name of the register- Return type:
- Returns:
values read from the register
- Raises:
ValueError – if the tpm is value None.
- reevaluate_tpm_status()
Reevaluate the TpmStatus.
NOTE: This method should not be needed. But can be used as a sanity check on the TileProgrammingState
- Return type:
- Returns:
True is the re-evaluated TpmStatus differs from the automated evaluation.
- property register_list: list[str]
Return a list of registers available on each device.
- Returns:
list of registers
- Raises:
ValueError – if the tpm is value None.
- property rfi_blanking_enabled_antennas: list[int]
Return the list of antennas with RFI blanking enabled.
- Returns:
list of antennas with RFI blanking enabled
- property running_beams: list[bool]
List hardware beams currently running.
- Returns:
list of hardware beam running states
- send_data_samples(data_type='', start_time=None, seconds=0.2, n_samples=1024, sync=False, first_channel=0, last_channel=511, channel_id=128, frequency=100.0, round_bits=3, **params)
Front end for send_xxx_data methods.
- Parameters:
data_type (
str) – sample type. “raw”, “channel”, “channel_continuous”, “narrowband”, “beam”start_time (
Optional[str]) – UTC Time for start sending data. Default start nowseconds (
float) – Delay if timestamp is not specified. Default 0.2 secondsn_samples (
int) – number of samples to send per packetsync (
bool) – (raw) send synchronised antenna samples, vs. round robinfirst_channel (
int) – (channel) first channel to send, default 0last_channel (
int) – (channel) last channel to send, default 511channel_id (
int) – (channel_continuous) channel to sendfrequency (
float) – (narrowband) Sky frequency for band centre, in Hzround_bits (
int) – (narrowband) how many bits to roundparams (
Any) – any additional keyword arguments
- Raises:
ValueError – error in time specification
- Return type:
- set_beamformer_regions(regions)
Set the frequency regions to be beamformed into a single beam.
The input list contains up to 48 blocks which represent at most 16 contiguous channel regions. Each block has 8 entries which represent: - starting physical channel - number of channels - hardware beam number - subarray ID - subarray logical channel - subarray beam ID - substation ID
- Parameters:
regions (
list[list[int]]) – a list encoding up to 48 regions- Raises:
ValueError – if the tpm is value None.
- Return type:
tuple[list[ResultCode],list[str]]- Returns:
Result code and message
- set_broadband_rfi_factor(factor)
Set the broadband RFI factor.
- set_csp_download(src_port, dst_ip_1, dst_ip_2, dst_port, is_last, netmask, gateway)
Set CSP Destination per tile.
- Parameters:
- Return type:
tuple[list[ResultCode],list[str]]- Returns:
Result code and message for information.
- set_current_warning_thresholds(current, min_thr, max_thr)
Set the current warning thresholds.
- Parameters:
- Return type:
- Returns:
The set current thresholds if successful else None
- set_lmc_download(mode, payload_length=1024, dst_ip='10.0.10.1', src_port=61648, dst_port=4660, netmask_40g=None, gateway_40g=None)
Specify whether control data will be transmitted over 1G or 40G networks.
- Parameters:
mode (
str) – “1G” or “10G”payload_length (
int) – SPEAD payload length for integrated channel data, defaults to 1024dst_ip (
str) – destination IP, defaults to “10.0.10.1”dst_port (
Optional[int]) – destination port, defaults to 4660gateway_40g (
Optional[str]) – IP address of the 40g subnet gateway, if it exists.
- Return type:
tuple[list[ResultCode],list[str]]- Returns:
Result code and message
- set_lmc_integrated_download(mode, channel_payload_length, beam_payload_length, dst_ip='10.0.10.1', src_port=61648, dst_port=4660, netmask_40g=None, gateway_40g=None)
Configure link and size of control data.
- Parameters:
mode (
str) – ‘1G’ or ‘10G’channel_payload_length (
int) – SPEAD payload length for integrated channel databeam_payload_length (
int) – SPEAD payload length for integrated beam datadst_ip (
str) – Destination IP, defaults to “10.0.10.1”src_port (
int) – source port, defaults to 0xF0D0dst_port (
int) – destination port, defaults to 4660gateway_40g (
Optional[str]) – IP address of the 40g subnet gateway, if it exists.
- Return type:
- set_phase_terminal_count(value)
Set the phase terminal count.
- set_pps_delay_correction(correction)
Set the ppsDelay correction.
- set_preadu_levels(levels)
Set preadu levels in dB.
- Parameters:
levels (
ndarray) – Preadu attenuation levels in dB- Raises:
ValueError – When attempting to set preaduLevels with a list of length not equal to 32 (i.e 32 ADC channels).
HardwareVerificationError – When the readback from hardware is unexpected.
- Return type:
- set_static_delays(delays)
Set the static delays.
- set_station_id(value)
Set Station ID.
- set_tpm_temperature_thresholds(max_board_alarm_threshold=None, max_fpga1_alarm_threshold=None, max_fpga2_alarm_threshold=None)
Set the temperature thresholds.
NOTE: Warning this method can configure the shutdown temperature of components and must be used with care. This method is capped to a maximum of 50 (unit: Degree Celsius). And is ONLY supported in tpm1_6.
- Parameters:
max_board_alarm_threshold (
Optional[float]) – The maximum alarm thresholds for the board (unit: Degree Celsius)max_fpga1_alarm_threshold (
Optional[float]) – The maximum alarm thresholds for the fpga1 (unit: Degree Celsius)max_fpga2_alarm_threshold (
Optional[float]) – The maximum alarm thresholds for the fpga2 (unit: Degree Celsius)
- Return type:
- Returns:
The set temperature thresholds if successful else None
- set_voltage_warning_thresholds(voltage, min_thr, max_thr)
Set the voltage warning thresholds.
- Parameters:
- Return type:
- Returns:
The set voltage thresholds if successful else None
- start_acquisition(task_callback=None, start_time=None, delay=2, global_reference_time=None)
Submit the start_acquisition slow task.
- Parameters:
- Return type:
tuple[list[ResultCode],list[str]]- Returns:
A tuple containing a result code and a unique id string to identify the command
- start_beamformer(task_callback=None, start_time=None, duration=-1, channel_groups=None, scan_id=0)
Start beamforming on a specific subset of the beamformed channels.
Current firmware version does not support channel mask and scan ID, these are ignored
- Parameters:
task_callback (
Optional[Callable]) – Update task state, defaults to Nonestart_time (
Optional[str]) – Start time as ISO formatted timeduration (
int) – Scan duration, in frames, default “forever”channel_groups (
Optional[list[int]]) – Channel groups to be started Command affects only beamformed channels for given groups Default: all channelsscan_id (
int) – ID of the scan to be started. Default 0
- Raises:
ValueError – invalid time specified
- Return type:
tuple[list[ResultCode],list[str]]- Returns:
A tuple containing a task status and a unique id string to identify the command
- start_pattern_generator(stage)
Start the pattern generator.
- stop_beamformer(task_callback=None, channel_groups=None)
Stop the beamformer.
- Parameters:
- Return type:
tuple[list[ResultCode],list[str]]- Returns:
A tuple containing a result code and a unique id string to
- stop_data_transmission()
Stop data transmission for send_channelised_data_continuous.
- Return type:
tuple[list[ResultCode],list[str]]- Returns:
Result code and message
- stop_integrated_data()
Stop the integrated data.
- Return type:
tuple[list[ResultCode],list[str]]- Returns:
Result code and message
- stop_pattern_generator(stage)
Stop the pattern generator.
- property sysref_present: NoReturn
Check if SYSREF signal is present.
- Raises:
NotImplementedError – not implemented in ska-low-sps-tpm-api.
- property test_generator_active: bool
Check if the test generator is active.
- Returns:
whether the test generator is active
- test_generator_input_select(inputs=0)
Specify ADC inputs which are substitute to test signal.
Specified using a 32 bit mask, with LSB for ADC input 0.
- tile_info()
Return information about the tile.
- update_fault_state(poll_success, exception_code=None)
Update fault state.
This method will evaluate if the current state if faulty. Depending on the previous fault state we will update the fault_state to allow navigation of the Opstate machine
NOTE: As evaluation becomes more complex we may want to refactor this method into a class. Currently this is a very simple evaluation, only checking for an inconsistent state.
- property voltage_mon: float
Return the internal 5V supply of the TPM.
- Returns:
the internal 5V supply of the TPM
- write_address(address, values)
Write a list of values to a given address.