What would be the most efficient way to transmit a signal, then to switch immediately to RX mode and to record the reflections?
1 Answers
You can transmit a signal using the TxBasebandSignalReq
message, wait for a TxFrameNtf
to indicate that the signal was successfully transmitted, and then ask for a recording using a RecordBasebandSignalReq
. To avoid a gap between the transmission and recording, you can use the txTime
attribute of the TxFrameNtf
to trigger the recording (recTime
attribute). Most modems using UnetStack will allow recordings to begin in the past, as long as the data is in the buffer (usually a few seconds).
The above idea is expressed in the Groovy code snippet below (without any error checking):
import org.arl.unet.*
import org.arl.unet.phy.*
def bb = agentForService(Services.BASEBAND)
bb << new TxBasebandSignalReq(signal: mySignal)
def ntf = receive(TxFrameNtf)
bb << new RecordBasebandSignalReq(recTime: ntf.txTime, recLen: nSamples)
Here mySignal
is the signal you want to send (complex baseband representation), and nSamples
is the number of baseband samples you want to record.
(You can do the same thing using Python in pretty much the same way)
The recording will start at the start of the transmission and will contain the transmitted signal (most likely clipped) followed by any echoes/returns. If you wanted to start the recording at the end of the transmission, you can do so by setting recTime
to ntf.txTime + mySignalDuration
where mySignalDuration
is the length of your signal in microseconds.
Do also bear in mind that the transmitted and recorded signals are complex baseband representations of the signal with a carrier frequency of bb.carrierFrequency
and sampling rate of bb.basebandRate
. This representation is more compact than the passband representation. However, if you wanted to use a passband representation in transmission, you can set fc: 0
in the TxBasebandSignalReq
and pass in a passband signal sampled at 4*bb.basebandRate
, but you do have to convert the received signal to passband (upsample, multiply by a complex exponential and take the real part). If you're using Python, this is easy to do using something like arlpy.signal.bb2pb()
.

- 2,110
- 6
- 14