Station Component Manager

This module implements component management for stations.

class SpsStationComponentManager(station_id, subrack_fqdns, tile_fqdns, lmc_daq_trl, bandpass_daq_trl, sdn_first_interface, sdn_gateway, csp_ingest_ip, channeliser_rounding, csp_rounding, antenna_config_uri, start_bandpasses_in_initialise, bandpass_integration_time, logger, communication_state_changed_callback, component_state_changed_callback, tile_health_changed_callback, subrack_health_changed_callback, on_workaround_flag=False, event_serialiser=None)

A component manager for a station.

__init__(station_id, subrack_fqdns, tile_fqdns, lmc_daq_trl, bandpass_daq_trl, sdn_first_interface, sdn_gateway, csp_ingest_ip, channeliser_rounding, csp_rounding, antenna_config_uri, start_bandpasses_in_initialise, bandpass_integration_time, logger, communication_state_changed_callback, component_state_changed_callback, tile_health_changed_callback, subrack_health_changed_callback, on_workaround_flag=False, event_serialiser=None)

Initialise a new instance.

Parameters:
  • station_id (int) – the id of this station

  • subrack_fqdns (Sequence[str]) – FQDNs of the Tango devices which manage this station’s subracks

  • tile_fqdns (Sequence[str]) – FQDNs of the Tango devices which manage this station’s TPMs

  • lmc_daq_trl (str) – The TRL of this Station’s DAQ Receiver for general LMC use. Could be empty if the device property is not set.

  • bandpass_daq_trl (str) – The TRL of this Station’s DAQ Receiver for bandpasses. Could be empty if the device property is not set.

  • sdn_first_interface (IPv4Interface) – CIDR-style IP address with mask, for the first interface in the block assigned for science data For example, “10.130.0.1/25” means “address 10.130.0.1 on network 10.130.0.0/25”.

  • sdn_gateway (Optional[IPv4Address]) – IP address of the SDN gateway, or None if the network has no gateway.

  • csp_ingest_ip (Optional[IPv4Address]) – IP address of the CSP ingest for this station.

  • channeliser_rounding (Optional[list[int]]) – The channeliser rounding to use for this station.

  • csp_rounding (int) – The CSP rounding to use for this station. An integer value between 0 and 7. Currently the underlying library accepts a list of 384 values (one for each coarse channel sent to CSP) but it actually only uses the first one of these. Until it is updated to support a full list, we restrict this interface to one integer.

  • antenna_config_uri (Optional[list[str]]) – location of the antenna mapping file

  • start_bandpasses_in_initialise (bool) – whether to start bandpasses in initialise.

  • bandpass_integration_time (float) – the integration time for channelised data capture started in initialise.

  • logger (Logger) – the logger to be used by this object.

  • 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

  • tile_health_changed_callback (Callable[[str, Optional[HealthState]], None]) – callback to be called when a tile’s health changed

  • subrack_health_changed_callback (Callable[[str, Optional[HealthState]], None]) – callback to be called when a subrack’s health changed

  • on_workaround_flag (bool) – whether to enable the workaround

  • event_serialiser (Optional[EventSerialiser]) – the event serialiser to be used by this object.

acquire_data_for_calibration(first_channel, last_channel, start_time=None, daq_mode='TCC', nof_samples=1835008, task_callback=None, task_abort_event=None)

Acquire data for calibration.

Parameters:
  • start_time (Optional[str]) – UTC Time for start sending data.

  • first_channel (int) – first channel to calibrate for

  • last_channel (int) – last channel to calibrate for

  • daq_mode (str) – the correlator mode to start, xGPU or TCC.

  • nof_samples (int) – the number of samples to integrate, only variable in TCC.

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

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

Return type:

None

adc_power()

Get input RMS levels.

Return type:

list[float]

Returns:

list of RMS levels of ADC inputs

apply_calibration(switch_time)

Switch the calibration bank.

(i.e. apply the calibration coefficients previously loaded by load_calibration_coefficients()).

Parameters:

switch_time (str) – an optional time at which to perform the switch

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

apply_pointing_delays(load_time)

Load the pointing delay at a specified time.

Parameters:

load_time (str) – time at which to load the pointing delay

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

property beamformer_regions: list[list[int]]

Get beamformer region table.

Bidimensional array of one row for each 8 channels, with elements: 0. start physical channel 1. number of channels 2. beam index 3. subarray ID 4. subarray_logical_channel 5. subarray_beam_id 6. substation_id 8. aperture_id

Each row is a set of 8 consecutive elements in the list.

Returns:

list of up to 8*48 values

beamformer_running_for_channels(channel_groups)

Check if the beamformer is running in a list of channel blocks.

Parameters:

channel_groups (Optional[list[int]]) – List of channel blocks to check

Return type:

bool

Returns:

True if the beamformer is running

property beamformer_table: list[list[int]]

Get beamformer region table.

Bidimensional array of one row for each 8 channels, with elements: 0. start physical channel 1. beam number 2. subarray ID 3. subarray_logical_channel 4. subarray_beam_id 5. substation_id 6. aperture_id

Each row is a set of 7 consecutive elements in the list.

Returns:

list of up to 7*48 values

board_temperature_summary()

Get summary of board temperatures.

Return type:

Optional[list[float]]

Returns:

minimum, average and maximum of board temperatures

property channeliser_rounding: numpy.ndarray

Channeliser rounding.

Number of LS bits dropped in each channeliser frequency channel. Valid values 0-7 Same value applies to all antennas and polarizations

Returns:

list of 512 values for each Tile, one per channel.

cleanup()

Cleanup resources held by the component manager.

This includes cleaning up resources held by all sub-component managers.

Return type:

None

clock_present_summary()

Get summary of 10 MHz clock presence.

Return type:

bool

Returns:

TRUE if 10 MHz clock is present in all tiles

configure_integrated_beam_data(integration_time, first_channel, last_channel)

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.

Parameters:
  • integration_time (float) – integration time in seconds, defaults to 0.5

  • first_channel (int) – first channel

  • last_channel (int) – last channel

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

configure_integrated_channel_data(integration_time, first_channel, last_channel)

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.

Parameters:
  • integration_time (float) – integration time in seconds, defaults to 0.5

  • first_channel (int) – first channel

  • last_channel (int) – last channel

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

configure_station_for_calibration(task_callback=None, task_abort_event=None, **daq_config)

Configure station for calibration.

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

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

  • daq_config (Any) – any extra config to configure DAQ with

Return type:

None

configure_test_generator(argin)

Distribute to tiles command configure_test_generator.

Parameters:

argin (str) – Json encoded parameter List

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

property csp_ingest_address: str

Get 40Gb CSP address.

Returns:

IP address for CSP ingest port

property csp_ingest_port: int

Get 40Gb CSP ingest port.

Returns:

UDP port for CSP ingest port

property csp_rounding: list[int] | None

CSP formatter rounding.

Rounding from 16 to 8 bits in final stage of the station beamformer, before sending data to CSP. Array of (up to) 384 values, one for each logical channel. Range 0 to 7, as number of discarded LS bits.

Returns:

CSP formatter rounding for each logical channel.

property csp_source_port: int

Get 40Gb CSP source port.

Returns:

UDP port for CSP source port

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

describe_test(test_name)

Return the doc string of a given self-check test.

Parameters:

test_name (str) – name of the test.

Return type:

str

Returns:

the doc string of a given self-check test.

property forty_gb_network_address: str

Get 40Gb network address.

Returns:

IP network address for station network

forty_gb_network_errors()

Get summary of network errors.

Return type:

list[int]

Returns:

list of 40Gb network errors for all tiles

fpga_temperature_summary()

Get summary of FPGAs temperatures.

Return type:

Optional[list[float]]

Returns:

minimum, average and maximum of FPGAs temperatures

property global_reference_time: str

Return the UTC time used as global synchronization time.

Returns:

UTC time in ISOT format used as global synchronization time

initialise(start_bandpasses=None, global_reference_time=None, task_callback=None, task_abort_event=None)

Initialise this station.

The order to turn a station on is: subrack, then tiles

Parameters:
  • start_bandpasses (Optional[bool]) – Whether to configure TPMs to send integrated data.

  • global_reference_time (Optional[str]) – Common global reference time for all TPMs, needs to be some time in the last 2 weeks. If not provided, 8am on the most recent Monday AWST will be used.

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

  • task_abort_event (Optional[Event]) – Abort the task

Return type:

None

property is_beamformer_running: bool

Get station beamformer state.

Returns:

Get station beamformer state

property is_configured: bool

Return whether this station component manager is configured.

Returns:

whether this station component manager is configured.

property is_programmed: bool

Get TPM programming state.

Returns:

True if all TPMs are programmed

property keep_test_data: bool

Get whether test data will be kept from the self_check_manager.

Returns:

whether the test data will be kept.

load_calibration_coefficients(calibration_coefficients)

Load calibration coefficients.

These may include any rotation matrix (e.g. the parallactic angle), but do not include the geometric delay.

Parameters:

calibration_coefficients (list[float]) – a bidirectional complex array of coefficients, flattened into a list

Return type:

None

load_calibration_coefficients_for_channels(calibration_coefficients, task_callback=None, task_abort_event=None)

Load calibration coefficients for all antennas and specific channels.

Parameters:
  • calibration_coefficients (list[float]) – a tridimensional complex array of coefficients, indexed by channels, antennas, polarizations, flattened into a list. First element is first channel. Dimension of antennas is 256, in tile antenna order, Dimension of polarizations is 4.

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

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

Raises:

ValueError – when the number of coefficients is insufficient or not a multiple of 2048 (i.e. 8 coefficients per channel per antenna)

Return type:

None

load_pointing_delays(delay_list)

Specify the delay in seconds and the delay rate in seconds/second.

The delay_array specifies the delay and delay rate for each antenna. First element in the array is beam_index: specifies which beam is desired (range 0-47, limited to 7 in the current firmware) Other elements are pairs of delay and delay rate for each antenna, in EEP antenna order. delay_list[2*eep_index -1] is delay, in seconds, and delay_list[2*eep] is the delay rate, in second/second, for antenna with given EEP index (range 1-256)

Parameters:

delay_list (list[float]) – delay in seconds, and delay rate in seconds/second

Return type:

None

off(task_callback=None)

Submit the _off method.

This method returns immediately after it submitted self._off for execution.

Parameters:

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

Return type:

tuple[TaskStatus, str]

Returns:

a result code and response message

on(task_callback=None)

Submit the _on method.

This method returns immediately after it submitted self._on for execution.

Parameters:

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

Return type:

tuple[TaskStatus, str]

Returns:

a task status and response message

pll_locked_summary()

Get summary of PLL lock state.

Return type:

bool

Returns:

TRUE if PLL locked in all tiles

property pps_delay_corrections: list[int]

Get the PPS delay correction.

Returns:

Array of pps delay corrections, one value per tile, in nanoseconds

property pps_delay_spread: int

Get PPS delay delta.

Returns the difference between the maximum and minimum delays so that users can track an observed pps drift. Returns a result in samples, each sample is 1.25ns.

Returns:

Maximum delay difference between tiles in samples.

pps_delay_summary()

Get summary of PPS delays.

Return type:

Optional[list[float]]

Returns:

minimum, average and maximum of PPS delays

property pps_delays: list[int]

Get PPS delay.

Array of one value per tile. Returns the PPS delay, Values are internally rounded to 1.25 ns steps

Returns:

Array of one value per tile, in nanoseconds

pps_present_summary()

Get summary of PPS presence.

Return type:

bool

Returns:

TRUE if PPS is present in all tiles

property preadu_levels: list[float]

Get attenuator level of preADU channels, one per input channel.

Returns:

Array of one value per antenna/polarization (32 per tile)

run_test(count, test_name, task_callback=None, task_abort_event=None)

Run a specific self check test.

Parameters:
  • count (int) – how many times to run the test.

  • test_name (str) – which test to run.

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

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

Return type:

None

self_check(task_callback=None, task_abort_event=None)

Run all self check tests.

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

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

Return type:

None

send_data_samples(argin, force=False)

Front end for send_xxx_data methods.

Parameters:
  • argin (str) – Json encoded parameter List

  • force (bool) – whether to cancel ongoing requests first.

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

set_beamformer_table(beamformer_table)

Set the frequency regions to be beamformed into each beam.

Parameters:

beamformer_table (list[list[int]]) – a list encoding up to 48 regions, with each region corresponding to 8 channels. Entry items specify:

  • start physical channel

  • beam_index: subarray beam used for this region, range [0:48)

  • subarray_id: ID of the subarray [1:48]

  • subarray_logical_channel: Logical channel in the subarray

    it is the same for all (sub)stations in the subarray Defaults to station logical channel

  • subarray_beam_id: ID of the subarray beam

    Defaults to beam index

  • substation_ID: ID of the substation

    Defaults to 0 (no substation)

  • aperture_id: ID of the aperture (station*100+substation?)

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

set_channeliser_rounding(channeliser_rounding, task_callback=None, task_abort_event=None)

Set the channeliserRounding in all Tiles.

Parameters:
  • channeliser_rounding (np.ndarray | list[int]) – the number of LS bits dropped in each channeliser frequency channel.

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

  • task_abort_event (Optional[threading.Event]) – Check for abort, defaults to None

Return type:

None

set_csp_ingest(dst_ip, src_port, dst_port)

Configure last tile link for CSP ingest channel.

Parameters:
  • dst_ip (str) – Destination IP, defaults to None

  • src_port (int) – source port, defaults to 0xF0D0

  • dst_port (int) – destination port, defaults to 4660

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

tuple containing Resultcode and message.

set_lmc_download(mode, payload_length, dst_ip, src_port=61648, dst_port=4660)

Configure link and size of LMC channel.

Parameters:
  • mode (str) – ‘1G’ or ‘10G’

  • payload_length (int) – SPEAD payload length for LMC packets

  • dst_ip (str) – Destination IP, defaults to None

  • src_port (int) – source port, defaults to 0xF0D0

  • dst_port (int) – destination port, defaults to 4660

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

set_lmc_integrated_download(mode, channel_payload_length, beam_payload_length, dst_ip='', src_port=61648, dst_port=4660, lock_mode=True)

Configure link and size of integrated LMC channel.

Parameters:
  • mode (str) – ‘1G’ or ‘10G’

  • channel_payload_length (int) – SPEAD payload length for integrated channel data

  • beam_payload_length (int) – SPEAD payload length for integrated beam data

  • dst_ip (str) – Destination IP, defaults to None

  • src_port (int) – source port, defaults to 0xF0D0

  • dst_port (int) – destination port, defaults to 4660

  • lock_mode (bool) – whether this call should lock integrated-mode auto refresh.

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

set_power_state(power_state, fqdn=None)

Set the power_state of the component.

TODO:

Power state should be set in the component mananger and then the device updated. Current design sets the component power state from the device component_state_changed callback. This should be corrected

Parameters:
  • power_state (PowerState) – the value of PowerState to be set.

  • fqdn (Optional[str]) – the fqdn of the component’s device.

Raises:

ValueError – fqdn not found

Return type:

None

standby(task_callback=None)

Submit the _standby method.

This method returns immediately after it submitted self._standby for execution.

Parameters:

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

Return type:

tuple[TaskStatus, str]

Returns:

a task status and response message

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

Start acquisition using slow command.

Parameters:
  • start_time (Optional[str]) – the time at which to start data acquisition, defaults to None

  • delay (Optional[int]) – delay start, defaults to 2

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

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

Return type:

None

start_adcs()

Start ADCs on all tiles.

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

start_beamformer(start_time=None, duration=-1, channel_groups=None, scan_id=0, task_callback=None, task_abort_event=None)

Start the beamformer at the specified time.

Parameters:
  • start_time (Optional[str]) – time at which to start the beamformer, defaults to 0

  • duration (int) – duration for which to run the beamformer, defaults to -1 (run forever)

  • channel_groups (Optional[list[int]]) – Channel groups to which the command applies.

  • scan_id (int) – ID of the scan which is started.

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

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

Return type:

None

start_communicating()

Establish communication with the station components.

Return type:

None

property static_delays: list[float]

Get static time delay correction.

Array of one value per antenna/polarization (32 per tile), in range +/-124. Delay in nanoseconds (positive = increase the signal delay) to correct for static delay mismathces, e.g. cable length.

Returns:

Array of one value per antenna/polarization (32 per tile)

stop_adcs()

Stop ADCs on all tiles.

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

stop_beamformer(channel_groups, task_callback=None, task_abort_event=None)

Stop the beamformer.

Parameters:
  • channel_groups (Optional[list[int]]) – Channel groups to which the command applies.

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

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

Return type:

None

stop_beamformer_for_channels(task_callback=None, task_abort_event=None, *, channel_groups=None)

Run the stop_beamformer method.

Parameters:
  • channel_groups (Optional[list[int]]) – Channel groups to which the command applies.

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

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

Return type:

None

stop_communicating()

Break off communication with the station components.

Return type:

None

stop_data_transmission()

Stop data transmission for send_channelised_data_continuous.

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

stop_integrated_data()

Stop the integrated data.

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

sysref_present_summary()

Get summary of SYSREF presence.

Return type:

bool

Returns:

TRUE if SYSREF is present in all tiles

property test_generator_active: bool

Get test generator state.

Returns:

True if at least one TPM uses test generator

property test_list: list[str]

Get list of self-check tests available.

Returns:

list of self-check tests available.

property test_logs: str

Get logs of most recently run self-check test set.

Returns:

logs of most recently run self-check test set.

property test_report: str

Get report of most recently run self-check test set.

Returns:

report of most recently run self-check test set.

tile_programming_state()

Get TPM programming state.

Return type:

list[str]

Returns:

list of programming state for all TPMs

trigger_adc_equalisation(target_adc=17.0, bias=0.0, task_callback=None, task_abort_event=None)

Equalise adc using slow command.

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

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

  • target_adc (float) – adc value in ADU units. Defaults to 17.

  • bias (float) – user specifed bias in dB added to the antenna preadu levels. Defaults to 0.

Return type:

None