FAQs from Rohde & Schwarz

Example on how to manually generate a *.wv file with Python

Description

I want to manually generate a waveform file(*.wv) with Python that I can later load to my vector signal generator.

Resolution

In order to generate a *.wv file manually you need the I and Q data of your waveform and the sampling frequency(clock) with which the signal is sampled.

In this easy example a clock of 10 MHz and a I/Q sequence of 20 samples is used.

FAQ-Example-on-how-to-manually-generate-a-.wv file-with-Python_01

In the header of the waveform file the so called tags are inserted. The tags TYPE, CLOCK, LEVEL OFFS and WAVEFORM are mandatory for each waveform.

All other tags are optional and can be inserted after the TYPE tag in arbitrary order.

The numeric range between –1.0 and +1.0 of the I and Q data corresponds to the modulation range of the waveform 16-bit D/A converter of -32767 to +32767.

This 16 bit signed integer numbers have to be converted to the resulting I and Q values represented in hexadecimal Little endian format.

Then the data has to be inserted in binary format into your WAVEFORM tag with the following structure:

  • Calculate the Length
  • Length = Number of I/Q pairs * 4 + 1 = 20*4 + 1 = 81 bytes
  • Place the string {WAVEFORM-81:# at the beginning of the data set
  • Place the symbol } at the end of the data set

After running the above code the generated file can be opened with the R&S ARB Toolbox and delivers the following waveform. Comparing the I and Q data from the Python code, one can see that the data has been generated correctly.

FAQ-Example-on-how-to-manually-generate-a-.wv file-with-Python_02

References:
SMBV100B User Manual
https://www.rohde-schwarz.com/produkte/messtechnik/vektorsignalgeneratoren/rs-smbv100b-vektorsignalgenerator_63493-519808.html