StationBeamformer

Overview

This plugin is responsible for managing the FPGA firmware station beamformer; summing the tile beams into 256-antenna beams using the ethernet network.

Python Class & Methods Index

class ska_low_sps_tpm_api.plugins.station_beamf.StationBeamformer(board, logger=None, **kwargs)[source]

Ring (station) beamformer

__init__(board, logger=None, **kwargs)[source]

StationBeamformer initialiser.

Parameters:

board – Pointer to board instance

abort(channel_groups=None)[source]

Stop the beamformer

Parameters:

channel_groups (list | None) – Groups of channels which must stop the scan. If None, stop all channels and the whole beamformer chain. If it is an empty list, do nothing

Returns:

True if OK

check_ddr_parity_error_counter()[source]
clean_up()[source]

Perform cleanup :return: Success

clear_dsp_latency_error()[source]

Clears the dsp latency error.

clear_errors()[source]

Clear frame errors and general error flag.

current_frame()[source]

Current frame as seen by the station beamformer.

Returns:

current frame, in units of 256 ADC frames (276,48 us)

defineChannelTable(region_array)[source]

Set frequency regions (legacy version, note the CamelCase name). 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]

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

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 HW

define_channel_table(region_array)[source]

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, 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: hardware beam ID, unused for station beamformer.

    beam_index is kept in the region_array because the tile beamformer uses beam_index and region_array is shared between the tile and station beamformers [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.

  • 5: subarray_beam_id: ID of the subarray beam.

  • 6: substation_ID: ID of the substation

  • 7: aperture_id: ID of the aperture

    (station*100+substation?)

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.

Parameters:

region_array – bidimensional array, one row for each spectral region, 3 or 8 items long

Returns:

True if OK

Raises:

PluginError – if parameters are illegal

define_spead_header(stationId, subarrayId=0, apertureId=0, refEpoch=-1, startTime=0)[source]

Define_spead_header() used to define SPEAD header for last tile requires stationId, subarrayId and apertureId from LMC Only stationId is require.

Parameters:
  • stationId – ID of the station: 1-512

  • subarrayId – ID of the subarray. can be overrided by defineChannelTable

  • apertureId – ID of the aperture.

  • refEpoch – Reference peoch. -1 (default) uses value already i defined in set_epoch()

  • startTime – (in seconds): offset from frame time, default 0

Returns:

True if OK

disable_flagging()[source]

This disables the transmission of incomplete frames, if a frame is not complete, the entire frame will be dropped. No flagging will occur and this will appear as packet loss to CSP.

enable_flagging()[source]

This enables the transmission of incomplete frames, any packets in the frame that are missing will be substituted for the reserved value (flagged).

get_channel_table()[source]

Returns a table with the following entries for each 8-channel block:

  • 0: start physical channel (64-440)

  • 1: beam_index: hardware beam ID, unused for station beamformer. beam_index is

    kept in the region_array because the tile beamformer uses beam_index and region_array is shared between the tile and station beamformers [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?)

Returns:

Nx7 table with one row every 8 channels

get_csp_rounding()[source]

Reads the csp rounding value stored in the firmware register

Returns:

CSP rounding value from device firmware register

Return type:

int

get_discarded_or_flagged_packet_count()[source]

When station beam flagging disabled, count of packets discarded. Will always be a multiple of 8. When station beam flagging enabled, count of packets substitued (flagged).

:return packet count

get_dsp_latency()[source]

Returns the DSP signal chain latency in ms

The DSP latency is calculated by measuring the difference between the SPEAD transmission timestamp in the station beamformer and the ADC sampling timestamp for the same packet.

NOTE: if this is run on on tile which is not the final one a latency of zero will be returned

Returns:

DSP latency in ms

Return type:

float

get_dsp_latency_error()[source]

Returns False if DSP latency has exceeded the DSP latency threshold. Default threshold is 10 ms.

Returns:

DSP latency error

Return type:

bool

get_dsp_output_spead_timestamp()[source]

Returns the output spead timestamp of firmware in UTCs

Returns:

output spead timestamp in UTC

Return type:

integer

get_regions()[source]

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, 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: hardware beam ID, unused for station beamformer.

    beam_index is kept in the region_array because the tile beamformer uses beam_index and region_array is shared between the tile and station beamformers [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.

  • 5: subarray_beam_id: ID of the subarray beam.

  • 6: substation_ID: ID of the substation

  • 7: aperture_id: ID of the aperture

    (station*100+substation?)

Returns:

Bidimensional array of regions

Return type:

list(list(int))

initialise(**kwargs)[source]

Abstract method where all firmware block initialisation should be performed.

Parameters:

kwargs – Initialisation arguments

Returns:

True or False, depending on whether initialisation was successful

initialise_beamf()[source]

Initialise Station Beamformer

is_flagging_enabled()[source]

Return True if station beam data flagging is enabled :return: is station beam flag enabled (bool)

is_running(channel_groups=range(0, 48))[source]

Check if the beamformer is still running. Compares current frame to programmed start and last frame

Parameters:

channel_groups – list of the channels to check

Returns:

True if beamformer is running in one of the selected channels

read_nof_ch()[source]

Read the station beamformer number of channels table, return the read value.

Returns:

Number of channels

Return type:

int

report_errors()[source]
Returns:

error flags

set_csp_rounding(rounding)[source]

Sets the number of bits rounded off before sending the result to the CSP.

For white noise it should be log2(sqrt(nof_antennas)), i.e. 4 for 256 antennas

Parameters:

rounding – Either scalar or list, of number of bits rounded off before sending the result to the CSP. If list, only 1st element is used. In future firmware, one value per channel.

Returns:

True if OK

set_dsp_latency_error_threshold(latency_threshold)[source]

Sets the latency threshold in ms. If any spead packet is sent out with a higher DSP latency than this the latency error flag goes high.

param latency_threshold: DSP latency threshold in ms :type latency_threshold: float

set_epoch(epoch)[source]

Set the Unix epoch in seconds since Unix reference time

Parameters:

epoch – Unix time for reference time (TPM synch time) 48 bit int

Returns:

True if OK

set_first_last_tile(is_first, is_last)[source]

Defines if a tile is first, last, both or intermediate One, and only one tile must be first, and last, in a chain A tile can be both (one tile chain), or none

Parameters:
  • isFirst – Tile is first in the beamformer chain

  • isLast – Tile is first in the beamformer chain

set_scan_id(scan_id=0, channel_groups=range(0, 48))[source]

Set the scan ID for the selected channel group.

Parameters:
  • scan_id – scan ID for the affected channel groups

  • channel_groups – list of affected channel groups

start(start_time=0, duration=-1, scan_id=0, channel_groups=range(0, 48))[source]

Starts an integration. The integration is specified in units of 256 ADC frames from start_frame (included) to stop_frame (excluded). Default for stop_frame is -1 = “forever”.

Parameters:
  • start_time – first frame (as seen by current_frame) in integration

  • duration – Integration duration, in frames. If -1, forever

  • channel_groups – channel groups to start, default all

Returns:

True if OK, False if not possible (integration already active)

status_check()[source]

Perform status check Checks if framing errors are present :return: Status