Tile Simulator

An implementation of a Tile simulator.

class DynamicTileSimulator(logger)

A simulator for a TPM, with dynamic value updates to certain attributes.

__init__(logger)

Initialise a new Dynamic Tile simulator instance.

Parameters:

logger (Logger) – a logger for this simulator to use

property board_temperature: float | None

Return the temperature of the TPM.

Returns:

the temperature of the TPM

cleanup()

Garbage-collection hook.

Return type:

None

property current: float

Return the current of the TPM.

Returns:

the current of the TPM

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

get_board_temperature()
Return type:

Optional[float]

Returns:

the mocked board temperature.

get_current()
Return type:

Optional[float]

Returns:

the mocked current.

get_fpga0_temperature()
Return type:

Optional[float]

Returns:

the mocked fpga0 temperature.

get_fpga1_temperature()
Return type:

Optional[float]

Returns:

the mocked fpga1 temperature.

get_voltage()
Return type:

Optional[float]

Returns:

the mocked voltage.

classmethod random_antenna_generator()

Generate a random antenna/pol number.

Yields:

a random antenna/pol number.

property voltage: float

Return the voltage of the TPM.

Returns:

the voltage of the TPM

class MockTpm(logger)

Simulator for a ska_low_sps_tpm_api.boards::Tpm class.

__init__(logger)

Initialise the MockTPM.

Parameters:

logger (Logger) – a logger for this simulator to use

find_register(string, display=False, info=False)

Find a item in a dictionary.

This is mocking the reading of a register for the purpose of testing TPM_driver

Parameters:
  • string (str) – Regular expression to search against

  • display (bool | None) – True to output result to console

  • info (bool | None) – for linter.

Return type:

List[RegisterInfo | None]

Returns:

registers found at address.

get_40g_core_configuration(core_id=0, arp_table_entry=0)

Return a 40G configuration.

Parameters:
  • core_id (int) – id of the core for which a configuration is to be returned

  • arp_table_entry (int) – ARP table entry to use

Return type:

dict[str, Any]

Returns:

core configuration

get_bios()

Return a mock bios string.

Return type:

str

Returns:

A string bios version.

get_board_info()

Retrieve TPM board information.

Return type:

dict[str, Any]

Returns:

A dictionary of board info.

get_gateway()

Return a mock gateway string.

Return type:

str

Returns:

A string gateway.

get_gateway_eep()

Return a mock gateway_eep string.

Return type:

str

Returns:

A string gateway_eep.

get_ip()

Return a mock ip string.

Return type:

str

Returns:

A string ip.

get_ip_eep()

Return a mock ip_eep string.

Return type:

str

Returns:

A string ip_eep.

get_mac()

Return a mock mac address string.

Return type:

str

Returns:

A string mac address.

get_netmask()

Return a mock netmask string.

Return type:

str

Returns:

A string netmask.

get_netmask_eep()

Return a mock netmask_eep string.

Return type:

str

Returns:

A string netmask_eep.

get_part_number()

Return a mock part_number string.

Return type:

str

Returns:

A string part_number.

get_serial_number()

Return a mock serial_number string.

Return type:

str

Returns:

A string serial_number.

property info: dict[str, Any]

Report MockTPM information.

Returns:

the info

read_address(address, n=1)

Get address value.

Parameters:
  • address (int) – Memory address to read from

  • n (int) – Number of items to read

Return type:

Any

Returns:

Values

read_register(register, n=1, offset=0)

Get register value.

Parameters:
  • register (int | str) – Memory register to read from

  • n (int) – Number of words to read

  • offset (int) – Memory address offset to read from

Raises:

NotImplementedError – if trying to read more than one value

Return type:

list[int]

Returns:

Values

property station_beamf: List[StationBeamformer]

Station beamf.

Returns:

the station_beamf.

property tpm_preadu: List[PreAdu]

Tpm pre adu.

Returns:

the preadu.

write_address(address, values, retry=True)

Write address value.

Parameters:
  • address (int) – Memory address to write

  • values (list[int]) – value to write

  • retry (bool) – retry (does nothing yet.)

Return type:

None

write_register(register, values, offset=0, retry=True)

Set register value.

Parameters:
  • register (int | str) – Register name

  • values (list[int]) – Values to write

  • offset (int) – Memory address offset to write to

  • retry (bool) – retry

Raises:
  • LibraryError – Attempting to set a register not in the memory address.

  • NotImplementedError – if trying to write more than one value

Return type:

None

class PreAdu(logger)

Mock preadu plugin.

__init__(logger)

Initialise mock plugin.

Parameters:

logger (Logger) – a logger for this simulator to use

get_attenuation()

Get preadu attenuation for all channels.

Return type:

list[float]

Returns:

attenuation for all channels.

read_configuration()

Read configuration.

Return type:

None

select_low_passband()

Select low pass band.

Return type:

None

set_attenuation(attenuation, channels=None)

Set preadu channel attenuation.

Parameters:
Return type:

None

write_configuration()

Write configuration to preadu.

Return type:

None

class StationBeamformer

Station beamformer.

__init__()

Initialise the station beamformer object.

define_channel_table(table)

Define station beamformer table.

Defines the station beamformer table. Each entry in the list contains: - start channel - number of channels - hw beam ID - subarray ID - subarray_logical_channel - subarray_beam_id - substation_id - aperture_id

Parameters:

table (list[list[int]]) – table of channel blocks. Entries of 8 items each:

Raises:

ValueError – if wrong value passed.

Return type:

None

disable_flagging()

Disable station beam flagging.

Return type:

None

enable_flagging()

Enable station beam flagging.

Return type:

None

get_channel_table()

Get channel table.

Return type:

list[list[int]]

Returns:

channel table

get_regions()

Get frequency regions.

Regions are defined in a 2-d array, for a maximum of 16 (48) regions. Each element in the array defines a region, with the form [start_ch, nof_ch, beam_index]

  • start_ch: region starting channel (currently must be a

    multiple of 2, LS bit discarded)

  • nof_ch: size of the region: must be multiple of 8 chans

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

  • 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?)

    Defaults to antenna ID = 1, substation ID

Return type:

list[list[int]]

Returns:

Bidimensional array of regions

is_running(channel_groups=None)

Check if the beamformer is running for the specified channels.

Parameters:

channel_groups (Optional[list[int]]) – Groups of channels to start

Return type:

bool

Returns:

is running.

is_station_beam_flagging_enabled()

Get the station beam flag state for each FPGA.

Return type:

bool

Returns:

station beam flag values as list of bool values

start(channel_groups)

Start.

Parameters:

channel_groups (Optional[list[int]]) – Groups of channels to start

Return type:

None

stop(channel_groups)

Stop.

Parameters:

channel_groups (Optional[list[int]]) – Groups of channels to start

Return type:

None

class TileSimulator(logger)

This attempts to simulate ska_low_sps_tpm_api.Tile.

This is used for testing the tpm_driver, it implements __getitem__, __setitem__ so that the TileSimulator can interface with the TPMSimulator in the same way as the ska_low_sps_tpm_api.Tile interfaces with the ska_low_sps_tpm_api.boards.TPM. Instead of writing to a register we write to a dictionary. It overwrite read_address, write_address, read_register, write_register for simplicity.

__init__(logger)

Initialise a new TPM simulator instance.

Parameters:

logger (Logger) – a logger for this simulator to use

beamformer_is_running(mask=None, beam=None, channel_groups=None)

Beamformer is running.

Parameters:
  • mask (Optional[int]) – Bitmask of the channels to be started. Ignored if beam is specified.

  • beam (Optional[int]) – beam number to start. Computes the mask using beam table

  • channel_groups (Optional[list[int]]) – list of channel groups, in range 0:48. group 0 for channels 0-7, to group 47 for channels 380-383.

Return type:

bool

Returns:

is the beam is running

property broadband_rfi_factor: float

Return broadband RFI factor.

Returns:

broadband RFI factor

check_arp_table(timeout=30.0)

Check arp table.

Parameters:

timeout (float) – Timeout in seconds

Return type:

bool

Returns:

a bool representing if arp table is healthy.

check_communication()

Return status of connection to TPM CPLD and FPGAs.

Example:

>> OK Status:

{‘CPLD’: True, ‘FPGA0’: True, ‘FPGA1’: True}

>> TPM ON, FPGAs not programmed or TPM overtemperature self shutdown:

{‘CPLD’: True, ‘FPGA0’: False, ‘FPGA1’: False}

>> TPM OFF or Network Issue:

{‘CPLD’: False, ‘FPGA0’: False, ‘FPGA1’: False}

Return type:

dict[str, bool]

Returns:

a dictionary with the key communication information.

check_global_status_alarms()

Check global status alarms.

Return type:

dict[str, int]

Returns:

a dictionary with the simulated alarm status.

check_pending_data_requests()
Return type:

bool

Returns:

the pending data requess flag.

check_pll_locked()

Check in hardware if PLL is locked.

Return type:

bool

Returns:

True if PLL is locked.

cleanup()

Cleanup logic for gc.

Return type:

None

clear_broadband_rfi()

Clear broadband RFI counters.

Return type:

None

compute_calibration_coefficients()

Compute calibration coefficients.

Return type:

None

configure_40g_core(core_id=0, arp_table_entry=0, src_mac=None, src_ip=None, src_port=None, dst_ip=None, dst_port=None, rx_port_filter=None, netmask=None, gateway_ip=None)

Configure the 40G code.

The dst_mac parameter is ignored in true 40G core (ARP resolution used instead)

Parameters:
  • core_id (int) – id of the core

  • arp_table_entry (int) – ARP table entry to use

  • src_mac (Optional[int]) – MAC address of the source

  • src_ip (Optional[str]) – IP address of the source

  • src_port (Optional[int]) – port of the source

  • dst_ip (Optional[str]) – IP address of the destination

  • dst_port (Optional[int]) – port of the destination

  • rx_port_filter (Optional[int]) – Filter for incoming packets

  • netmask (Optional[str]) – Netmask

  • gateway_ip (Optional[str]) – Gateway IP

Raises:

ValueError – when the core_id is not [0,1]

Return type:

None

configure_integrated_beam_data(integration_time=0.5, first_channel=0, last_channel=191)

Configure and start continuous integrated beam data.

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

  • first_channel (int) – first channel

  • last_channel (int) – last channel

Return type:

None

configure_integrated_channel_data(integration_time=0.5, first_channel=0, last_channel=511)

Configure and start continuous integrated channel data.

TODO Implement generation of integrated packets :type integration_time: float :param integration_time: integration time in seconds, defaults to 0.5 :type first_channel: int :param first_channel: first channel :type last_channel: int :param last_channel: last channel

Return type:

None

configure_ramp_pattern(stage, polarisation, ramp)

Configure a ramp pattern.

Parameters:
  • stage (str) – one of (“jesd”, “channel”, “beamf”, “all”)

  • polarisation (int) – one of (0, 1, -1). select -1 for “all” polariations

  • ramp (str) – (“ramp1”, “ramp2”, “all”)

Return type:

None

connect(initialise=False, load_plugin=True, enable_ada=False, enable_adc=True, dsp_core=True, adc_mono_channel_14_bit=False, adc_mono_channel_sel=0, adc_fullscale_voltage=1.59)

Attempt to form a connection with TPM.

Parameters:
  • initialise (bool) – Initialises the TPM object

  • load_plugin (bool) – loads software plugins

  • enable_ada (bool) – Enable ADC amplifier (usually not present)

  • enable_adc (bool) – Enable ADC

  • dsp_core (bool) – Enable loading of DSP core plugins

  • adc_mono_channel_14_bit (bool) – Enable ADC mono channel 14bit mode

  • adc_mono_channel_sel (int) – Select channel in mono channel mode (0=A, 1=B)

  • adc_fullscale_voltage (float) – Congiure ADC full-scale voltage (default 1.59 V)

Return type:

None

current_tile_beamformer_frame()
Return type:

int

Returns:

beamformer frame.

define_channel_table(region_array, fpga_id=None)

Set frequency regions.

Regions are defined in a 2-d array, for a maximum of 16 regions. Each element in the array defines a region, with the form: >> [start_ch, nof_ch, beam_index, <optional> >> subarray_id, subarray_logical_ch, aperture_id, substation_id] >> 0: start_ch: region starting channel (currently must be a >> multiple of 2, LS bit discarded) >> 1: nof_ch: size of the region: must be multiple of 8 chans >> 2: beam_index: subarray beam used for this region, range [0:48) >> 3: subarray_id: ID of the subarray [1:48] >> 4: subarray_logical_channel: Logical channel in the subarray >> it is the same for all (sub)stations in the subarray >> Defaults to station logical channel >> 5: subarray_beam_id: ID of the subarray beam >> Defaults to beam index >> 6: substation_ID: ID of the substation >> Defaults to 0 (no substation) >> 7: aperture_id: ID of the aperture (station*100+substation?) >> Defaults to

Total number of channels must be <= 384 The routine computes the arrays beam_index, region_off, region_sel, and the total number of channels nof_chans, and programs it in the hardware. Optional parameters are placeholders for firmware supporting more than 1 subarray. Current firmware supports only one subarray and substation, so corresponding IDs must be the same in each row

Parameters:
  • fpga_id (Optional[int]) – the id of the fpga we want to define the channel table for. if None both are configured.

  • region_array (list[list[int]]) – bidimensional array, one row for each spectral region, 3 or 8 items long

Return type:

bool

Returns:

True if OK

define_spead_header(station_id, subarray_id, nof_antennas, ref_epoch=-1, start_time=0, ska_spead_header_format=False)

Define the SPEAD header for the given parameters.

Parameters:
  • station_id (int) – The ID of the station.

  • subarray_id (int) – The ID of the subarray.

  • nof_antennas (int) – Number of antennas in the station

  • ref_epoch (int) – Unix time of epoch. -1 uses value defined in set_epoch

  • start_time (Optional[int]) – start time

  • ska_spead_header_format (bool) – True for new (SKA) CBF SPEAD header format

Return type:

bool

Returns:

a bool representing if command executed without error.

disable_all_adcs()

Disable all simulated ADC channels.

Return type:

None

disable_broadband_rfi_blanking(antennas=range(0, 16))

Disable broadband RFI blanking on specified antennas.

Parameters:

antennas (range | list[int]) – list antennas on which to disable rfi blanking

Return type:

None

disable_station_beam_flagging(fpga_id=None)

Disable station beam flagging.

Parameters:

fpga_id (Optional[int]) – id of the fpga.

Return type:

None

disconnect()

Disconnect the simulator by executing cleanup logic.

Return type:

None

enable_all_adcs()

Enable all simulated ADC channels.

Return type:

None

enable_broadband_rfi_blanking(antennas=range(0, 16))

Enable broadband RFI blanking on specified antennas.

Parameters:

antennas (range | list[int]) – list antennas on which to enable rfi blanking

Return type:

None

enable_station_beam_flagging(fpga_id=None)

Enable station beam flagging.

Parameters:

fpga_id (Optional[int]) – id of the fpga.

Return type:

None

erase_fpgas()

Erase the fpga firmware.

Return type:

None

evaluate_mcu_action()

Evaluate thresholds to temperatures.

In the case of overheating, we will mock the action of the MCU (micro controller unit).

Return type:

None

find_register(register_name='', display=False, info=False)

Return register information from a provided search string.

Note: this is a wrapper method of ‘ska_low_sps_tpm_api.boards.tpm.find_register’

Parameters:
  • register_name (str) – Regular expression to search against

  • display (bool) – True to output result to console

  • info (bool) – print a message with additional information if True.

Return type:

list[None | RegisterInfo]

Returns:

List of found registers

get_40g_core_configuration(core_id, arp_table_entry=0)

Return a 40G configuration.

Parameters:
  • core_id (int) – id of the core for which a configuration is to be returned

  • arp_table_entry (int) – ARP table entry to use

Return type:

Optional[dict[str, Any]]

Returns:

core configuration or None if not found

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.

Return type:

dict[str, dict[str, int]]

Returns:

mocked 40G packet counts.

get_adc_rms(sync=False)

Get ADC power, immediate.

Parameters:

sync (Optional[bool]) – Synchronise RMS read

Return type:

list[float]

Returns:

the mock ADC rms values.

get_arp_table()

Get arp table.

Return type:

dict[int, list[int]]

Returns:

the app table

get_beamformer_regions()

Get frequency regions.

Read the beamformer regions in the channelizer, with all the parameters for each region. Only FPGA1 tables are read because the same region_array is written to FPGA2. Regions are defined in a 2-d array, for a maximum of 16 (48) regions. Each element in the array defines a region, with the form [start_ch, nof_ch, beam_index]

  • start_ch: region starting channel (currently must be a

    multiple of 2, LS bit discarded)

  • nof_ch: size of the region: must be multiple of 8 chans

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

  • 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?)

    Defaults to antenna ID = 1, substation ID

Return type:

list[list[int]]

Returns:

Bidimensional array of regions

get_beamformer_table(fpga_id=0)

Return the beamformer table.

Returns a table with the following entries for each 8-channel block: >> 0: start physical channel (64-440) >> 1: beam_index: subarray beam used for this region, range [0:48) >> 2: subarray_id: ID of the subarray [1:48] >> Here is the same for all channels >> 3: subarray_logical_channel: Logical channel in the subarray >> Here equal to the station logical channel >> 4: subarray_beam_id: ID of the subarray beam >> 5: substation_id: ID of the substation >> 6: aperture_id: ID of the aperture (station*100+substation?)

Parameters:

fpga_id (int) – A parameter to specify what fpga we want to return the beamformer table for. (Default fpga_id = 0)

Note: this is a wrapper method of ‘ska_low_sps_tpm_api.boards.tpm.station_beamf.get_channel_table’

Return type:

list[list[int]]

Returns:

Nx7 table with one row every 8 channels

get_channeliser_truncation()

Get the channeliser truncation.

Return type:

list[int]

Returns:

the channeliser truncation

get_firmware_list()
Return type:

List[dict[str, Any]]

Returns:

firmware list.

get_fpga_time(device)
Parameters:

device (Device) – device.

Return type:

int

Returns:

the fpga_time.

Raises:

LibraryError – If invalid device specified.

get_fpga_timestamp(device=ska_low_sps_tpm_api.base.definitions.Device.FPGA_1)

Get timestamp from FPGA.

Parameters:

device (Device) – device.

Return type:

int

Returns:

the simulated timestamp.

Raises:

LibraryError – Invalid device specified

get_health_status(**kwargs)

Get the health state of the tile.

Parameters:

kwargs (Any) – Any kwargs to identify health group. see ska_low_sps_tpm_api.Tile

Return type:

dict[str, Any]

Returns:

mocked fetch of health.

get_phase_terminal_count()

Get PPS phase terminal count.

Return type:

int

Returns:

the simulated phase terminal count.

get_pointing_delay(beam_index)

Get pointing delay for a given beam.

Parameters:

beam_index (int) – beam number

Return type:

list[list[list[float]]]

Returns:

pointing delay in seconds

get_pps_delay(enable_correction=True)

Get the pps delay.

Parameters:

enable_correction (bool) – enable correction.

Return type:

int

Returns:

the pps delay.

get_preadu_levels()

Get preADU attenuation levels.

Return type:

list[float]

Returns:

Attenuation levels corresponding to each ADC channel, in dB.

get_station_id()

Get station ID.

Returns:

station ID programmed in HW

Return type:

int

get_temperature()

Get the board temperature.

Return type:

float

Returns:

a float with the board temperature.

Raises:

BoardError – when the CPLD is not connectable.

get_tile_id()
Return type:

int

Returns:

the mocked tile_id.

get_tpm_temperature_thresholds()

Return a dictionary of temperature thresholds.

return structure looks like: >>{ >> “board_warning_threshold”: max, >> “board_alarm_threshold” : max, >> “fpga1_warning_threshold”: max, >> “fpga1_alarm_threshold”: max, >> “fpga2_warning_threshold”: max, >> “fpga2_alarm_threshold”: max, >>}

Returns:

A dictionary containing the temperature thresholds.

Return type:

dict

initialise(station_id=0, tile_id=0, lmc_use_40g=False, lmc_dst_ip=None, lmc_dst_port=4660, lmc_integrated_use_40g=False, lmc_integrated_dst_ip=None, lmc_integrated_dst_port=4660, src_ip_fpga1=None, src_ip_fpga2=None, dst_ip_fpga1=None, dst_ip_fpga2=None, src_port=4661, dst_port=4660, netmask_40g=None, gateway_ip_40g=None, active_40g_ports_setting='port1-only', enable_adc=True, enable_ada=False, use_internal_pps=False, pps_delay=0, time_delays=0, pps_period=1, is_first_tile=False, is_last_tile=False, qsfp_detection='auto', adc_mono_channel_14_bit=False, adc_mono_channel_sel=0, adc_fullscale_voltage=1.59, global_start_time=None)

Initialise tile.

Parameters:
  • station_id (int) – station ID

  • tile_id (int) – Tile ID in the station

  • lmc_use_40g (bool) – if True use 40G interface to transmit LMC data, otherwise use 1G

  • lmc_dst_ip (Optional[str]) – destination IP address for LMC data packets

  • lmc_dst_port (int) – destination UDP port for LMC data packets

  • lmc_integrated_use_40g (bool) – if True use 40G interface to transmit LMC integrated data, otherwise use 1G

  • lmc_integrated_dst_ip (Optional[str]) – the destingation ip for lmc integrated data.

  • lmc_integrated_dst_port (int) – the destingation port for lmc integrated data.

  • src_ip_fpga1 (Optional[str]) – source IP address for FPGA1 40G interface

  • src_ip_fpga2 (Optional[str]) – source IP address for FPGA2 40G interface

  • dst_ip_fpga1 (Optional[str]) – destination IP address for beamformed data from FPGA1 40G interface

  • dst_ip_fpga2 (Optional[str]) – destination IP address for beamformed data from FPGA2 40G interface

  • src_port (int) – source UDP port for beamformed data packets

  • dst_port (int) – destination UDP port for beamformed data packets

  • enable_ada (bool) – enable adc amplifier, Not present in most TPM versions

  • enable_adc (bool) – Enable ADC

  • active_40g_ports_setting (str) – placeholder docstring

  • gateway_ip_40g (Optional[str]) – placeholder docstring

  • netmask_40g (Optional[str]) – placeholder docstring

  • use_internal_pps (bool) – use internal PPS generator synchronised across FPGAs

  • pps_delay (int) – PPS delay correction in 625ps units

  • time_delays (float | int | list) – time domain delays for 32 inputs

  • pps_period (int) – PPS period in seconds

  • is_first_tile (bool) – True if this tile is the first tile in the beamformer chain

  • is_last_tile (bool) – True if this tile is the last tile in the beamformer chain

  • qsfp_detection (str) – “auto” detects QSFP cables automatically, “qsfp1”, force QSFP1 cable detected, QSFP2 cable not detected “qsfp2”, force QSFP1 cable not detected, QSFP2 cable detected “all”, force QSFP1 and QSFP2 cable detected “flyover_test”, force QSFP1 and QSFP2 cable detected and adjust polarity for board-to-board cable “none”, force no cable not detected

  • adc_mono_channel_14_bit (bool) – Enable ADC mono channel 14bit mode

  • adc_mono_channel_sel (int) – Select channel in mono channel mode (0=A, 1=B)

  • adc_fullscale_voltage (float) – Congiure ADC full-scale voltage (default 1.59 V)

  • global_start_time (Optional[int]) – TPM will act as if it is started at this time (seconds)

Return type:

None

initialise_beamformer(start_channel, nof_channels, beam_index=0)

Mock set the beamformer parameters.

Parameters:
  • start_channel (int) – start_channel

  • nof_channels (int) – nof_channels

  • beam_index (int) – index of the beam

Raises:

ValueError – For out of range values.

Return type:

None

is_programmed()

Return whether the mock has been implemented.

Return type:

bool

Returns:

the mocked programmed state

is_station_beam_flagging_enabled(fpga_id=None)

Get the station beam flag state.

Parameters:

fpga_id (Optional[int]) – id of the fpga.

Return type:

list

Returns:

is station beam flag enabled

load_calibration_coefficients(antenna, calibration_coefficients)

Load calibration coefficients.

calibration_coefficients is a bi-dimensional complex array of the form calibration_coefficients[channel, polarization], with each element representing a normalized coefficient, with (1.0, 0.0) the normal, expected response for an ideal antenna. Channel is the index specifying the channels at the beamformer output, i.e. considering only those channels actually processed and beam assignments. The polarization index ranges from 0 to 3. 0: X polarization direct element 1: X->Y polarization cross element 2: Y->X polarization cross element 3: Y polarization direct element The calibration coefficients may include any rotation matrix (e.g. the parallitic angle), but do not include the geometric delay.

Parameters:
  • antenna (int) – Antenna number (0-15)

  • calibration_coefficients (list[list[complex]]) – Calibration coefficient array (384x4 complex)

Raises:

ValueError – If inputs do not pass validation.

Return type:

None

load_calibration_coefficients_for_channels(first_channel, calibration_coefficients)

Load calibration coefficients for all antennas and specific channels.

calibration_coefficients is a tri-dimensional complex array of the form calibration_coefficients[channel, antenna, polarization], with each element representing a normalized coefficient, with (1.0, 0.0) the normal, expected response for an ideal antenna.

channel is the index specifying the channels at the beamformer output, i.e. considering only those channels actually processed and beam assignments. First channel is specified in the parameter, the number of channels is determined by the array shape.

antenna is the antenna index, ranging 0 to 15.

The polarization index ranges from 0 to 3.

  • 0: X polarization direct element

  • 1: X->Y polarization cross element

  • 2: Y->X polarization cross element

  • 3: Y polarization direct element

The calibration coefficients may include any rotation matrix (e.g. the parallitic angle), but do not include the geometric delay.

Parameters:
  • first_channel (int) – First channel index at the beamformer output for which calibration coefficients are provided.

  • calibration_coefficients (ndarray) – Calibration coefficient array [channel, antenna, polarization]

Return type:

None

load_pointing_delay(load_time=0, load_delay=64)

Load pointing delay.

Parameters:
  • load_time (int) – load time

  • load_delay (int) – delay in (in ADC frames/256) to apply when load_time == 0

Return type:

None

max_broadband_rfi(antennas=range(0, 16))

Return maximum broadband RFI counter value.

Parameters:

antennas (range | list[int]) – list antenna IDs whose RFI counters to read

Return type:

int

Returns:

maximum broadband RFI counter value

mock_off(lock=False)

Fake a connection by constructing the TPM.

Parameters:

lock (bool) – True if we want to lock this state.

Return type:

None

mock_on(lock=False)

Fake a connection by constructing the TPM.

Parameters:

lock (bool) – True if we want to lock this state.

Return type:

None

program_fpgas(bitfile)

Mock programmed state to True.

Parameters:

bitfile (str) – the name of the bitfile to download

Raises:

LibraryError – if bitfile is of type None.

Return type:

None

read_all_live_calibration_coefficients()

Read all live calibration coefficients.

Return type:

list[list[list[complex]]]

Returns:

Calibration coefficient array

read_all_staged_calibration_coefficients()

Read all staged calibration coefficients.

Return type:

list[list[list[complex]]]

Returns:

Calibration coefficient array

read_broadband_rfi(antennas=range(0, 16))

Read out the broadband RFI counters.

Parameters:

antennas (range | list[int]) – list antennas of which rfi counters to read

Return type:

ndarray

Returns:

rfi counters

read_polyfilter_name()

Return the polyfilter name.

Return type:

str

Returns:

string filter name

reset_eth_errors()

Reset Ethernet errors.

Return type:

None

property rfi_blanking_enabled_antennas: list[int]

Return list of antennas with broadband RFI blanking enabled.

Returns:

list of antennas with rfi blanking enabled

send_beam_data(timeout=0, timestamp=None, seconds=0.2)

Send beam data.

Parameters:
  • timeout (int) – timeout

  • timestamp (Optional[int]) – timestamp

  • seconds (float) – When to synchronise

Return type:

None

send_channelised_data(number_of_samples=1024, first_channel=0, last_channel=511, timestamp=None, seconds=0.4)

Send channelised data from the TPM.

Parameters:
  • number_of_samples (int) – Number of spectra to send

  • first_channel (int) – First channel to send

  • last_channel (int) – Last channel to send

  • timestamp (Optional[int]) – When to start transmission

  • seconds (float) – When to synchronise

Return type:

None

send_channelised_data_continuous(channel_id, number_of_samples=128, wait_seconds=0, timestamp=None, seconds=0.2)

Continuously send channelised data from a single channel.

Parameters:
  • channel_id (int) – Channel ID

  • number_of_samples (int) – Number of spectra to send

  • wait_seconds (int) – Wait time before sending data

  • timestamp (Optional[int]) – When to start

  • seconds (float) – When to synchronise

Return type:

None

send_channelised_data_narrowband(frequency, round_bits, number_of_samples=128, wait_seconds=0, timestamp=None, seconds=0.2)

Continuously send channelised data from a single channel.

Parameters:
  • frequency (float) – Sky frequency to transmit

  • round_bits (int) – Specify which bits to round

  • number_of_samples (int) – Number of spectra to send

  • wait_seconds (int) – Wait time before sending data

  • timestamp (Optional[int]) – When to start

  • seconds (float) – When to synchronise

Return type:

None

send_raw_data(sync=False, timestamp=None, seconds=0.2, fpga_id=None)

Send raw data.

Parameters:
Return type:

None

set_beamformer_regions(region_array)

Set beamformer region_array.

Parameters:

region_array (list[list[int]]) – region_array

Return type:

None

set_broadband_rfi_factor(rfi_factor=1.0)

Set broadband RFI factor.

Parameters:

rfi_factor (float) – broadband RFI factor

Return type:

None

set_channeliser_truncation(trunc)

Set the channeliser coefficients to modify the bandpass.

Parameters:

trunc (list[int]) – list with M values, one for each of the frequency channels. Same truncation is applied to the corresponding frequency channels in all inputs.

Return type:

None

set_csp_download(src_port=None, dst_ip_1=None, dst_ip_2=None, dst_port=None, is_last=False, netmask=None, gateway=None)

Set CSP Destination.

Determines where station beams are sent on the Science Data Network.

Parameters:
Return type:

None

set_csp_rounding(rounding)

Set the final rounding in the CSP samples, one value per beamformer channel.

Parameters:

rounding (list[int]) – Number of bits rounded in final 8 bit requantization to CSP

Return type:

bool

Returns:

true is write a success.

set_first_last_tile(is_first, is_last)

Set first last tile in chain.

Parameters:
  • is_first (bool) – true if first

  • is_last (bool) – true if last

Return type:

bool

Returns:

a bool representing if command executed without error.

set_lmc_download(mode, data_type=None, payload_length=None, dst_ip='10.0.10.1', src_port=61648, dst_port=4660, netmask_40g=None, gateway_ip_40g=None)

Specify where the control data will be transmitted.

With the simulator no traffic will leave the cluster. To transmit data from the pod hosting the simulator to the DAQ (data acquisition) receiver, a Kubernetes service is required. Therefore dst_ip is the name of the service to use rather than the IP.

Parameters:
  • mode (str) – “1G” or “10G”

  • data_type (Optional[str]) – Specify which data type to configure, or None for all.

  • payload_length (Optional[int]) – SPEAD payload length for integrated channel data, defaults to 1024

  • dst_ip (str) – destination service.

  • src_port (Optional[int]) – sourced port, defaults to 0xF0D0

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

  • netmask_40g (Optional[str]) – the mask to apply

  • gateway_ip_40g (Optional[str]) – the gateway ip.

Return type:

None

set_lmc_integrated_download(mode, data_type=None, channel_payload_length=None, beam_payload_length=None, dst_ip='10.0.10.1', src_port=61648, dst_port=4660, netmask_40g=None, gateway_ip_40g=None)

Configure link and size of control data for integrated LMC packets.

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

  • data_type (Optional[str]) – Specify which data type to configure, or None for all.

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

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

  • dst_ip (str) – Destination IP

  • src_port (int) – Source port for integrated data streams

  • dst_port (int) – Destination port for integrated data streams

  • netmask_40g (Optional[str]) – the mask to apply to the 40g.

  • gateway_ip_40g (Optional[str]) – the gateway ip for the 40g.

Return type:

None

set_pattern(stage, pattern, adders, start=False, shift=0, zero=0)

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.

Return type:

None

set_phase_terminal_count(value)

Set PPS phase terminal count.

Parameters:

value (int) – phase terminal count to apply.

Return type:

None

set_pointing_delay(delay_array, beam_index)

Set pointing delay.

Parameters:
  • delay_array (list[list[float]]) – delay array

  • beam_index (int) – beam index

Return type:

None

set_preadu_levels(levels)

Set preADU attenuation levels.

Parameters:

levels (ndarray) – Desired attenuation levels for each ADC channel, in dB.

Return type:

None

set_spead_format(ska_spead_header_format)

Set CSP SPEAD format.

Parameters:

ska_spead_header_format (bool) – True for new (SKA) format, False for old (AAVS)

Return type:

None

set_station_id(station_id, tile_id)

Set mock registers to some value.

Parameters:
  • tile_id (int) – tile_id

  • station_id (int) – station_id

Return type:

None

set_test_generator_pulse(freq_code, amplitude=0.0)

Set test generator pulse.

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

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

Return type:

None

set_time_delays(delays)

Set coarse zenith delay for input ADC streams.

Parameters:

delays (int | float | list[float]) – the delay in input streams, specified in nanoseconds. A positive delay adds delay to the signal stream

Return type:

bool

Returns:

True if command executed to completion.

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)

Raises:

ValueError – is the value set is not in the set range.

Return type:

None

simulate_health_value(path, value)

Simulate a value in the health structure.

Parameters:
  • path (list[str]) – The dictionary path you want to inject a value at

  • value (Any) – The value you want injecting.

Return type:

None

property ska_spead_header: bool

Return format of the CSP Spead header.

Returns:

True for new new (SKA) format, False for old (AAVS)

property spead_ska_format_supported: bool

Check if new (SKA) format for CSP SPEAD header is supported.

Returns:

True if new (SKA) format for CSP SPEAD header is supported

start_acquisition(start_time=None, delay=2, global_start_time=None)

Start data acquisition.

Parameters:
  • start_time (Optional[int]) – Time for starting (frames)

  • delay (int) – delay after start_time (frames)

  • global_start_time (Optional[int]) – TPM will act as if it is started at this time (seconds)

Return type:

None

start_beamformer(start_time=0, duration=-1, scan_id=0, mask=None, beam=None, channel_groups=None)

Start beamformer.

Parameters:
  • start_time (int) – start time UTC

  • duration (int) – duration

  • scan_id (int) – ID of the scan, to be specified in the CSP SPEAD header

  • mask (Optional[int]) – Bitmask of the channels to be started. Ignored if beam is specified.

  • beam (Optional[int]) – beam number to start. Computes the mask using beam table

  • channel_groups (Optional[list[int]]) – list of channel groups, in range 0:48. group 0 for channels 0-7, to group 47 for channels 380-383.

Return type:

bool

Returns:

true if the beamformer was started successfully.

start_pattern(stage)

Start the pattern generator at the specified stage.

Parameters:

stage (str) – The stage in the signal chain where the pattern should be started. Options are: ‘jesd’ (output of ADCs), ‘channel’ (output of channelizer), or ‘beamf’ (output of tile beamformer), or ‘all’ for all stages.

Return type:

None

stop_beamformer(mask=None, beam=None, channel_groups=None)

Stop beamformer.

Parameters:
  • mask (Optional[bool]) – Bitmask of the channels to be started. Ignored if beam is specified.

  • beam (Optional[int]) – beam number to start. Computes the mask using beam table

  • channel_groups (Optional[list[int]]) – list of channel groups, in range 0:48. group 0 for channels 0-7, to group 47 for channels 380-383.

Return type:

None

stop_data_transmission()

Stop data transmission.

Return type:

None

stop_integrated_data()

Stop integrated data.

Return type:

None

stop_pattern(stage)

Stop the pattern generator at the specified stage.

Parameters:

stage (str) – The stage in the signal chain where the pattern should be stopped. Options are: ‘jesd’ (output of ADCs), ‘channel’ (output of channelizer), or ‘beamf’ (output of tile beamformer), or ‘all’ for all stages.

Return type:

None

switch_calibration_bank(switch_time=0)

Switch calibration bank.

Parameters:

switch_time (int) – switch time

Return type:

None

test_generator_input_select(inputs)

Test generator input select.

Parameters:

inputs (int) – inputs

Return type:

None

test_generator_set_delay(delays)

Set delay values for test generator channels.

Parameters:

delays (list[float]) – one delay value per ADC channel (32 entries).

Raises:

ValueError – if delays does not contain exactly 32 entries.

Return type:

None

test_generator_set_noise(amplitude=0.0, load_time=0)

Set generator test noise.

Parameters:
  • amplitude (float) – amplitude of noise

  • load_time (int) – load time

Return type:

None

test_generator_set_tone(generator, frequency=100000000.0, amplitude=0.0, phase=0.0, load_time=0)

Test generator tone setting.

Parameters:
  • generator (int) – generator select. 0 or 1

  • frequency (float) – Tone frequency in Hz

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

  • phase (float) – Initial tone phase, in turns

  • load_time (int) – Time to start the tone.

Return type:

None

property tile_info: str

Report tile firmware information.

Returns:

A string of tile information.