1e3/RU2UE[ru_id][UE_id][CC_id]->sampling_rate,// sampling time (ns)
(double)PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB-66.227);// rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
#ifdef DEBUG_SIM
rx_pwr=signal_energy_fp(r_re0,r_im0,
nb_antennas_rx,
length<length_meas?length:length_meas,
0)/(12.0*frame_parms->N_RB_DL);
LOG_D(OCM,"[SIM][DL] UE %d : ADC in (RU %d) %f dBm/RE for subframe %d\n",
1e3/UE2RU[0][ru_id][CC_id]->sampling_rate,// sampling time (ns)
(double)RC.ru[ru_id]->max_rxgain-(double)RC.ru[ru_id]->att_rx-66.227);// rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
printf("-Q Activate and set the MBMS service: 0 : not used (default eMBMS disabled), 1: eMBMS and RRC Connection enabled, 2: eMBMS relaying and RRC Connection enabled, 3: eMBMS enabled, RRC Connection disabled, 4: eMBMS relaying enabled, RRC Connection disabled\n");
printf("-R [6,15,25,50,75,100] Sets N_RB_DL\n");
printf("-r Activates rate adaptation (DL for now)\n");
printf("-s snr_dB set a fixed (average) SNR, this deactivates the openair channel model generator (OCM)\n");
printf("-S snir_dB set a fixed (average) SNIR, this deactivates the openair channel model generator (OCM)\n");
printf("-t Gives a fixed UL mcs for eNB scheduler\n");
printf("-T activate the traffic generator. Valide options are m2m,scbr,mcbr,bcbr,auto_pilot,bicycle_race,open_arena,team_fortress,m2m_traffic,auto_pilot_l,auto_pilot_m,auto_pilot_h,auto_pilot_e,virtual_game_l,virtual_game_m,virtual_game_h,virtual_game_f,alarm_humidity,alarm_smoke,alarm_temperature,openarena_dl,openarena_ul,voip_g711,voip_g729,video_vbr_10mbps,video_vbr_4mbps,video_vbr_2mbp,video_vbr_768kbps,video_vbr_384kbps,video_vbr_192kpbs,background_users\n");
printf("-u Set the number of local UE\n");
printf("-U Set the mobility model for UE, options are: STATIC, RWP, RWALK\n");
printf("-V [vcd_file] Enable VCD dump into vcd_file\n");
printf("-w number of CBA groups, if not specified or zero, CBA is inactive\n");
#ifdef SMBV
printf("-W IP address to connect to Rohde&Schwarz SMBV100A and configure SMBV from config file. -W0 uses default IP 192.168.12.201\n");
#else
printf("-W [Rohde&Schwarz SMBV100A functions disabled. Recompile with SMBV=1]\n");
#endif
printf("-x deprecated. Set the transmission mode in config file!\n");
printf("-y Set the number of receive antennas at the UE (1 or 2)\n");
printf("-Y Set the global log verbosity (none, low, medium, high, full) \n");
printf("-z Set the cooperation flag (0 for no cooperation, 1 for delay diversity and 2 for distributed alamouti\n");
printf("-Z Reserved\n");
printf("--xforms Activate the grapical scope\n");
#if T_TRACER
printf("--T_port [port] use given port\n");
printf("--T_nowait don't wait for tracer, start immediately\n");
printf("--T_dont_fork to ease debugging with gdb\n");
AssertFatal(result==EXIT_SUCCESS,"Failed to free memory (%d)!\n",result);
}
}while(message_p!=NULL);
#endif
//Run the aperiodic user-defined events
if(oai_emulation.info.oeh_enabled==1)
execute_events(frame);
if(ue_connection_test==1){
if((frame%20)==0){
snr_dB+=snr_direction;
sinr_dB-=snr_direction;
}
if(snr_dB==-20){
snr_direction=snr_step;
}elseif(snr_dB==20){
snr_direction=-snr_step;
}
}
oai_emulation.info.frame=frame;
//oai_emulation.info.time_ms += 1;
oai_emulation.info.time_s+=0.01;// emu time in s, each frame lasts for 10 ms // JNote: TODO check the coherency of the time and frame (I corrected it to 10 (instead of 0.01)
//update_omg (frame); // frequency is defined in the omg_global params configurable by the user
LOG_D(EMU,"UE %d: DL simulation 1: UE_trx_read : current TS now %"PRIi64", last TS %"PRIi64"\n",UE_id,current_UE_rx_timestamp[UE_id][CC_id],last_UE_rx_timestamp[UE_id][CC_id]);
while(current_UE_rx_timestamp[UE_id][CC_id]<
(last_UE_rx_timestamp[UE_id][CC_id]+read_size)){
LOG_D(EMU,"UE %d: DL simulation 2: UE_trx_read : current TS %"PRIi64", last TS %"PRIi64", sleeping\n",UE_id,current_UE_rx_timestamp[UE_id][CC_id],last_UE_rx_timestamp[UE_id][CC_id]);
usleep(500);
}
LOG_D(EMU,"UE %d: DL simulation 3: UE_trx_read : current TS now %"PRIi64", last TS %"PRIi64"\n",UE_id,current_UE_rx_timestamp[UE_id][CC_id],last_UE_rx_timestamp[UE_id][CC_id]);
// to make channel reciprocal uncomment following line instead of previous. However this only works for SISO at the moment. For MIMO the channel would need to be transposed.
//UE2RU[UE_id][ru_id] = RU2UE[ru_id][UE_id];
AssertFatal(RU2UE[ru_id][UE_id][CC_id]!=NULL,"RU2UE[%d][%d][%d] is null\n",ru_id,UE_id,CC_id);
AssertFatal(UE2RU[UE_id][ru_id][CC_id]!=NULL,"UE2RU[%d][%d][%d] is null\n",UE_id,ru_id,CC_id);
//pathloss: -132.24 dBm/15kHz RE + target SNR - eNB TX power per RE
update_omg_model(event.key,event.value);//implement it with assigning the new values to that of oai_emulation & second thing is to ensure mob model is always read from oai_emulation
td_avg=(int)(((K*(long)td)+(((1<<3)-K)*((long)td_avg)))>>3);// in us
LOG_T(EMU,"sleep frame %d, time_now %ldus,time_last %ldus,average time difference %ldns, CURRENT TIME DIFF %dus, avgerage difference from the target %dus\n",
LOG_D(EMU,"Faster than realtime increase the avg sleep time for %d us, frame %d\n",
sleep_time_us,frame);
// LOG_D(EMU,"Faster than realtime increase the avg sleep time for %d us, frame %d, time_now %ldus,time_last %ldus,average time difference %ldns, CURRENT TIME DIFF %dus, avgerage difference from the target %dus\n", sleep_time_us,frame, time_now,time_last,td_avg, td/1000,(td_avg-TARGET_SF_TIME_NS)/1000);
LOG_D(EMU,"Slower than realtime reduce the avg sleep time for %d us, frame %d, time_now\n",
sleep_time_us,frame);
//LOG_T(EMU,"Slower than realtime reduce the avg sleep time for %d us, frame %d, time_now %ldus,time_last %ldus,average time difference %ldns, CURRENT TIME DIFF %dus, avgerage difference from the target %dus\n", sleep_time_us,frame, time_now,time_last,td_avg, td/1000,(td_avg-TARGET_SF_TIME_NS)/1000);
}
}// end if next_slot%2
slot++;
if(slot==20){//Frame's Epilogue
frame++;
slot=0;
// if n_frames not set by the user or is greater than max num frame then set adjust the frame counter