Tpm Driver
An implementation of a Tile component manager that drives a real TPM.
The class is basically a wrapper around the Tile class, in order to have a consistent interface for driver and simulator. This is an initial version. Some methods are still simulated. A warning is issued in this case, or a NotImplementedError exception raised.
- class TpmDriver(logger, tile_id, tile, tpm_version, communication_state_changed_callback, component_state_changed_callback)[source]
Hardware driver for a TPM.
- __init__(logger, tile_id, tile, tpm_version, communication_state_changed_callback, component_state_changed_callback)[source]
Initialise a new TPM driver instance passing in the Tile object.
- Parameters
logger (
logging.Logger
) – a logger for this simulator to usetile_id (
int
) – the unique ID for the tiletile (
pyaavs.tile.Tile
) – the tile driven by this TpmDrivertpm_version (
str
) – TPM version: “tpm_v1_2” or “tpm_v1_6”communication_state_changed_callback (
typing.Callable
[[ska_control_model.CommunicationStatus
],None
]) – callback to be called when the status of the communications channel between the component manager and its component changescomponent_state_changed_callback (
typing.Callable
[...
,None
]) – callback to be called when the component state changes.
- property adc_rms: list[float]
Return the last measured RMS power of the TPM’s analog-to-digital converter.
- apply_calibration(switch_time=0)[source]
Switch the calibration bank.
(i.e. apply the calibration coefficients previously loaded by
load_calibration_coefficients()
).- Parameters
switch_time (
typing.Optional
[int
]) – an optional time at which to perform the switch- Return type
- property arp_table: dict[int, list[int]]
Check that ARP table has been populated in for all used cores 40G interfaces.
Use cores 0 (fpga0) and 1(fpga1) and ARP ID 0 for beamformer, 1 for LMC 10G interfaces use cores 0,1 (fpga0) and 4,5 (fpga1) for beamforming, and 2, 6 for LMC with only one ARP.
- property beamformer_table: list[list[int]]
Fetch internal beamformer table.
Fetch table used by the hardware beamformer to define beams and logical bands :rtype:
list
[list
[int
]] :return: bidimensional table, with 48 entries, one every 8 channelsstart physical channel
tile hardware beam
subarray ID
subarray start logical channel
subarray_beam_id - (int) ID of the subarray beam
substation_id - (int) Substation
aperture_id: ID of the aperture (station*100+substation?)
- property board_temperature: float
Return the temperature of the TPM.
- Return type
- Returns
the temperature of the TPM
- property clock_present: bool
Check if 10 MHz clock signal is present.
- Return type
- Returns
True if 10 MHz clock is present. Checked in poll loop, cached
- configure_40g_core(core_id, arp_table_entry, src_mac, src_ip, src_port, dst_ip, dst_port)[source]
Configure the 40G code.
- Parameters
- Return type
- configure_integrated_beam_data(integration_time=0.5, first_channel=0, last_channel=191)[source]
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.
- configure_integrated_channel_data(integration_time=0.5, first_channel=0, last_channel=511)[source]
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.
- configure_test_generator(frequency0, amplitude0, frequency1, amplitude1, amplitude_noise, pulse_code, amplitude_pulse, load_time=0)[source]
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 (
int
) – Time to start the generator.
- Return type
- property csp_rounding: list[int]
Read the cached value for the final rounding in the CSP samples.
Need to be specfied only for the last tile :rtype:
list
[int
] :return: Final rounding for the CSP samples. Up to 384 values
- property current_tile_beamformer_frame: int
Return current tile beamformer frame, in units of 256 ADC frames.
- Return type
- Returns
current tile beamformer frame
- property currents: dict[str, Any]
Return a dictionary of all current values available in the TPM.
- Return type
- Returns
currents in the TPM
- download_firmware(bitfile, task_callback=None)[source]
Download firmware bitfile onto the TPM as a long runnning command.
- Parameters
bitfile (
str
) – a binary firmware blobtask_callback (
typing.Optional
[typing.Callable
]) – Update task state, defaults to None
- Return type
- Returns
TaskStatus and message
- property dsp: dict[str, Any]
Return the tile beamformer and station beamformer status in the TPM.
- Return type
- Returns
dsp status in the TPM
- property firmware_available: list[dict[str, Any]]
Return the list of the firmware loaded in the system.
- Return type
list
[dict
[str
,typing.Any
]]- Returns
the firmware list
- property firmware_name: str
Return the name of the firmware that this TPM simulator is running.
- Return type
- Returns
firmware name
- property firmware_version: str
Return the name of the firmware that this TPM simulator is running.
- Return type
- Returns
firmware version (major.minor)
- property fpga1_temperature: float
Return the temperature of FPGA 1.
- Return type
- Returns
the temperature of FPGA 1
- property fpga2_temperature: float
Return the temperature of FPGA 2.
- Return type
- Returns
the temperature of FPGA 2
- property fpga_current_frame: int
Return the FPGA current frame counter.
- Return type
- Returns
the FPGA_1 current frame counter
- Raises
ConnectionError – if communication with tile failed
- property fpga_reference_time: int
Return the FPGA reference time.
Required to map the FPGA timestamps, expressed in frames to UTC time
- Return type
- Returns
the FPGA_1 reference time, in Unix seconds
- property fpgas_time: list[int]
Return the FPGAs clock time.
Useful for detecting clock skew, propagation delays, contamination delays, etc.
- Return type
- Returns
the FPGAs clock time
- Raises
ConnectionError – if communication with tile failed
- get_tile_id()[source]
Get the tile ID stored in the FPGA.
- Return type
- Returns
tile ID
- Raises
LibraryError
- property hardware_version: str
Return whether this TPM is 1.2 or 1.6.
- Return type
- Returns
TPM hardware version. 120 or 160
- initialise(task_callback=None)[source]
Download firmware, if not already downloaded, and initializes tile.
- Parameters
task_callback (
typing.Optional
[typing.Callable
]) – Update task state, defaults to None- Return type
- Returns
A tuple containing a task status and a message
- initialise_beamformer(start_channel, nof_channels, is_first, is_last)[source]
Initialise the beamformer.
- property io: dict[str, Any]
Return a dictionary of I/O Interfaces status available in the TPM.
- Return type
- Returns
io in the TPM
- property is_beamformer_running: bool
Whether the beamformer is currently running.
- Return type
- Returns
whether the beamformer is currently running
- property is_programmed: bool
Return whether this TPM is programmed (i.e. firmware has been downloaded to it).
- Return type
- Returns
whether this TPM is programmed
- load_calibration_coefficients(antenna, calibration_coefficients)[source]
Load calibration coefficients.
These may include any rotation matrix (e.g. the parallactic angle), but do not include the geometric delay.
- load_pointing_delays(delay_array, beam_index)[source]
Specify the delay in seconds and the delay rate in seconds/second.
The delay_array specifies the delay and delay rate for each antenna. beam_index specifies which beam is desired (range 0-7)
- property pending_data_requests: bool
Check for pending data requests.
- Return type
- Returns
whether there are pending send data requests
- property phase_terminal_count: int
Return the phase terminal count.
- Return type
- Returns
the phase terminal count
- property pll_locked: bool
Check if ADC clock PLL is locked.
- Return type
- Returns
True if PLL is locked. Checked in poll loop, cached
- post_synchronisation()[source]
Perform post tile configuration synchronization.
TODO Private method or must be available externally?
- Return type
- property pps_delay: float
Return the last measured PPS delay of the TPM.
- Return type
- Returns
PPS delay correction in nanoseconds. Rounded to 1.25 ns units
- property pps_present: bool
Check if PPS signal is present.
- Return type
- Returns
True if PPS is present. Checked in poll loop, cached
- send_data_samples(data_type='', timestamp=0, seconds=0.2, n_samples=1024, sync=False, first_channel=0, last_channel=511, channel_id=128, frequency=150000000.0, round_bits=3)[source]
Front end for send_xxx_data methods.
- Parameters
data_type (
str
) – sample type. “raw”, “channel”, “channel_continuous”, “narrowband”, “beam”timestamp (
int
) – Timestamp for start sending data. Default 0 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 round
- Raises
ValueError – if values wrong
- Return type
- set_beamformer_regions(regions)[source]
Set the frequency regions to be beamformed into a single beam.
- set_lmc_download(mode, payload_length=1024, dst_ip=None, src_port=61648, dst_port=4660)[source]
Specify whether control data will be transmitted over 1G or 40G networks.
- Parameters
mode (
str
) – “1G” or “10G”payload_length (
int
) – SPEAD payload length for integrated channel data, defaults to 1024dst_ip (
typing.Optional
[str
]) – destination IP, defaults to Nonesrc_port (
typing.Optional
[int
]) – sourced port, defaults to 0xF0D0dst_port (
typing.Optional
[int
]) – destination port, defaults to 4660
- Return type
- set_lmc_integrated_download(mode, channel_payload_length, beam_payload_length, dst_ip=None, src_port=61648, dst_port=4660)[source]
Configure link and size of control data.
- Parameters
mode (
str
) – ‘1G’ or ‘10G’channel_payload_length (
int
) – SPEAD payload length for integrated channel databeam_payload_length (
int
) – SPEAD payload length for integrated beam datadst_ip (
typing.Optional
[str
]) – Destination IP, defaults to Nonesrc_port (
int
) – source port, defaults to 0xF0D0dst_port (
int
) – destination port, defaults to 4660
- Return type
- start_acquisition(start_time=None, delay=2)[source]
Start data acquisition.
This must be run as a long running command
- Parameters
start_time (
typing.Optional
[str
]) – the time at which to start data acquisition, defaults to Nonedelay (
typing.Optional
[int
]) – delay start, defaults to 2
- Return type
- Returns
if data acquisition started correctly
- start_beamformer(start_time=0, duration=-1, subarray_beam_id=1, scan_id=0)[source]
Start the beamformer at the specified time.
- Parameters
- Return type
- stop_communicating()[source]
Stop communicating with the TPM.
- Todo
is there a better way to do this? Should Tile16 have a disconnect() method that we can call here?
- Return type
- stop_data_transmission()[source]
Stop data transmission for send_channelised_data_continuous.
- Return type
- sync_fpgas()[source]
Synchronise the FPGAs.
TODO Method appears to be mostly internal (private).
- Return type
- property sysref_present: bool
Check if SYSREF signal is present.
- Return type
- Returns
True if SYSREF is present. Checked in poll loop, cached
- property temperatures: dict[str, Any]
Return a dictionary of all temperature values available in the TPM.
- Return type
- Returns
temperatures in the TPM
- property test_generator_active: bool
Check if the test generator is active.
- Return type
- Returns
whether the test generator is active
- test_generator_input_select(inputs=0)[source]
Specify ADC inputs which are substitute to test signal.
Specified using a 32 bit mask, with LSB for ADC input 0.
- property timing: dict[str, Any]
Return a dictionary of the Timing Signals status available in the TPM.
- Return type
- Returns
timings in the TPM
- property voltage_mon: float
Return the internal 5V supply of the TPM.
- Return type
- Returns
the internal 5V supply of the TPM
- property voltages: dict[str, Any]
Return a dictionary of all voltage values available in the TPM.
- Return type
- Returns
voltages in the TPM