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, station_id, tile, tpm_version, communication_state_changed_callback, component_state_changed_callback)
Hardware driver for a TPM.
- __init__(logger, tile_id, station_id, tile, tpm_version, communication_state_changed_callback, component_state_changed_callback)
Initialise a new TPM driver instance passing in the Tile object.
- Parameters:
logger (
Logger
) – a logger for this simulator to usetile_id (
int
) – the unique ID for the tilestation_id (
int
) – the unique ID for the station to which this tile belongs.tile (
Tile
) – the tile driven by this TpmDrivertpm_version (
str
) – TPM version: “tpm_v1_2” or “tpm_v1_6”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 changescomponent_state_changed_callback (
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.
- Returns:
the RMS power of the TPM’s ADC
- property alarms: dict[str, Any]
Return the alarms status in the TPM.
- Returns:
alarms status in the TPM
- apply_calibration(switch_time=0)
Switch the calibration bank.
(i.e. apply the calibration coefficients previously loaded by
load_calibration_coefficients()
).
- apply_pointing_delays(load_time)
Load the pointing delay at a specified time.
- 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.
- Returns:
list of core id and arp table populated
- property beamformer_table: list[list[int]]
Fetch internal beamformer table.
Fetch table used by the hardware beamformer to define beams and logical bands :return: bidimensional table, with 48 entries, one every 8 channels
start 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.
- Returns:
the temperature of the TPM
- property channeliser_truncation: list[int]
Read the cached value for the channeliser truncation.
- Returns:
cached value for the channeliser truncation
- property clock_present: bool
Check if 10 MHz clock signal is present.
- Returns:
True if 10 MHz clock is present. Checked in poll loop, cached
- 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.
- configure_integrated_beam_data(integration_time=0.5, first_channel=0, last_channel=191)
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)
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)
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: numpy.ndarray | None
Read the cached value for the final rounding in the CSP samples.
Need to be specfied only for the last tile :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.
- Returns:
current tile beamformer frame
- property currents: dict[str, Any]
Return a dictionary of all current values available in the TPM.
- Returns:
currents in the TPM
- download_firmware(bitfile)
Download the provided firmware bitfile onto the TPM.
- property dsp: dict[str, Any]
Return the tile beamformer and station beamformer status in the TPM.
- Returns:
tile beamformer and station beamformer status in the TPM
- property firmware_available: list[dict[str, Any]]
Return the list of the firmware loaded in the system.
- Returns:
the firmware list
- property firmware_name: str
Return the name of the firmware that this TPM simulator is running.
- Returns:
firmware name
- property firmware_version: str
Return the name of the firmware that this TPM simulator is running.
- Returns:
firmware version (major.minor)
- 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
- property fpga_current_frame: int
Return the FPGA current frame counter.
- 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
- 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.
- Returns:
the FPGAs clock time
- Raises:
ConnectionError – if communication with tile failed
- get_40g_configuration(core_id=-1, arp_table_entry=0)
Return a 40G configuration.
- get_tile_id()
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.
- Returns:
TPM hardware version. 120 or 160
- initialise_beamformer(start_channel, nof_channels, is_first, is_last)
Initialise the beamformer.
- property io: dict[str, Any]
Return a dictionary of I/O Interfaces status available in the TPM.
- Returns:
io in the TPM
- property is_beamformer_running: bool
Whether the beamformer is currently running.
- 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).
- Returns:
whether this TPM is programmed
- load_calibration_coefficients(antenna, calibration_coefficients)
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)
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.
- Returns:
whether there are pending send data requests
- property phase_terminal_count: int
Return the phase terminal count.
- Returns:
the phase terminal count
- property pll_locked: bool
Check if ADC clock PLL is locked.
- Returns:
True if PLL is locked. Checked in poll loop, cached
- post_synchronisation()
Perform post tile configuration synchronization.
TODO Private method or must be available externally?
- Return type:
- property pps_delay: int | None
Return last measured delay between PPS and 10 MHz clock.
- Returns:
PPS delay correction in nanoseconds. Rounded to 1.25 ns units
- property pps_delay_correction: int | None
Return last measured ppsdelay correction.
- Returns:
PPS delay correction in nanoseconds. Rounded to 1.25 ns units
- property pps_present: bool
Check if PPS signal is present.
- Returns:
True if PPS is present. Checked in poll loop, cached
- property preadu_levels: list[float] | None
Get preadu levels in dB.
- Returns:
cached values of Preadu attenuation level in dB
- read_address(address, nvalues)
Return a list of values from a given address.
- read_register(register_name)
Read the values in a named register.
- property register_list: list[str]
Return a list of registers available on each device.
- Returns:
list of registers
- 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)
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)
Set the frequency regions to be beamformed into a single beam.
The input list contains up to 48 blocks which represent at most 16 contiguous channel regions. Each block has 8 entries which represent: - starting physical channel - number of channels - hardware beam number - subarray ID - subarray logical channel - subarray beam ID - substation ID
- set_lmc_download(mode, payload_length=1024, dst_ip=None, src_port=61648, dst_port=4660, netmask_40g=None, gateway_40g=None)
Specify whether control data will be transmitted over 1G or 40G networks.
- set_lmc_integrated_download(mode, channel_payload_length, beam_payload_length, dst_ip=None, src_port=61648, dst_port=4660, netmask_40g=None, gateway_40g=None)
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 datasrc_port (
int
) – source port, defaults to 0xF0D0dst_port (
int
) – destination port, defaults to 4660gateway_40g (
Optional
[int
]) – IP address of the 40g subnet gateway, if it exists.
- Return type:
- start_acquisition(start_time=None, delay=2)
Start data acquisition.
This must be run as a long running command
- start_beamformer(start_time=0, duration=-1, subarray_beam_id=1, scan_id=0)
Start the beamformer at the specified time.
- Parameters:
- Return type:
- property static_delays: list[float]
Read the cached value for the static delays, in sample.
- Returns:
static delay, in samples one per TPM input
- stop_communicating()
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()
Stop data transmission for send_channelised_data_continuous.
- Return type:
- property sysref_present: bool
Check if SYSREF signal is present.
- 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.
- Returns:
temperatures in the TPM
- property test_generator_active: bool
Check if the test generator is active.
- Returns:
whether the test generator is active
- test_generator_input_select(inputs=0)
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.
- Returns:
timings in the TPM
- tpm_disconnected(intentional_disconnect=False)
Tile disconnected to tpm.
- property voltage_mon: float
Return the internal 5V supply of the TPM.
- Returns:
the internal 5V supply of the TPM
- property voltages: dict[str, Any]
Return a dictionary of all voltage values available in the TPM.
- Returns:
voltages in the TPM
- write_address(address, values)
Write a list of values to a given address.