Tile Component Manager

This module implements component management for tiles.

class TileComponentManager(simulation_mode, test_mode, logger, max_workers, tile_id, station_id, tpm_ip, tpm_cpld_port, tpm_version, subrack_fqdn, subrack_tpm_id, communication_state_changed_callback, component_state_changed_callback, _tpm_driver=None)

A component manager for a TPM (simulator or driver) and its power supply.

__init__(simulation_mode, test_mode, logger, max_workers, tile_id, station_id, tpm_ip, tpm_cpld_port, tpm_version, subrack_fqdn, subrack_tpm_id, communication_state_changed_callback, component_state_changed_callback, _tpm_driver=None)

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 use

  • max_workers (int) – nos. of worker threads

  • tile_id (int) – the unique ID for the tile

  • station_id (int) – the unique ID for the station to which this tile belongs.

  • tpm_ip (str) – the IP address of the tile

  • tpm_cpld_port (int) – the port at which the tile is accessed for control

  • tpm_version (str) – TPM version: “tpm_v1_2” or “tpm_v1_6”

  • subrack_fqdn (str) – FQDN of the subrack that controls power to this tile

  • subrack_tpm_id (int) – This tile’s position in its subrack

  • 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 changes

  • component_state_changed_callback (Callable[..., None]) – callback to be called when the component state changes

  • _tpm_driver (Optional[TpmDriver]) – a optional TpmDriver to inject for testing.

apply_calibration(load_time='')

Load the calibration coefficients at the specified time delay.

Parameters:

load_time (str) – switch time as ISO formatted time

Raises:

ValueError – invalid time

Return type:

None

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:

None

configure_test_generator(frequency0, amplitude0, frequency1, amplitude1, amplitude_noise, pulse_code, amplitude_pulse, load_time=None)

Test generator setting.

Parameters:
  • frequency0 (float) – Tone frequency in Hz of DDC 0

  • amplitude0 (float) – Tone peak amplitude, normalized to 31.875 ADC units, resolution 0.125 ADU

  • frequency1 (float) – Tone frequency in Hz of DDC 1

  • amplitude1 (float) – Tone peak amplitude, normalized to 31.875 ADC units, resolution 0.125 ADU

  • amplitude_noise (float) – Amplitude of pseudorandom noise normalized to 26.03 ADC units, resolution 0.102 ADU

  • pulse_code (int) – Code for pulse frequency. Range 0 to 7: 16,12,8,6,4,3,2 times frame frequency

  • amplitude_pulse (float) – pulse peak amplitude, normalized to 127.5 ADC units, resolution 0.5 ADU

  • load_time (Optional[str]) – Time to start the generator. in UTC ISO formatted string.

Raises:

ValueError – invalid time specified

Return type:

None

download_firmware(argin, task_callback=None)

Submit the download_firmware slow task.

This method returns immediately after it is submitted for execution.

Parameters:
  • argin (str) – can either be the design name returned from GetFirmwareAvailable command, or a path to a file

  • task_callback (Optional[Callable]) – Update task state, defaults to None

Return type:

tuple[TaskStatus, str]

Returns:

A tuple containing a task status and a unique id string to identify the command

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: 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 fpga_time: str

Return FPGA internal time in UTC format.

Returns:

FPGA internal time

property fpgas_unix_time: list[int]

Return FPGA internal Unix time.

Used to check proper synchronization :return: list of two Unix time integers

initialise(task_callback=None, program_fpga=True)

Submit the initialise slow task.

This method returns immediately after it is submitted for execution.

Parameters:
  • task_callback (Optional[Callable]) – Update task state, defaults to None

  • program_fpga (bool) – Force FPGA reprogramming, for complete initialisation

Return type:

tuple[TaskStatus, str]

Returns:

A tuple containing a task status and a unique id string to identify the command

off(task_callback=None)

Tell the upstream power supply proxy to turn the tpm off.

Parameters:

task_callback (Optional[Callable]) – Update task state, defaults to None

Return type:

tuple[TaskStatus, str]

Returns:

a result code and a unique_id or message.

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:

tuple[TaskStatus, str]

Returns:

a result code and a unique_id or message.

post_synchronisation(task_callback=None)

Submit the post_synchronisation slow task.

This method returns immediately after it is submitted for execution.

Parameters:

task_callback (Optional[Callable]) – Update task state, defaults to None

Return type:

tuple[TaskStatus, str]

Returns:

A tuple containing a task status and a unique id string to identify the command

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 now

  • seconds (float) – Delay if timestamp is not specified. Default 0.2 seconds

  • n_samples (int) – number of samples to send per packet

  • sync (bool) – (raw) send synchronised antenna samples, vs. round robin

  • first_channel (int) – (channel) first channel to send, default 0

  • last_channel (int) – (channel) last channel to send, default 511

  • channel_id (int) – (channel_continuous) channel to send

  • frequency (float) – (narrowband) Sky frequency for band centre, in Hz

  • round_bits (int) – (narrowband) how many bits to round

  • params (Any) – any additional keyword arguments

Raises:

ValueError – error in time specification

Return type:

None

set_power_state(power_state)

Set the power state of the tile.

If power state changed, re-evaluate the tile programming state and updates it inside the driver. This pushes a callback if it changed.

Parameters:

power_state (PowerState) – The desired power state

Return type:

None

standby(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:

tuple[TaskStatus, str]

Returns:

a result code, or None if there was nothing to do.

start_acquisition(task_callback=None, *, start_time=None, delay=2)

Submit the start_acquisition slow task.

Parameters:
  • task_callback (Optional[Callable]) – Update task state, defaults to None

  • start_time (Optional[str]) – the acquisition start time

  • delay (int) – a delay to the acquisition start

Return type:

tuple[TaskStatus, str]

Returns:

A tuple containing a task status and a unique id string to identify the command

start_beamformer(start_time=None, duration=-1, subarray_beam_id=-1, 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:
  • start_time (Optional[str]) – Start time as ISO formatted time

  • duration (int) – Scan duration, in frames, default “forever”

  • subarray_beam_id (int) – Subarray beam ID of the channels to be started Command affects only beamformed channels for given subarray ID Default -1: all channels

  • scan_id (int) – ID of the scan to be started. Default 0

Raises:

ValueError – invalid time specified

Return type:

None

start_communicating()

Establish communication with the tpm and the upstream power supply.

Return type:

None

stop_communicating()

Establish communication with the tpm and the upstream power supply.

Return type:

None

property tpm_status: TpmStatus

Return the TPM status.

Returns:

the TPM status

update_tpm_power_state(power_state)

Update the power state, calling callbacks as required.

If power state is ON, then the TPM is checked for initialisation, and initialised if not already so.

Parameters:

power_state (PowerState) – the new power state of the component. This can be None, in which case the internal value is updated but no callback is called. This is useful to ensure that the callback is called next time a real value is pushed.

Return type:

None