Monday, September 9, 2013

Deriving the Total Throughput Supported in LTE


In LTE:

Each Resource Block refers to
   0.5 msec
   12 Sub carriers (Each Sub Carrier is of 15khz)
   7 Symbols (Normal Cyclic Prefix)

Which makes 84 Resource elements per Resource Block.


1 Sec = 2 Slots = 2 Resource Blocks

So For 20Mhz is the Bandwidth:
Number of RBS  X 2 Slot (per Sec) * Number of RES
= 100 * 2 * 84 
=16800 Resource Elements

So, per sec eNodeB total resources are 16800 Resource Eleements

Considering 64 QAM is the Modulation, Each Resource Element carries 6 Bits
=16800 * 6 
= 100800 bits per milli second
= 100800 * 1000 = 
= 100800K 
= ~100 Mbits per second

Considering 4 X 4 DL MIMO = ~400 Mbits per second

As we know that DL Grid also possess other entities like PDCCH, PSS, SSS, MIB, PHICH,Reference Signals, etc., and other Factors like Modulation,etc.,

Considering 25% of 400 Mbits occupies the above 
It brings down to ~300 Mbits per second

References:
TS 36.213 Evolved Universal Terrestrial Radio Access (E-UTRA); Physical layer procedures
Section 7.1.7 - Modulation order and transport block size determination 





Wednesday, December 19, 2012

Accumulation Enable vs DCI 3/3A


From specs 36.213, 5.1. With 'Absolute Power' config i.e. 'Accumulation not enabled', DCI 3/3A cannot be supported and hence TPC-PUSCH-RNTI shall not be configured when accumulation is not enabled.

 

Please note the table and below mentioned text for reference in specs, which indicate support of absolute configuration only with DCI Format 0.

 

    • if accumulation is not enabled based on the UE-specific parameter Accumulation-enabled provided by higher layers
      • where was signalled on PDCCH with DCI format 0 on subframe  
      • The value of  is
        • For FDD,= 4
        • For TDD UL/DL configurations 1-6,  is given in Table 5.1.1.1-1
        • For TDD UL/DL configuration 0
          • If the PUSCH transmission in subframe 2 or 7 is scheduled with a PDCCHof DCI format 0 in which the LSB of the UL index is set to 1, = 7
          • For all other PUSCH transmissions,  is given in Table 5.1.1.1-1.
      • The  dB absolute values signalled on PDCCH with DCI format 0 are given in Table 5.1.1.1-2.

 

Table 5.1.1.1-2: Mapping of TPC Command Field in DCI format 0/3 to absolute and accumulated  values.

TPC Command Field in

DCI format 0/3

Accumulated [dB]

Absolute [dB] only DCI format 0

0

-1

-4

1

0

-1

2

1

1

3

3

4

 

 

 




Monday, October 8, 2012

DRX Feature in LTE



Main Points before Dig Deeper:

1) DRX is the feature which is to enhanace battery life to UE.
2) Below are the parameters/configuration details that plays rols in DRX handling (from 36.331 spec)
           onDurationTimer
           InactivityTimer
           reTransmissionTimer  
           longDRXCycleOffset (LongDrxCycleTimer  and DRXOffset)
           shortDRXCycle
           drxShortCycleTimer

----------------------------------------------------------------------------------------------------------------
Important points to note on above:
a) onDurationTimer should be >= shortDRX/longDRXCycleTimer
b) onDurationTimer duration is part of ShortDRX/longDRXCycleTimer
c) If Both Short and LongDrxCycle timer values are configured then, longDRXCycle should be multiple of shortDRXCycleTimer.
d) if shortDRXCycle and longDRXCycle are configured then shortDRXCycle takes first then it moves to longDRXCycle
e) the drxOffset helps UE to know when UE should start onDurationTimer after inActivieTimer gets expired. Formulae available in 36.321 (Pasting below from same)
      i) If the Short DRX Cycle is used 
       (SFN * 10) + subframe number] modulo (shortDRX-Cycle) =(drxStartOffset) modulo (shortDRX-Cycle)
      
       OR
     ii) if the Long DRX Cycle is used and 
          [(SFN * 10) + subframe number] modulo (longDRX-Cycle) = drxStartOffset: 
      THEN         
             start onDurationTimer.

f) When UE has multi-RAB and each RAB is configured with different DRX configurations, then UE should consider the minimum of the DRX configurations.

----------------------------------------------------------------------------------------------------------------



Order or usage at UE during DRX:

inActivity 
    -> ShortDRXCycles's onDurationTimer
           -> Rest of Short DRXCycleTimer
               -> numberof Times ShortDRXCycle gets executed which is equal to drxShortCycleTimer
                    -> After completion of shortDRXCycle, move to longDRXCycle (Here also onDurationTimer first                
                        and rest of the longDRXCycle - onDurationTimer
                   -> Fromt this point onwards only longDRXCycle is active

----------------------------------------------------------------------------------------------------------------
Exmaple:
   Below are the sample configured Values:
                onDurationTimer = sf200
                drx_InactivityTimer = sf80
                drx_reTransmissionTimer = sf2 
                longDrxCycleOffset = sf1280=5
                 ShortDrxCycle = sf640
                drxShortCycleTimer = 1


and let us suppose we received DL SCH data in below SFN/SFs 
                SFN/SF = 370 – 8 ---> DL-SCH received for UE attached
                To
                SFN/SF = 704 – 6  ---> Next DL-SCH received for the same attached UE

And Below is the way of  understanding:


370-8
                Inactivity Timer 80 ms = SFN+8 i.e
                And from the formula Short DRX Cycle is used and [(SFN * 10) + subframe number] modulo (shortDRX-Cycle) = (drxStartOffset) modulo (shortDRX-Cycle);
384-5 OnDuration Timer Can start
+ShortDRXCycle (sf640) (Being drxShortCycleTimer =1 only once ShortDRXCycle executed)
384+64 – 5 =  448-5
+LongDRXCycle (sf1280)
448+128 -  5  = 576 – 5
+LongDRXCycle(sf1280)
576+128 – 5 = 704 – 5

And we can receive  downlink packet from 704-6 as observed .
----------------------------------------------------------------------------------------------------------------
Reg. DRXReTXTimer: This is like even there is no DL/UL data but retransmissions are happening because of HARQ NACKs. So, untill retransmissions are getting over DRX will not get activitate because of retransmissions even there is no NEW DL/UL Data.

----------------------------------------------------------------------------------------------------------------
Attaching the Image: (Thanks to the blogs and authors helping me to understand the same)


Friday, July 27, 2012

PAGING – PF and PO Calculation - LTE



Paging is indication to UE to establish NAS Procedure basically happens at two occasions
1)      Incoming Call Alert: Means Mobile Terminated Call.
2)      Broadcast Change : E-UTRAN notifies the UEs by means of a Paging message including a SystemInfoModification flag

Paging message will be associated with PF and PO at RE - Grid Level.
Where PF is associated with Corresponding SystemFrame and PO is associated with SubFrame where Paging Message is  Broadcasted.

Then how to Caliculate Paging Frame and Paging Occasion for particular UE:
In caliculation the below factors plays role
·         SFN – System Frame Number
·         DefaultPagingCycle is from SIB2
·         PagingDrx Cycle from S1-Paging Message
·         Ue Id : Received from S1-Paging Message
·         nB : From SIB2


Now Let us Take Example to caliculate Paging Occasion :

In SIB2:
                nB -  T / 4
                DefaultPagingCycle :  64
                From S1-Paging Message:
                PagingDRX : 128
                UeIndex from S1 Paging : UE_ID = 0x0115 = (0000 0001 0001 0101 ) after Removing 6 LSBs which makes (0000 0001 00 = 4)
                The above UeIndex is in general UeIdentity % 1024 which means, results only  occupies 10 Bits Only. So, above we Removed 6 LSbits.



T = Min (PagingDRXCycle, DefaultPagingDrxCycle) = Min ( 128,64) = 64
nB = T/4 = 64/4 = 16
N = min(T,nB) = Min(64, 16) =  16
UE_ID = 4 (From above Steps derived from S1 Paging Message)

SFN mod T= (T div N)*(UE_ID mod N)
RHS => (T Div N) * (UE_ID mod N) = ( 64 Div 16) * ( 4 % 16) = 4 * 4 = 16
LHS => SFN Mod T = SFN Mod 64 = 16
So,

PF values could be any thing  where SFN =  (64 * i ) + 16  (I = 0 to N But SFN <= 1024)
i.e Values PF can  be any of 80, 144, 208, 272, 336, 400, 464, 528, 592, 656, 720, 784, 848, 912, 976, 1040, 1104, 1168.

Now Comes To Paging Ocassion:
Ns: max(1,nB/T) = max (1, 16/64) = 1

i_s = floor(UE_ID/N) mod Ns
ð  i_s = floot(4 / 16) mod 1 = 0

From the below table when i_s == 0 and Ns = 1 => P0 = 9 
FDD:
Ns
PO when i_s=0
PO when i_s=1
PO when i_s=2
PO when i_s=3
1
9
N/A
N/A
N/A
2
4
9
N/A
N/A
4
0
4
5
9


So considering current SFN is 100 : for the above UE PF which is mentioned in the series is 144. i.e Paging message can go in SF=144 and SFN=9
Ref : 3GPP 36.304 UE Procedures in Idle Mode. Section 7.1 and 7.2

EAGLE VIEW - RACH Procedure (LTE)




Purpose : This procedure Used to get N/W Access

In General RACH Procedure is triggered in  5 Cases, but Not to confuse with many things the below ONE is the common case
1)      To get Initial Access  : Which means to register with the network initially this is the first process (After MIB, SIB reading)
Other Cases      
2)      During Hand Over
3)      Radio Link Failure
4)      UL Data Arrival and UL is not in Sync
5)      DL Data Arival and UL is not in Sync.


In Resource Grid Where Does RACH Sits:

                RACH will be present in 6 successive RBs (Resource Blocks) i.e n to n+5
                Which means 12 Subcarries of 15 Khz * 6 = 72 SubCarriers
                But for PRACH preamble each subcarrier space is 1.25 Khz i.e One 15Khz = 12  PRACH SubCarriers
                That makes 12 * 12 * 6 = 864 PRACH SubCarriers
                In these 864 SubCarriers 25 Subcarriers are used as Guard Subcarriers (13 + 12)  which makes 839 Subcarriers.
                This Values makes the Zud-Off Sequence Value.

As we mentioned above RACH occupies n to n+5 RBS. Where Does UE gets this ‘n’ value is from SIB2’s “prach-FreqOffset” value. 



During RACH procedure (Assuming only One UE trying to Access N/w at that moment)
UE Selects RA-RNTI value which ranges from 1 to 10 (For FDD – Based on Which SubFrame UE sending RACH) And with a Random Preamble ( < 64 ).
Now
RAR (Random Access Response) will be received from N/W with Same RA-RNTI value.
Once UE Receives RAR
UE responds with Msg3 (i.e RRCConnectionRequest Message)
Then
N/W responds with Msg4 (i.e ContentionResoultion Message) – Some times N/w piggyBacks RRCConnectionResponse with this ContentionResolution Message.

The above are steps in RACH Procedure.

Now next step is to understand what is ContentionResolution
RACH : Two types of RACH are present
1)      Contention Based
2)      Contention Free

What is Contention-Based : 
The Example Scenario for this is:
Take an example at Airport where all passengers will be switching on UE once they arrive at Airport.  Switching-On means everyone is trying to register with Network and we know that in this process RACH procedure will happen.  This RACH Procedure is happening in Bursted Mode.

Here The preamble Selection happens in Random by UE. So, there are chances that multiple UEs can send RACH Indication with same Preamble ID.  Which Means there is contention for N/W Resources.
As such N/W is not aware of this burst,  N/W responds with RAR with Same Preamble ID.
Now
All UE who receives this RAR Messages assumes that RAR is addressed to them and all UE started sending Msg3 .
Msg3  contains  ReasonForAttach + Ue Identity (which is independent of UEs)
Then N/w Responds for the Msg3 which it Received only and responds with Contention Resolution Message where it will have all 5 Bytes that are sent by UE.
Now  corresponding UE alone responds with Msg5
and other UEs will re-start RACH Procedure.


Contention-Free :  Lets suppose there is RadioLinkFailue during Call and it is not wise to allo UE to select Random Value to get Resources from eNodeB.  So, each eNodeB preserves few Preambles for this. UEs will come to know these set value from SIB2.
preambleInfo
                                                                    numberOfRA-Preambles: n52
                                                                    preamblesGroupAConfig
                                                                        sizeOfRA-PreamblesGroupA: n44

where numberOfRA-Preambles are referring to Contention-Based i.e < 53 and from 53 – 64 , these preambles used by N/W during the scenarios which are mentioned as 2,3,4,5 in first Para. So here 53-64 Preamble values are used only for Contention-Free RACH Procedure.

sizeOfRA-PreamblesGroupA : Contenion Based Preambles Set but who are near to eNodeB ( < 45)
and
45 – 52 preamble set used for Contention Based but for the UEs who are far from eNodeB

Tuesday, July 17, 2012

Digging into LTE MIB

MIB will be read after UE does the Primay and Secondary synchronization.

MIB transmits for every 10 ms in subframe number ‘0’ and slot 1’s  First 4 OFDM Symbols. 
But new Retransmissions happen where SFN%4 == 0 and in the rest of places it is retransmission.
i.e in given SFN n where (n%4 == 0), same MIB content will be sent in n, n+1, n+2 and n+3 System Frames.

What MIB has  w.r.to RRC Spec :  SystemFrameNumber (8 Bits), PHICH Configuration and DL Bandwidth

PHICH Configuration is required in MIB, this helps UE to caliculate PDCCH symbols to find locate CCE of that UE (Because next step after MIB reading is reading SIB1 reading, to read SIB1 UE should be knowing PDCCH info).

SystemFrameNumber (Except 2 LSB Bits i.e 8 MSB Bits) to find SFN. Being it is only 8 bits worst case UE can read 5 radio frames to get exact SFN  number.

DLBandWidth : Based on this , UE will know the number of RBs and number of CCEs , with which Common  Search Space will be derived. This helps in cornering the CCE related to SIB1 (which is next step).

But as RRC Says, that’s all the information does MIB conveys. 
No, it also gives NumberOfTXAntennas also. Number of DL antenna Ports (not physical antennae). Each antenna port uses one cell specific reference signal, that is used by UE for channel estimation.

MIB Transmission happens as below:
MIB content given by MAC is 24 Bits .
With the 24 Bits + 16 CRC bits are added = 40 Bits
Code Rate applicable = 1/48 which means 40 * 48  = 1920
                                        
As the same MIB content is transmissted in 4 Subsequence SystemFrames 1920/4 = 480 bits will be transmitted in each RadioFrame. 
How this 480 ?
MIB Transmission is : In 6 ResourceBlocks , 4 OFDM Symbols of Slot1 of Subframe 0
i.e Each RB 12*4 = 48 Res – 8 Res (towards Referece Signals) = 40 REs are left for MIB content per RB
for 6 RBs = 40 * 6 = 240 Res
Being MIB is transmitted with QPSK , 1 RE can carry 2 bits of Data
i.e 240 * 2 = 480
 Note: 6 RBs correspond to the minimum DL BW supported by LTE, which UE assumes when it first receives BCH. After decoding MIB it comes to know of the actual DL BW used by the cell and will adjust its receiver BW accordingly                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
Next How UE understand TX-Antennas Ports (as that is not part of MIB content) :
MIB has CRC which gets scrambled with one of 3 sequences which represents (One, Two OR Four Anttenas). UE when it received it tries to decode with all three based on CRC check UE understands what is TXAntennas.

PBCH can use single antenna or transmit diversity transmission modes. UE blindly detects number of antenna ports used for PBCH using CRC scrambling sequence. From this UE determines number of cell specific reference signals configured in the cell. If cell is configured with 2 antenna ports, SFBC transmit diversity scheme is used for BCH, PCH and L1/L2 Control signalling. If 4 antenna ports are detected, SFBC/FSTD transmit diversity is used for BCH, PCH and L1/L2 control signalling.

Saturday, January 8, 2011

Abstract Class Usage for Process to Library Communication

Problem statement:
 
A process is doing lots of different functionalities, and each functionality is a library. So, In general we allways write a interface class where in the both will talk to each other.
But
Let us suppose library want to use some facilities of Main Process . Then
 
1) write an abstract class with the functions which needs to be implemented by main process
2) Main process will inherit this abstract class and main process code will implement these functions.
3) Make sure that this abstract class will have initized function which will be called by Main Process by passing its own this pointer.
So, now this abstract class will always holds the main process class pointer.
4) When ever library wants to avail the main process services, we can get those using the this pointer which it is received. (Any how Main Process class is already inherited and implemented in main process code)
 
//Main Process
Class Main:: public SumServiceCallBackLibrary  //Mainclass is inherited AbstractClassCallBack
{
        public :
                void initializeSubModule1()  {
                        libraryObject.Initialize(this);
                }
               
               
};
 
Main::startShutdown()
{
 
   cout << "Main class received message from library to shut down the system";
};
 
//abstract class which is also interface between library and process
Class SumServiceCallBackLibrary 
{
virtual void  startShutdown() = 0;
};
 
Class LibraryClass
{
  public:
    Initalize(SumServiceCallBackLibrary  * r_cbPtr)  { m_pcSSCBptr= r_cbPtr; }
 
    initiateShutdown() {
        m_pcSSCBptr->startShutDown();  //Here we are calling the implmentation of main process.
    }
               
 
  private:
    SumServiceCallBackLibrary  *m_pcSSCBptr;
}
 
 

When Socket Recv() call got blocked even sockfd is having data

Problem Description:

We have a server where in it is waiting to receive some data so that it can respond with answer. And we have coded such that we are blocked on Select() call,
Once select() gets unblocked we will verity on which FD the data has been triggered using FD_ISSET ,

But the problem is FD_ISSET is returning success mentioning there is data on that socket descriptor, but when we tried to call recv() the data is not getting read so on recv() call the program got blocked.

Don’t know the reason why this happens: (Read like etherenet will do some kind of filling the multiple messages for single eth packet, but not sure whether this is the reason)

But I solved this issue :

By making recv call socket as unblocking
And
Here is how:

(In server code : accept() will return the socket (hSok) then make that socket descriptor as unblocking

int fcntl_flag = 0;

if ((fcntl_flag = fcntl(hSok, F_GETFL, 0)) < 0)
{
printf("\n Error getting sockfd flags F_GETFL %s\n",strerror(errno));

}
if (fcntl(hSok, F_SETFL, fcntl_flag | O_NONBLOCK) < 0)
{
printf("\n Error setting sockfd flags F_SETFL %s\n",strerror(errno));
}

Tuesday, October 19, 2010

Executing Wild Cards from C programs

We all know that we can execute some simple commands using system(...) call form c program.
or
we will use execl(...) to do that.

First we will understand the difference excel(..) and system(...) calls:

1) execl(...) it executes as it is by doing fork.. so wild cards will not be effected.
but system(...) call spawns shell and does fork and and execute the command provided as arguments.

2) System(...) is blocking call. It blocks the flow of execution. Where as execl(...) is not that it just spawns a fork and the parent process will not get blocked.

we can't use wildcards using execl(...) reason is execl() will not spawn any shell where in wildcards can be understood. so if we would like to use wildcards then how we should write is

execl("/bin/bash" ,"bash", "-c", "rm -f /home/cc/rr* ", (char*)0);

send the parameters as arguments to bash. then it works..

Same can be executed as
bash$ bash -p rm -f /home/cc/rr*