| 296 | | In the [next part of this tutorial] we'll edit the the receiving sdr application to store measured data to a remote network Influx database. |
| 297 | | |
| | 296 | In the [next part] we'll briefly show how to access measure data on Influx DB. |
| | 297 | |
| | 298 | === View recorded data parameters in Influx DB using Grafana === |
| | 299 | |
| | 300 | On the receiving side sdrapp, enable the OML recording capability by recompiling the application with the _USE_OML_ flag. (If the application is still running, be sure to stop the application by doing Ctrl-C and exit out of the node back to the console again.) |
| | 301 | |
| | 302 | Edit the Makefile by adding ''-D_USE_OML_'' at the end of CPPFLAGS. |
| | 303 | |
| | 304 | {{{#!shell |
| | 305 | CPPFLAGS ?= $(INC_FLAGS) -MMD -MP -Ofast --fast-math -finline-functions -std=c++11 -D_USE_OML_ |
| | 306 | }}} |
| | 307 | |
| | 308 | Now rebuild the application from the console. This enables the recording of paramters displayed on the console into Influx DB - namely: seq_num, pkt_len, corr_strength. These values will be written to InFlux DB under a database name ''collectd'' and a sender id ''rx_data_link_0''. |
| | 309 | |
| | 310 | {{{#!shell-session |
| | 311 | user@console:~$ make remote-make |
| | 312 | }}} |
| | 313 | |
| | 314 | |
| | 315 | We'll run the application for a longer duration so a large set of values are recorded for viewing. Edit the ''run_data_script.sh'' script so the receive and transmit handlers are run for 2000 seconds. |
| | 316 | |
| | 317 | {{{#!shell |
| | 318 | ## BEGIN data transfer |
| | 319 | ## Invoke receive handler |
| | 320 | ## rxsig_data <runtime_in_milliseconds> <correlation threshold> |
| | 321 | python rc.py $RXNODE 5180 "rxsig_data 2000000 10000" |
| | 322 | |
| | 323 | |
| | 324 | ## Invoke transmit handler |
| | 325 | ## txsig_data <runtime_in_milliseconds> <delay_between_burst_in_msec> |
| | 326 | python rc.py $TXNODE 5180 "txsig_data 2000000 1000" |
| | 327 | |
| | 328 | echo "DONE!" |
| | 329 | }}} |
| | 330 | |
| | 331 | Rerun both applications also make sure the RF front end is turned on. The receiver will record the paramters for each detected packet. |
| | 332 | {{{#!shell |
| | 333 | user@console:~$ curl "am1.cosmos-lab.org:5054/rf_control/set_tx_path?node=sdr2-s3-lg1.bed.cosmos-lab.org&rf_port=0&power_amp=on&f_lower=2500&f_upper=2680" |
| | 334 | }}} |
| | 335 | |
| | 336 | The recorded values can be queried from the console with a call to the [https://docs.influxdata.com/influxdb/v1.7/guides/querying_data/ InfluxDB API]. |
| | 337 | |
| | 338 | {{{#!shell |
| | 339 | curl -XPOST 'http://idb2:8086/query?db=collectd&pretty=true' --data-binary 'q=select * from _mp__collectd' |
| | 340 | : |
| | 341 | "results": [ |
| | 342 | { |
| | 343 | "statement_id": 0, |
| | 344 | "series": [ |
| | 345 | { |
| | 346 | "name": "_mp__collectd", |
| | 347 | "columns": [ |
| | 348 | "time", |
| | 349 | "corr_threshold", |
| | 350 | "pkt_len", |
| | 351 | "sender_id", |
| | 352 | "seq_no", |
| | 353 | "seq_num", |
| | 354 | "time_stamp", |
| | 355 | "time_stamp_server" |
| | 356 | ], |
| | 357 | "values": [ |
| | 358 | [ |
| | 359 | "2020-06-16T15:44:04.310022857Z", |
| | 360 | 32221.601562, |
| | 361 | 7, |
| | 362 | "rx_data_link_0", |
| | 363 | "1", |
| | 364 | 1, |
| | 365 | "2.266386", |
| | 366 | "2.309666" |
| | 367 | ], |
| | 368 | |
| | 369 | : |
| | 370 | : |
| | 371 | : |
| | 372 | [ |
| | 373 | "2020-06-16T16:17:20.274931375Z", |
| | 374 | 35238.019531, |
| | 375 | 2, |
| | 376 | "rx_data_link_0", |
| | 377 | "2049", |
| | 378 | 205, |
| | 379 | "1998.270517", |
| | 380 | "1998.274432" |
| | 381 | ], |
| | 382 | [ |
| | 383 | "2020-06-16T16:17:21.276384485Z", |
| | 384 | 35233.40625, |
| | 385 | 63, |
| | 386 | "rx_data_link_0", |
| | 387 | "2050", |
| | 388 | 206, |
| | 389 | "1999.272047", |
| | 390 | "1999.276026" |
| | 391 | ], |
| | 392 | [ |
| | 393 | "2020-06-16T16:17:22.276512538Z", |
| | 394 | 35226.476562, |
| | 395 | 34, |
| | 396 | "rx_data_link_0", |
| | 397 | "2051", |
| | 398 | 207, |
| | 399 | "2000.272036", |
| | 400 | "2000.276081" |
| | 401 | ] |
| | 402 | |
| | 403 | : |
| | 404 | }}} |
| | 405 | |
| | 406 | |
| | 407 | The recorded values can also be view on a web browser using Grafana as the front end. In order to have the web browser access the Grafana server, a tunnel was created from localhost port 3000 to idb2:3000. |
| | 408 | |
| | 409 | Following is a trace of the correlation threshold. |
| | 410 | [[Image(wiki:WikiFormatting:influx_corr_thresh)]] |
| | 411 | |
| | 412 | At the end of you session remember to turn off the RF front end with the following command. |
| | 413 | |
| | 414 | {{{#!shell-session |
| | 415 | user@console:~$ curl "am1.cosmos-lab.org:5054/rf_control/set_tx_path?node=sdr2-s3-lg1.bed.cosmos-lab.org&rf_port=0&power_amp=off" |
| | 416 | <response status="OK"> |
| | 417 | <message>OK</message> |
| | 418 | </response> |
| | 419 | }}} |