print_stats.c 50.7 KB
Newer Older
1
/*******************************************************************************
2
    OpenAirInterface
ghaddab's avatar
ghaddab committed
3
    Copyright(c) 1999 - 2014 Eurecom
4

ghaddab's avatar
ghaddab committed
5 6 7 8
    OpenAirInterface is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
9 10


ghaddab's avatar
ghaddab committed
11 12 13 14
    OpenAirInterface is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
15

ghaddab's avatar
ghaddab committed
16
    You should have received a copy of the GNU General Public License
17 18
    along with OpenAirInterface.The full GNU General Public License is
   included in this distribution in the file called "COPYING". If not,
ghaddab's avatar
ghaddab committed
19
   see <http://www.gnu.org/licenses/>.
20 21

  Contact Information
ghaddab's avatar
ghaddab committed
22 23
  OpenAirInterface Admin: openair_admin@eurecom.fr
  OpenAirInterface Tech : openair_tech@eurecom.fr
24
  OpenAirInterface Dev  : openair4g-devel@lists.eurecom.fr
25

ghaddab's avatar
ghaddab committed
26
  Address      : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
27

ghaddab's avatar
ghaddab committed
28
 *******************************************************************************/
29 30 31

/*! \file PHY/LTE_TRANSPORT/print_stats.c
* \brief PHY statstic logging function
32
* \author R. Knopp, F. Kaltenberger, navid nikaein
33 34 35
* \date 2011
* \version 0.1
* \company Eurecom
36
* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr, navid.nikaein@eurecom.fr
37 38 39 40 41 42 43 44 45 46
* \note
* \warning
*/

#include "PHY/LTE_TRANSPORT/proto.h"

#include "PHY/defs.h"
#include "PHY/extern.h"
#include "SCHED/extern.h"

47 48
#ifdef OPENAIR2
#include "../openair2/LAYER2/MAC/proto.h"
49
#include "../openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
50
#endif
51 52

extern int mac_get_rrc_status(uint8_t Mod_id,uint8_t eNB_flag,uint8_t index);
Florian Kaltenberger's avatar
Florian Kaltenberger committed
53
#if defined(OAI_USRP) || defined(EXMIMO) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
54 55
#include "common_lib.h"
extern openair0_config_t openair0_cfg[];
56 57
#endif

58 59
int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t mode, int input_level_dBm)
{
60

gauthier's avatar
gauthier committed
61 62
  uint8_t eNB=0;
  uint32_t RRC_status;
63 64 65 66 67 68
  int len=length;

  if (phy_vars_ue==NULL)
    return 0;

  if ((mode == normal_txrx) || (mode == no_L2_connect)) {
69
    len += sprintf(&buffer[len], "[UE_PROC] UE %d, RNTI %x\n",phy_vars_ue->Mod_id, phy_vars_ue->lte_ue_pdcch_vars[0]->crnti);
70
     len += sprintf(&buffer[len],"[UE PROC] RSRP[0] %.2f dBm/RE, RSSI %.2f dBm, RSRQ[0] %.2f dB, N0 %d dBm/RE (NF %.1f dB)\n",
71 72 73
		    10*log10(phy_vars_ue->PHY_measurements.rsrp[0])-phy_vars_ue->rx_total_gain_dB,
		    10*log10(phy_vars_ue->PHY_measurements.rssi)-phy_vars_ue->rx_total_gain_dB, 
		    10*log10(phy_vars_ue->PHY_measurements.rsrq[0]),
74 75
		    phy_vars_ue->PHY_measurements.n0_power_tot_dBm,
		    (double)phy_vars_ue->PHY_measurements.n0_power_tot_dBm+132.24);
76 77

    /*
78
    len += sprintf(&buffer[len],
79
                   "[UE PROC] Frame count: %d\neNB0 RSSI %d dBm/RE (%d dB, %d dB)\neNB1 RSSI %d dBm/RE (%d dB, %d dB)neNB2 RSSI %d dBm/RE (%d dB, %d dB)\nN0 %d dBm/RE, %f dBm/%dPRB (%d dB, %d dB)\n",
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
                   phy_vars_ue->frame_rx,
                   phy_vars_ue->PHY_measurements.rx_rssi_dBm[0],
                   phy_vars_ue->PHY_measurements.rx_power_dB[0][0],
                   phy_vars_ue->PHY_measurements.rx_power_dB[0][1],
                   phy_vars_ue->PHY_measurements.rx_rssi_dBm[1],
                   phy_vars_ue->PHY_measurements.rx_power_dB[1][0],
                   phy_vars_ue->PHY_measurements.rx_power_dB[1][1],
                   phy_vars_ue->PHY_measurements.rx_rssi_dBm[2],
                   phy_vars_ue->PHY_measurements.rx_power_dB[2][0],
                   phy_vars_ue->PHY_measurements.rx_power_dB[2][1],
                   phy_vars_ue->PHY_measurements.n0_power_tot_dBm,
                   phy_vars_ue->PHY_measurements.n0_power_tot_dBm+10*log10(12*phy_vars_ue->lte_frame_parms.N_RB_DL),
                   phy_vars_ue->lte_frame_parms.N_RB_DL,
                   phy_vars_ue->PHY_measurements.n0_power_dB[0],
                   phy_vars_ue->PHY_measurements.n0_power_dB[1]);
95 96
    */

97
#ifdef EXMIMO
98
    len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB (LNA %d, vga %d dB)\n",phy_vars_ue->rx_total_gain_dB, openair0_cfg[0].rxg_mode[0],(int)openair0_cfg[0].rx_gain[0]);
99
#endif
Florian Kaltenberger's avatar
Florian Kaltenberger committed
100
#if defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
101
    len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB\n",phy_vars_ue->rx_total_gain_dB);
102
#endif
Florian Kaltenberger's avatar
Florian Kaltenberger committed
103
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
104 105
    len += sprintf(&buffer[len], "[UE_PROC] Frequency offset %d Hz (%d), estimated carrier frequency %f Hz\n",phy_vars_ue->lte_ue_common_vars.freq_offset,openair_daq_vars.freq_offset,openair0_cfg[0].rx_freq[0]-phy_vars_ue->lte_ue_common_vars.freq_offset);
#endif
106 107
    len += sprintf(&buffer[len], "[UE PROC] UE mode = %s (%d)\n",mode_string[phy_vars_ue->UE_mode[0]],phy_vars_ue->UE_mode[0]);
    len += sprintf(&buffer[len], "[UE PROC] timing_advance = %d\n",phy_vars_ue->timing_advance);
knopp's avatar
knopp committed
108 109
    if (phy_vars_ue->UE_mode[0]==PUSCH) {
      len += sprintf(&buffer[len], "[UE PROC] Po_PUSCH = %d dBm (PL %d dB, Po_NOMINAL_PUSCH %d dBm, PHR %d dB)\n", 
Florian Kaltenberger's avatar
Florian Kaltenberger committed
110
		     phy_vars_ue->ulsch_ue[0]->Po_PUSCH,
knopp's avatar
knopp committed
111
		     get_PL(phy_vars_ue->Mod_id,phy_vars_ue->CC_id,0),
Florian Kaltenberger's avatar
Florian Kaltenberger committed
112 113
		     phy_vars_ue->lte_frame_parms.ul_power_control_config_common.p0_NominalPUSCH,
		     phy_vars_ue->ulsch_ue[0]->PHR);
knopp's avatar
knopp committed
114 115 116
      len += sprintf(&buffer[len], "[UE PROC] Po_PUCCH = %d dBm (Po_NOMINAL_PUCCH %d dBm, g_pucch %d dB)\n", 
		     get_PL(phy_vars_ue->Mod_id,phy_vars_ue->CC_id,0)+
		     phy_vars_ue->lte_frame_parms.ul_power_control_config_common.p0_NominalPUCCH+
117
		     phy_vars_ue->dlsch_ue[0][0]->g_pucch,
knopp's avatar
knopp committed
118
		     phy_vars_ue->lte_frame_parms.ul_power_control_config_common.p0_NominalPUCCH,
119
		     phy_vars_ue->dlsch_ue[0][0]->g_pucch);
knopp's avatar
knopp committed
120
    }
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476
    //for (eNB=0;eNB<NUMBER_OF_eNB_MAX;eNB++) {
    for (eNB=0; eNB<1; eNB++) {
      len += sprintf(&buffer[len], "[UE PROC] RX spatial power eNB%d: [%d %d; %d %d] dB\n",
                     eNB,
                     phy_vars_ue->PHY_measurements.rx_spatial_power_dB[eNB][0][0],
                     phy_vars_ue->PHY_measurements.rx_spatial_power_dB[eNB][0][1],
                     phy_vars_ue->PHY_measurements.rx_spatial_power_dB[eNB][1][0],
                     phy_vars_ue->PHY_measurements.rx_spatial_power_dB[eNB][1][1]);

      len += sprintf(&buffer[len], "[UE PROC] RX total power eNB%d: %d dB, avg: %d dB\n",eNB,phy_vars_ue->PHY_measurements.rx_power_tot_dB[eNB],phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB]);
      len += sprintf(&buffer[len], "[UE PROC] RX total power lin: %d, avg: %d, RX total noise lin: %d, avg: %d\n",phy_vars_ue->PHY_measurements.rx_power_tot[eNB],
                     phy_vars_ue->PHY_measurements.rx_power_avg[eNB], phy_vars_ue->PHY_measurements.n0_power_tot, phy_vars_ue->PHY_measurements.n0_power_avg);
      len += sprintf(&buffer[len], "[UE PROC] effective SINR %.2f dB\n",phy_vars_ue->sinr_eff);
      len += sprintf(&buffer[len], "[UE PROC] Wideband CQI eNB %d: %d dB, avg: %d dB\n",eNB,phy_vars_ue->PHY_measurements.wideband_cqi_tot[eNB],phy_vars_ue->PHY_measurements.wideband_cqi_avg[eNB]);

      switch (phy_vars_ue->lte_frame_parms.N_RB_DL) {
      case 6:
        len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d] dB\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][0],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][1],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][2],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][3],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][4],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][5]);


        len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d] dB\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][0],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][1],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][2],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][3],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][4],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][5]);


        len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][0][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][0][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][1][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][1][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][2][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][2][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][3][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][3][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][4][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][4][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][5][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][5][0]);

        len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][0][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][0][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][1][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][1][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][2][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][2][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][3][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][3][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][4][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][4][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][5][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][5][1]);

        len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d]\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][0],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][1],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][2],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][3],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][4],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][5]);

        len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&phy_vars_ue->PHY_measurements,eNB,6)));
        len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB,
                       pmi2hex_2Ar1(quantize_subband_pmi2(&phy_vars_ue->PHY_measurements,eNB,0,6)),
                       pmi2hex_2Ar1(quantize_subband_pmi2(&phy_vars_ue->PHY_measurements,eNB,1,6)));
        break;

      case 25:
        len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d %d] dB\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][0],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][1],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][2],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][3],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][4],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][5],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][6]);

        len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d %d] dB\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][0],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][1],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][2],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][3],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][4],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][5],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][6]);


        len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][0][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][0][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][1][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][1][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][2][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][2][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][3][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][3][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][4][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][4][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][5][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][5][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][6][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][6][0]);

        len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][0][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][0][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][1][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][1][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][2][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][2][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][3][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][3][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][4][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][4][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][5][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][5][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][6][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][6][1]);

        len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d %d]\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][0],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][1],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][2],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][3],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][4],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][5],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][6]);

        len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&phy_vars_ue->PHY_measurements,eNB,7)));
        len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB,
                       pmi2hex_2Ar1(quantize_subband_pmi2(&phy_vars_ue->PHY_measurements,eNB,0,7)),
                       pmi2hex_2Ar1(quantize_subband_pmi2(&phy_vars_ue->PHY_measurements,eNB,1,7)));
        break;

      case 50:
        len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d %d %d %d] dB\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][0],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][1],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][2],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][3],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][4],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][5],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][6],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][7],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][8]);

        len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d %d %d %d] dB\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][0],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][1],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][2],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][3],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][4],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][5],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][6],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][7],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][8]);


        len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][0][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][0][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][1][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][1][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][2][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][2][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][3][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][3][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][4][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][4][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][5][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][5][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][6][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][6][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][7][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][7][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][8][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][8][0]);

        len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][0][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][0][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][1][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][1][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][2][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][2][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][3][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][3][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][4][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][4][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][5][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][5][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][6][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][6][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][7][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][7][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][8][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][8][1]);

        len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d %d %d %d]\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][0],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][1],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][2],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][3],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][4],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][5],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][6],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][7],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][8]);

        len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&phy_vars_ue->PHY_measurements,eNB,9)));
        len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB,
                       pmi2hex_2Ar1(quantize_subband_pmi2(&phy_vars_ue->PHY_measurements,eNB,0,9)),
                       pmi2hex_2Ar1(quantize_subband_pmi2(&phy_vars_ue->PHY_measurements,eNB,1,9)));
        break;

      case 100:
        len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d %d %d %d %d %d %d %d] dB\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][0],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][1],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][2],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][3],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][4],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][5],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][6],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][7],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][8],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][9],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][10],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][11],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][0][12]);

        len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d %d %d %d %d %d %d %d] dB\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][0],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][1],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][2],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][3],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][4],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][5],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][6],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][7],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][8],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][9],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][10],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][11],
                       phy_vars_ue->PHY_measurements.subband_cqi_dB[eNB][1][12]);


        len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][0][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][0][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][1][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][1][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][2][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][2][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][3][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][3][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][4][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][4][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][5][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][5][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][6][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][6][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][7][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][7][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][8][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][8][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][9][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][9][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][10][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][10][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][11][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][11][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][12][0],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][12][0]);

        len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][0][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][0][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][1][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][1][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][2][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][2][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][3][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][3][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][4][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][4][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][5][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][5][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][6][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][6][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][7][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][7][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][8][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][8][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][9][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][9][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][10][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][10][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][11][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][11][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_re[eNB][12][1],
                       phy_vars_ue->PHY_measurements.subband_pmi_im[eNB][12][1]);

        len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d %d %d %d %d %d %d %d]\n",
                       eNB,
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][0],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][1],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][2],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][3],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][4],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][5],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][6],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][7],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][8],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][9],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][10],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][11],
                       phy_vars_ue->PHY_measurements.selected_rx_antennas[eNB][12]);

        len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&phy_vars_ue->PHY_measurements,eNB,13)));
        len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB,
                       pmi2hex_2Ar1(quantize_subband_pmi2(&phy_vars_ue->PHY_measurements,eNB,0,13)),
                       pmi2hex_2Ar1(quantize_subband_pmi2(&phy_vars_ue->PHY_measurements,eNB,1,13)));
        break;
      }

#ifdef OPENAIR2
477
      RRC_status = mac_UE_get_rrc_status(phy_vars_ue->Mod_id, 0);
478 479
      len += sprintf(&buffer[len],"[UE PROC] RRC status = %d\n",RRC_status);
#endif
480

481
 
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502
      len += sprintf(&buffer[len], "[UE PROC] Transmission Mode %d (mode1_flag %d)\n",phy_vars_ue->transmission_mode[eNB],phy_vars_ue->lte_frame_parms.mode1_flag);
      len += sprintf(&buffer[len], "[UE PROC] PBCH err conseq %d, PBCH error total %d, PBCH FER %d\n",
                     phy_vars_ue->lte_ue_pbch_vars[eNB]->pdu_errors_conseq,
                     phy_vars_ue->lte_ue_pbch_vars[eNB]->pdu_errors,
                     phy_vars_ue->lte_ue_pbch_vars[eNB]->pdu_fer);

      if (phy_vars_ue->transmission_mode[eNB] == 6)
        len += sprintf(&buffer[len], "[UE PROC] Mode 6 Wideband CQI eNB %d : %d dB\n",eNB,phy_vars_ue->PHY_measurements.precoded_cqi_dB[eNB][0]);

      if (phy_vars_ue->dlsch_ue[0] && phy_vars_ue->dlsch_ue[0][0] && phy_vars_ue->dlsch_ue[0][1]) {
        len += sprintf(&buffer[len], "[UE PROC] Saved PMI for DLSCH eNB %d : %jx (%p)\n",eNB,pmi2hex_2Ar1(phy_vars_ue->dlsch_ue[0][0]->pmi_alloc),phy_vars_ue->dlsch_ue[0][0]);

        len += sprintf(&buffer[len], "[UE PROC] eNB %d: dl_power_off = %d\n",eNB,phy_vars_ue->dlsch_ue[0][0]->harq_processes[0]->dl_power_off);

        len += sprintf(&buffer[len], "[UE PROC] DL mcs1 (dlsch cw1) %d\n",phy_vars_ue->dlsch_ue[0][0]->harq_processes[0]->mcs);
        len += sprintf(&buffer[len], "[UE PROC] DL mcs2 (dlsch cw2) %d\n",phy_vars_ue->dlsch_ue[0][1]->harq_processes[0]->mcs);
      }

      len += sprintf(&buffer[len], "[UE PROC] DLSCH Total %d, Error %d, FER %d\n",phy_vars_ue->dlsch_received[0],phy_vars_ue->dlsch_errors[0],phy_vars_ue->dlsch_fer[0]);
      len += sprintf(&buffer[len], "[UE PROC] DLSCH (SI) Total %d, Error %d\n",phy_vars_ue->dlsch_SI_received[0],phy_vars_ue->dlsch_SI_errors[0]);
      len += sprintf(&buffer[len], "[UE PROC] DLSCH (RA) Total %d, Error %d\n",phy_vars_ue->dlsch_ra_received[0],phy_vars_ue->dlsch_ra_errors[0]);
503
#ifdef Rel10
504 505 506 507 508 509 510 511 512
      int i=0;

      //len += sprintf(&buffer[len], "[UE PROC] MCH  Total %d\n", phy_vars_ue->dlsch_mch_received[0]);
      for(i=0; i <phy_vars_ue->lte_frame_parms.num_MBSFN_config; i++ ) {
        len += sprintf(&buffer[len], "[UE PROC] MCH (MCCH MBSFN %d) Total %d, Error %d, Trials %d\n",
                       i, phy_vars_ue->dlsch_mcch_received[i][0],phy_vars_ue->dlsch_mcch_errors[i][0],phy_vars_ue->dlsch_mcch_trials[i][0]);
        len += sprintf(&buffer[len], "[UE PROC] MCH (MTCH MBSFN %d) Total %d, Error %d, Trials %d\n",
                       i, phy_vars_ue->dlsch_mtch_received[i][0],phy_vars_ue->dlsch_mtch_errors[i][0],phy_vars_ue->dlsch_mtch_trials[i][0]);
      }
513

514 515 516 517
#endif
      len += sprintf(&buffer[len], "[UE PROC] DLSCH Bitrate %dkbps\n",(phy_vars_ue->bitrate[0]/1000));
      len += sprintf(&buffer[len], "[UE PROC] Total Received Bits %dkbits\n",(phy_vars_ue->total_received_bits[0]/1000));
      len += sprintf(&buffer[len], "[UE PROC] IA receiver %d\n",openair_daq_vars.use_ia_receiver);
518

519 520 521
    }

  } else {
522
    len += sprintf(&buffer[len], "[UE PROC] Frame count: %d, RSSI %3.2f dB (%d dB, %d dB), N0 %3.2f dB (%d dB, %d dB)\n",
523 524 525 526 527 528 529
                   phy_vars_ue->frame_rx,
                   10*log10(phy_vars_ue->PHY_measurements.rssi),
                   phy_vars_ue->PHY_measurements.rx_power_dB[0][0],
                   phy_vars_ue->PHY_measurements.rx_power_dB[0][1],
                   10*log10(phy_vars_ue->PHY_measurements.n0_power_tot),
                   phy_vars_ue->PHY_measurements.n0_power_dB[0],
                   phy_vars_ue->PHY_measurements.n0_power_dB[1]);
530 531
#ifdef EXMIMO
    phy_vars_ue->rx_total_gain_dB = ((int)(10*log10(phy_vars_ue->PHY_measurements.rssi)))-input_level_dBm;
532
    len += sprintf(&buffer[len], "[UE PROC] rxg_mode %d, input level (set by user) %d dBm, VGA gain %d dB ==> total gain %3.2f dB, noise figure %3.2f dB\n",
533 534 535 536 537
                   openair0_cfg[0].rxg_mode[0],
                   input_level_dBm,
                   (int)openair0_cfg[0].rx_gain[0],
                   10*log10(phy_vars_ue->PHY_measurements.rssi)-input_level_dBm,
                   10*log10(phy_vars_ue->PHY_measurements.n0_power_tot)-phy_vars_ue->rx_total_gain_dB+105);
538 539 540 541 542 543 544 545
#endif
  }

  len += sprintf(&buffer[len],"EOF\n");

  return len;
} // is_clusterhead

546

547 548
int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length)
{
549 550

  unsigned int success=0;
gauthier's avatar
gauthier committed
551
  uint8_t eNB,UE_id,i,j,number_of_cards_l=1;
552
  uint32_t ulsch_errors=0,dlsch_errors=0;
553 554
  uint32_t ulsch_round_attempts[4]= {0,0,0,0},ulsch_round_errors[4]= {0,0,0,0};
  uint32_t dlsch_round_attempts[4]= {0,0,0,0},dlsch_round_errors[4]= {0,0,0,0};
gauthier's avatar
gauthier committed
555
  uint32_t UE_id_mac, RRC_status;
556

557 558 559 560 561 562 563 564 565 566 567
  if (phy_vars_eNB==NULL)
    return 0;

  int len = length;

  //  if(phy_vars_eNB->frame==0){
  phy_vars_eNB->total_dlsch_bitrate = 0;//phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_bitrate + phy_vars_eNB->total_dlsch_bitrate;
  phy_vars_eNB->total_transmitted_bits = 0;// phy_vars_eNB->eNB_UE_stats[UE_id].total_transmitted_bits +  phy_vars_eNB->total_transmitted_bits;
  phy_vars_eNB->total_system_throughput = 0;//phy_vars_eNB->eNB_UE_stats[UE_id].total_transmitted_bits + phy_vars_eNB->total_system_throughput;
  // }

568
  for (eNB=0; eNB<number_of_cards_l; eNB++) {
569
    len += sprintf(&buffer[len],"[eNB PROC] eNB %d/%d Frame %d: RX Gain %d dB, I0 %d dBm (%d,%d) dB \n",
570 571 572 573 574 575 576
                   eNB,number_of_cards_l,
                   phy_vars_eNB->proc[0].frame_tx,
                   phy_vars_eNB->rx_total_gain_eNB_dB,
                   phy_vars_eNB->PHY_measurements_eNB[eNB].n0_power_tot_dBm,
                   phy_vars_eNB->PHY_measurements_eNB[eNB].n0_power_dB[0],
                   phy_vars_eNB->PHY_measurements_eNB[eNB].n0_power_dB[1]);

577 578 579
    len += sprintf(&buffer[len],"[eNB PROC] PRB I0 (%X.%X.%X.%X): ",
		   phy_vars_eNB->rb_mask_ul[0],
		   phy_vars_eNB->rb_mask_ul[1],phy_vars_eNB->rb_mask_ul[2],phy_vars_eNB->rb_mask_ul[3]);
580

581
    for (i=0; i<phy_vars_eNB->lte_frame_parms.N_RB_UL; i++) {
582 583
      len += sprintf(&buffer[len],"%4d ",
                     phy_vars_eNB->PHY_measurements_eNB[eNB].n0_subband_power_tot_dBm[i]);
584
      if ((i>0) && ((i%25) == 0)) 
Florian Kaltenberger's avatar
Florian Kaltenberger committed
585
	len += sprintf(&buffer[len],"\n");
586
    }
587 588 589 590 591 592 593 594
    len += sprintf(&buffer[len],"\n");
    len += sprintf(&buffer[len],"\n[eNB PROC] PERFORMANCE PARAMETERS\n");
    /*
    len += sprintf(&buffer[len],"[eNB PROC] Total DLSCH Bitrate for the System %dkbps\n",((phy_vars_eNB->eNB_UE_stats[0].dlsch_bitrate + phy_vars_eNB->eNB_UE_stats[1].dlsch_bitrate)/1000));
    len += sprintf(&buffer[len],"[eNB PROC] Total Bits successfully transitted %dKbits in %dframe(s)\n",((phy_vars_eNB->eNB_UE_stats[0].total_transmitted_bits + phy_vars_eNB->eNB_UE_stats[1].total_transmitted_bits)/1000),phy_vars_eNB->frame+1);
    len += sprintf(&buffer[len],"[eNB PROC] Average System Throughput %dKbps\n",(phy_vars_eNB->eNB_UE_stats[0].total_transmitted_bits + phy_vars_eNB->eNB_UE_stats[1].total_transmitted_bits)/((phy_vars_eNB->frame+1)*10));
    */

595
    for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
596
#ifdef OPENAIR2
597

gauthier's avatar
gauthier committed
598
      if (phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->rnti>0) {
599 600 601 602 603 604 605
        phy_vars_eNB->total_dlsch_bitrate = phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_bitrate + phy_vars_eNB->total_dlsch_bitrate;
        phy_vars_eNB->total_transmitted_bits = phy_vars_eNB->eNB_UE_stats[UE_id].total_TBS + phy_vars_eNB->total_transmitted_bits;

        //phy_vars_eNB->total_system_throughput = phy_vars_eNB->eNB_UE_stats[UE_id].total_transmitted_bits + phy_vars_eNB->total_system_throughput;
        if (phy_vars_eNB->eNB_UE_stats[UE_id].mode == PUSCH)
          for (i=0; i<8; i++)
            success = success + (phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_trials[i][0] - phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_l2_errors[i]);
606
      }
607

608 609
#else
      phy_vars_eNB->total_dlsch_bitrate = phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_bitrate + phy_vars_eNB->total_dlsch_bitrate;
Florian Kaltenberger's avatar
Florian Kaltenberger committed
610
      phy_vars_eNB->total_transmitted_bits = phy_vars_eNB->eNB_UE_stats[UE_id].total_TBS +  phy_vars_eNB->total_transmitted_bits;
611

Florian Kaltenberger's avatar
Florian Kaltenberger committed
612
      //phy_vars_eNB->total_system_throughput = phy_vars_eNB->eNB_UE_stats[UE_id].total_transmitted_bits + phy_vars_eNB->total_system_throughput;
613 614 615
      for (i=0; i<8; i++)
        success = success + (phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_trials[i][0] - phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_l2_errors[i]);

616 617 618
#endif
    }

knopp's avatar
 
knopp committed
619
    len += sprintf(&buffer[len],"[eNB PROC] Total DLSCH bits successfully transmitted %d kbits in %d frame(s)\n",(phy_vars_eNB->total_transmitted_bits/1000),phy_vars_eNB->proc[0].frame_tx+1);
Florian Kaltenberger's avatar
Florian Kaltenberger committed
620
    len += sprintf(&buffer[len],"[eNB PROC] Total DLSCH average system throughput %d kbps\n",(phy_vars_eNB->total_dlsch_bitrate/1000));
knopp's avatar
 
knopp committed
621
    len += sprintf(&buffer[len],"[eNB PROC] Total DLSCH successful transmissions %d in %d frame(s)\n",success,phy_vars_eNB->proc[0].frame_tx+1);
622 623 624
    //len += sprintf(&buffer[len],"[eNB PROC] FULL MU-MIMO Transmissions/Total Transmissions = %d/%d\n",phy_vars_eNB->FULL_MUMIMO_transmissions,phy_vars_eNB->check_for_total_transmissions);
    //len += sprintf(&buffer[len],"[eNB PROC] MU-MIMO Transmissions/Total Transmissions = %d/%d\n",phy_vars_eNB->check_for_MUMIMO_transmissions,phy_vars_eNB->check_for_total_transmissions);
    //len += sprintf(&buffer[len],"[eNB PROC] SU-MIMO Transmissions/Total Transmissions = %d/%d\n",phy_vars_eNB->check_for_SUMIMO_transmissions,phy_vars_eNB->check_for_total_transmissions);
625

626
  }
627

628 629
  len += sprintf(&buffer[len],"\n");

630
  for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
631
#ifdef OPENAIR2
632

gauthier's avatar
gauthier committed
633
    if (phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->rnti>0) {
634
#endif
knopp's avatar
knopp committed
635
      len += sprintf(&buffer[len],"[eNB PROC] UE %d (%x) Power: (%d,%d) dB, Po_PUSCH: (%d,%d) dBm, Po_PUCCH (%d/%d) dBm, Po_PUCCH1 (%d,%d) dBm,  PUCCH1 Thres %d dBm \n",
636 637 638 639 640 641
                     UE_id,
                     phy_vars_eNB->eNB_UE_stats[UE_id].crnti,
                     dB_fixed(phy_vars_eNB->lte_eNB_pusch_vars[UE_id]->ulsch_power[0]),
                     dB_fixed(phy_vars_eNB->lte_eNB_pusch_vars[UE_id]->ulsch_power[1]),
                     phy_vars_eNB->eNB_UE_stats[UE_id].UL_rssi[0],
                     phy_vars_eNB->eNB_UE_stats[UE_id].UL_rssi[1],
642
		     dB_fixed(phy_vars_eNB->eNB_UE_stats[UE_id].Po_PUCCH/phy_vars_eNB->lte_frame_parms.N_RB_UL)-phy_vars_eNB->rx_total_gain_eNB_dB,
knopp's avatar
knopp committed
643
		     phy_vars_eNB->lte_frame_parms.ul_power_control_config_common.p0_NominalPUCCH,
644 645
		     dB_fixed(phy_vars_eNB->eNB_UE_stats[UE_id].Po_PUCCH1_below/phy_vars_eNB->lte_frame_parms.N_RB_UL)-phy_vars_eNB->rx_total_gain_eNB_dB,
		     PUCCH1_THRES+phy_vars_eNB->PHY_measurements_eNB[0].n0_power_tot_dBm-dB_fixed(phy_vars_eNB->lte_frame_parms.N_RB_UL),
646 647 648 649 650 651 652 653 654 655
                     phy_vars_eNB->eNB_UE_stats[UE_id].sector);

      for(i=0; i<8; i++)
        len+= sprintf(&buffer[len],"   harq %d: DL mcs %d, UL mcs %d, UL rb %d, delta_TF %d\n",
                      i,
                      phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->harq_processes[i]->mcs,
                      phy_vars_eNB->ulsch_eNB[(uint8_t)UE_id]->harq_processes[i]->mcs,
                      phy_vars_eNB->ulsch_eNB[(uint8_t)UE_id]->harq_processes[i]->nb_rb,
                      phy_vars_eNB->ulsch_eNB[(uint8_t)UE_id]->harq_processes[i]->delta_TF);

656
      len += sprintf(&buffer[len],"[eNB PROC] Wideband CQI: (%d,%d) dB\n",
657 658 659
                     phy_vars_eNB->PHY_measurements_eNB[eNB].wideband_cqi_dB[UE_id][0],
                     phy_vars_eNB->PHY_measurements_eNB[eNB].wideband_cqi_dB[UE_id][1]);

660
      len += sprintf(&buffer[len],"[eNB PROC] Subband CQI:    ");
661 662 663 664 665

      for (i=0; i<25; i++)
        len += sprintf(&buffer[len],"%2d ",
                       phy_vars_eNB->PHY_measurements_eNB[eNB].subband_cqi_tot_dB[UE_id][i]);

666
      len += sprintf(&buffer[len],"\n");
667

thomasl's avatar
thomasl committed
668
      len += sprintf(&buffer[len],"[eNB PROC] DL TM %d, DL_cqi %d, DL_pmi_single %jx\n",
669 670 671 672
                     phy_vars_eNB->transmission_mode[UE_id],
                     phy_vars_eNB->eNB_UE_stats[UE_id].DL_cqi[0],
                     pmi2hex_2Ar1(phy_vars_eNB->eNB_UE_stats[UE_id].DL_pmi_single));

673
      len += sprintf(&buffer[len],"[eNB PROC] DL Subband CQI: ");
674 675 676 677 678

      for (i=0; i<13; i++)
        len += sprintf(&buffer[len],"%2d ",
                       phy_vars_eNB->eNB_UE_stats[UE_id].DL_subband_cqi[0][i]);

679
      len += sprintf(&buffer[len],"\n");
680

681
      len += sprintf(&buffer[len],"[eNB PROC] Timing advance %d samples (%d 16Ts), update %d\n",
682 683 684 685
                     phy_vars_eNB->eNB_UE_stats[UE_id].UE_timing_offset,
                     phy_vars_eNB->eNB_UE_stats[UE_id].UE_timing_offset>>2,
                     phy_vars_eNB->eNB_UE_stats[UE_id].timing_advance_update);

686
      len += sprintf(&buffer[len],"[eNB PROC] Mode = %s(%d)\n",
687 688
                     mode_string[phy_vars_eNB->eNB_UE_stats[UE_id].mode],
                     phy_vars_eNB->eNB_UE_stats[UE_id].mode);
689
#ifdef OPENAIR2
gauthier's avatar
gauthier committed
690
      UE_id_mac = find_UE_id(phy_vars_eNB->Mod_id,phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->rnti);
691

692
      if (UE_id_mac != -1) {
693
        RRC_status = mac_eNB_get_rrc_status(phy_vars_eNB->Mod_id,phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->rnti);
694
        len += sprintf(&buffer[len],"[eNB PROC] UE_id_mac = %d, RRC status = %d\n",UE_id_mac,RRC_status);
695
      } else
696 697
        len += sprintf(&buffer[len],"[eNB PROC] UE_id_mac = -1\n");

698
#endif
699

700
#ifdef OPENAIR2
701

702 703
      if (phy_vars_eNB->eNB_UE_stats[UE_id].mode == PUSCH) {
#endif
704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813
        len += sprintf(&buffer[len],"[eNB PROC] SR received/total: %d/%d (diff %d)\n",
                       phy_vars_eNB->eNB_UE_stats[UE_id].sr_received,
                       phy_vars_eNB->eNB_UE_stats[UE_id].sr_total,
                       phy_vars_eNB->eNB_UE_stats[UE_id].sr_total-phy_vars_eNB->eNB_UE_stats[UE_id].sr_received);

        ulsch_errors = 0;

        for (j=0; j<4; j++) {
          ulsch_round_attempts[j]=0;
          ulsch_round_errors[j]=0;
        }

        len += sprintf(&buffer[len],"[eNB PROC] ULSCH errors/attempts per harq (per round): \n");

        for (i=0; i<8; i++) {
          len += sprintf(&buffer[len],"   harq %d: %d/%d (fer %d) (%d/%d, %d/%d, %d/%d, %d/%d)\n",
                         i,
                         phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_errors[i],
                         phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_decoding_attempts[i][0],
                         phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_round_fer[i][0],
                         phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_round_errors[i][0],
                         phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_decoding_attempts[i][0],
                         phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_round_errors[i][1],
                         phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_decoding_attempts[i][1],
                         phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_round_errors[i][2],
                         phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_decoding_attempts[i][2],
                         phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_round_errors[i][3],
                         phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_decoding_attempts[i][3]);
          ulsch_errors+=phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_errors[i];

          for (j=0; j<4; j++) {
            ulsch_round_attempts[j]+=phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_decoding_attempts[i][j];
            ulsch_round_errors[j]+=phy_vars_eNB->eNB_UE_stats[UE_id].ulsch_round_errors[i][j];
          }
        }

        len += sprintf(&buffer[len],"[eNB PROC] ULSCH errors/attempts total %d/%d (%d/%d, %d/%d, %d/%d, %d/%d): \n",
                       ulsch_errors,ulsch_round_attempts[0],

                       ulsch_round_errors[0],ulsch_round_attempts[0],
                       ulsch_round_errors[1],ulsch_round_attempts[1],
                       ulsch_round_errors[2],ulsch_round_attempts[2],
                       ulsch_round_errors[3],ulsch_round_attempts[3]);

        dlsch_errors = 0;

        for (j=0; j<4; j++) {
          dlsch_round_attempts[j]=0;
          dlsch_round_errors[j]=0;
        }

        len += sprintf(&buffer[len],"[eNB PROC] DLSCH errors/attempts per harq (per round): \n");

        for (i=0; i<8; i++) {
          len += sprintf(&buffer[len],"   harq %d: %d/%d (%d/%d/%d, %d/%d/%d, %d/%d/%d, %d/%d/%d)\n",
                         i,
                         phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_l2_errors[i],
                         phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_trials[i][0],
                         phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_ACK[i][0],
                         phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_NAK[i][0],
                         phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_trials[i][0],
                         phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_ACK[i][1],
                         phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_NAK[i][1],
                         phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_trials[i][1],
                         phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_ACK[i][2],
                         phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_NAK[i][2],
                         phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_trials[i][2],
                         phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_ACK[i][3],
                         phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_NAK[i][3],
                         phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_trials[i][3]);
          dlsch_errors+=phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_l2_errors[i];

          for (j=0; j<4; j++) {
            dlsch_round_attempts[j]+=phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_trials[i][j];
            dlsch_round_errors[j]+=phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_NAK[i][j];
          }
        }

        len += sprintf(&buffer[len],"[eNB PROC] DLSCH errors/attempts total %d/%d (%d/%d, %d/%d, %d/%d, %d/%d): \n",
                       dlsch_errors,dlsch_round_attempts[0],
                       dlsch_round_errors[0],dlsch_round_attempts[0],
                       dlsch_round_errors[1],dlsch_round_attempts[1],
                       dlsch_round_errors[2],dlsch_round_attempts[2],
                       dlsch_round_errors[3],dlsch_round_attempts[3]);


        len += sprintf(&buffer[len],"[eNB PROC] DLSCH total bits from MAC: %dkbit\n",(phy_vars_eNB->eNB_UE_stats[UE_id].total_TBS_MAC)/1000);
        len += sprintf(&buffer[len],"[eNB PROC] DLSCH total bits ack'ed: %dkbit\n",(phy_vars_eNB->eNB_UE_stats[UE_id].total_TBS)/1000);
        len += sprintf(&buffer[len],"[eNB PROC] DLSCH Average throughput (100 frames): %dkbps\n",(phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_bitrate/1000));
        len += sprintf(&buffer[len],"[eNB PROC] Transmission Mode %d\n",phy_vars_eNB->transmission_mode[UE_id]);

        if(phy_vars_eNB->transmission_mode[UE_id] == 5) {
          if(phy_vars_eNB->mu_mimo_mode[UE_id].dl_pow_off == 0)
            len += sprintf(&buffer[len],"[eNB PROC] ****UE %d is in MU-MIMO mode****\n",UE_id);
          else if(phy_vars_eNB->mu_mimo_mode[UE_id].dl_pow_off == 1)
            len += sprintf(&buffer[len],"[eNB PROC] ****UE %d is in SU-MIMO mode****\n",UE_id);
          else
            len += sprintf(&buffer[len],"[eNB PROC] ****UE %d is not scheduled****\n",UE_id);
        }

        len += sprintf(&buffer[len],"[eNB PROC] RB Allocation on Sub-bands: ");

        //  for (j=0;j< mac_xface->lte_frame_parms->N_RBGS;j++)
        for (j=0; j<7; j++)
          len += sprintf(&buffer[len],"%d ",
                         phy_vars_eNB->mu_mimo_mode[UE_id].rballoc_sub[j]);

        len += sprintf(&buffer[len],"\n");
        len += sprintf(&buffer[len],"[eNB PROC] Total Number of Allocated PRBs = %d\n",phy_vars_eNB->mu_mimo_mode[UE_id].pre_nb_available_rbs);

814 815 816
#ifdef OPENAIR2
      }
    }
817

818 819 820
#endif
    len += sprintf(&buffer[len],"\n");
  }
821

822
  len += sprintf(&buffer[len],"EOF\n");
823

824 825
  return len;
}