Modeling a 4G LTE System in MATLAB - MathWorks€¦ · 30 MIMO-OFDM overview X Y Time 𝑡𝑛...
Transcript of Modeling a 4G LTE System in MATLAB - MathWorks€¦ · 30 MIMO-OFDM overview X Y Time 𝑡𝑛...
1 © 2011 The MathWorks, Inc.
Modeling a 4G LTE System in MATLAB
김용정 부장
Senior Application Engineer
Mathworks Korea
2
4G LTE and LTE Advanced
– True Global standard
– True Broadband mobile communications
– How it was achieved?
– What are the challenges?
MATLAB and communications system design
– Modeling and simulation
– Simulation acceleration
– Path to implementation
Case study:
– Physical layer modeling of an LTE system in MATLAB
Summary
Agenda
3
4G LTE and LTE Advanced
4
Motivation
– Very high capacity & throughput
– Support for video streaming, web browsing, VoIP, mobile apps
A true global standard
– Contributions from all across globe
– Deployed in AMER, EMEA, APLA
4G LTE and LTE Advanced Distinguishing Features
5
A true broadband mobile standard
– From 2 Mbps (UMTS)
– To 100 Mbps (LTE)
– To 1 Gbps (LTE Advanced)
4G LTE and LTE Advanced Distinguishing Features
6
How is this remarkable advance possible?
Integration of enabling technologies with sophisticated
mathematical algorithms
– OFDM
– MIMO (multiple antennas)
– Turbo Coding
Smart usage of resources and bandwidth
– Adaptive modulation
– Adaptive coding
– Adaptive MIMO
– Adaptive bandwidth
7
What MATLAB users care about LTE?
Academics
– Researchers contributing to future standards
– Professors
– Students
Practitioners
– System Engineers
– Software designers
– Implementers of wireless systems
Challenge in interaction and cooperation between these
two groups
MATLAB is their common language
8
Challenges:
From specification to implementation
Simplify translation from
specification to a model as
blue-print for implementation
Introduce innovative
proprietary algorithms
Dynamic system-level
performance evaluation
Accelerate simulation of large
data sets
Address gaps in the
implementation workflow
9
Where does MATLAB fit in addressing these
challenges?
MATLAB and Communications
System Toolbox are ideal for LTE
algorithm and system design
MATLAB and Simulink provide an
environment for dynamic & large
scale simulations
Accelerate simulation with a
variety of options in MATLAB
Connect system design to
implementation with
– C and HDL code generation
– Hardware-in-the-loop verification
10
Communications System Toolbox
Algorithm libraries in MATLAB Algorithm libraries in Simulink
Over 100 algorithms for
– Modulation, Interleaving, Channels, Source Coding
– Error Coding and Correction
– MIMO, Equalizers, Synchronization
– Sources and Sinks, SDR hardware
11 © 2011 The MathWorks, Inc.
Case Study:
physical layer of LTE (Release 10)
ScramblingModulation
mapper
Layer
mapperPrecoding
Resource element
mapper
OFDM signal
generation
Resource element
mapper
OFDM signal
generationScrambling
Modulation
mapper
layers antenna portscodewords
12
1. Start modeling in MATLAB
2. Iteratively incorporate components such as Turbo Coding,
MIMO, OFDM and Link Adaptation
3. Put together a full system model with MATLAB & Simulink
4. Accelerate simulation speed in MATLAB at each step
What we will do today
13 © 2011 The MathWorks, Inc.
Modeling and Simulation
14
LTE Physical layer model in standard
Turbo Channel
Coding
MIMO OFDMA
Adaptation
of everything
Reference: 3GPP TS 36 211 v10 (2010-12)
Up/Downlink Shared
Channel
– Transport channel
– Physical channel
15
ScramblingModulation
mapper
Layer
mapperPrecoding
Resource element
mapper
OFDM signal
generation
Resource element
mapper
OFDM signal
generationScrambling
Modulation
mapper
layers antenna portscodewords
LTE Physical layer model in MATLAB
Turbo Channel
Coding
MIMO OFDMA
Adaptation
of everything
Channel coding
Rate matching
Code block
concatenation
110 ,...,, Aaaa
110 ,...,, Bbbb
110 ,...,, rKrrr ccc
)(
1)(
1)(
0 ,...,, iDr
ir
ir r
ddd
110 ,...,, rErrr eee
110 ,...,, Gfff
Transport block
CRC attachment
Code block segmentation
Code block CRC attachment
>> Open LTE system model
16
Error correction & coding
technology of LTE standard
Performance: Approach the
channel capacity (Shannon
bound)
Represents an evolution of
convolutional coding
Based on an iterative
decoding scheme
Overview of Turbo Coding
17
MATLAB Demo
=comm.ConvolutionalEncoder(
= comm.ViterbiDecoder(…
„InputFormat‟, „Hard‟,…
18
MATLAB Demo
=comm.ViterbiDecoder…
„InputFormat‟, „Soft‟,…
= comm.QPSKDemodulator(
„DecisionMethod‟,‟Log-Likelihood ratio‟
19
MATLAB Demo
= comm.TurboEncoder
= comm.TurboDecoder(…
„NumIterations‟, 6,…
= comm.QPSKDemodulator(
„DecisionMethod‟,‟Log-Likelihood ratio‟
20
UL/DL-SCH transport channel processing
Channel coding
Rate matching
Code block
concatenation
110 ,...,, Aaaa
110 ,...,, Bbbb
110 ,...,, rKrrr ccc
)(
1)(
1)(
0 ,...,, iDr
ir
ir r
ddd
110 ,...,, rErrr eee
110 ,...,, Gfff
Transport block
CRC attachment
Code block segmentation
Code block CRC attachment
3GPP TS 36.212 v10.0.0
>>commpccc
21
MATLAB Function block
Channel coding
Rate matching
Code block
concatenation
110 ,...,, Aaaa
110 ,...,, Bbbb
110 ,...,, rKrrr ccc
)(
1)(
1)(
0 ,...,, iDr
ir
ir r
ddd
110 ,...,, rErrr eee
110 ,...,, Gfff
Transport block
CRC attachment
Code block segmentation
Code block CRC attachment
UP/Downlink Shared Channel - transport
channel
Turbo Channel
Coding
22
Orthogonal Frequency Division Multiplexing
– Multicarrier modulation scheme (FFT-based)
Sample the spectrum at uniform intervals called sub-carriers
– Transmit data independently at each sub-carrier
Most important feature
– Robust against multi-path fading
– Using low-complexity frequency-domain equalizers
OFDM Overview
23
Multi-path propagation leads to frequency selective fading
Frequency-domain equalization is less complex and perfectly
matches OFDM
We need to know channel response at each sub-carrier – pilots
OFDM & Multi-path Fading
y(n) = ℎ𝑛 x( 𝑛 − 𝑑𝑛)𝑁𝑛=0 *ℎ1, 𝑑1}
*ℎ2, 𝑑2}
*ℎ0, 𝑑0}
Y(ω) = H(ω)X(ω)
Multi-path
If G(ω𝑘) ≈ 𝐻−1(ω𝑘) G(ω𝑘) Y(ω𝑘) ≈ 𝑋(ω𝑘) Frequency-domain equalization
ω
Frequency-selective fading H(ω)
G(ω)H(ω)
1
ω
24
Frequency
Nmax=2048
…
…
Time (msec)
Resource
block
Resource
element
0.5 1
Resource
grid
1.5 2
How Does LTE Implement OFDM?
Pilots
Interpolate
vertically
(Frequency)
Interpolate
horizontally (Time)
25
How to Implement LTE OFDM in MATLAB
switch
prmLTEPDSCH.Nrb
Depending on
Channel Bandwidth
Case 25, N=512;
Set Frequency-domain
FFT size
= 6*numRb + mod(v+vsh, 6) + 1;
Transmitter:
Place pilots in regular intervals
Case 100, N=2048; = mean([hp(:,1,1,n) hp(:,3,1,n)])
Receiver:
Estimate channel by
interpolating in time &
frequency
= mean([hp(k,2,1,:) hp(k,4,1,:)])
X=ifft(tmp,N,1);
Create OFDM signal
26
MIMO Overview
Multiple Input Multiple Output
Using multiple transmit and receive
antennas
Multiple Input Multiple Output
h1,1
h1,2
h4,4
h2,1
X Y
Y = H*X + n
H=ℎ11 ℎ12 ℎ13 ℎ14ℎ21 ℎ22 ℎ23 ℎ24ℎ31 ℎ32 ℎ33 ℎ34ℎ41 ℎ42 ℎ43 ℎ44
Channel
27
Where is MIMO being used?
Several wireless standards
– 802.11n: MIMO extensions of WiFi as of 2008
– 802.16e: As of 2005 in WiMax Standard
– 3G Cellular: 3GPP Release 6 specifies transmit diversity mode
– 4G LTE
Two main types of MIMO
– Spatial multiplexing
– Space-Time Block Coding (STBC)
28
Space-Time Block Codes (STBC)
STBCs insert redundant data at transmitter
Improves the BER performance
Alamouti code (2 Tx, 2 Rx) is one of simplest
examples of orthogonal STBCs
29
Spatial Multiplexing
MIMO technique used in LTE standard
Divide the data stream into independent sub-streams and use multiple transmit antennas
MIMO is one of the main reasons for boost in data rates – More transmit antennas leads to higher capacity
MIMO Receiver essentially solves this system of linear equations
Y = HX + n
30
MIMO-OFDM overview
X Y
Time 𝑡𝑛
subcarrier 𝑤𝑘
Y=𝐻 ∗ 𝑋 + 𝑛
To avoid singularity:
1. Precode input with pre-selected V
2. Transmit over antennas based on Rank
𝐻 = ℎ1 ℎ2 ℎ3 ℎ4ℎ1 ℎ2 ℎ3 ℎ4ℎ31 ℎ32 ℎ33 ℎ34ℎ41 ℎ42 ℎ43 ℎ44
𝐻 = 𝑈𝐷𝑉𝐻
Dimension =4; Rank =3;
H = singular (not invertible)
What if 2 rows are
linearly dependent?
Singular Value Decomposition
31
Adaptive MIMO:
Closed-loop Pre-coding and Layer Mapping
Layer
Mapping Precoding(*) OFDM
Channel Rank
Estimation
Precoder Matrix
Estimation
Base station
mobile
Rank Indicator
Precoder Matrix Indicator
32
Adaptive MIMO in MATLAB
In Receiver:
Detect V = Rank of the H Matrix
= Number of layers
In Transmitter: (next frame)
Based on number of layers
Fill up transmit antennas with
available rank
case 4
out =
complex(zeros(inLen1/2, v));
out(:,1:2) = reshape(in1, 2,
inLen1/2).';
out(:,3:4) = reshape(in2, 2,
inLen2/2).';
V=
prmLTEPDSCH.numLayers;
Switch V
33
0l
0R
0R
0R
0R
6l 0l
0R
0R
0R
0R
6l
On
e an
ten
na
po
rtT
wo
an
ten
na
po
rts
Resource element (k,l)
Not used for transmission on this antenna port
Reference symbols on this antenna port
0l
0R
0R
0R
0R
6l 0l
0R
0R
0R
0R
6l 0l
1R
1R
1R
1R
6l 0l
1R
1R
1R
1R
6l
0l
0R
0R
0R
0R
6l 0l
0R
0R
0R
0R
6l 0l
1R
1R
1R
1R
6l 0l
1R
1R
1R
1R
6l
Fo
ur
ante
nn
a p
ort
s
0l 6l 0l
2R
6l 0l 6l 0l 6l
2R
2R
2R
3R
3R
3R
3R
even-numbered slots odd-numbered slots
Antenna port 0
even-numbered slots odd-numbered slots
Antenna port 1
even-numbered slots odd-numbered slots
Antenna port 2
even-numbered slots odd-numbered slots
Antenna port 3
Cell-Specific Reference Signal Mapping
• Null transmissions allow for separable channel estimation at Rx
• Use clustering or interpolation for RE channel estimation
4 CSR, 0 nulls /slot /RB
=> 8 CSR/160 RE
4 CSR, 4 nulls /slot /RB
=> 8 CSR /152 RE
Varies per antenna port:
4 CSR, 8 nulls /slot /RB
=> 8 CSR / 144 RE
2 CSR, 10 nulls /slot /RB
=> 4 CSR / 144 RE
Figure 6.10.1.2-1, 3GPP TS 36.211 v10.0.0
34
Link Adaptation Overview
Examples of link adaptations
– Adaptive modulation QPSK, 16QAM, 64QAM
– Adaptive coding Coding rates from (1/13) to (12/13)
– Adaptive MIMO 2x1, 2x2, …,4x2,…, 4x4, 8x8
– Adaptive bandwidth Up to 100 MHz (LTE-A)
35
LTE Physical layer model in MATLAB
Turbo Channel
Coding
MIMO OFDMA
Adaptation
of everything
36 © 2011 The MathWorks, Inc.
Simulation Acceleration
37
Simulation acceleration options in MATLAB
System
Objects
MATLAB to C
User’s Code
GPU
processing
Parallel
Computing
>> Demo
commacceleration
38
Task 1 Task 2 Task 3 Task 4 Task 1 Task 2 Task 3 Task 4
Parallel Simulation Runs
Time Time
TOOLBOXES
BLOCKSETS
Worker
Worker
Worker
Worker
>> Demo
39
Simulation acceleration options in MATLAB
System
Objects
MATLAB to C
User’s Code
GPU
processing
Parallel
Computing
40
GPU Processing with
Communications System Toolbox
Alternative implementation
for many System objects
take advantage of GPU
processing
Use Parallel Computing
Toolbox to execute many
communications algorithms
directly on the GPU
Easy-to-use syntax
Dramatically accelerate
simulations
GPU System objects
comm.gpu.TurboDecoder
comm.gpu.ViterbiDecoder
comm.gpu.LDPCDecoder
comm.gpu.PSKDemodulator
comm.gpu.AWGNChannel
41
Acceleration with GPU System objects
Version Elapsed time Acceleration
CPU 8 hours 1.0
1 GPU 40 minutes 12.0
Cluster of 4
GPUs
11 minutes 43.0
Same numerical results
= comm.TurboDecoder(…
„NumIterations‟, N,… = comm.gpu.TurboDecoder(…
„NumIterations‟, N,…
= comm.AWGNChannel(… = comm.gpu.AWGNChannel(…
42
Acceleration Strategies Applied in MATLAB
Option
Technology / Product
1. Best Practices in Programming • Vectorization & pre-allocation • Environment tools. (i.e. Profiler, Code Analyzer)
MATLAB, Toolboxes, System Toolboxes
2. Better Algorithms • Ideal environment for algorithm exploration • Rich set of functionality (e.g. System objects)
MATLAB, Toolboxes, System Toolboxes
3. More Processors or Cores
• High level parallel constructs (e.g. parfor, matlabpool)
• Utilize cluster, clouds, and grids
Parallel Computing Toolbox, MATLAB Distributed Computing Server
4. Refactoring the Implementation • Compiled code (MEX) • GPUs, FPGA-in-the-Loop
MATLAB, MATLAB Coder, Parallel Computing Toolbox
43 © 2011 The MathWorks, Inc.
MATLAB to C code
44
Why Engineers translate MATLAB to C today?
Integrate MATLAB algorithms w/ existing C environment
using source code or static libraries
Prototype MATLAB algorithms on desktops as
standalone executables
Accelerate user-written MATLAB algorithms
Implement C/C++ code on processors or hand-off to
software engineers
45
Algorithm Design and
Code Generation in
MATLAB
With MATLAB Coder, design engineers can
• Maintain one design in MATLAB
• Design faster and get to C/C++ quickly
• Test more systematically and frequently
• Spend more time improving algorithms in MATLAB
Automatic Translation of MATLAB to C
verify /accelerate
iterate
46
Java
visualization
graphics
nested functions
sparse
variable-sized data
arrays
struct
numeric
fixed-point
functions
complex
System objects
global
persistent
malloc
classes
MATLAB Language Support for
Code Generation
47
Supported MATLAB Language
Features and Functions
Broad set of language features and functions/system
objects supported for code generation.
Matrices and
Arrays Data Types
Programming
Constructs Functions
• Matrix operations
• N-dimensional arrays
• Subscripting
• Frames
• Persistent variables
• Global variables
• Complex numbers
• Integer math
• Double/single-precision
• Fixed-point arithmetic
• Characters
• Structures
• Numeric classes
• Variable-sized data
• System objects
• Arithmetic, relational,
and
logical operators
• Program control
(if, for, while, switch )
• MATLAB functions and sub-functions
• Variable length argument lists
• Function handles
Supported algorithms
• > 400 MATLAB operators and
functions
• > 200 System objects for
• Signal processing
• Communications
• Computer vision
48
Fixed-Point Design: Motivation
ASIC/FPGA or fixed-point DSP implementation
Saves power and/or cost
Introduces quantization errors
Integer + sign fractional
L
L-N N
Quantization overflow
Word length and Fraction Length must be specified
– For every variable
Degradation must be analyzed
49
Doing Fixed-Point in C is Hard
No native fixed-point math libraries
No built-in overflow / underflow checks
No tools to determine optimal integer and fractional bits
No visualization of floating and fixed-point
representations
50
Fixed-Point Specification in MATLAB
Quantizing data:
x_fxp = fi( x, 1, 16, 15) % 16 bits, 15 fractional bits
Architecture specification:
– 16,32,40 bits (DSP) vs flexible number of bits (FPGA)
– Arithmetic rules: full precision, keep MSB
51
MATLAB Accelerates Fixed-Point Design
Streamline conversion of floating-point algorithms to fixed-point
– NumericTypeScope tool
Simulate fixed-point algorithms – Directly in MATLAB
– Handle large data sets
– Simulate with compiled-C-code speed
Generate efficient and portable C code with MATLAB Coder
– codegen command
52 © 2011 The MathWorks, Inc.
MATLAB to Hardware
53
FPGA Designer
Separate Views of DSP Implementation
System Designer
Algorithm Design
Fixed-Point
Timing and Control Logic
Architecture Exploration
Algorithms / IP
System Test Bench
Environment Models
Algorithms / IP
Analog Models
Digital Models
RTL Design
IP Interfaces
Hardware Architecture
RTL Verification
Functional Simulation
Static Timing Analysis
Timing Simulation
Behavioral Simulation
Back Annotation Implement Design
Map
Place & Route
Synthesis
Hardware
FPGA Requirements
Hardware Specification
Test Stimulus
54
OFDM Transmitter
55
MATLAB to Hardware
ifft(x, 2048, 1)
Issue #1
– „x‟ is 2048x4 matrix
– MATLAB does 2048-pt FFT along first dimension
– Output is also 2048x4
– Cannot process samples this way in hardware!
– Serialize design
Issue #2
– MATLAB does double-precision floating-point arithmetic
– Floating point is expensive in hardware (power and area)
– Convert to fixed-point
56
HDL Workflow
Floating Point Model – Satisfies System Requirements
Executable Specification
– MATLAB and/or Simulink Model
Model Elaboration – Develop Hardware Friendly Architecture in Simulink
– Convert to Fixed-Point Determine Word Length
Determine Binary Point Location
Implement Design – Generate HDL code using Simulink HDL Coder
– Import Custom and Vendor IP
Verification – Software co-simulation with HDL simulator
– Hardware co-simulation Verification
Implement Code Generation
Model
Elaboration
Contin
uous V
erific
atio
n
Floating Point
Model
System
Requirements
57
Divide and conquer Save simulation data to use in development
58
MATLAB-based FFT
Can be done
Resources
– 120 LUTs (1%)
– 32 Slices (1%)
– 0 DSP48s
Need 2048-point FFT
32-point FFT chokes
synthesis tool!
59
Re-implement using Simulink blocks compare against original code
60
Convert to fixed-point compare against original code
61
What you just saw
Simulink Fixed-Point to
model fixed-point data types
– Word lengths
– Fraction lengths
Fixed-Point Tool – monitoring signal
min/max, overflow
– optimization of
data types
62
Analyze BER to determine word length
Anything beyond
8 bits is “good
enough”
63
Serial & Fixed-point “HDL ready”
64
Automatically Generate HDL Code Simulink HDL Coder
65
HDL Coder Generate VHDL and Verilog Code for FPGA and ASIC designs
HDL
Coder
MATLAB Simulink
Verilog and VHDL
Automatic floating-point to
fixed-point conversion
HDL resource optimizations
and reports
Algorithm-to-HDL traceability
Integration with simulation &
synthesis tools
New: MATLAB to HDL
66
HDL Verifier Verify VHDL and Verilog code using cosimulation and FPGAs
Support for 15 Altera and
Xilinx FPGA boards
• Use with:
• HDL Coder
• Hand-written HDL code
New:
FPGA Hardware-in-the Loop Verification MATLAB Simulink
ModelSim® and Incisive®
Xilinx® and Altera® boards
HDL
Verifier
67
Summary
MATLAB is an ideal language for LTE
modeling and simulation
Communications System Toolbox extend
breadth of MATLAB modeling tools
You can accelerate simulation with a
variety of options in MATLAB
– Parallel computing, GPU processing,
MATLAB to C
Address implementation workflow gaps
with
– Automatic MATLAB to C/C++ and HDL
code generation
– Hardware-in-the-loop verification