Advertisement
martaczaska

SINR

Dec 7th, 2020
801
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.86 KB | None | 0 0
  1. public void licz_SINR() {
  2.         Double[] S_NLOS = new Double[19];
  3.         Double[] S_LOS = new Double[19];
  4.         Double[] I_W_NLOS = new Double[19]; //inerferencje w watach
  5.         Double[] I_W_LOS = new Double[19]; //inerferencje w watach
  6.         Double[] S_0_NLOS = new Double[100];
  7.         Double[] S_0_LOS = new Double[100];
  8.         double nGaussNLOS, nGaussLOS;
  9.  
  10.         for (int q = 0; q < 2; q++) {
  11.             if(q==1){
  12.                 Random r1 = new Random();
  13.                 Random r2 = new Random();
  14.                 nGaussLOS = r1.nextGaussian()*sigma_LOS;
  15.                 nGaussNLOS = r2.nextGaussian()*sigma_NLOS;
  16.                 System.out.println("Random r1 : " + nGaussLOS);
  17.                 System.out.println("Random r2 : " + nGaussNLOS);
  18.                 for(int j = 0; j < 100; j++){
  19.                     for(int i=0; i < 19; i++){
  20.                         PL_LOS[i][j] = PL_LOS[i][j] + nGaussLOS;
  21.                         PL_NLOS[i][j] = PL_NLOS[i][j] + nGaussNLOS;
  22.                     }
  23.                 }
  24.             }
  25.  
  26.             for (int t = 0; t < 100; t++) {
  27.                 for (int i = 0; i < 19; i++) {
  28.                         S_NLOS[i] = licz_sygnal_odebrany(p[i],  Gtx, Lftx, Grx, Lfrx,  0, PL_NLOS[i][t]);
  29.                         S_LOS[i] = licz_sygnal_odebrany(p[i],  Gtx, Lftx, Grx, Lfrx,  0, PL_LOS[i][t]);  //LOS tylko miÄ™dzy UT i BS0
  30.                     }
  31.  
  32.                 S_0_NLOS[t] = Math.pow(10, (S_NLOS[0] / 10));// - 3))* Math.pow(10, 3); // z dBm na waty
  33.                 I_W_NLOS[0] = 0.0;
  34.                 I_suma_NLOS = 0.0;
  35.  
  36.                 S_0_LOS[t] = Math.pow(10, (S_LOS[0] / 10));// - 3))* Math.pow(10, 3); // z dBm na waty
  37.                 I_W_LOS[0] = 0.0;
  38.                 I_suma_LOS = 0.0;
  39.  
  40.                 for (int j = 1; j < 19; j++) {
  41.                     I_W_NLOS[j] = Math.pow(10, (S_NLOS[j] / 10)); // - 3)* Math.pow(10, 3); // z dBm na waty
  42.                     I_suma_NLOS = I_suma_NLOS + I_W_NLOS[j];
  43.  
  44.                     I_W_LOS[j] = Math.pow(10, (S_LOS[j] / 10));// - 3))* Math.pow(10, 3); // z dBm na waty
  45.                     I_suma_LOS = I_suma_LOS + I_W_LOS[j];
  46.                 }
  47.  
  48.                 if(q == 0){
  49.                     SINR_NLOS[t] = S_0_NLOS[t] / (I_suma_NLOS + N_W);
  50.                     SINR_dB_NLOS[t] = 10 * Math.log10(SINR_NLOS[t]); //na dB
  51.  
  52.                     SINR_LOS[t] = S_0_LOS[t] / (I_suma_LOS + N_W);
  53.                     SINR_dB_LOS[t] = 10 * Math.log10(SINR_LOS[t]); //na dB
  54.                 }
  55.                 else if(q == 1){
  56.                     SINR_NLOS[t] = S_0_NLOS[t] / (I_suma_NLOS + N_W);
  57.                     SINR_dB_NLOS_zaniki[t] = 10 * Math.log10(SINR_NLOS[t]); //na dB
  58.  
  59.                     SINR_LOS[t] = S_0_LOS[t] / (I_suma_LOS + N_W);
  60.                     SINR_dB_LOS_zaniki[t] = 10 * Math.log10(SINR_LOS[t]); //na dB
  61.                 }
  62.  
  63.             }
  64.  
  65.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement