=== wiserd === [[TOC(wiser/mSoftware* )]] '''wiserd''' was developed as a basic software building block of a distributed frequency-domain based spectrum sensing system consisting of a number of deployed spectrum sensors (SDR nodes) that are managed by the centralized controller. The main goal was to provision the SDR node with a monolithic (i.e. simple to deploy) relatively portable (i.e. with minimal number of software dependencies) application with fft based processing of time-domain RF signals that has ability to control RF and spectrum sensing parameters. Over time, the '''wiserd''' grew up to include other (not necessarily frequency domain and not receiver only) modules. The [http://en.wikipedia.org/wiki/Daemon_%28computing%29 daemon type C++ application] is divided into modules and is multithreaded. The block-diagram of the application is shown in Figure 1. It consist of the following functional modules: [[Image(wiserd.jpg, width=300px, margin=30, align=left)]] * The '''main module''' (controller) handles user commands which can either be entered locally on a controlling terminal or sent from a remote controller over TCP. * The '''radio module (uhd)''' handles all the communication to and from the radio device. While the current version of the module was designed to work with VITA standard, it was only thoroughly tested with USRP devices. If another radio device was to be used, this is would be the only module that needs to be tested/changed. * The '''receiver module (rx)''' uses the radio device to receive IQ time samples at preset frequencies with preset sampling rates and forwards them to the receiver '''consumer modules'''. In addition to interfacing with consumers, the rx module is also used to assign consumer threads to processing cores based on real-time requirements. It can also be used for buffering and re-packetization. * The '''transmitter module (tx)''' uses the radio device to transmit signals, received from '''transmitter producer modules''' as IQ time samples, at preset frequencies with preset sampling rates. The producer/consumer modules are written following the [http://en.wikipedia.org/wiki/Factory_method_pattern factory method pattern]: * '''Receiver consumer modules''' receive the IQ time samples from the receiver module and process them. The same set of IQ samples is passed on to all consumers for arbitrary processing. At present, available receiver consumers are: fft_movavg_udp, fft_pow_udp, store_to_file. * '''Transmitter producer modules''' send the IQ time samples to the transmitter module to be transmitted on the radio device. Present transmitter producers are: signal_from_file, waveform. The '''wiserd''' code was written using [http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml Google style]. ==== Receiver modules ==== 1. '''fft_movavg_udp''': performs the FFT on the time samples received from the receiver module, calculates the moving average and sends the results via UDP. The consumer name used to add the consumer while using the program is "fftmovingavgudp". Needed parameters: FFT length, averaging window length, UDP address and port. 1. '''fft_pow_udp''': performs the FFT on the time samples, calculates the power of each FFT bin and sends the results as arrays of 8bit numbers via UDP, with a preset minimal power corresponding to 0 and preset maximal power corresponding to 255. Consumer name is "fftpowudp". Needed parameters: FFT length, minimal power, maximal power, UDP address and port. 1. '''store_to_file''': simply stores the time samples as complex 32bit floats in a binary file, with the format of the file being: receiver frequency as a 32bit float, receiver sampling rate as a 32bit float, receiver gain as a 32bit float, the number of stored samples as a 32bit unsigned integer, followed by the samples as 32bit complex floats, with the real part coming first and imaginary second for each sample. Consumer name is "storetofile". Needed parameters: the required number of time samples to store. 1. '''fft_movavg_oml''': performs the FFT on the time samples received from the receiver module, calculates the moving average and sends the results to the OML server. The consumer name is "fftmovingavgoml". Needed parameters: FFT length, averaging window length, OML server address and port (use server name "FILE" to store locally), OML filename. 1. '''fft_sigpower_oml''': performs the FFT on the time samples receivd from the receiver module, calculates the peak power in dBm and 3dB bandwidth each second, and on used command sends the results to the OML server. Needed parameters: FFT length, OML server address and port (use server name "FILE" to store locally), OML filename. ==== Transmitter modules ==== 1. '''signal_from_file''': reads IQ time samples stored as complex floats from a file and sends them to the transmitting module. Producer name is "signalfromfile". Needed parameters: file name. 1. '''waveform''': has a number of predefined waveforms to be sent to the transmitting module. Consumer name is "waveform". Needed parameters: waveform type, waveform frequency (depending on the type). ==== Usage ==== The commands may be entered in the command line or sent via TCP. The default port is 5123. The list of commands with their syntax: ===== get ===== '''get''' command is used to obtain values of parameters of certain modules. The user must use the correct module (uhd, rx and tx) when trying to access a parameter. For example, the receiver frequency, called rx_freq, is a parameter of the radio module (uhd), since it is set using the radio device driver. On the other hand, FFT length or the moving average window or anything the receiver consumers might need is a part of the receiver module (rx). For example, the command to get the current value of the receiver frequency is: {{{ get uhd rx_freq }}} ===== set ===== '''set''' command is used to set values of the parameters. It's similar to "get", with the addition of the value at the end. Example: {{{ set uhd rx_freq 3.432e9 }}} ===== add ===== '''"add"''' command is used to add a consumer to the transmitting or receiving module. Examples: {{{ add rx fftmovingavgudp add tx waveform }}} ===== delete ===== '''"delete"''' command deletes (stops) an added producer/consumer from the transmitting or receiving module. Examples: {{{ delete rx fftpowudp }}} ===== scan ===== "scan" is a procedure that reads a script from a file, and then follows it to perform scanning of the spectrum by repeatedly adding the store_to_file consumer, and then deleting it when the work is done, for different values of receiving parameters. It has a single parameter: the file name from which the script is loaded. The input file is a textual file. The first line contains a single number N, the number of times the store_to_file will be run, followed by N lines containing 4 parameters each: central receiver frequency, receiver sampling rate, receiver gain and the required number of samples to be stored. ==== Module Parameters ==== || Receiver module ('''rx''') || || numbins || FFT length || || avgwinlen || Averaging window length || || measurement_uri || UDP address used to send the measurement results to || || measurement_port || UDP port used to send the measurement results to || || minimal_power || Lower bound of measured power || || maximal_power || Upper bound of measured power || || Transmitter module ('''tx''') || || wavetype || Type of transmitted waveform (SINE, CONST) || || wavefreq || Frequency of the transmitted waveform || || amplitude || Amplitude of the transmitted waveform || || wavefilename || Input file name || || Radio module ('''uhd''') || || rx_freq || Receiver central frequency || || rx_rate || Receiver sampling rate || || rx_bandwidth || Receiver bandwidth || || rx_gain || Receiver gain || || rx_antenna || Receiver antenna || || tx_freq || Transmitter central frequency || || tx_rate || Transmitter sampling rate || || tx_bandwidth || Transmitter bandwidth || || tx_gain || Transmitter gain || || tx_antenna || Transmitter antenna || || sub_device || USRP radio internal subdevice to be used || || clock_ref || USRP radio clock reference || ==== Development ==== The latest version of the '''wiserd''' code is available in the [source:wiserd git repository]. To check out the latest code: {{{ git clone username@packages.orbit-lab.org:/common/git/wiserd }}} The '''wiserd''' daemon is built and installed in /usr/sbin with: {{{ make make install }}}