Changes between Version 4 and Version 5 of Tutorials/Wireless/Measurement Tool


Ignore:
Timestamp:
May 27, 2019, 7:55:47 PM (5 years ago)
Author:
nilanjan
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials/Wireless/Measurement Tool

    v4 v5  
    220220 4. Once the read buffer is completely populated, create and fft object to convert the time samples into frequency bins. FFT is take for every 1024 time samples and saved into another buffer.
    221221
    222  In side this block, we create an object that performs 1024pt FFTs.
     222 Inside this block, we create an object that performs 1024pt FFTs.
    223223{{{
    224224   std::vector<std::complex<float> > time_buff( samps_per_buff );
     
    240240}}}
    241241
    242  Create keyed-values that will be sent for storage. Here we specify a string label with an OML type. After all the keyed-value pairs have been defined, we start a connection with the OML service.
     242 Create keyed-values that will be sent for storage. Here we specify a string label (for the key, ie. a variable) with an OML data type. After all the keyed-value pairs have been defined, we start a connection with the OML service.
    243243 {{{
    244        std::vector< std::pair<std::string, OmlValueT> > _omlKeys;
    245       //                                 string label        OML type
    246       _omlKeys.push_back( std::make_pair("mboard_id",        OML_STRING_VALUE));
    247       _omlKeys.push_back( std::make_pair("mboard_serial",    OML_STRING_VALUE));
    248       _omlKeys.push_back( std::make_pair("mboard_name",      OML_STRING_VALUE));
    249       _omlKeys.push_back( std::make_pair("rx_id",            OML_STRING_VALUE));
    250       _omlKeys.push_back( std::make_pair("rx_subdev_name",   OML_STRING_VALUE));
    251       _omlKeys.push_back( std::make_pair("rx_subdev_spec",   OML_STRING_VALUE));
    252       _omlKeys.push_back( std::make_pair("rx_ant",           OML_STRING_VALUE));
    253 
    254       _omlKeys.push_back( std::make_pair("channel",          OML_UINT32_VALUE));
    255       _omlKeys.push_back( std::make_pair("total_samps",      OML_UINT32_VALUE));
    256       _omlKeys.push_back( std::make_pair("sample_size",      OML_UINT32_VALUE));
    257 
    258       _omlKeys.push_back( std::make_pair("rx_freq",          OML_DOUBLE_VALUE));
    259       _omlKeys.push_back( std::make_pair("rx_rate",          OML_DOUBLE_VALUE));
    260       _omlKeys.push_back( std::make_pair("rx_gain",          OML_DOUBLE_VALUE));
    261       _omlKeys.push_back( std::make_pair("SizeFFT",          OML_UINT32_VALUE));
    262       _omlKeys.push_back( std::make_pair("Bins",             OML_BLOB_VALUE));
    263 
    264       oml.start( _omlKeys );
     244      // Register measurement points
     245      oml.register_mp("mboard_id",        OML_STRING_VALUE);
     246      oml.register_mp("mboard_serial",    OML_STRING_VALUE);
     247      oml.register_mp("mboard_name",      OML_STRING_VALUE);
     248      oml.register_mp("rx_id",            OML_STRING_VALUE);
     249      oml.register_mp("rx_subdev_name",   OML_STRING_VALUE);
     250      oml.register_mp("rx_subdev_spec",   OML_STRING_VALUE);
     251      oml.register_mp("rx_ant",           OML_STRING_VALUE);
     252      oml.register_mp("channel",          OML_UINT32_VALUE);
     253      oml.register_mp("total_samps",      OML_UINT32_VALUE);
     254      oml.register_mp("sample_size",      OML_UINT32_VALUE);
     255      oml.register_mp("rx_freq",          OML_DOUBLE_VALUE);
     256      oml.register_mp("rx_rate",          OML_DOUBLE_VALUE);
     257      oml.register_mp("rx_gain",          OML_DOUBLE_VALUE);
     258      oml.register_mp("SizeFFT",          OML_UINT32_VALUE);
     259      oml.register_mp("Bins",             OML_BLOB_VALUE);
     260
     261      // Start recording session
     262      oml.start( );
     263
    265264 }}}
    266265
    267  After the OML start has been issued we can set the keyed-value pairs with updated values from sensors. In this section the FFT is
    268  performed on chunks of 1024 complex samples and the magnitude is computed. These get stored in the OML as binary data (oml_blob).
     266 After the OML start has been issued we can set the keyed-value pairs with updated values from sensors. In this section the FFT is performed on chunks of 1024 complex samples and the magnitude is computed. These get stored in the OML as binary data (oml_blob).
    269267 Once all the keyed-valued pairs are updated with set_key(), they are sented over to the OML server by issuing the insert command.
    270268 This is done repeatedly until the entire buffer has been processed.
    271269 {{{
    272         oml.set_key("rx_id",            (void*)usrp_info["rx_id"].c_str() );
    273         oml.set_key("rx_subdev_name",   (void*)usrp_info["rx_subdev_name"].c_str() );
    274         oml.set_key("rx_subdev_spec",   (void*)usrp_info["rx_subdev_spec"].c_str() );
    275         oml.set_key("rx_ant",           (void*)usrp_info["rx_ant"].c_str() );
     270
     271        oml.set_mp("rx_id",            (void*)usrp_info["rx_id"].c_str() );
     272        oml.set_mp("rx_subdev_name",   (void*)usrp_info["rx_subdev_name"].c_str() );
     273        oml.set_mp("rx_subdev_spec",   (void*)usrp_info["rx_subdev_spec"].c_str() );
     274        oml.set_mp("rx_ant",           (void*)ant.c_str() );
     275
     276        oml.set_mp("channel",          (void*)&ch );
     277        oml.set_mp("total_samps",      (void*)&total_num_samps );
     278
     279        ui32 = sizeof(MultiDeviceBuffer.at(ch).at(0));
     280        oml.set_mp("sample_size",      (void*)&ui32);
    276281
    277282        d64 = (double)(usrp->get_rx_freq() / 1e6);
    278         oml.set_key("rx_freq", (void*)&d64);
     283        oml.set_mp("rx_freq", (void*)&d64);
     284        d64 = (double)(usrp->get_rx_rate() / 1e6);
     285        oml.set_mp("rx_rate", (void*)&d64);
     286        d64 = (double)(usrp->get_rx_gain());
     287        oml.set_mp("rx_gain", (void*)&d64);
     288
     289        ui32 = samps_per_buff;
     290        oml.set_mp("SizeFFT", (void*)&ui32);
    279291
    280292        unsigned int nfftBlocks = MultiDeviceBuffer.at(ch).size() / samps_per_buff;
     
    294306
    295307          // save the magnitude values as an OML blob
    296           oml.set_key_blob("Bins",(void*)&signal_mag_instant.front(),
    297                            (unsigned int)signal_mag_instant.size() * sizeof(float) );
    298 
    299           // Send OML measurement to OML server
     308          oml.set_mp_blob("Bins",(void*)&signal_mag_instant.front(),
     309                          (unsigned int)signal_mag_instant.size() * sizeof(float) );
     310
     311          // send all OML variables to server for recording
    300312          oml.insert();
    301313        }
    302314
    303         //oml.stop();  // Don't need this since it is called in the destructor.
     315      } // end for()
     316
     317
    304318 }}}
    305319
     
    309323=== View results from OML database ===
    310324
    311 The database  is store in /var/lib/oml2 of the console. Use the command line front-end tool (sqlite3) to query the database direct
    312 ly especially for binary data. For a detailed overview on sqlite3 CLI please refer ​http://www.sqlite.org/cli.html.
     325The database  is store in /var/lib/oml2 of the console. Use the command line front-end tool (sqlite3) to query the database directly. For a detailed overview on sqlite3 CLI please refer ​http://www.sqlite.org/cli.html.
    313326
    314327An application has been made to parse this database. This application is very specific to this tutorial. If the format of the data