Changeset 7381
- Timestamp:
- 04/30/08 14:33:05 (5 years ago)
- Location:
- ossiedev/branches/hvolos/ossie-sdrf2007/components/AGCwSWDIV
- Files:
-
- 1 added
- 1 modified
-
plothistory.m (added)
-
src/AGCwSWDIV.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ossiedev/branches/hvolos/ossie-sdrf2007/components/AGCwSWDIV/src/AGCwSWDIV.cpp
r7104 r7381 24 24 #include <string> 25 25 #include <iostream> 26 #include <fstream> 26 27 #include <math.h> 27 28 #include "AGCwSWDIV.h" … … 253 254 float avg_energy_ant1=0; 254 255 float noise_floor; 256 int max_hist=1000; 257 float value_history[max_hist][2]; 258 int hist_count=0; 259 int hist_index=0; 260 261 std::ofstream outfile; 255 262 256 263 … … 320 327 321 328 ant_energy=20.0f*log10f(ant_energy); 329 330 value_history[hist_index][0]=ant; 331 if (isinf(ant_energy)) 332 { 333 value_history[hist_index][1]=-50; 334 } 335 else 336 { 337 value_history[hist_index][1]=ant_energy; 338 } 339 hist_count++; 340 hist_index++; 341 if (hist_index>=max_hist) 342 { 343 hist_index=0; 344 } 345 346 if (hist_count>700) 347 { 348 outfile.open ("datahistory.txt",std::ios::out); 349 for (i=hist_index; i<max_hist;i++) 350 { 351 outfile<<value_history[i][0]<<","<<value_history[i][1]<<"\n"; 352 353 } 354 355 for (i=0; i<hist_index;i++) 356 { 357 outfile<<value_history[i][0]<<","<<value_history[i][1]<<"\n"; 358 359 } 360 361 362 outfile.close(); 363 hist_count=0; 364 } 322 365 323 366 … … 326 369 metadata->signal_strength =20.0f*log10f(energy/gain); 327 370 371 328 372 if (ant==0) 329 373 … … 331 375 //0 is the RX/TX port 332 376 ant_energy-=rx_ant_0_cal; 333 noise_floor=- 0-rx_ant_0_cal;377 noise_floor=-10-rx_ant_0_cal; 334 378 } 335 379 else 336 380 { 337 381 ant_energy-=rx_ant_1_cal; 338 noise_floor=- 0-rx_ant_1_cal;382 noise_floor=-10-rx_ant_1_cal; 339 383 } 340 384 341 385 342 386 343 387 //metadata->signal_strength =ant; 388 //DEBUG(3, AGCwSWDIV, "Ant Energy" <<ant_energy <<"dB " <<", Signal Strength:"<<metadata->signal_strength<<"dB, ant:"<<ant) 344 389 /** 345 346 if ((ant_energy>-noise_floor)&(!isinf(ant_energy))) 390 if ((ant_energy>noise_floor)&(!isinf(ant_energy))) 347 391 { 348 392 DEBUG(3, AGCwSWDIV, "Ant Energy" <<ant_energy <<"dB " <<", Signal Strength:"<<metadata->signal_strength<<"dB, ant:"<<ant) … … 375 419 std::cout<<"Ant 0 Avg. Energy:"<<avg_energy_ant0/count_ant0<<" dB "<<"Ant 1 Avg. Energy:"<<avg_energy_ant1/count_ant1<<" dB"<<std::endl; 376 420 } 377 */ //DEBUG(3, AGCwSWDIV, "Ant Energy" <<ant_energy <<"dB " <<", Signal Strength:"<<metadata->signal_strength<<"dB, ant:"<<ant) 421 **/ 422 //DEBUG(3, AGCwSWDIV, "Ant Energy" <<ant_energy <<"dB " <<", Signal Strength:"<<metadata->signal_strength<<"dB, ant:"<<ant) 378 423 379 424 if ((ant_energy<sw_ant_thresh)&(ant_energy>noise_floor)&(!isinf(ant_energy))) … … 387 432 ant=1; 388 433 389 //std::cout<<"ant:"<<ant<<"."; 434 // std::cout<<":"<<ant<<"."; 435 // rx_config[0].id = CORBA::string_dup("SET_RX_ANT_1"); 436 rx_config[0].value <<= (CORBA::ULong) ant; 437 //std::cout<<"Attempting to write to port"<<std::endl; 438 rx_control->set_values(rx_config); 439 390 440 } 391 441 … … 400 450 401 451 // empty input buffer 452 453 402 454 dataIn_0->bufferEmptied(); 403 455