pilots_NB_IoT.c 8.99 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/***********************************************************************

**********************************************************************/
/*! \file PHY/LTE_TRANSPORT/pilots_NB_IoT.c
* \Generation of Reference signal (RS) for NB-IoT,	 TS 36-211, V13.4.0 2017-02
* \author M. KANJ
* \date 2017
* \version 0.0
* \company bcom
* \email: matthieu.kanj@b-com.com
* \note
* \warning
*/

15
#include "PHY/defs.h"
16
#include "PHY/defs_NB_IoT.h"
17
#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
18

19
void generate_pilots_NB_IoT(PHY_VARS_eNB         *phy_vars_eNB,
20 21
                            int32_t              **txdataF,
                            int16_t              amp,
22 23
                            uint16_t             Ntti, 				// Ntti = 0..9
					        unsigned short       RB_ID,			// RB reserved for NB-IoT
24
					        unsigned short       With_NSSS) 		// With_NSSS = 1; if the frame include a sub-Frame with NSSS signal
25 26
{

27 28
  LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->frame_parms;
  uint16_t subframe = Ntti;
29
  uint32_t tti,tti_offset,slot_offset,Nsymb,samples_per_symbol;
30
  uint8_t  first_pilot,second_pilot;
31
  unsigned short RB_IoT_ID = RB_ID;
32 33
  Nsymb        = 14;
  first_pilot  = 5;     // first pilot position
34 35
  second_pilot = 6;		// second pilot position

36 37 38 39 40
  slot_offset        = (Ntti*2)%20;

  if(subframe !=5 && ((With_NSSS*subframe)!= 9) )			//  condition to avoid NPSS and NSSS signals						
  {
    tti_offset         = subframe*frame_parms->ofdm_symbol_size*Nsymb; 				// begins with 0
41 42 43 44
    samples_per_symbol = frame_parms->ofdm_symbol_size;  				// ex. 512
	
		//Generate Pilots for slot 0 and 1
		
45
		//antenna 0 symbol 5 slot 0
46
		lte_dl_cell_spec_NB_IoT(phy_vars_eNB,
47 48 49
					            &txdataF[0][tti_offset + (first_pilot*samples_per_symbol)], 			// tti_offset 512 x 32 bits
                                amp,
                                slot_offset,
50 51 52
                                0,
                                0,
                                RB_IoT_ID);
53
					 
54
		//antenna 0 symbol 6 slot 0
55
		lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (second_pilot*samples_per_symbol)],
56 57 58
                                amp,
                                slot_offset,
                                1,
59 60
                                0,
                                RB_IoT_ID);
61

62
		//antenna 0 symbol 5 slot 1
63
		lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (7*samples_per_symbol) + (first_pilot*samples_per_symbol)],
64 65 66
                                amp,
                                1+slot_offset,
                                0,
67 68
                                0,
                                RB_IoT_ID);
69

70
		//antenna 0 symbol 6 slot 1
71
		lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (7*samples_per_symbol) + (second_pilot*samples_per_symbol)],
72 73 74
                                amp,
                                1+slot_offset,
                                1,
75 76
                                0,
                                RB_IoT_ID);
77 78 79

		if (frame_parms->nb_antennas_tx > 1) {  																// Pilots generation with two antennas

80
			// antenna 1 symbol 5 slot 0
81
			lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (first_pilot*samples_per_symbol)],
82 83 84
                                    amp,
                                    slot_offset,
                                    0,
85 86
                                    1,
                                    RB_IoT_ID);
87

88
			// antenna 1 symbol 6 slot 0
89
			lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (second_pilot*samples_per_symbol)],
90 91 92
                                    amp,
                                    slot_offset,
                                    1,
93 94
                                    1,
                                    RB_IoT_ID);
95

96
			//antenna 1 symbol 5 slot 1
97
			lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (7*samples_per_symbol) + (first_pilot*samples_per_symbol)],
98 99 100
                                    amp,
                                    1+slot_offset,
                                    0,
101 102
                                    1,
                                    RB_IoT_ID);
103

104
			// antenna 1 symbol 6 slot 1
105
			lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (7*samples_per_symbol) + (second_pilot*samples_per_symbol)],
106 107 108
                                    amp,
                                    1+slot_offset,
                                    1,
109 110
                                    1,
                                    RB_IoT_ID);
111 112 113 114
		}
  }
}

115 116 117 118 119 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


//////////////////////////////////////////////////////
/*
void generate_pilots_NB_IoT(PHY_VARS_eNB_NB_IoT  *phy_vars_eNB,
                            int32_t              **txdataF,
                            int16_t              amp,
                            uint16_t             Ntti,              // Ntti = 10
                            unsigned short       RB_IoT_ID,         // RB reserved for NB-IoT
                            unsigned short       With_NSSS)         // With_NSSS = 1; if the frame include a sub-Frame with NSSS signal
{

  NB_IoT_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->frame_parms_NB_IoT;

  uint32_t tti,tti_offset,slot_offset,Nsymb,samples_per_symbol;
  uint8_t  first_pilot,second_pilot;

  Nsymb        = 14;
  first_pilot  = 5;     // first pilot position
  second_pilot = 6;     // second pilot position
  
  for (tti=0; tti<Ntti; tti++) {                                        // loop on sub-frames    

    tti_offset         = tti*frame_parms->ofdm_symbol_size*Nsymb;               // begins with 0
    samples_per_symbol = frame_parms->ofdm_symbol_size;                 // ex. 512
    slot_offset        = (tti*2)%20;                                            // 0, 2, 4, ....... 18 
    
    if((slot_offset != 10) && ((With_NSSS*slot_offset) != 18)) {        //  condition to avoid NPSS and NSSS signals
    
        //Generate Pilots for slot 0 and 1
        
        //antenna 0 symbol 5 slot 0
        lte_dl_cell_spec_NB_IoT(phy_vars_eNB,
                                &txdataF[0][tti_offset + (first_pilot*samples_per_symbol)],             // tti_offset 512 x 32 bits
                                amp,
                                RB_IoT_ID,
                                slot_offset,
                                0, //p
                                0);
                     
        //antenna 0 symbol 6 slot 0
        lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (second_pilot*samples_per_symbol)],
                                amp,
                                RB_IoT_ID,
                                slot_offset,
                                1,
                                0);

        //antenna 0 symbol 5 slot 1
        lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (7*samples_per_symbol) + (first_pilot*samples_per_symbol)],
                                amp,
                                RB_IoT_ID,
                                1+slot_offset,
                                0,
                                0);

        //antenna 0 symbol 6 slot 1
        lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (7*samples_per_symbol) + (second_pilot*samples_per_symbol)],
                                amp,
                                RB_IoT_ID,
                                1+slot_offset,
                                1,
                                0);

        if (frame_parms->nb_antennas_tx > 1) {                                                                  // Pilots generation with two antennas

            // antenna 1 symbol 5 slot 0
            lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (first_pilot*samples_per_symbol)],
                                    amp,
                                    RB_IoT_ID,
                                    slot_offset,
                                    0,
                                    1);

            // antenna 1 symbol 6 slot 0
            lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (second_pilot*samples_per_symbol)],
                                    amp,
                                    RB_IoT_ID,
                                    slot_offset,
                                    1,
                                    1);

            //antenna 1 symbol 5 slot 1
            lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (7*samples_per_symbol) + (first_pilot*samples_per_symbol)],
                                    amp,
                                    RB_IoT_ID,
                                    1+slot_offset,
                                    0,
                                    1);

            // antenna 1 symbol 6 slot 1
            lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (7*samples_per_symbol) + (second_pilot*samples_per_symbol)],
                                    amp,
                                    RB_IoT_ID,
                                    1+slot_offset,
                                    1,
                                    1);
        }
    }
  }
}
*/