Wrappers for radio hardware¶
The following classes provide wrappers around certain ALH resources related to experimental radios available on sensor nodes.
Spectrum sensing¶
-
class
vesna.alh.spectrumsensor.
SpectrumSensor
(alh)¶ ALH node acting as a spectrum sensor.
Parameters: alh – ALH implementation used to communicate with the node -
get_config_list
()¶ Query and return the list of supported device configurations.
Returns: a ConfigList
object
-
is_complete
(program)¶ Return true if given program has been successfuly completed.
Parameters: program – a SpectrumSensorProgram
object
-
program
(program)¶ Send the given spectrum sensing program to the node.
Parameters: program – a SpectrumSensorProgram
object
-
retrieve
(program)¶ Retrieve results from the given spectrum sensing program.
Parameters: program – a SpectrumSensorProgram
objectReturns: a SpectrumSensorResult
object
-
sweep
(sweep_config)¶ Perform a single frequency sweep and return results immediately
Parameters: sweep_config – frequency sweep configuration to use, a SweepConfig
object
-
-
class
vesna.alh.spectrumsensor.
SpectrumSensorProgram
(sweep_config, time_start, time_duration, slot_id)¶ Describes a single spectrum sensing task.
Parameters: - sweep_config – frequency sweep configuration to use, a
SweepConfig
object - time_start – time to start the task (UNIX timestamp)
- time_duration – duration of the task in seconds
- slot_id – numerical slot id used for storing measurements
- sweep_config – frequency sweep configuration to use, a
-
class
vesna.alh.spectrumsensor.
SpectrumSensorResult
(program)¶ Result of a spectrum sensing task.
-
get_data
()¶ Return power measurements in dbm in form a two-dimensional array.
-
get_hz_list
()¶ Return a list of frequencies in hertz covered by this result.
-
get_s_list
()¶ Return a list of timestamps in seconds covered by this result.
-
write
(path)¶ Write measurements into a tab-separated-values file.
Parameters: path – path to the file to write
-
-
class
vesna.spectrumsensor.
ConfigList
¶ List of devices and device configurations supported by attached hardware.
-
get_config
(device_id, config_id)¶ Return the specified device configuration.
Parameters: - device_id – numeric device id, as returned by the list command
- config_id – numeric configuration id, as returned by the list command
-
get_sweep_config
(start_hz, stop_hz, step_hz, name=None)¶ Return best frequency sweep configuration for specified requirements.
Parameters: - start_hz – lower bound of the frequency band to sweep (inclusive)
- stop_hz – upper bound of the frequency band to sweep (inclusive)
- step_hz – preferred frequency step to use
- name – optional required sub-string in device configuration name
-
-
class
vesna.spectrumsensor.
Device
(id, name)¶ A spectrum sensing device.
A particular hardware model can have one or more physical spectrum sensing devices, each of which can support one or more configurations.
-
class
vesna.spectrumsensor.
DeviceConfig
(id, name, device)¶ Configuration for a spectrum sensing device.
The set of possible configurations for a device is usually hardware-dependent (i.e. a configuration usually reflects physical hardware settings) A configuration defines the usable frequency range, resolution bandwidth and sweep time for a device.
By convention, when specifying channel ranges, the range is given in the same format as for the range built-in (i.e. inclusive lower bound inclusive, exclusive upper bound). When specifiying frequency ranges, both bounds are inclusive.
-
ch_to_hz
(ch)¶ Convert channel number to center frequency in hertz.
-
covers
(start_hz, stop_hz)¶ Return true if this configuration can cover the given frequency band.
Parameters: - start_hz – lower bound of the frequency band to check (inclusive)
- stop_hz – upper bound of the frequency band to check (inclusive)
-
get_full_sweep_config
(step_hz=None)¶ Return a sweep configuration that covers the entire frequency range supported by this device configuration.
Parameters: step_hz – frequency step to use (by default, step by a single channel)
-
get_start_hz
()¶ Return the lowest settable frequency.
-
get_stop_hz
()¶ Return the highest settable frequency.
-
get_sweep_config
(start_hz, stop_hz, step_hz)¶ Return a sweep configuration that covers the specified frequency band.
Parameters: - start_hz – lower bound of the frequency band to sweep (inclusive)
- stop_hz – upper bound of the frequency band to sweep (inclusive)
- step_hz – sweep frequency step
-
hz_to_ch
(hz)¶ Convert center frequency in hertz to channel number.
-
-
class
vesna.spectrumsensor.
SweepConfig
(config, start_ch, stop_ch, step_ch, nsamples=100)¶ Frequency sweep configuration for a spectrum sensing device.
Parameters: - config – device configuration object to use
- start_ch – lowest frequency channel to sweep
- stop_ch – one past the highest frequency channel to sweep
- step_ch – how many channels in a step
- nsamples – how many samples to average per measurement (only supported on some devices)
-
get_ch_list
()¶ Return a list of channels covered by this configuration
-
get_hz_list
()¶ Return a list of frequencies covered by this configuration
Signal generation¶
-
class
vesna.alh.signalgenerator.
SignalGenerator
(alh)¶ ALH node acting as a signal generator.
Parameters: alh – ALH implementation used to communicate with the node -
get_config_list
()¶ Query and return the list of supported device configurations.
Returns: a ConfigList
object
-
program
(program)¶ Send the given signal generation program to the node.
Parameters: program – a SignalGeneratorProgram
object
-
program_list
(program_list)¶ Send several signal generator programs to the node.
Parameters: program_list – a list of SignalGeneratorProgram
objects
-
-
class
vesna.alh.signalgenerator.
SignalGeneratorProgram
(tx_config, time_start, time_duration)¶ Describes a single signal generation task.
Parameters: - tx_config – transmission configuration to use
- time_start – time to start the task (UNIX timestamp)
- time_duration – duration of the task in seconds
-
class
vesna.alh.signalgenerator.
ConfigList
¶ List of devices and device configurations supported by attached hardware.
-
get_config
(device_id, config_id)¶ Return the specified device configuration.
Parameters: - device_id – numeric device id, as returned by the list command
- config_id – numeric configuration id, as returned by the list command
-
get_tx_config
(f_hz, power_dbm, name=None)¶ Return best transmission configuration for specified requirements.
Parameters: - f_hz – transmission frequency
- power_dbm – transmission power
- name – optional required sub-string in device configuration name
-
-
class
vesna.alh.signalgenerator.
Device
(id, name)¶ A signal generation device.
A particular hardware model can have one or more physical signal generation devices, each of which can support one or more configurations.
-
class
vesna.alh.signalgenerator.
DeviceConfig
(id, name, device)¶ Configuration for a signal generation device.
The set of possible configurations for a device is usually hardware-dependent (i.e. a configuration usually reflects physical hardware settings). A configuration defines the usable frequency and power range.
-
ch_to_hz
(ch)¶ Convert channel number to center frequency in hertz.
-
covers
(f_hz, power_dbm)¶ Return true if this configuration can support the given frequency and power.
Parameters: - f_hz – transmission frequency in hertz
- power_dbm – transmission power in dBm
-
get_start_hz
()¶ Return the lowest settable frequency.
-
get_stop_hz
()¶ Return the highest settable frequency.
-
get_tx_config
(f_hz, power_dbm)¶ Return the transmission configuration for the given frequency and power.
Parameters: - f_hz – transmission frequency in hertz
- power_dbm – transmission power in dBm
-
-
class
vesna.alh.signalgenerator.
TxConfig
(config, f_ch, power_dbm)¶ Transmission configuration for a signal generation device.
Parameters: - config –
DeviceConfig
device configuration object to use - f_ch – frequency channel for transmission
- power_db – power level for transmission
- config –
UWB node¶
-
class
vesna.alh.uwbnode.
UWBNode
(alh)¶ ALH node abstracting an UWB node functionality
Parameters: alh – ALH implementation used to communicate with the node -
check_pending_measurement
()¶ check if measurement data is ready for transfer
-
get_last_range_data
()¶ return measurements data
-
get_radio_settings
()¶ read current uwb radio settings
-
get_sensor_id
()¶ read the ID of UWB node
-
setup_radio
(settings)¶ setup radio from RadioSettings object
-