=== wiserd === [[PageOutline]] '''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 parameters may be entered in the command line or sent via TCP. The default port is 5123. To set a parameter, the user must enter its name preceded by ''--'', and followed by the desired value. For example, to set receiver frequency to 700 MHz the user can enter the following: {{{ --uhd_rx_freq 700e6 }}} To get the current value of any parameter, the user must enter only the parameter name preceded by ''--'': {{{ --uhd_rx_freq }}} Adding the described modules is done using the parameter ''--addmodule'', followed by the module name. In order to run a module for a specified time, the parameters ''--recv_running_time'' or ''--tran_running_time'' need to be set to the desired time (in milliseconds), and the flag ''--timed'' needs to be used. ==== Module Parameters ==== || --addmodule || Add a module (RX modules: 'timesamplestofile', 'fftmovingavgoml', 'fftmovingavgudp', 'fftsigpoweroml', 'fftpowudp'; TX modules: 'signalfromfile', 'waveform') || || --delmodule || Delete a module || --timed || Module runs for a predefined time and then gets automatically deleted || --uhd_rx_antenna || Receiver antenna ('RX2', 'TX/RX') || --uhd_tx_antenna || Transmitter antenna ('TX/RX') || --uhd_rx_freq || Receiver central frequency || --uhd_tx_freq || Transmitter central frequency || --uhd_rx_rate || Receiver sampling rate || --uhd_tx_rate || Transmitter sampling rate || --uhd_rx_gain || Receiver gain in dB || --uhd_tx_gain || Transmitter gain in dB || --uhd_rx_bandwidth || Receiver bandwidth || --uhd_tx_bandwidth || Transmitter bandwidth || --recv_numbins || Number of FFT bins. || --recv_avgwinlen || Averaging window length. || --recv_oml_filename || Output filename for OML || --recv_oml_servername || OML server name ('idb2:3003' or 'file') || --recv_oml_output_type || Output data type for OML ('blob', 'vector', 'scalars') || --recv_udp_port || UDP port || --recv_udp_uri || UDP uri || --recv_min_power || Minimal considered power in dBm || --recv_max_power || Maximal considered power in dBm || --recv_output_filename || Filename for local storing the time samples (do not add the extension) || --recv_running_time || Running time for timed modules, in milliseconds || --tran_wavetype || Type of transmitted waveform, SINE, CONST, SQUARE, RAMP || --tran_wavefreq || Frequency of transmitted waveform || --tran_amplitude || Amplitude of transmitted waveform (max 0.7) || --tran_wavefilename || Name of the file containing the waveform || --tran_running_time || Running time for timed modules, in milliseconds ==== 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 }}} To install required prerequisites: {{{ apt-get install liblog4cxx10-dev libocomm-dev liboml2 liboml2-dev }}} The '''wiserd''' daemon is built and installed in /usr/sbin with: {{{ make make install }}}