comm.signalwave module¶
This module provides several classes related to signals. Signal is used to keep information about a transmission. A transmitter should create a signal with appropriate information describing key properties of the signal (e.g. transmit power). At the receiver, the signal is collected and judge whether the signal is decodeable by using the channel information to calculate the gain, BER, and others to draw the conclusion. Therefore, Signal is acting as an interface (or data structure) for:
the Channel to write the distortion information during the transmission, and
the Transceiver to then reads the distortion information and decide whether the received signal passes the CRC check.
Since Signal acts as a common interface between Transceiver and Channel,
thus Channel must pair with appropriate Signal and Transceiver so that
all agree on what distortion informtion to specify, where the channel
will specify the info and the signal will provide the data structure.
So an implementation should extend comm.channel.BaseChannel which provides
descripion of signal distortion over the channel, then a corresponding signal
implementation of comm.signalwave.BaseSignal subclass carrying the data
structure of the signal properties should be provided to pair with the channel.
Current known relationships are:
Channel |
Signal |
Transceiver |
|---|---|---|
DiscModel; LogDistanceModel |
QualityBasedSignal |
Transceiver; TransceiverDir |
(user-defined) |
QualityBasedSignal; (user-defined) |
UserTransceiver |
Note
Created by: CH Foh (2021)
List of Classes¶
BaseSignal¶
It is the base class providing all common properties of a signal.
QualityBasedSignal¶
It is a quality-based signal. it extends the base class to add quality property.
-
class
comm.signalwave.BaseSignal(source, freq, tx_power=None)¶ Bases:
abc.ABCThis is a abstract base class for a signal. It provides specification only.
The class contains properties for transceiver to set before transmitting the signal. After propagation, the channel will record the propagation outcome to the signal onto some specific signal properties.
- Attributes
- source
node.node.BaseNodesubclass The source node transmitting this signal.
- tx_powerfloat
Transmit power used for this signal.
- freqfloat
Carrier freq of the signal.
- distancefloat
The distance for this signal to travel.
- LOS_dirfloat
The signal line-of-sight (LOS) travelling direction.
- infodict
An additional storage point for (i) the transmitter to pass additional information to the channel, or (ii) the channel to the receiving transceiver, or (iii) the receiving transceiver to the user simulatioin. When the signal is made multiple copies to propagate to each channel link, only shallow copy is done.
- source
Methods
add_info(key, value)Use this method to add an info to the signal that can be retrieved later.
copy()This method is used to make a copy of the signal of the subclass.
get_info(key)Use this method to retrieve an earlier added info.
-
abstract
__init__(source, freq, tx_power=None)¶ This is the constructor. It must be reimplemented and super() must be called.
- Parameters
- source_node
comm.transceiver.BaseTransceiversubclass To specify which transceiver is transmitting this signal.
- freqfloat
The carrier frequency of this signal.
- tx_powerfloat
The transmit power in dBm
- source_node
-
add_info(key, value)¶ Use this method to add an info to the signal that can be retrieved later.
- Parameters
- keystr
The key of the information to store.
- valueany
The value of the information to store.
-
get_info(key)¶ Use this method to retrieve an earlier added info. It returns None if the provied key is not found.
- Parameters
- keystr
The key of the information to retrieve.
- Returns
- any
The value of the inforamtion associated with the key.
-
abstract
copy()¶ This method is used to make a copy of the signal of the subclass. It must be explicitly reimplemented in a subclass.
-
class
comm.signalwave.QualityBasedSignal(source, freq, tx_power=None)¶ Bases:
comm.signalwave.BaseSignalThis is a simple implementation of signal providing a single measure of an overall quality of the wave transmission. It provides a property to indicate quality. It is up to the channel to use the indicator. Two methods are created for signal quality reporting and retrieval:
- Attributes
- qualityfloat
Storing the received signal quality after pathloss. The actual measure depends on the channel model, it is up to the channel to decide how to record the channel quality. It may record a value between 0 and 1, it may provide an integer value describing the channel quality, or it may also record the received signal power in dBm.
Methods
add_info(key, value)Use this method to add an info to the signal that can be retrieved later.
copy()See the description in the base class for more information.
get_info(key)Use this method to retrieve an earlier added info.
-
__init__(source, freq, tx_power=None)¶ This is the constructor. It must be reimplemented and super() must be called.
- Parameters
- source
comm.transceiver.BaseTransceiversubclass To specify which transceiver is transmitting this signal.
- freqfloat
The carrier frequency of this signal.
- tx_powerfloat
The transmit power in dBm.
- source
-
copy()¶ See the description in the base class for more information.
- Returns
comm.signalwave.QualityBasedSignalReturn a copy of this signal.