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 usemax_workers (
int
) – nos. of worker threadstile_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 controltpm_version (
str
) – TPM version: “tpm_v1_2” or “tpm_v1_6”subrack_fqdn (
str
) – FQDN of the subrack that controls power to this tilesubrack_tpm_id (
int
) – This tile’s position in its subrackcommunication_state_changed_callback (
Callable
[[CommunicationStatus
],None
]) – callback to be called when the status of the communications channel between the component manager and its component changescomponent_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:
- 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:
- 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 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 ADUload_time (
Optional
[str
]) – Time to start the generator. in UTC ISO formatted string.
- Raises:
ValueError – invalid time specified
- Return type:
- download_firmware(argin, task_callback=None)
Submit the download_firmware slow task.
This method returns immediately after it is submitted for execution.
- Parameters:
- Return type:
- 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 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.
- 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.
- post_synchronisation(task_callback=None)
Submit the post_synchronisation slow task.
This method returns immediately after it is submitted for execution.
- 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_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:
- standby(task_callback=None)
Tell the upstream power supply proxy to turn the tpm on.
- start_acquisition(task_callback=None, *, start_time=None, delay=2)
Submit the start_acquisition slow task.
- Parameters:
- Return type:
- 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 timeduration (
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 channelsscan_id (
int
) – ID of the scan to be started. Default 0
- Raises:
ValueError – invalid time specified
- Return type:
- start_communicating()
Establish communication with the tpm and the upstream power supply.
- Return type:
- stop_communicating()
Establish communication with the tpm and the upstream power supply.
- Return type:
- 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: