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
- property fpga1_temperature: float
Return the temperature of FPGA 1.
- Returns:
the temperature of FPGA 1
- class MockTpm(logger)
Simulator for a pyfabil::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
- read_address(address, n=1)
Get address value.
- read_register(register, n=1, offset=0)
Get register value.
- property station_beamf: List[StationBeamformer]
Station beamf.
- Returns:
the station_beamf.
- write_address(address, values, retry=True)
Write address value.
- write_register(register, values, offset=0, retry=True)
Set register value.
- Parameters:
- Return type:
:raises LibraryError:Attempting to set a register not in the memory address.
- 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.
- set_attenuation(attenuation, channels=None)
Set preadu channel attenuation.
- 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:
- class TileSimulator(logger)
This attempts to simulate pyaavs 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 AAVS Tile interfaces with the pyfabil 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
- check_arp_table(timeout=30.0)
Check arp table.
- check_global_status_alarms()
Check global status alarms.
- 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:
- Raises:
ValueError – when the core_id is not [0,1]
- Return type:
- configure_integrated_beam_data(integration_time=0.5, first_channel=0, last_channel=192)
Configure and start continuous integrated beam data.
- configure_integrated_channel_data(integration_time=0.5, first_channel=0, last_channel=512)
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:
- 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)
Attempt to form a connection with TPM.
- Parameters:
initialise (
bool
) – Initialises the TPM objectload_plugin (
bool
) – loads software pluginsenable_ada (
bool
) – Enable ADC amplifier (usually not present)enable_adc (
bool
) – Enable ADCdsp_core (
bool
) – Enable loading of DSP core pluginsadc_mono_channel_14_bit (
bool
) – Enable ADC mono channel 14bit modeadc_mono_channel_sel (
int
) – Select channel in mono channel mode (0=A, 1=B)
- Return type:
- define_spead_header(station_id, subarray_id, nof_antennas, ref_epoch=-1, start_time=0)
Define the SPEAD header for the given parameters.
- Parameters:
- Return type:
- Returns:
a bool representing if command executed without error.
- erase_fpga(force=True)
Erase the fpga firmware.
- get_40g_core_configuration(core_id=-1, arp_table_entry=0)
Return a 40G configuration.
- Parameters:
- Return type:
- Returns:
core configuration or list of core configurations or none
- get_adc_rms(sync=False)
Get ADC power, immediate.
- get_fpga_time(device)
- Parameters:
device (
Device
) – device.- Return type:
- Returns:
the fpga_time.
- Raises:
LibraryError – If invalid device specified.
- get_fpga_timestamp(device=pyfabil.base.definitions.Device.FPGA_1)
Get timestamp from FPGA.
- Parameters:
device (
Device
) – device.- Return type:
- Returns:
the simulated timestamp.
- Raises:
LibraryError – Invalid device specified
- get_health_status(**kwargs)
Get the health state of the tile.
- get_phase_terminal_count()
Get PPS phase terminal count.
- Return type:
- Returns:
the simulated phase terminal count.
- get_pps_delay(enable_correction=True)
Get the pps delay.
- get_preadu_levels()
Get preADU attenuation levels.
- initialise(station_id=0, tile_id=0, lmc_use_40g=False, lmc_dst_ip=None, lmc_dst_port=4660, lmc_integrated_use_40g=False, src_ip_fpga1=None, src_ip_fpga2=None, dst_ip_fpga1=None, dst_ip_fpga2=None, src_port=4661, dst_port=4660, dst_port_single_port_mode=4662, rx_port_single_port_mode=4662, netmask_40g=None, gateway_ip_40g=None, active_40g_ports_setting='port1-only', enable_adc=True, enable_ada=False, enable_test=False, use_internal_pps=False, pps_delay=0, time_delays=0, is_first_tile=False, is_last_tile=False, qsfp_detection='auto', adc_mono_channel_14_bit=False, adc_mono_channel_sel=0)
Initialise tile.
- Parameters:
station_id (
int
) – station IDtile_id (
int
) – Tile ID in the stationlmc_use_40g (
bool
) – if True use 40G interface to transmit LMC data, otherwise use 1Glmc_dst_ip (
Optional
[str
]) – destination IP address for LMC data packetslmc_dst_port (
int
) – destination UDP port for LMC data packetslmc_integrated_use_40g (
bool
) – if True use 40G interface to transmit LMC integrated data, otherwise use 1Gsrc_ip_fpga1 (
Optional
[str
]) – source IP address for FPGA1 40G interfacesrc_ip_fpga2 (
Optional
[str
]) – source IP address for FPGA2 40G interfacedst_ip_fpga1 (
Optional
[str
]) – destination IP address for beamformed data from FPGA1 40G interfacedst_ip_fpga2 (
Optional
[str
]) – destination IP address for beamformed data from FPGA2 40G interfacesrc_port (
int
) – source UDP port for beamformed data packetsdst_port (
int
) – destination UDP port for beamformed data packetsenable_ada (
bool
) – enable adc amplifier, Not present in most TPM versionsenable_adc (
bool
) – Enable ADCactive_40g_ports_setting (
str
) – placeholder docstringdst_port_single_port_mode (
int
) – placeholder docstringrx_port_single_port_mode (
int
) – placeholder docstringenable_test (
bool
) – setup internal test signal generator instead of ADCuse_internal_pps (
bool
) – use internal PPS generator synchronised across FPGAspps_delay (
int
) – PPS delay correction in 625ps unitstime_delays (
int
) – time domain delays for 32 inputsis_first_tile (
bool
) – True if this tile is the first tile in the beamformer chainis_last_tile (
bool
) – True if this tile is the last tile in the beamformer chainqsfp_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 detectedadc_mono_channel_14_bit (
bool
) – Enable ADC mono channel 14bit modeadc_mono_channel_sel (
int
) – Select channel in mono channel mode (0=A, 1=B)
- Return type:
- initialise_beamformer(start_channel, nof_channels)
Mock set the beamformer parameters.
- Parameters:
- Raises:
ValueError – For out of range values.
- Return type:
- is_programmed()
Return whether the mock has been implemented.
- Return type:
- Returns:
the mocked programmed state
- load_antenna_tapering(beam, tapering_coefficients)
Load antenna tapering.
- load_beam_angle(angle_coefficients)
Load beam angle.
- 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.
- load_pointing_delay(load_time=0, load_delay=64)
Load pointing delay.
- mock_off()
Fake a connection by constructing the TPM.
- NOTE:
This method exists in the Simulator Only
- Return type:
- mock_on()
Fake a connection by constructing the TPM.
- NOTE:
This method exists in the Simulator Only
- Return type:
- program_fpgas(bitfile)
Mock programmed state to True.
- send_beam_data(timeout=0, timestamp=0, seconds=0.2)
Send beam data.
- send_channelised_data(number_of_samples=1024, first_channel=0, last_channel=511, timestamp=None, seconds=0.2)
Send channelised data from the TPM.
- 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.
- 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:
- Return type:
- send_raw_data(sync=False, timestamp=None, seconds=0.2, fpga_id=None)
Send raw data.
- set_beamformer_regions(region_array)
Set beamformer region_array.
- set_channeliser_truncation(trunc, signal=None)
Set the channeliser coefficients to modify the bandpass.
- set_csp_rounding(rounding)
Set the final rounding in the CSP samples, one value per beamformer channel.
- set_first_last_tile(is_first, is_last)
Set first last tile in chain.
- set_lmc_download(mode, payload_length=1024, dst_ip=None, 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.
- set_lmc_integrated_download(mode, channel_payload_length, beam_payload_length, dst_ip=None, 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’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 for integrated data streamsdst_port (
int
) – Destination port for integrated data streamsgateway_ip_40g (
Optional
[str
]) – the gateway ip for the 40g.
- Return type:
- set_pointing_delay(delay_array, beam_index)
Set pointing delay.
- set_preadu_levels(levels)
Set preADU attenuation levels.
- set_station_id(station_id, tile_id)
Set mock registers to some value.
- set_test_generator_pulse(freq_code, amplitude=0.0)
Set test generator pulse.
- set_time_delays(delays)
Set coarse zenith delay for input ADC streams.
- start_acquisition(start_time=None, delay=2, tpm_start_time=None)
Start data acquisition.
- start_beamformer(start_time=0, duration=-1, scan_id=0, mask=1099511627775)
Start beamformer.
- switch_calibration_bank(switch_time=0)
Switch calibration bank.
- test_generator_input_select(inputs)
Test generator input select.
- test_generator_set_noise(amplitude_noise=0.0, load_time=0)
Set generator test noise.
- test_generator_set_tone(generator, frequency=100000000.0, amplitude=0.0, phase=0.0, load_time=0)
Test generator tone setting.