SlideShare a Scribd company logo
Documentation
AcknowledgementAcknowledgementAcknowledgementAcknowledgement
First of all we thank ALLAH for supporting us.
Special thanks to Prof. Magdi Fekry for being so helpful
with us.
We are grateful to Eng. Mohammed Ismail for providing
us with the WiMAX standard as well as helping us
throughout our project.
Special thanks to Nahdet El Mahrousa organization.
Karim Mohamed Hassan
Name
com.gmail@elbehaidyE-MAIL
02-5563981
Phone
0105785825Mobile
Mahmod Abdelaziz AbdelmonemName
mahmoudabdelaziz@gmail.com
E-MAIL
02-7540420Phone
0105538047Mobile
Mostafa Ibrahim MohamedName
.gmail@m2mostafaiE-MAIL
-345074102Phone
0126777583Mobile
Mina Michael AwadName
com.hotmail@2000_michael_minaE-MAIL
-409049202Phone
0122212650
Mobile
Team members
:Preface
The explosive growth of the Internet over the last decade has lead to an increasing
demand for high-speed Internet access. Broadband wireless access (BWA) is
increasingly gaining popularity as an alternative technology to DSL lines and cable
modems. Following the hugely successful global deployment of the 802.11 wireless
local area network (LAN) standard, deployment of the IEEE 802.16d wireless
metropolitan area network (MAN) standard is currently in progress. This technology
aims to provide fixed broadband wireless access to residential and small business
applications, as well as enable Internet access in countries without any existing wired
infrastructure in place. Standardization efforts are also underway for the 802.16e
version that attempts to provide mobility to the end user in a MAN environment. The
WiMAX Forum (Worldwide Interoperability for Microwave Access) is an industry-led,
non-profit corporation formed to promote and certify compatibility and interoperability
of broadband wireless products. The organization is a non-profit association formed
in 2003 by equipment and component suppliers to promote the adoption of IEEE
802.16 compliant equipment by operators of broadband wireless access systems.
Software radio systems are potentially the next main improvement in mobile and
wireless communications. The software radio techniques in handset design are
facilitated thanks to technology evolution. The capability of such systems to support
re-configuration in response to operator requirements is essential if the true potential
of mobile communications has to be perceived. Moreover, customer expectations for
new applications can be economically fulfilled by terminal and service
reconfiguration.
Our project implements the 802.16 physical standard using software; this gives a lot
of flexibility and upgradeability for the system. The next title explains why we chose
802.16 (WiMAX) as our project.
Why we chose WiMAX as our project:
The idea of our project came from the importance of wireless communications in the
recent few years, but wireless communications have many limitations due to the
problems in propagation like fading and attenuation, WiMAX is based on OFDM
which is a new modulation technique that can overcome many of the problems in
wireless communications as well as providing high data rates which is the most
interesting part that this new standard provides, also it provides a wide coverage
area.
People now are looking forward to having wireless access (Mobile communications,
Internet, video conference,…) with high data rates, for that reason WiMAX is
expected to be the dominant wireless communication system in Egypt in the next
decade, and our project hopefully should be a successful first step towards the
complete implementation of the whole Wimax standard , therefore we can have a
final product that can compete the other markets in the future in one of the
communication systems that are still under research.
What we have made in our project:
:ve'ject weIn our pro
- Implemented the baseband physical layer of WiMAX on the above DSP kit (C6416
DSK) using C++ code where both the transmitter and the receiver are implemented
on the kit.
- Simulated the effect of the channel using MATLAB on the PC including:
1- Fading
2- Noise
3- Propagation loss
4- Frequency and phase offset
The data is first generated on the PC and then transmitted to the kit which performs
the transmission processing, after that the data goes back to the PC to take the
channel effects sending it back to the kit to perform the reception receiving
processing, finally the data goes back to the PC and compared with the transmitted
data to get BER results.
This documentation is organized as follows:
Chapter 1 gives an overview of WiMAX and why it's used as well as its
network structure and future
Chapter 2 shows how WiMAX is suited for NLOS propagation including a
brief explanation of OFDM system as well as other features of WiMAX
physical standard
Chapter 3 THIS CHAPTER IS THE CORE OF OUR PROJECT, it shows how we
designed our system including the software design of the system blocks, it
also discusses the link budget calculations for the proposed system
Chapter 4 includes the simulations of the different blocks of the system on
MATLAB as well as the simulation results, it also describes the testing phase
of our project
Chapter 5 explains our platform which is C6416DSK showing how we dealt
with its peripherals and how we solved the problems associated with them
like TCP and EDMA
Chapter 6 shows the future work that could be made by our younger
colleagues in the next years as a step towards the complete implementation
of the WiMAX standard
010001001000
01100011……
1
CONTENTS
Contents....................................................................................................................1
1. WiMAX……………………….……………………………………..………...…5
1.1 Introduction………………………………………………..………………...…5
1.2 What is WiMAX? ......................................................................................5
1.3 Why WiMAX? …………………………………………….……………….......6
1.3.1 WiMAX can offer very high data rates and extended coverage..6
1.3.2 WiMAX, more flexibility and security………………………………6
1.3.3 WiMAX, a very efficient radio solution………………………….…7
1.3.4 The WiMAX standard is beneficial to every link in the broadband
wireless chain………………………………………………………………7
1.4 WiMAX Network requirements and architecture………………..………..…8
1.4.1 Network requirements………………………………………………8
1.4.2 END-TO-END ARCHITECTURE EVOLUTION…………….……9
1.4.3 NETWORK ARCHITECTURE……………………………….……10
1.4.3.1 Radio Network Serving Node (RNSN) ……..……10
1.4.3.2 Access Point (AP) ………………………….…………10
1.4.3.3 Subscriber Station (SS)…………………………………11
1.5 The WiMAX (802.16) MAC and PHY layers………..………………………11
1.5.1 MAC layer……………………………………..…………………….11
1.5.2 PHY layer……………………………………………………………11
1.6 WiMAX Future ………………………………………………………………12
2. NLOS propagation…………………………………………………………14
2.1 Introduction………………………………………….…………………………14
2.2 NLOS vs. LOS propagation………………………….………………………14
2.3 WiMAX Solutions for NLOS propagation ………………..…………………16
2.3.1 OFDM technology………………………………….………………16
2.3.2 Sub Channelization………………………………………………..17
2.3.3 Adaptive antenna systems………………………….…………….18
2.3.4 Transmit and Receive Diversity…………………………………..18
2.3.5 Adaptive modulation………………………………………….……19
2.3.6 Error Correction Techniques………………………………….…..19
2.3.7 Power Control………………………………………………..……..19
2.4 overview of 802.16 PHY layer……………………………………………….20
3. System design…………………………………………………..………….24
3.1 An introduction to software defined radio ………….……….……….24
3.2 The procedure of our project ……………………………………………26
3.3 Designing an OFDM system for our application……...……………………28
3.4 Software design of the system blocks…………………..…………………..29
3.4.1 The transmitter…………………………………...…………………29
3.4.1.1 Randomizer ………………………….……………….29
3.4.1.2 Convolutional turbo encoding ……………………..30
3.4.1.3 Interleaver …………………………………………….30
3.4.1.4 Mapper ……………………………………………….31
3.4.1.5 Inserting pilots…………………………..……………….32
3.4.1.6 Inverse Fast Fourier Transform (IFFT)…..……………33
3.4.1.7 Adding guard band…………………………..………….33
3.4.1.8 Transmission frame……………………….…………….34
3.4.2 The receiver……………………………………………..………….36
3.4.2.1 Packet detection and symbol timing………..…………36
3.4.2.2 Removing guard band………………………..…………41
2
3.4.2.3 Frequency offset estimation & frequency
synchronization……………………………………………...……………41
3.4.2.4 FFT…………………………………………...…..………43
3.4.2.5 Channel estimation…………………………...…...……44
3.4.2.6 Removing pilots and padding………………...…..……44
3.4.2.7 De mapper………………………………………….……44
3.4.2.8- De interleaver………………………………………......44
3.4.2.9 Turbo decoding...........................................................45
3.4.2.10 De randomizer……………………………………….…45
3.5 Link budget analysis and channel simulation………………………………46
3.5.1 Link budget analysis……………………………………………….46
3.5.2 Channel simulation…………………………………………………47
3.6 future work …………………………………………………………….………48
4. Simulation&Testing……………………………………………………….....50
4.1 System simulation………………………………...………………………..…50
4.1.1 The effect of the interleaver……………..……………………..…50
4.1.2 The effect of the pilots…………………………………………..…52
4.1.3 Simulation of the packet detection algorithm………...............…52
4.2 System testing……………………………………………………………....…53
4.2.1 Testing the frequency synchronization algorithm………….……53
4.2.2 Testing of the turbo encoder………………………………………54
5. Platform……………………………………………………………...………57
5.1 Why we choose C6000 As our Platform……………………………………57
5.1.1 Advantages of designing with DSPs over other
microprocessors……………………………………………………………..…….57
5.1.2Features of the C6000 devices include……………………..……57
5.2 Code Composer Studio………………………………………………………57
5.2.1 Creating a System Configuration…………………………………57
5.2.1.1 Project Management and Editing Tools………………58
5.3 Code Composer Studio Debug Tools………………………………………58
5.3.1Watch Window………………………………………………………58
5.3.2 Displaying Graphs……………………………………….…………58
5.4 Peripherals used in our project………………………………………………58
5.4.1 Enhancement Direct Memory Access (EDMA)……….…………58
5.4.1.1 EDMA configuration…………………………..…………60
5.4.1.2 EDMA problems we faced………………………...……60
5.4.2 JTAG (RTDX)……………………………………………….………60
5.4.2.1 What is JTAG? ………………………………….………60
5.4.2.2The role of RTDX in our project…………………..…….61
5.4.2.3 RTDX problems we faced during the project ..……61
5.4.3 TURBO CO-PROCESSOR (TCP) …………………………..61
5.4.3.1 Introduction ……………………………………………61
5.4.3.2 How to program TCP……………………………………62
5.4.3.2.1 TCP Configuration……………………………62
5.4.3.2.2 EDMA Configuration ……………………62
3
6. Codes………………………………………………………………………….…67
6.1 Transmitter………………………………….………………………………….67
6.1.1 The randomizer …………………..……………………………..67
6.1.2 the Interleaver ………………………………………………67
6.1.3 FFT ……………………….…………………………………………67
6.1.4 twiddle …………………………...………………………………….68
6.1.5 IFFT………………………………...………………………………..69
6.1.6 Mapper………………………………..……………………………..69
6.1.7 Framing and pilot insertion ……..……………………………69
6.1.8 converting from float to complex …………………………..71
6.1.9 preamble generation …………………………………………71
6.1.10 adding guard band …………………………………………….76
6.1.11 Turbo encoder ………………………………………………77
6.2 Receiver …………………………………………………………………….79
6.2.1 derandomizer ……………………………………………………..79
6.2.2 De-interleaver………………………………………………………79
6.2.3 FFT ……………………………………………………………..80
6.2.4 Twiddle ………………………………………………………….80
6.2.5 De-mapper ………………………………………………………..80
6.2.6 remove pilots and padding ………………………………….81
6.2.7 converting from complex to float ……………………………82
6.2.8 Packet detection ………………………………………………..82
6.2.9 calculating variance ………………………………………………83
6.2.10 channel estimation ……………………………………………83
6.2.11 Frequncy synchronization ……………………………………86
6.2.12 frequncy correction ……………………………………………86
6.2.13 Remove Guard band …………………………………………….87
7. Conclusion …………………………………………………………………….88
APPENDIX A Turbo Encoder & Decoder…………..………………………………….I
APPENDIX B Turbo encoder testing code……………………………………………VII
APPENDIX C Matlab simulation code …………………………………………………IX
APPENDIX D List of Figures……………………………………………………………XIV
APPENDIX E List of Tables……………………………..………………………………XV
APPENDIX F Abbreviations and Acronyms…………..………………………………XV
APPENDIX G Application notes & references…………..…………….......................XVI
4
Introduction
What is WiMAX?
Why WiMAX?
WiMAX Network requirements and ARCHITECTURE
The WiMAX (802.16) MAC and PHY layers
WiMAX Future
5
1. WiMAX
1.1. Introduction
Broadband Wireless Access (BWA) has been serving enterprises and operators for
years, to the great satisfaction of its users. However, the new IP-based standard
developed by the IEEE 802.16 is likely to accelerate adoption of the technology. It
will expand the scope of usage thanks to: 1_the possibility of operating in licensed
and unlicensed frequency bands, 2_unique performance under Non-Line-of-Sight
(NLOS) conditions, 3_ Quality of Service (QoS) awareness, 4_extension to
nomadicity, and more.
In parallel, the WiMAX forum, backed by industry leaders, will encourage the
widespread adoption of broadband wireless access by establishing a brand for the
technology and pushing interoperability between products.
In this chapter we'll deal with the following topics:
1- What is WiMAX and why we chose it.
2- WiMAX network requirements and architecture.
3- The future of WiMAX.
1.2. What is WiMAX?
Worldwide Interoperability for Microwave Access (WiMAX) is the common name
associated to the IEEE 802.16a/REVd/e standards.
These standards are issued by the IEEE 802.16 subgroup that originally covered the
Wireless Local Loop (WLL) technologies with radio spectrum from 10 to 66 GHz.
Recently, these specifications were extended below 10 GHz.
• In January 2003, the IEEE approved 802.16a as an amendment to IEEE 802.16-
2001, defining (Near) Line-Of- Sight capability
• In July 2004, IEEE 802.16REVd, published under the name IEEE 802.16-2004,
introduces support for indoor CPE (NLOS) through additional radio capabilities such
as antenna beam forming and OFDM sub-channeling.
• In 2005, an IEEE 802.16e introduced support for mobility.
The WiMAX Forum intends to do for 802.16 what the Wi-Fi Alliance did for 802.11:
• Harmonize standards and certify interoperability between equipment from different
vendors. Standardized interoperable solutions will result in mass volume and bring
down costs,
• Promote and establish a brand for the technology.
6
Figure 1.1 WiMAX standards comparison
1.3. Why WiMAX?
1.3.1 WiMAX can offer very high data rates and extended coverage
However,
•75 Mbit/s capacity for the base station is achievable with a 20 MHz channel in best
propagation conditions. But regulators will often allow only smaller channels (10 MHz
or less) reducing the maximum bandwidth.
• Even though 50 km is achievable under optimal conditions and with a reduced data
rate (a few Mbit/s), the typical coverage will be around 5 km with indoor CPE (NLOS)
and around 15 km with a CPE connected to an external antenna (LOS).
1.3.2 WiMAX, more flexibility and security
Unlike WLAN, WiMAX provides a media access control (MAC) layer that uses a
grant-request mechanism to authorize the exchange of data. This feature allows
better exploitation of the radio resources, in particular with smart antennas, and
independent management of the traffic of every user. This simplifies the support of
real-time and voice applications. One of the inhibitors to widespread deployment of
WLAN was the poor security feature of the first releases. WiMAX proposes the full
range of security features to ensure secured data exchange:
• Terminal authentication by exchanging certificates to prevent rogue devices,
• User authentication using the Extensible Authentication Protocol (EAP),
• Data encryption using the Data Encryption Standard (DES) or Advanced Encryption
Standard (AES), both much more robust than the Wireless Equivalent Privacy (WEP)
7
initially used by WLAN. Furthermore, each service is encrypted with its own security
association and private keys.
1.3.3 WiMAX, a very efficient radio solution
WiMAX must be able to provide a reliable service over long distances to customers
using indoor terminals or PC cards (like today's WLAN cards).
These requirements, with limited transmit power to comply with health requirements,
will limit the link budget. Subchanneling in uplink and smart antennas at the base
station has to overcome these constraints.
The WiMAX system relies on a new radio physical (PHY) layer and appropriate MAC
layer to support all demands driven by the target applications.
The PHY layer modulation is based on OFDM, in combination with a centralized
MAC layer for optimized resource allocation and support of QoS for different types of
services (VoIP, real-time and non real-time services, and best effort). The OFDM
PHY layer is well adapted to the NLOS propagation environment in the 2 - 11 GHz
frequency range. It is inherently robust when it comes to handling the significant
delay spread caused by the typical NLOS reflections. Together with adaptive
modulation, which is applied to each subscriber individually according to the radio
channel capability, OFDM can provide a high spectral efficiency.
WiMAX provides flexibility in terms of channelization, carrier frequency, and duplex
mode (TDD and FDD) to meet a variety of requirements for available spectrum
resources and targeted services.
An important and very challenging function of the WiMAX system is the support of
various advanced antenna techniques, which are essential to provide high spectral
efficiency, capacity, system performance, and reliability:
• Beam forming using smart antennas provides additional gain to bridge long
distances or to increase indoor coverage; it reduces inter-cell interference and
improves frequency reuse,
• transmit diversity and MIMO techniques using multiple antennas take advantage
of multipath reflections to improve reliability and capacity.
1.3.4 The WiMAX standard is beneficial to every link in the broadband
wireless chain:
Operators:
- Wireless systems significantly reduce operator investment risk
- Common Platform drives down costs, fosters healthy competition and encourages
innovation
-No more commitments to a single vendor
Consumers:
- Receive services in areas that were previously out of the broadband loop
- More players in the market translate into more choices for receiving broadband
access services
- Quick “trickle down” effect of cost savings to consumers, translating into lower
monthly rates
8
Component Makers:
- Standardization creates a volume opportunity for chip set vendors/silicon suppliers
Equipment Vendors:
- Concentrate on specialization (i.e. Base Stations or CPEs) - no longer need to
create an entire end-to-end solution as in proprietary model
- Standards-based, common platform fosters rapid innovation and the addition of new
components and services
1.4 WiMAX Network requirements and ARCHITECTURE
1.4.1 Network requirements:
The architecture framework is based on the following requirements:
• Applicability: The architecture shall be applicable to licensed and license-exempt
802.16 deployments.
• Service Provider Categories: The architecture, especially the RAN, shall be
suitable for adoption by all incumbent operator types.
•Harmonization/Interworking: The architecture shall lend itself to integration with an
existing IP operator core network (e.g., DSL, cable, or 3G) via interfaces that are IP-
based and not operator-domain specific. This permits reuse of mobile client software
across operator domains.
•Provisioning and Management: The architecture shall accommodate a variety of
online and offline client provisioning, enrollment, and management schemes based
on open, broadly deployable Industry standards.
•IP Connectivity: The architecture shall support a mix of IPv4 and IPv6 network
interconnects and communication endpoints and a variety of standard IP context
management schemes.
•IP Services: The architecture shall support a broad range of TCP and UDP real-
time and non-real-time applications.
•Security: The architecture shall support Subscriber Station (SS) authorization,
strong bilateral user authentication based on a variety of authentication mechanisms
such as username/password, X.509 certificates, Subscriber Identity Module (SIM),
Universal SIM (USIM), Removable User Identity Module (RUIM), and provide
services such as data integrity, data replay protection, data confidentiality, and non-
repudiation using the maximum key lengths permissible under global export
regulations.
•Mobility Management: The architecture shall scale from fixed access to fully mobile
operation scenarios with scalable infrastructure evolution, eventually supporting low
latency (< 100 msec) and virtually zero packet loss handovers at mobility speeds of
120 km/hr or higher.
9
1.4.2 END-TO-END ARCHITECTURE EVOLUTION
Figure1.2 conceptually shows the architecture evolution for 802.16. A basic 802.16-
2004-based fixed access (indoor and outdoor) deployment is typically accomplished
via a static provisioning relationship between an SS and an 802.16 AP.
The collection of APs and interconnecting routers or switches included in the RAN
can be logically viewed as a contiguous cloud with no inter-AP mobility requirements
from a SS point of view.
The RAN(s) interconnect via a logically centralized operator IP core network to one
or more external networks as shown. The operator IP core may host services such
as IP address management, Domain Name Service (DNS), media switching between
IP packet-switched data and Public Switched Telephony Network (PSTN) circuit-
switched data, 2.5G/3G/Wi-Fi harmonization and interworking, and VPN services.
Going from Fixed access to Portability with Simple Mobility involving the use of
Mobile SSs (MSS) such as laptops and Personal Device Assistants (PDA) introduces
network infrastructure changes such as the need to support break-before-make
micro- and macro-mobility handovers across APs with relaxed handover packet loss
and latency (less than two seconds), cross-operator roaming, and the need to
support reuse of user and MSS authorization credentials across logically partitioned
RAN clouds.
Going from Portability to Full Mobility requires support in the RAN for low (~zero)
packet loss and low latency (<100 msec) make-before-break handovers and
mechanisms such as Idle mode with paging for extended low-power operation.
An important design consideration is QoS. Fixed Access and Portable usage models
need only support acceptable QoS guarantees for stationary usage scenarios.
Portability introduces the requirement to transfer the Service Level Agreement (SLA)
across APs involved in a handover, although QoS may be relaxed during handovers.
Full Mobility requires consistent QoS in all operating modes, including handovers.
The 802.16 RAN will need to deliver Bandwidth and/or QoS on Demand as needed
to support diverse real-time and non-real-time services over the 802.16 RAN.
Besides the traditional Best Effort forwarding, the RAN will need to handle latency
intolerant traffic generated by applications such as VoIP and interactive games.
The decoupling of the RAN from an operator IP core network permits incremental
migration to fully mobile operation. An operator must however give due consideration
to the RAN topology (such as coverage overlap, user capacity, and range) to ensure
that the physical network is future-proof for such an evolution.
Figure 1.2 END-TO-END Architecture Evolutions
10
1.4.3 NETWORK ARCHITECTURE
Figure1.3 shows an end-to-end reference architecture for 802.16. The network
mainly can be divided into three major functional aggregations: the 802.16 SS/MSS,
the 802.16 RAN, and interconnect to various operators IP core and application
provider networks. The IP core network
a) Manages the resources of the 802.16 RAN,
b) Provides core network services such as address management, authentication,
service authorization, and provisioning for 802.16
Figure 1.3 802.16 Reference Architecture
The reference architecture, especially interconnectivity in the RAN and interconnects
to remote IP networks, is based on extensive use of native IP suite of protocols. In
the sections below, we describe three logical entities: the Radio Network Serving
Node (RNSN), AP, and SS/MSS.
1.4.3.1 Radio Network Serving Node (RNSN)
A Radio Network Service Node (RNSN) is a logical network entity that interfaces the
RAN with the operator IP core network, Application Service Provider (ASP) networks,
and other service networks such as IP Multimedia Subsystems (IMS), remote
Enterprise Intranets, PSTN, and the Internet.
1.4.3.2 Access Point (AP):
An 802.16 Access Point (referred to in the 802.16 standard as a base station) is a
logical entity that provides the necessary air interface functions including SS/MSS
admission control and UL/DL scheduling.
11
1.4.3.3 Subscriber Station (SS):
An 802.16 SS is the end point of the network it may be one of the following:
1- The end user himself
2- A connection point that connects a group of users to the network AP.
1.5 The WiMAX (802.16) MAC and PHY layers
1.5.1 MAC layer:
The MAC layer is composed of 3 layers:-
a-Convergence sub layer provides any transformation or mapping of external
network data received through the CS service access point
b-MAC common part sub layer this includes classifying external network service data
units (SDUs)and associating them to the proper MAC service flow identifier (SFID)
which identifies the scheduling and the QOS parameters and connection identifier
(CID) which identifies the connection between the AP and SS, it may also include
such functions as payload header suppression (PHS)
c-Security sub layer that provides authentication of network access and connection
establishment to avoid theft of service, and it provides key exchange and encryption
for data privacy.
1.5.2 PHY layer: (discussed later in section 2.3)
Fig1.4 shows the MAC and PHY layers
Figure 1.4 IEEE STD 802.16 Protocol layering
12
:WiMAX Future.61
The future of WiMAX is the new generaton of the 802.16 standard which is the
802.16e standard which depends basically on the orthogonal frequency multiple
accesses (OFDMA) and that’s due to:
OFDMA is a much more flexible and powerful way to achieve multiple-access with an
OFDM modem. In OFDMA, the multiple-access is not only accommodated in the time
domain, but also in the frequency domain, just like traditional FDMA, minus the
guard-band overhead. As a result, an OFDMA system can support more users with
minimum delay. The finer data rate granularity in OFDMA, as illustrated in Figure 1.5,
is paramount to rich media applications with diverse QoS requirements. In additional,
OFDMA has about an 18dB uplink budget advantage over OFDM-TDMA. Most
importantly, OFDMA enables the exploitation of “multi-user diversity” that
dramatically increases the spectral efficiency of a broadband wireless system.
Figure 1.5 OFDMA vs. OFDM/TDMA
13
Introduction
NLOS vs. LOS propagation
WiMAX Solutions for NLOS propagation
14
2- NLOS propagation
:Introduction.12
While many technologies currently available for fixed broadband wireless can only
provide line of sight (LOS) coverage, the technology behind WiMAX has been
optimized to provide excellent non line of sight (NLOS) coverage. WiMAX’s advanced
technology provides the best of both worlds – large coverage distances of up to 50
km under LOS conditions and typical cell radii of up to 8 km under NLOS conditions.
Here in this chapter we discuss the following topics:
1- NLOS vs LOS propagataion.
2- WiMAX Solutions for NLOS propagation.
3- Overview of 802.16 PHY standard.
:propagationLOS.vsNLOS.22
The radio channel of a wireless communication system is often described as being
either LOS or NLOS. In a LOS link, a signal travels over a direct and unobstructed
path from the transmitter to the receiver. A LOS link requires that most of the first
Fresnel zone is free of any obstruction, see Figure2.1.If this criteria is not met then
there is a significant reduction in signal strength. The Fresnel clearance required
depends on the operating frequency and the distance between the transmitter and
receiver locations.
Figure 2.1 Fresnel zone clearance
In a NLOS link, a signal reaches the receiver through reflections, scattering, and
diffractions. The signals arriving at the receiver consists of components from the
direct path, multiple reflected paths, scattered energy, and diffracted propagation
15
paths. These signals have different delay spreads, attenuation, polarizations, and
stability relative to the direct path.
Figure 2.2 NLOS vs. LOS
The multi path phenomena can also cause the polarization of the signal to be
changed. Thus using polarization as a means of frequency re-use, as is normally
done in LOS deployments can be problematic in NLOS applications. How a radio
system uses these multi path signals to an advantage is the key to providing service
in NLOS conditions. A product that merely increases power to penetrate obstructions
(sometimes called “near line of sight”) is not NLOS technology because this
approach still relies on a strong direct path without using energy present in the
indirect signals. Both LOS and NLOS coverage conditions are governed by the
propagation characteristics of their environment, path loss, and radio link budget.
There are several advantages that make NLOS deployments desirable. For instance,
strict planning requirements and antenna height restrictions often do not allow the
antenna to be positioned for LOS. For large-scale contiguous cellular deployments,
where frequency re-use is critical, lowering the antenna is advantageous to reduce
the co channel interference between adjacent cell sites. This often forces the base
stations to operate in NLOS conditions. LOS systems cannot reduce antenna heights
because doing so would impact the required direct view path from the CPE to the
Base Station. NLOS technology also reduces installation expenses by making under-
the-eaves CPE installation a reality and easing the difficulty of locating adequate
CPE mounting locations. The technology also reduces the need for pre installation
site surveys and improves the accuracy of NLOS planning tools.
16
Figure 2.3 Effect of CPE location
The NLOS technology and the enhanced features in WiMAX make it possible to use
indoor customer premise equipment (CPE). This has two main challenges; firstly
overcoming the building penetration losses and secondly, covering reasonable
distances with the lower transmit powers and antenna gains that are usually
associated with indoor CPEs. WiMAX makes this possible, and the NLOS coverage
can be further improved by leveraging some of WiMAX’s optional capabilities. This is
elaborated more in section 2.2.
2.3 WiMAX Solutions for NLOS propagation:
WiMAX technology solves or mitigates the problems resulting from NLOS
conditions by using:
• OFDM technology.
• Sub-Channelization.
• Directional antennas.
• Transmit and receive diversity.
• Adaptive modulation.
• Error correction techniques.
• Power control.
:FDM technologyO.1.32
Orthogonal frequency division multiplexing (OFDM) technology provides operators
with an efficient means to overcome the challenges of NLOS propagation. The
WiMAX OFDM waveform offers the advantage of being able to operate with the
larger delay spread of the NLOS environment. By virtue of the OFDM symbol time
and use of a cyclic prefix, the OFDM waveform eliminates the inter-symbol
interference (ISI) problems and the complexities of adaptive equalization. Because
the OFDM waveform is composed of multiple narrowband orthogonal carriers,
selective fading is localized to a subset of carriers that are relatively easy to equalize.
An example is shown below as a comparison between an OFDM signal and a single
carrier signal, with the information being sent in parallel for OFDM and in series for
single carrier.
17
Figure 2.4 Multi carrier vs. Single carrier
The ability to overcome delay spread, multi-path, and ISI in an efficient manner
allows for higher data rate throughput. As an example it is easier to equalize the
individual OFDM carriers than it is to equalize the broader single carrier signal.
Figure 2.5 OFDM performance in frequency selective fading
For all of these reasons recent international standards such as those set by IEEE
802.16 have established OFDM as the preferred technology of choice.
2.3.2 Sub Channelization
Sub Channelization in the uplink is an option within WiMAX. Without sub
channelization, regulatory restrictions and the need for cost effective CPEs, typically
cause the link budget to be asymmetrical, this causes the system range to be up link
limited. Sub channeling enables the link budget to be balanced such that the system
18
gains are similar for both the up and down links. Sub channeling concentrates the
transmit power into fewer OFDM carriers; this is what increases the system gain that
can either be used to extend the reach of the system, overcome the building
penetration losses, and or reduce the power consumption of the CPE. The use of sub
channeling is further expanded in orthogonal frequency division multiple access
(OFDMA) to enable a more flexible use of resources that can support nomadic or
mobile operation.
Figure 2.6 The effect of sub-channelization
2.3.3 Adaptive antenna systems:
Directional antennas increase the fade margin by adding more gain this increases
the link availability. Delay spread is further reduced by directional antennas at both
the Base Station and CP. The antenna pattern suppresses any multi-path signals
that arrive in the sidelobes and backlobes. The effectiveness of these methods has
been proven and demonstrated in successful deployments, in which the service
operates under significant NLOS fading.
Adaptive antenna systems (AAS) are an optional part of the 802.16 standard. These
have beam forming properties that can steer their focus to a particular direction or
directions. This means that while transmitting, the signal can be limited to the
required direction of the receiver; like a spotlight. Conversely when receiving, the
AAS can be made to focus only in the direction from where the desired signal is
coming from. They also have the property of suppressing cochannel interference
from other locations. AASs are considered to be future developments that could
eventually improve the spectrum re-use and capacity of a WiMAX network.
2.3.4 Transmit and Receive Diversity:
Diversity schemes are used to take advantage of multi-path and reflectioned signals
that occur in NLOS conditions. Diversity is an optional feature in WiMAX. The
diversity algorithms offered by WiMAX in both the transmitter and receiver increase
the system availability. The WiMAX transmit diversity option uses space time coding
to provide transmit source independence; this reduces the fade margin requirement
and combats interference. For receive diversity, various combining techniques are
exist to improve the availability of the system. For instance, maximum ratio
combining (MRC) takes advantage of two separate receive chains to help overcome
fading and reduce path loss. Diversity has proven to be an effective tool for coping
with the challenges of NLOS propagation.
19
:Adaptive modulation.5.32
Adaptive modulation allows the WiMAX system to adjust the signal modulation
scheme depending on the signal to noise ratio (SNR) condition of the radio link.
When the radio link is high in quality, the highest modulation scheme is used, giving
the system more capacity. During a signal fade, the WiMAX system can shift to a
lower modulation scheme to maintain the connection quality and link stability. This
feature allows the system to overcome time-selective fading. The key feature of
adaptive modulation is that it increases the range that a higher modulation scheme
can be used over, since the system can flex to the actual fading conditions, as
opposed to having a fixed scheme that is budgeted for the worst case conditions.
Figure 2.7 Relative cell radii for adaptive modulation
2.3.6 Error Correction Techniques
Error correction techniques have been incorporated into WiMAX to reduce the
system signal to noise ratio requirements. Strong Reed Solomon FEC, convolutional
encoding, and interleaving algorithms are used to detect and correct errors to
improve throughput. These robust error correction techniques help to recover errored
frames that may have been lost due to frequency selective fading or burst errors.
Automatic repeat request (ARQ) is used to correct errors that cannot be corrected by
the FEC, by having the errored information resent. This significantly improves the bit
error rate (BER) performance for a similar threshold level.
2.3.7 Power Control
Power control algorithms are used to improve the overall performance of the system,
it is implemented by the base station sending power control information to each of
the CPEs to regulate the transmit power level so that the level received at the base
station is at a pre-determined level. In a dynamical changing fading environment this
pre-determined performance level means that the CPE only transmits enough power
to meet this requirement. The converse would be that the CPE transmit level is
based on worst-case conditions. The power control reduces the overall power
consumption of the CPE and the potential interference with other co-located base
stations. For LOS the transmit power of the CPE is approximately proportional to it’s
distance from the base station, for NLOS it is also heavily dependant on the
clearance and obstructions.
20
:PHY layer.16802Overview of.42
Physical layer is the last layer of the transmitter in the WiMAX system before the RF
section and after the MAC layer and the first layer in the receiver after the RF section
and before the MAC layer.
The 802.16-2004 standards describe four different air interfaces (physical layer). One
of these interfaces is optimized for non-line-of-sight, RF frequencies < 11 GHz, and
distances up to 30 km. Although the standard has officially named this PHY layer as
Wireless MAN-OFDM.
The basic characteristics of the air interface are 256 carriers OFDM, bandwidths that
range from 1.25 MHz to 20 MHz, and carrier frequencies up to 11 GHz.
In the WiMAX air interface, the basic OFDM symbols are based on a 256 point FFT.
As with other OFDM systems, a portion of these 256 subcarriers are set aside
(unused) for guard bands and the center frequency Subcarrier is not used because it
is easily susceptible to RF carrier feed through. In WiMAX, only 200 subcarriers are
actually used. These 200 carriers are allocated as 192 carriers for data and 8 carriers
as pilots. The pilot carriers are always BPSK modulated and the data carriers are
BPSK, QPSK, 16 QAM, or 64 QAM.
Figure 2.8 OFDM subcarriers
The system can be configured to use any bandwidth from 1.25 MHz to 20 MHz and
regardless of the bandwidth; the symbols always contain 200 carriers. For narrow
bandwidth systems, this implies the subcarriers are very closely spaced, which
provides a relatively long symbol period (symbol period is defined as 1 / subcarrier
spacing). These closely spaced subcarriers and long symbols help overcome
channel impairments such as multipath. This long symbol period is a key
differentiator between WiMAX systems and wireless LAN systems (relatively short
symbols), which provides WiMAX with significant advantages for long distances and
non-line-of-sight applications.
WiMAX systems can be deployed as TDD, FDD, or half-duplex FDD. Figure2.10
shows a typical frame in a TDD configuration where the basestation and subscriber
equipment each transmit on the same RF frequency, separated in time. The
basestation transmits a downlink subframe, followed by a short gap called
transmit/receive transition gap (TTG), and then individual subscribers transmit the
uplink subframes. The subscribers are accurately synchronized such that their
transmissions do not overlap each other as they arrive at the basestation. Following
all uplink subframes, another short gap called receive/transmit transition gap (RTG)
is allocated before the basestation can again start transmitting.
Figure 2.9 downlink and uplink subframes
21
Notice each uplink subframe is preceded by a preamble. This is called a “short
preamble” and allows the basestation to synchronize on each individual subscriber.
Looking closer at the downlink, a downlink subframe always begins with a preamble,
followed by a header, and one or more downlink bursts of data. These downlink
bursts are generally made up of multiple symbols within the burst. Within each burst,
the modulation type is constant; however, from burst to burst the modulation type can
change. Bursts using robust modulation types such as BPSK and QPSK are required
to be transmitted first, followed by less robust modulation types (16 and 64 QAM).
Downlink subframes containing all four types of modulation would need to be in this
order: BPSK followed by QPSK, 16 QAM, and finally 64 QAM.
Every transmission on both the uplink and downlink always begins with a preamble.
This preamble allows receivers to synchronize with the transmitter and is used for
channel estimation. The downlink transmission begins with a long preamble.. These
preamble symbols are transmitted with 3 dB more power than all other symbols in the
downlink subframe, making them easier for the receivers to demodulate and decode
correctly. A “short preamble” is used at the beginning of each uplink bursts. When
using extremely long downlink bursts that contain many symbols, it may be desirable
to insert a midamble (short preamble) in between the downlink bursts. This short
preamble helps receivers resynchronize and perform additional channel estimation.
Following the preamble is a frame control header (FCH). This FCH is implemented
as a single symbol of BPSK modulation. This symbol contains 88 bits of overheard
data that describes critical system information such as base station ID and the
downlink burst profile that receivers need to decode the subframe. The FCH does not
contain enough information to fully describe the network or downlink profile, but it
does contain enough that receivers can start decoding the downlink bursts.
The downlink bursts contain user data as well as control messages. The downlink
bursts each contain one or more symbols. Each symbol in the burst contains
between 12 and 108 bytes of payload data, depending on the modulation type and
coding gain. Table …. shows the seven different combinations of modulation type
and coding gain. For each of these combinations a specific amount of payload data is
required for each symbol.
Table 1 Modulation and coding combinations
When necessary, padding adds bits so that the payload data is in correct block sizes
that will map into an integer number of symbols. The Randomizer XOR’s the data
with a pseudo random bit sequence to toggle some of the 1’s to 0’s and some 0’s to
1’s. This randomizer eliminates long strings of 1’s or 0’s in the payload data. A single
tail byte is added and the bits are ready for turbo coding. These coding steps provide
forward error correction and are very common coding methods used in digital
22
communication systems. This coding adds redundant data that helps identify and fix
bits that are missing or corrupted.
The final steps in coding involve interleaving, which is performed in two steps.
After coding FFT is done to the bits then adding guard band to the frame then ending
it. And the reverse of this operation is done to the frame in the receiver.
To simplify transmitter and receiver designs, all symbols in the FCH and DL data
bursts are transmitted with equal power. Because symbols use four different
modulation types (BPSK, QPSK, etc.), it is necessary to scale each such that the
average symbol power from each symbol is approximately equal.
23
An introduction to software defined radio
The procedure of our project
Designing an OFDM system for our application
Software design of the system blocks
Link budget analysis and channel simulation
Future work
24
3- System design
3.1 An introduction to software defined radio:
The challenge of modern wireless communications like WiMAX has considerably
pushed the research towards the Software Radio. The presence of various standards
for wireless communications and the great difference of services offered by mobile
communication providers have led to the planning of a universal connection, that
adapts itself to different requirements.
The software radio terminals must be auto re-configurable, in order to match the
different telecommunication standards. Software Radio (SWR) defines a radio
system which has an operating range, bandwidth, level of power, type of modulation,
channel coding and so on, all of them configurable by software without changing the
hardware.
The main rewards of a Software Radio terminal are:
♦ The marketing of a single product able to satisfy different customers through
a software update.
♦ The support to the products can be simplified, and the hardware repair made
easier. With the great variety of services that will be offered with 3G, the
distribution will assume a remarkable role to interpret customer moods.
♦ For the customer, probably, it will be both a benediction and a curse: the
strong dependence of the products from the software obliges the user to
frequent updates, to always be able to utilize new services available from the
provider.
Figure3.1 shows the basic configuration of a software radio terminal
Figure 3.1 basic configuration of a software radio terminal
The Analog to Digital conversion (ADC) is moved as near as possible to the antenna,
so to make filtering in digital processing.
SWR arrangement capability to support different standards is mainly due to:
♦ The range of frequencies and bandwidth of the RF stage
♦ The greatest bandwidth assigned to a signal
♦ The sampling frequency of the ADCs
♦ The maximum dynamic range
♦ The computational capability of the digital processors (DSP in general).
Software Radio Transceiver, in its widest meaning, defines a general TX/RX
architecture that can be completely reconfigured, directly operating on an RF
digitized information stream. Analog processing is limited at the RF front-end, where
a pass-band image-rejection filter selects a large spectrum portion containing the
desired services. After a LNA, an ADC converts the signal with the precision required
25
by the system specifications. The digital RF stream is then fed to a RF-BB physical
layer DSP subsystem that:
♦ Centers the received signal spectrum to the band of services of interest
♦ Lowers the sampling frequency of the digital stream down to the minimum
rate required by the standard specifications
♦ Operates the necessary filtering in order to reject the unwanted adjacent
signals
♦ Demodulates, channel- and source-decodes the symbol flow and supplies
the information bit-stream, for subsequent processing, to higher layers
hardware and software
In the following we propose a re-configurable platform able to implement the different
standards, with currently available technology. In figure3.2 it is shown a block
diagram of a possible complete transceiver that uses a DSP based hardware for the
implementation of the different baseband and IF stage systems.
Nowadays, the technology does not allow having a digital RF stage (Digital Front-
End), so the SWR transceiver uses different analog RF stages, one for each
considered standard. If a SWR approach is followed, the implementation of the
different telecommunication standards can be reduced to the implementation and
optimization of some basic processing blocks.
Figure 3.2 DSP based hardware transceiver
In WiMAX, flexibility is greatly required where SWR allows for the following:
♦ Easy upgrade from OFDM to OFDMA
♦ Software upgrade of the FFT size from 256 to 512 and 1024
♦ The standard itself is up gradable to 802.16e
♦ Uplink subchannelization support
♦ Turbo coding support
♦ Support for adaptive modulation
26
In our project we're designing the BB physical layer of the system using software as
we'll see in the rest of the chapter. The remaining portions of the system can be
developed in the future work as we'll explain in chapter 6.
3.2 The procedure of our project:
In this chapter we explain the steps through which we accomplished our project. We
first divided ourselves into 2 groups:
The 1st
group had the following tasks in order:
1- Having an overview of the WiMAX system and understand its network
structure in brief
2- Studying the 802.16 protocol on which WiMAX is based and concentrating on
the physical layer, but sometimes we refer to the MAC layer to understand
some points in the physical layer.
3- Proposing a model for our project to be implemented on our platform, this
model has some assumptions which we put to let the implementation feasible.
These assumptions shall be described for each block individually.
The 2nd
group had the following tasks in order:
1- Searching on the web for a suitable platform for our project, there were many
like FPGA, DSP and ASIC. But finally they made a decision that DSP is the
most suitable for us as we'll explain in chapter 5.
2- Selecting which DSP to work on and which one is more suitable for project
3- Studying the selected DSP kit which is C6416DSK and how to deal with its
different peripherals as well how to program it
4- Interfacing the kit to the PC which was a very essential task in our project as
we'll explain in the following section
Then we come to the most critical part of our project where we integrate between the
2 groups such that the system is implemented on the selected platform but before
coming to this step we shall first explain what we've actually made in our project.
27
In our project we've
- Implemented the baseband downlink physical layer of WiMAX on the above DSP kit
(C6416 DSK) using C++ code where both the transmitter and the receiver are
implemented on the kit.
- Simulated the effect of the channel using MATLAB on the PC including:
1- Fading
2- Noise
3- Propagation loss
4- Frequency and phase offset
The data is first generated on the PC and then transmitted to the kit which performs
the transmission processing, after that the data goes back to the PC to take the
channel effects sending it back to the kit to perform receiving processing, finally the
data goes back to the PC and compared with the transmitted data to get BER results.
After this brief explanation of our project we shall explain the phases of integration of
our project:
Phase 1: Designing each block in the system individually using C++ code
Phase 2: Testing each block individually as well as simulation on MATLAB, this part
shall be explained in detail in the next chapter
Phase 3: Integrating all the blocks together of both the transmitter and the receiver in
an ideal channel with no noise, also the data transmitted is only 1 OFDM symbol.
Phase 4: Adding preamble and more OFDM symbols to be transmitted in an ideal
channel
Phase 5: In this phase we start adding the channel effects, first we add noise only
then we begin to add fading and phase delay and see how the performance becomes
worse, then we add the channel estimation block and observe how it improved the
performance.
Phase 6: Here we test the packet detection algorithm and estimate the symbol timing
as we'll explain in section 3.4.2.1
Phase 7: We begin to add frequency offset and see how it degrades the BER, and
then we add the frequency synchronization function to see how it improves the BER.
Now after explaining the phases of our project implementation we'll begin to explain
the design issues that we were subject to in our project concerning the
communication system:
1- Selecting the OFDM system parameters as well as the sampling time for our
system.
2- The software design of the modules used in the transmitter and the receiver
as well as the operation of each module and its benefit.
3- Link budget analysis and channel simulation on MATLAB.
010001001000
01100011……
Figure 3.3 System design
28
3.3 Designing an OFDM system for our application:
WiMAX is a broadband wireless access communication system; this puts some
constraints on the channel parameters like delay spread and other parameters as
well.
Since we are operating in a NLOS medium with coverage area within a few
kilometers we can say that the delay spread is around 2 µseconds.
So we'll choose the guard band Tg=4×delay spread=8µsec.
Also we'll let the guard band equal to quarter the symbol duration, so
The symbol duration Ts=5×Tg=40µsec
And the subcarrier spacing=1/Ts=25 KHz
And since the allocated bandwidth=5MHz
So the number of subcarriers=bandwidth/subcarrier spacing= 200 subcarrier
So the required FFT size=256
We'll take 192 subcarrier for the data and 8 for the pilots because we need the pilots
for channel estimation and correction and actually 8 pilots are enough.
Then in order to get the bit rate, we shall assume QPSK modulation so we've 2
bits/subcarrier
I.e. we have 2×192 information bits / OFDM symbol
So the bit rate Rb becomes:
Rb=(2×192)/(Ts+Tg)=8Mbps
If we use 16QAM modulation the bit rate will be 16Mbps.
Finally we want to get the sampling time to be used while simulating the channel on
MATLAB,
We can simply get it by dividing Tg by the number of samples in the guard band
which equal 64 samples (quarter the OFDM symbol)
Tsample=8/64=125nsec
So the parameters are:
2 µsecDelay spread
8 µsecGuard band duration
40 µsecSymbol duration
25 KHZSubcarrier spacing
5 MHZBandwidth
200Total # of subcarriers
192Data subcarriers
8Pilot subcarriers
256FFT size required
125 nsecSampling time
Table 2 OFDM parameters
29
Convolutional
turbo encoder
Interleaver Mapper
Adding guard
band
Pilot
insertion
IFFTRF
Randomizer
Data
:Software design of the system blocks.43
As we've explained in the previous chapter, WiMAX physical layer is composed of
many blocks, here in this chapter we introduce the blocks which we've implemented.
First of all we've designed only the uplink as we've explained in the beginning of the
chapter, also our project doesn't involve real time due to the delay on the PC to take
the channel effects.
:The transmitter.1.43
Its block diagram is as follows:
Figure 3.4 Transmitter block diagram
3.4.1.1 Randomizer:
Operation:
It randomizes the bits input to it by modulo -2 addition of the data with the output of
an LFSR with characteristic polynomial 1 +X14
+X15
.
Figure 3.5 PRBS for data randomization
Benefits:
- It's considered a means of scrambling the data for more security.
- Ensures more bit transitions to support clock recovery.
INPUT:
184 bit of data.
OUTPUT:
184 bit to the turbo encoder.
Function prototype:
void randomizer(char dinr[],char doutr[])//din input to, dout from randomizer
30
3.4.1.2 Convolutional turbo encoding:
Operation:
This block encodes the incoming data bits using a very efficient coding
technique which is turbo coding. Before the data enters this block we add 1
byte of zero padding.
For a detailed explanation of the turbo encoder look at appendix A
Benefits:
It makes a significant improvement in the BER for the same SNR, especially
when it is used together with the interleaver.
Also for the same BER it saves an amount of the transmitted power.
Assumptions:
Here we assumed coding rate=1/2. The other parameters shall be explained
when we deal with the TCP peripheral associated with our platform in
chapter5
INPUT:
184 bits (after zero padding)
OUTPUT:
384 bits to the interleaver
Function Prototype: void Turbo_encoder (char input[], char frame[]) //Frame is the
decoded output
3.4.1.3 Interleaver:
Operation:
- After the encoder all the encoded bits shall be interleaved by a block
interleaver with block size corresponding to number of coded bits per
allocated subchannels per OFDM symbol Interleaving is done in two
permutations according to two the functions:
The first permutation is defined by the equation:
mk=(Ncbps/12) ×Kmod12+floor(K/12) K=0,1,2,3,....,Ncbps1
(3.1)
The second permutation is defined by the equation:
j k=s×floor(mk/s)+(mk+Ncbps-floor(12×mk/Ncbps))mod(s) K=0,1,2,3,....,Ncbps-1
(3.2)
Where:
Ncpc= number of coded bits per subcarrier i.e. 1,2,4,6 for BPSK, QPSK, 16-QAM, 64-
QAM
S=ceil (Ncpc/2)
Ncbps=number of bits at transmission per block.
K=index of coded bits before 1st
permutation.
mk=index of coded bits after 1st
permutation and before the second permutation
jk=index of the coded bits after the second permutation and before the mapping.
31
Table 3 block sizes of the bit interleaver
The first bit out of the interleaver shall map to the MSB in the constellation.
Benefits:
- The first step of interleaving is to rearrange the ordering of the bits to make
certain that adjacent bits are not mapped onto adjacent carriers. This helps
eliminate errors by reducing the chance that adjacent bits would be lost if a
portion of the channel bandwidth is degraded with some type of spurious or
band limited noise.
- The second step of interleaving is to reorder the bits so that the original
adjacent bits are alternately mapped into more or less reliable points on the
IQ constellation. In complex modulation like 64 QAM, each IQ point
represents multiple bits of data, and some of these bits are easier to detect
(therefore, more reliable) than other bits. After interleaving, the coded bits are
mapped to the IQ constellation, starting with carrier number –100 on up to
carrier number +100.
Assumptions:
In our project we are working with QPSK modulation and in the default case
of the interleaver which is 16 subchannels so finally the interleaver block size
we used is 384.
INPUT:
384 bit from encoder (QPSK, 16 subchannels)
OUTPUT:
384 bit to the mapper (QPSK, 16 subchannels)
Function Prototype: void interleave(char dini[],char douti[])
3.4.1.4 Mapper:
Operation:
- The data out of the interleaver is entered serially to the constellation mapper,
BPSK Gray-mapped QPSK, 16-QAM, 64-QAM shall be supported, where the
support of 64-QAM is optional for license exempt band.
The constellations shall be normalized by multiplying the constellation point
by an indicated factor c to achieve equal average power.
The constellation mapped data shall be subsequently modulated onto the
allocated subcarriers in order of increasing the frequency index. The first
mapped symbol of the mapper shall be modulated with allocated subcarrier
with the lowest frequency offset index.
32
FIGURE 3.6 BPSK, QPSK, 16-QAM and 64-QAM constellations
Benefits:
Changing the modulation type (BPSK, QPSK, 16-QAM, 64-QAM) allow us to
increase bit rate within the same symbol.
Assumptions:
In our project we used QPSK modulation.
INPUT:
384 bit from interleaver (QPSK, 16 subchannels)
OUTPUT:
192 symbol (QPSK modulation)
Function Prototype: void mapper(char dinm[], float doutIm[],float doutQm[])
3.4.1.5 Inserting pilots
Operation:
It adds pilots to the OFDM symbol at the locations specified in IEEE 802.16
standard.
Benefits:
It's used at the receiver for channel estimation as described in the channel
estimation block.
Assumptions:
No assumptions.
INPUT:
192 bits from the mapper
OUTPUT:
200 bits
33
Function Prototype: void frame(float I[],float Q[],COMPLEX data_outf[])//data is
the output, I and Q are the inputs before pilot insersion
3.4.1.6 Inverse Fast Fourier Transform (IFFT):
Operation:
It constructs the time domain OFDM symbol by calculating the 256 point
inverse discrete Fourier transform but in a more efficient way which is called
FFT.
Refer to chapter 12 of 'The Scientist and Engineer's Guide to Digital Signal
Processing' to have a better understand of the FFT and IFFT.
When we call this function we first call the twiddle function that calculates the
phases of the exponentials used in the FFT function.
Then, because we want to make an IFFT function using FFT so we'll do the
following:
1- Change the sign of the imaginary part of the input data
2- Get its FFT after calculating the twiddle factors
3- Change the sign of the imaginary part of the output data
Note:
Before entering the IFFT function we have to add zero padding to increase
the input samples from 200 to 256 because the algorithm works better when
the input samples is a power of 2. We add 28 zeros at the beginning of the
symbol and 27 at the end so as not to add any frequency components this is
why we don't put them all at the end of the symbol.
Benefits:
It is the simplest way to implement multicarrier modulation, and thanks to it
OFDM became feasible.
INPUT:
200 bits after pilot insertion+56 mapping
OUTPUT:
256 symbols
Function Prototype: void iFFT(COMPLEX input[], int n) // n is the IFFT size
3.4.1.7 Adding guard band
Operation:
It takes the last 64 symbols output from the IFFT block and puts them at the
beginning of the symbol
Benefits:
- To account for the delay spread of the channel impulse response thus
avoiding intercarrier interference.
- To avoid ISI
Assumptions:
In the standard the guard band varies from 1/8 to 1/4 of the symbol duration,
here we've assumed that the guard band is 1/4 the OFDM symbol which is 64
samples.
INPUT:
256 symbols from the FFT
34
)(22 )()(644 kAllk PconjP ××=×
OUTPUT:
320 symbols
Function Prototype: void guardband(COMPLEX din[], COMPLEX dout[])
3.4.1.8 Transmission frame:
In this section we describe the frame structure which we proposed, it has some
differences from the 802.16 protocol.
The frame is composed of a group of OFDM symbols preceded by a preamble. The
preamble structure is as follows:
Each preamble consists of either one of 2 OFDM symbols .The OFDM symbols are
defined by the values of the composing sub carrier. Each OFDM symbol contains a
cyclic prefix, which length is the same as the cyclic prefix (CP) of the data.
The first preamble is the downlink preamble. It consists of 2 consecutive OFDM
symbols .The first OFDM symbol consists of sub carriers of indices which is multiple
of 4. As a result the time domain wave form consists of four repetitions of 64 sample
fragment preceded by a CP. the second OFDM symbol consists of even sub
carriers. As a result the time domain waveform consists of two repetitions of 128
sample fragment preceded by a CP .The compilation of the two OFDM symbols is
called long preamble.
FIGURE 3.7 Downlink and network entry preamble structure
The frequency domain sequence for all full band width preambles are derived from
the sequence
The frequency domain sequence of 4 times 64 is P4*64 is defined by:
kmod4=0 (3.3)
0 kmod4≠0
35
)(2 kAlleven PP ×=
In last equation the factor of 2 equates the root mean square power with that of
data section. The additional 2 is related to the 3db boost.
In the uplink the data preamble consists of one OFDM symbol which consists only of
the even sub carriers .The time domain sequence consists of 2 times 128 samples
preceded by a CP. The values of the sub carriers are set according to Peven. This
Preamble is referred as short preamble.
FIGURE 3.8 PEVEN time domain structure
kmod2=0 (3.4)
0 kmod2≠0
In Peven 2 is related to the 3db boost.
In our project we used the short preamble in the downlink instead of the long
preamble, also we'll make use of the 2 repeated 128 data symbols in the double
sliding window algorithm used in symbol timing as we'll explain in section 3.4.2.1
which gives us better performance.
Also we've made another assumption which is:
We didn't apply the adaptive modulation technique thus we didn't add the FCH
header in the frame which is used to identify the burst profile (modulation + coding)
as well as other functions.
36
3.4.2 The receiver:
Its block diagram is s follows:
The first stage of the receiver is packet detection and symbol timing; Synchronization
is an essential task for any digital communication system. Without accurate
synchronization algorithms, it is not possible to reliably receive the transmitted data.
From the digital Base band algorithm design engineer's perspective, synchronization
algorithms are the major design Problem that has to be solved to build a successful
product.
3.4.2.1 Packet detection and symbol timing:
A-Packet Detection
Packet detection is the task of finding an approximate estimate of the start of the
preamble of an incoming data packet. As such it is the first synchronization algorithm
that is performed, so the rest of the synchronization process is dependent on good
packet detection performance.
Packet detection is made by comparing a certain decision variable mn with a
threshold, if it's greater than the threshold then the packet is present, if not then the
packet isn't present.
The performance of the packet detection algorithm can be summarized with two
probabilities: probability of detection PD and probability of false alarm PFA. PD is the
probability of detecting a packet when it is truly present, thus high PD is a desirable
quality for the test.
PFA is the probability that the test incorrectly decides that a packet is present, when
actually there is none, thus PFA should be as small as possible. In general,
increasing PD increases PFA and decreasing PFA decreases PD, hence the
algorithm designer must settle for some balanced compromise between the two
conflicting goals.
Generally it can be said that a false alarm is a less severe error than not detecting a
packet at all. The reason is that after a false alarm, the receiver will try to synchronize
to nonexistent packet and will detect its error at the first received data integrity check.
On the other hand, not detecting a packet always results in lost data. A false alarm
can also result in lost data, in case an actual data packet starts during the time the
receiver has not yet detected its mistake. In this case, the receiver will not be able to
Packet detection
& symbol timing
Channel
estimation
Turbo
Decoder
De-MapperDe-interleaver
RF
De-randomizer
Data
Removing
guard band
Frequency
synchronization
Pilot
removal
FFT
Figure 3.9 Receiver block diagram
37
catch that packet. The probability of this occurring depends on several issues like the
network load and the time it takes for the receiver to detect its mistake. In conclusion,
a little higher PFA can be tolerated to guarantee good PD.
In WiMAX the preamble is used for packet detection, it's composed of 1 symbol of 2
repeated portions which shall be useful here in packet detection as we shall see in
the next section; also it will be useful for frequency synchronization which is
explained in section 3.4.2.3
Double Sliding Window Packet Detection
This algorithm makes use of the repeated preamble symbol; it calculates two
consecutive sliding windows of the received energy. The basic principle is to form the
decision variable mn as a ratio of the total energy contained inside the two windows.
Figure 3.10 shows the windows A and B and the response of mn to a received
packet. In Figure 3.10, the A and B windows are considered stationary relative to the
packet that slides over them to the right. It can be seen that when only noise is
received the response is flat, since both windows contain ideally the same amount of
noise energy. When the packet edge starts to cover the A window, the energy in the
A window gets higher until the point where A is totally contained inside the start of the
packet. This point is the peak of the triangle shaped mn and the position of the packet
in Figure 3.10 corresponds to this sample index n. After this point B window starts to
also collect signal energy, and when it is also completely inside the received packet,
the response of mn is flat again. Thus the response of mn can be thought of as a
differentiator, in that its value is large when the input energy level changes rapidly.
The packet detection is declared when mn crosses over the threshold value Th.
Figure 3.10.The response of the double sliding window packet detection
algorithm.
The following equations shows the calculation of the A&B windows values
(3.6)
38
Then the decision variable is formed by dividing the value of the an by bn
(3.7)
A simulated response of the variable mn is shown in Figure 3.11. The figure is a
preamble with 10dB SNR. The figure clearly shows how the value of mn does not
depend on the total received power.
Figure 3.11Double sliding window packet detection.
After the peak, the response levels off to the same value as before the peak,
although the received energy level is much higher. An additional benefit of this
approach is that, at the peak point of mn the value of an contains the sum of signal
energy S and noise energy N and the bn value is equal to noise energy N, thus the
value of mn at the peak point can be used to estimate the received SNR. The
following equations are the ratio an and bn at the peak point and the SNR estimate
calculated from the ratio.
39
(3.8)
(3.9)
:Symbol timing-B
Symbol timing refers to the task of finding the precise moment of when individual
OFDM symbols start and end. The symbol timing result defines the DFT window; i.e.,
the set of samples used to calculate DFT of each received OFDM symbol. The DFT
result is then used to demodulate the subcarriers of the symbol. The approach to
symbol timing is different for WiMAX and broadcast OFDM systems. A WiMAX
receiver cannot afford to spend any time beyond the preamble to find the symbol
timing, whereas a broadcast transmission receiver can spend several symbols to
acquire an accurate symbol timing estimate.
All what we have to do is just take the sample at which the decision variable reaches
its maximum value, this sample represents the middle of the preamble symbol, so we
just bypass 128 samples to be at the beginning of the next OFDM symbol. In the next
part we discuss how to optimize the symbol timing in a multipath channel.
Optimization of Symbol Timing in a Multipath Channel
The performance of the symbol timing algorithm directly influences the effective
multipath tolerance of an OFDM system. An OFDM receiver achieves maximum
multipath tolerance when symbol timing is fixed to the first sample of an OFDM
symbol. Figure 3.12 shows three consecutive OFDM symbols, their respective cyclic
prefixes (CP), and the effect of symbol timing on the DFT window. The ideal timing
for symbol 2 is shown as the ideal DFT window in Figure 3.12 (a). In this case the
DFT window does not contain any samples from the CP; hence the maximum length
of the channel impulse response (CIR) that does not cause intersymbol interference
(ISI) is equal to the CP length. This is the maximum possible ISI free multipath length
for an OFDM system. In practice, it is impossible to fix the symbol timing point
perfectly to the first sample of the OFDM symbol. There will always be some
variability in the symbol timing estimate around its mean value. In addition to the
ideal symbol timing, Figure 3.12 shows the probability density function (PDF) of a
realistic symbol timing estimate with the mean value equal to the ideal symbol timing.
The PDF shows how the actual symbol timing estimate can be before or after the
ideal value. The effect on the DFT window is shown as the DFT window range; that
is, the range within which the DFT window will fall. When the symbol timing point is
estimated before the ideal value, the start of the DFT window will contain samples
from the CP and the last samples of the symbol are not used at all. This case does
not cause serious problems, because the CP is equal to the last samples of the
symbol so the circular convolution property of DFT is still satisfied. It is possible that
some ISI is caused by the early symbol timing estimate, if the CIR is long enough to
reach the first samples of the DFT window. For a properly designed OFDM system,
the amount of this interference is negligible, because the last taps of the CIR are
small. Next consider the case when the symbol timing estimate is after the ideal
value. In this case, the start of the DFT window will be after the first sample of the
symbol and the last samples are taken from the beginning of the CP of the next
40
symbol. For example, in Figure 3.12(a), this would mean that the DFT window for
symbol 2 would contain samples from the CP 3. When this happens, significant ISI is
created by the samples form CP of the next symbol. Additionally the circular
convolution property required for the orthogonality of the subcarriers is no longer
true, hence intercarrier interference is generated. The end result of a late symbol
timing estimate is a significant performance loss.
Fortunately, there is a simple solution for this problem. Since early symbol timing
does not create significant problems, the mean value of the symbol timing point can
be shifted inside the CP. This is shown in Figure 3.12(b). After the shift, the PDF of
the symbol timing estimate is entirely contained inside the CP 2, hence the DFT
range is also within CP 2 and symbol 2. This means that the circular convolution is
preserved and no ISI is caused by the samples from CP 3. The optimal amount of the
shift depends on the OFDM system parameters and the performance of the symbol
timing algorithm.
We shall take the shift equal to 4 samples as a design parameter as we already have
64 samples for the CP so it doesn't matter if we reduce them to be effectively 60
samples instead of 64.
The drawback of the shift of the mean symbol timing point is reduced multipath
tolerance of the OFDM system. The shift effectively shortens the CP by the amount
of the shift, because some samples of the CP are always used for the DFT window.
This means that a CIR shorter that the CP can cause ISI; however, as was
mentioned earlier, the last taps of the CIR are quite small, so the effect on
performance is not serious. Nevertheless the OFDM system designer should keep
the symbol timing in mind and put some samples in to the CP in addition to the
maximum expected CIR length.
Figure 3.12 Effect of variance in symbol timing
Function Prototype: int detection_of_packet(float reci,float recq,float[])
//reci&recq are the real and imaginary of the input sample, m is the vector containing
the previous division values
41
3.4.2.2 Removing guard band:
This block is just the reverse operation of the adding guard band block.
Function Prototype: void removeguardband(COMPLEX din[],COMPLEX dout[])
3.4.2.3 Frequency offset estimation & frequency synchronization:
One of the main drawbacks of OFDM is its sensitivity to carrier frequency offset. The
effect of carrier frequency error on SNR will be introduced in the next chapter when
we discuss the simulation results. The degradation is caused by two main
phenomena: reduction of amplitude of the desired subcarrier and ICI caused by
neighboring carriers. The amplitude loss occurs because the desired subcarrier is no
longer sampled at the peak of the sinc-function of DFT. Adjacent carriers cause
interference, because they are not sampled at the zero-crossings of they sinc-
functions. For relatively small frequency errors, the degradation in SNR in dB was
approximated by:
(3.10)
where f∆ is the frequency error as a fraction of the subcarrier spacing and T is the
sampling period. The performance effect varies strongly with the modulation used;
naturally, constellations with fewer points can tolerate larger frequency errors than
large constellations. Figure 3.13 illustrates the effect for QPSK and 64-QAM
constellations. The figure shows that the 64QAM, the largest constellation in
IEEE802.16, cannot tolerate more than 1% error in the carrier frequency for a
negligible SNR loss of 0.5dB, whereas QPSK modulation can tolerate up to 5% error
for the same SNR loss.
42
Figure 3.13 SNR degradation due to frequency offset
Figure 3.13 SNR degradation due to frequency offset for QPSK and 64-QAM
There are several approaches for frequency synchronization; here we shall use the
time domain approach as follows:
We first derive a data-aided maximum-likelihood estimator that operates on the
received time domain signal. The training information required is at least two
consecutive repeated symbols as those used in the preamble of WiMAX standard.
Let the transmitted signal be sn, then the complex baseband model of the passband
signal yn is
(3.11)
where ftx is the transmitter carrier frequency. After the receiver downconverts the
signal with a carrier frequency frx, the received complex baseband signal rn, ignoring
noise for the moment, is
(3.12)
where f∆ = ftx - frx is the difference between the transmitter and receiver carrier
frequencies. Let D be the delay between the identical samples of the two repeated
symbols which equals 128 in 802.16. Then the frequency offset estimator is
developed as follows, starting with an intermediate variable z
43
(3.13)
So we get that the variable z is a sum of complex variables with an angle proportional
to the frequency offset. Finally, the frequency error estimator is formed as
(3.14)
where the z operator takes the angle of its argument.
In the next part we discuss the operating range of this algorithm to see the maximum
frequency offset I can detect.
The range is directly related to the length of the repeated symbols. The angle of z is
of the form -2 f∆ DTs, which is unambiguously defined only in the range from –Π to
Π. Thus if the absolute value of the frequency error is larger than the limit of equation
3.15 the estimate will be incorrect:
(3.15)
So in our system since D=128 and Ts=125nsec so the maximum detectable
frequency offset
f∆ = 31.25KHZ
Function Prototype:
float freq_sync(COMPLEX det[])//this function gets the offset frequency to be used
for correction using the input det
void freq_correction(COMPLEX d_fault[],COMPLEX d_correct[]) //this function
corrects the offset
3.4.2.4 FFT:
Operation:
It calculates the FFT of the input samples.
To know more about its operation refer to chapter 12 of 'The Scientist and
Engineer's Guide to Digital Signal Processing'
Its operation is even simpler than IFFT as we just call the twiddle function and
then the FFT function.
INPUT:
256 symbols from the mapper
OUTPUT:
256 bits
44
))j/Nfloor(12(jfloor(j/s)sM mod(s)cbpsj ×++×=
Function Prototype: void FFT(COMPLEX *Y, int N)// N is the FFT size
3.4.2.5 Channel estimation:
Operation:
It uses the pilots, estimates their amplitudes and phases and uses them to
correct the other samples as we already know the amplitude and phase of the
pilots prior to transmission.
Benefits:
There are no assumptions for this block as there is no standard for
synchronization or channel estimation
INPUT:
256 bits from the FFT
OUTPUT:
256 bits
Function prototype: void channel_estm(COMPLEX input[],COMPLEX out[])
3.4.2.6 Removing pilots and padding
This block just removes the pilots after channel estimation; also it removes the zero
padding that was added prior to transmission.
Function Prototype: void remove_pilots_padding(COMPLEX data_inf[],float
Ioutf[],float Qoutf[]) //Data_inf is the input, Ioutf,Qoutf are the complex outputs
3.4.2.7 De mapper
Operation:
After removing the pilots the de-mapper reverses the action of the mapper in
the transmitter.
INPUT:
192 symbol (QPSK modulation)
OUTPUT:
384 bit to the interleaver (QPSK , 16 subchannels)
Function Prototype: void demapper(float dinId[],float dinQd[],char doutd[])
3.4.2.8- De interleaver
Operation:
It reverses the effect of the interleaver and is done in two permutations
The first permutation is defined by the equation:
j=0,1,2,3,....,Ncbps-1
(3.16)
The second permutation is defined by the equation:
)/Nmfloor(121)-(N-m12K cbpsjcbpsjj ×××= j=0,1,2,3,....,Ncbps-1
45
(3.17)
The first permutation in the de-interleaver is the reverse of the second
permutation in the interleaver and, the second permutation in the de-
interleaver is the reverse of the first permutation in the interleaver
INPUT:
384 bit from de-mapper (QPSK, 16 subchannels)
OUTPUT:
384 bit to the encoder (QPSK, 16 subchannels)
Function Prototype: void deinterleave(char dind[],char doutd[])
3.4.2.9 Turbo decoding
Operation:
It decodes the bits which were previously encoded at the transmitter using the
TCP associated with our platform. For more details about this peripheral look
at chapter 5 that explains in some detail how we configured this block to
achieve the required performance.
Also the theory behind turbo decoding is explained in appendix A
Benefit:
It improves the BER
Assumptions:
We used the turbo code standard IS2000 instead of that in 802.16 protocol
INPUT:
384 bits
OUTPUT:
184 bits
3.4.2.10 De randomizer
Operation:
It reverses the action of the randomizer in the transmitter
INPUT:
184 bits from the turbo encoder.
OUTPUT:
184 data bits.
46
3.5 Link budget analysis and channel simulation:
3.5.1 Link budget analysis:
Figure 3.14
Link budget is one of the most important design issues in any communication link. In
WiMAX the link between the transmitter and the receiver has so many problems like
fading, attenuation as well as other losses due to the fact that the Fresnel zone isn't
clear enough.
So actually link budget includes both the path loss model due to attenuation in the
path as well as the clearance model.
To start our analysis we shall study both the uplink and the downlink to see which of
them is considered a limit on the link, the following table includes the parameters of
both the base station and the Customer Premises Equipment (CPE) to start our
analysis:
Uplink(CPE to base
station)
Downlink(Base station to
CPE)
2432Transmitted power(dBm)
-115-103Sensitivity of
receiver(dBm)
06Combiner loss at Tx(dB)
03Feeder loss at Tx(dB)
317Antenna gain Tx(dBi)
1010Fading margin(dB)
33Interference margin(dB)
11Antenna body loss(dB)
77AAS & Diversity gain(dB)
Table 4 base station and CPE link budget analysis
Where AAS stands for: Adaptive Antenna System
The next step is to calculate the maximum allowable path loss in both the uplink and
the downlink:
In downlink, the max. Path loss allowed = 136dB
In uplink, the max. allowable path loss = 135dB
So it's obvious that we're limited by the uplink not the downlink, therefore we let the
maximum path loss equal to 135dB to get the maximum cell radius.
But also we note that the link budget is almost balanced which is quite good.
After that we begin to use Okumura's model to calculate the path loss due to both
attenuation and non-clearance assuming that the cell radius is 3Km.
The equation for path loss calculation is as follows:
PL(dB)= Lf(f,d) + Am(f,d) – G(hte) – G(hre) – Garea
47
50
Tx Antenna Gain
simout
To Workspace
2
Rx Antenna Gain1
Product
Phase/
Frequency
Offset
Phase/
Frequency
Offset
Multipath
Rayleigh Fading
Multipath Rayleigh
Fading Channel
Gaussian
Gaussian Noise
Generator
Q
From
Workspace1
I
From
Workspace
j
Constant
Add1
Add
where:
PL Overall Path Loss;
Lf Free space path loss
Am Median attenuation relative to free space
G (hte) Base station antenna height gain factor
G (hre) Mobile antenna height gain factor
Garea The gain due to the type of the environment(assuming suburban environment)
D is the distance between the base station and the CPE
So if we take hte=200m, hre= 3m, d=3km, f=2.5GHZ
Lf=20*log(4*pi* d/ λ) =110 dB.
G(hte)= 20log(hte/200)=0 dB.
G(hre)= 20log(hre/3)=0 dB.
PL=110+25-0-0-12=123 dB.
PL= 123 dB, which is less than the maximum allowable path loss, so it's Ok to work
under these conditions for a distance of 3Km or even more.
Also if we're operating in a rural environment the path loss becomes: PL= 108dB
which means that we can increase the cell radius much more than 3km
(theoretically).
:Channel simulation.25.3
Now after we've finished the link budget analysis we want to design our channel
using MATALB simulink to take the effect of the previous effects.
The channel model will be as follows:
Figure 3.15 channel simulation simulink model
The parameters of the channel will be chosen as follows:
1- Path loss =93.56 dB according to the above calculations.
2-Tx antenna gain=17dBi
3- Rx antenna gain =3dBi
4- Rayleigh fading channel block:
In this block we assume 3 paths with different gains and maximum delay
spread equal to 2 µsec.
5- Guassian noise generator to add noise to the transmitted data.
6- Frequency and phase offset block:
we add frequency offset = 10KHZ
where the maximum correctable frequency offset = 1/(2*128*Ts) = 31.25KHZ as
explained in section 3.3 in the frequency synchronization block in the receiver.
Also we add phase offset to account for the path delay between the Tx and the Rx,
where the phase offset is calculated as follows:
Phase offset = (2 * PI / λ) * D = 0,
where D = 3KM , λ = 3 e8 /2.5 e9
Finally we scale the data before entering the channel such that its power = 32dBm
48
3.6 Future Work:
WiMAX is a huge system; its complete implementation may take several years of
work.
In our project we've implemented almost most of the physical layer on the DSP kit.
We hope that the students in the upcoming years would complete the system.
Referring to figure 3.2, the system is composed of 4 parts:
1- BB physical layer
2- MAC layer (Network interface)
3- Digital IF stage
4- RF stage
We suggest the following stages as a step towards the complete implementation of
the system:
Stage 1: Completing the remaining parts of the physical layer which are:
• Adaptive modulation
• Power control
• Uplink and downlink subframes
Stage 2: Implementing the MAC common part sublayer of the system, this may need
more than one group.
Stage 3: Implementing the security sublayer
Stage 4: Implementing the digital IF stage
Stage 5: Implementing the RF stage
49
System simulation
System testing
50
50
Tx Antenna Gain
rxdata
To Workspace
3
Rx Antenna Gain1
Product
Multipath
Rayleigh Fading
Multipath Rayleigh
Fading Channel
Q
From
Workspace1
I
From
Workspace
Free Space
Path Loss
80 dB
Free Space
Path Loss
j
Constant
Add
AWGN
AWGN
Channel
4- System simulation & testing
Simulation is an important step in the design of any system because it shows the
expected performance of our system; it's also used to check that the algorithms we
used operate properly with no logical errors.
Testing is also very useful; as we test each block individually on the platform before
interconnecting all the blocks together, this may seem to take longer time but actually
it's more time efficient.
This chapter is divided into 2 main sections:
1- System simulation
2- System testing
:System simulation4.1
In this part we shall use MATLAB to simulate some of the blocks used in our system
to see their effect on the system performance.
4.1.1 The effect of the interleaver:
To show this we shall simulate a QPSK system using repetition 3 coding with and
without the interleaver in a fading channel.
The code used for the simulation on Matlab is in Appendix C.
The simulink model used is shown in figure 4.1 below:
Figure 4.1 Interleaver test simulink model
The simulink model takes I and Q from the workspace to add the channel effects as
follows:
- The path loss=86dB for a carrier frequency of 2.5GHZ and the distance=100m
- The symbol rate = 500Ksps (i.e. bit rate =1Mbps)
- AWGN block represents the noise effect where the SNR is changed from this
block.
- The fading channel blocks adds fading to the signal to see its effect on the BER
where the delay spread=2µsec as the application is broadband wireless access
where the delay spread is relatively large.
Then we receive the data from the simulink after adding fading and noise as well as
the propagation loss effect.
After that demapping and decoding is made then a decision is made to the favor of a
zero or a one according to the majority rule (repetition 3 coding)
The code for that is also in the appendix.
The code also includes BER calculations. Then we repeat the same steps but without
the interleaver to see its effect on the performance of the communication link.
51
2 4 6 8 10 12 14 16 18 20
10
-5
10
-4
10
-3
10
-2
10
-1
10
0
Eb/No
BER
BER curves in AWGN versus Rayleigh fading channel
with delay spread 2microsec
Rayleigh Fading Channel
AWGN Channel
The BER curves will be as follows:
2 4 6 8 10 12 14 16 18 20
10
-0.4
10
-0.3
Eb/No
BER
BER curves with and without interleaver in a 2microsec rms Rayleigh fading channel
BER with interleaver
BER without interleaver
Figure 4.2 BER curves with & without interleaver
In the next part we shall show the difference in the BER between a fading channel
and the AWGN channel using codes similar to that above but the only difference is
that we shall remove the Rayleigh fading channel block one time and put it another
time.
The BER curves will be as follows:
Figure 4.3 BER curves with and without fading
Comment:
The interleaver has no effect in case of AWGN channel since the location of the bits
won't change the performance but it has a significant effect in case of fading
channels.
52
50
Tx Antenna Gain
rxdata
To Workspace
3
Rx Antenna Gain1
Product
Phase/
Frequency
Offset
Phase/
Frequency
Offset
Multipath
Rayleigh Fading
Multipath Rayleigh
Fading Channel
Q
From
Workspace1
I
From
Workspace
Free Space
Path Loss
80 dB
Free Space
Path Loss
j
Constant
Add
AWGN
AWGN
Channel
4.1.2 The effect of the pilots:
Since our system is operating in a fading environment, pilots are necessary to
estimate the magnitude and phase effects of the channel to be used for correcting
the information bits.
Here we simulate the effect of using a pilot with a sample of 100 data bits in a
Rayleigh fading channel, 1st
we use only one pilot and we find that it will correct
around 50 errors due the fading effect but if we use 2 pilots we can correct almost all
of the 100 errors due to the channel effect.
The code for simulation of pilot effect is in the appendix
Then we use simulink to add fading, noise as well as phase offset (delay)
The simulink model is as follows:
Figure 4.4 Pilot test simulink model
Then the objective is to estimate the magnitude and the phase of the pilots to be
used for correction. The code for that is in the appendix.
This code was in case of using 2 pilots, the 2 pilots were able to correct almost all of
the channel errors in the 100 bit sample due to fading.
In case of using 1 pilot a similar code is used but it won't be able to correct all the
errors (only 50 of them)
Conclusion:
From the previous simulation we got that pilots are very necessary in case of
multipath fading channels because they estimate the magnitude and phase offset
due to the channel (i.e. channel estimation).
Therefore in Wimax we use 8 pilots in the 256 OFDM symbol to make up for the
channel effects where the channel can be modeled as a Rayleigh fading channel with
2µsec delay spread because Wimax is used for BWA (Broadband Wireless Access)
applications.
4.1.3 Simulation of the packet detection algorithm:
Here we test the double sliding window packet detection algorithm explained in
chapter 3 using MATLAB.
In figure 4.5 below we display the output from the correlator where we first enter
noise then the preamble, so the output of the correlator increases till it reaches its
maximum at the midpoint of the preamble, the preamble starts at sample 321 and its
length is 256. The SNR=3.3dB
53
d o u t
T o W o rksp a ce
P ro d u c t
P h a se /
F re q u e n cy
O ffse t
P h a se /
F re q u e n cy
O ffse t
Q
F ro m
W o rksp a c e 1
I
F ro m
W o rksp a ce
j
C o n sta n t
A d d
A W G N
A W G N
C h a n n e l
Figure 4.5 Output of packet detection algorithm
The MATLAB code used for simulation is in the appendix.
4.2 System testing:
:Testing the frequency synchronization algorithm4.2.1
In this part we test the frequency synchronization function using MATLAB, also we'll
show the effect of frequency offset on the BER where it's required to increase the
SNR to achieve the same BER without frequency offset. This indicates the
importance of frequency synchronization.
The MATLAB code used is in the appendix
Then the data enters simulink including 10KHZ frequency offset as shown in figure
4.6
After that dout is processed to get the frequency offset
Figure 4.6 Frequency sync. test model
54
Then after that frequency correction is applied to the output
The BER rate with the frequency correction is as follows:
Figure 4.7 Performance of frequency correction algorithm
As we see that the BER after frequency correction is almost the same as
without frequency offset.
Conclusion:
Frequency synchronization is very essential but there is an upper limit on the
frequency offset which is increased as we increase the length of the preamble as we
explained in chapter 3, but as the preamble length increases we'll have more
overhead so it's a compromise.
4.2.2 Testing of the turbo encoder:
We tested the code of the turbo encoder using 12 bits as input and the same
interleaver of our system, and then we compared its output with the manual trace we
made.
The input data we entered to the convolutional encoder is 0 1 0 1 0 1 0 1 0 1 0 0,
then it is interleaved and entered to a convolutional encoder similar to the 1st
one
after interleaving data will be in this format 0 0 1 1 0 0 1 1 0 0 1 0, then the output
frame is punctured according to the following combination
Output combination of data
U0A0 U1A'1 U2A2 U3A'3…………………U11A'11
Tail bits
U12A12 U13A13 U14A14 U'122A'12 U'13A'13 U'14A'14
The output frame of the testing code we used is
0 0 1 0 0 1 1 0 0 0 1 0 0 0 1 0 0 0 1 1 0 1 0 1 0 0 0 1 1 1 1 1 0 0 0 0
55
After that we performed a manual trace to check on our code and it is as follows:
U I/p state A U' I/p' state A'
0 0 000 0
1 1 100 1
0 0 010 1
1 0 001 0
0 1 100 0
1 1 110 0
0 1 111 0
1 1 111 1
0 0 011 0
1 1 101 0
0 1 110 1
0 1 111 0
0 0 000 0
0 0 000 0
1 1 100 1
1 1 110 0
0 1 111 0
0 0 011 0
1 1 101 0
1 0 010 0
0 1 101 1
0 1 110 1
1 0 011 1
0 0 001 1
Tail
0 0 011 0
0 0 001 1
1 0 000 1
1 0 000 1
0 0 000 0
0 0 000 0
Then by using the puncturing scheme mentioned above we get the Output frame
0 0 1 0 0 1 1 0 0 0 1 0 0 0 1 0 0 0 1 1 0 1 0 1 0 0 0 1 1 1 1 1 0 0 0 0
By comparing it with the output of the code we find that they are similar
56
Why we choose C6000 As our Platform
Code Composer Studio
Code Composer Studio Debug Tools
Peripherals used in our project
57
5- Platform
5.1 Why we choose C6000 As our Platform
5.1.1 Advantages of designing with DSPs over other microprocessors:
Single-cycle multiply accumulate operations
Real-time performance, simulation and emulation
Flexibility
Reliability
Increased system performance
Reduced system cost
5.1.2Features of the C6000 devices include:
⇒ Advanced CPU with eight functional units, including two multipliers and six
arithmetic units.
⇒ Executes up to eight instructions per cycle for up to ten times the
performance of other DSPs.
⇒ Reduces code size, program fetches, and power consumption
⇒ Efficient code execution on independent functional units
⇒ Industry’s most efficient C compiler on DSP benchmark suite
⇒ 8/16/32-bit data support, providing efficient memory support for a variety of
applications
⇒ 40-bit arithmetic options, which add extra precision for vocoders and other
computationally intensive applications.
⇒ 32 x 32–bit integer multiply with 32– or 64–bit result
⇒ A complete development tool includes the following:
C compiler
Assembly optimizer
Assembler
Linker
Evaluation tools
5.2 Code Composer Studio:
5.2.1 Creating a System Configuration:
CCStudio Setup allows you to configure the CCStudio IDE software to work with
different hardware or simulator targets. You can quickly begin working using the
default configuration or one of the standard configuration files supplied with CCStudio
IDE. For C6000 system, the C64x simulator is the default configuration. CCStudio
Setup provides you with the option of creating a configuration using standard
configuration files, or creating a customized configuration using your own
configuration files. When using the Kit with CCStudio make sure its configuration
points to real target not simulator.
58
5.2.1.1 Project Management and Editing Tools:
The project manager organizes files into folders for source files; include files,
libraries, and DSP/BIOS configuration files. Source files that are generated by
DSP/BIOS are placed in the Generated files folder. The CCStudio IDE finds files by
searching for project files in the following path order when building the program:
The folder that contains the source file.
The folders listed in the Include Search Path for the compiler or assembler
options (from left to right).
5.3 Code Composer Studio Debug Tools:
5.3.1 Watch Window
When debugging a program, it is often helpful to understand how the value of a
variable changes during program execution. The Watch window allows you to
monitor the values of local and global variables and C/C++ expressions.
In the Watch Locals tab, the debugger automatically displays the Name, Value, and
Type of the variables that are local to the currently executing function.
In the Watch tab, the debugger displays the Name, Value, and Type of the local and
global variables and expressions that you specify.
5.3.2 Displaying Graphs
If you ran a program using only breakpoints and watch windows, you would not see
much information about what the program was doing. You could set watch variables
on addresses within the inp_buffer and out_buffer arrays, but you would need to
watch a lot of variables and the display would be numeric rather than visual.
CCStudio IDE provides a variety of ways to graph data processed by your program.
In the Graph Property Dialog, change the Graph Title, Start Address, Acquisition
Buffer Size, Display Data Size, DSP Data Type, Autoscale and Maximum Y-value
properties to the values shown here. Scroll down or resize the dialog box to see all
the properties.
5.4 Peripherals used in our project
I. EDMA
II. JTAG For RTDX
III. TURBO CO-PROCESSOR (TCP)
5.4.1 Enhancement Direct Memory Access (EDMA)
The EDMA is a peripheral that can be set up to copy data from one place to another
without the CPU’s intervention. The EDMA can be setup to copy data or program
from a source (external/internal memory, or a serial port) to a destination (e.g.
internal memory). After this transfer completes, the EDMA can “auto initialize” itself
and perform the same transfer again, or it can be reprogrammed.
59
5.4.1.1 EDMA configuration
The EDMA in Our Platform TMS320C6416 Contains 64 Channel each channel
contains 6 32-bits registers as appear in figure 5.1
Figure 5.1 EDMA Channel registers
Looking at the EDMA parameters one register at a time:
1. Options: contains many fields as follows
ESIZE in which we choose our element size which will be transferred we
have 3 choices as follows:
ℵ 00 : 32-Bit
ℵ 01 : 16-Bit
ℵ 10 : 8-Bits
SUM & DUM fields indicate how the source and destination addresses are
to be modified between element reads and writes.
Here we have 4 choices :
I. 00: Fixed means that the pointer remains fixed after reading or
writing.
II. 01: Increment by element size after each reading or writing.
III. 10: Decrement by element size after each reading or writing.
IV. 11 : Index which mean that the pointer increase after each reading
by the value in the index register
Frame Sync (FS) field indicates how much data should be moved
whenever the EDMA is triggered to run. if we want to move the whole frame
of data when the CPU starts the EDMA channel, we should set FS = 1. and,
when we use the EDMA only moves one element per trigger event ,we
should set FS =0.
PRIORITY field which indicate the priority of this channel is it high priority or
low.
2DS & 2DD fields which indicate if the source is two dimensional array or
not and the same for the destination
LINK field which indicate is this channel link to another channel or not
2. Source: Should have the source address.
3. Transfer Counter: this register contain two fields
I. ELEMENT COUNT: It Will contain the number of elements we want to
transfer.
II. FRAME COUNT: It will contain the number of frames we want to
transfer.
4. Destination: Should have the destination address.
60
5. Index: this register contain two fields :
II. ELEMENT INDEX: which will contain the number of bytes that the
pointer of source must be updated by after reading from source 1
element the same for destination according to which of them is
configure to be indexed.
III. FRAME INDEX: which will contain the number of bytes that the
pointer of source will be updated by after transfer 1 complete frame
6. Reload/Linking: will contain the channel number which we will link to it.
5.4.1.2 EDMA problems we faced
• in our project as to add the channel effects (noise ,fading ,path loss ,etc…..)
we use RTDX to exchange data between Platform & PC to add channel
effects on MATLAB so the EDMA use is to Take frame by frame from BIG
Buffer - Output from MATLAB after adding Channel effect – in memory to
execute the receiver algorithm on this frame HERE APPEAR THE PROBLEM
which is how to update the source to continue in the BIG Buffer and don't
return to start from the begin of the Buffer as the EDMA doesn't design for
this operation .
Solution:
so we solved this problem by define a pointer to the start of the
buffer and then increase it by the size of the frame then close the
channel and RE-Configure it again with the new SOURCE "
pointer ".
5.4.2 JTAG (RTDX)
5.4.2.1 What is JTAG?
JTAG is a built-in interface in our platform in which we used to transfer data in a full
duplex manner to and from the computer.
Real-Time Data Exchange (RTDX) provides real-time, continuous visibility into the
way target applications operate in the real world. RTDX allows system developers to
transfer data between a host and target devices without interfering with the target
application. The data can be analyzed and visualized on the host using any host
client.
RTDX consists of both target and host components. A small RTDX software library
runs on the target application. The target application makes function calls to this
library's API in order to pass data to or from it. This library makes use of a scan-
based emulator to move data to or from the host platform via the JTAG interface.
Data transfer to the host occurs in real-time while the target application is running.
On the host platform, an RTDX Host library operates in conjunction with Code
Composer™. Displays and analysis tools communicate with RTDX via an easy-to-
use COM API to obtain the target data and/or to send data to the target application.
HOST and TARGET applications may be written using C, C++, Visual Basic or any
other language that can deal with the JTAG interface.
61
5.4.2.2The role of RTDX in our project:
Is to send the data
From the data source (computer) to the transmitter (KIT).
From the transmitter (KIT) to the computer to add the channel
effect then back to the KIT.
From the receiver (KIT) to the data destination (computer) to
estimate the channel effects on the transmitted data.
We used the matlab to handle the RTDX since the matlab has a powerful, easy to
use link for Code Composer Studio, (refer to tutorials in matlab help for RTDX links).
The RTDX may have more than one channel with more than one buffer assigned to
each channel to carry the data to be transferred or received; such buffers may have
varying sizes according to user requirements.
Refer to CCS help for RTDX options and etc…
5.4.2.3 RTDX problems we faced during the project:
a. we used the CCS RTDX tutorials for creating the HOST and TARGET
applications using C++ and we successfully sent and received a
maximum of 600 bytes per transfer which wasn’t sufficient for us.
b. RTDX data rate exchange wasn’t suitable for real-time data source.
Solution: we used matlab for HOST (computer) application and matlab
RTDX tutorial for TARGET (KIT) application and we successfully sent a
maximum of 10,000 bytes wich was sufficient enough for us.
c. Using matlab we couldn’t establish more than one transfer per
channel.
Solution: we used multiple channels when needed.
5.4.3 TURBO CO-PROCESSOR (TCP)
5.4.3.1 Introduction
The turbo coprocessor (TCP) is a programmable peripheral for decoding of
IS2000/3GPP turbo codes, integrated into TI’s TMS320C6416 DSP device. The
coprocessor operates either as a complete turbo decoder including the iterative
structure (standalone processing mode), or it can operate as a single maximum A
posterior (MAP) decoder (shared processing mode). In the standalone processing
mode, the inputs into the TCP are channel-soft decisions for systematic and parity
bits; the outputs are hard decisions. In the shared processing mode, the inputs are
channel-soft decisions for systematic and parity bits and apriori information for
systematic bits, and the outputs are extrinsic information for systematic bits.
The TCP programmable parameters are:
• Code rate (1/2, 1/3 or 1/4)
• Frame length
• Maximum number of iterations
• Threshold for early stopping criterion
62
5.4.3.2 How to program TCP
TCP Programming includes two Phases:
a) TCP Configuration.
b) EDMA Configuration for TCP transmit and receive
Channels.
5.4.3.2.1 TCP Configuration
The TCP parameters are adjusted so as to perform the required decoding operation.
They are follows:
• Operation mode: Stand alone mode.
• Code rate: 1/2
• Frame length: 186
• Reliability length: 62
• Prolog size: 24
• Maximum number of iterations: 8
• SNR threshold: 20
Comments on the above parameters:
The maximum number of iterations, prolog size, SNR threshold and reliability length
are explained in the appendix.
For more information about how to program the TCP including setting its tail bits,
forming the interleaver table and allocating memory for the input and the hard
decision output refer to 'spra 749a' and 'spru534b.pdf'
5.4.3.2.2 EDMA Configuration
The EDMA contain two different channels for TCP one for receive from TCP and the
other to Transmit to TCP
The Transmit Channel
Input Configuration Parameters Transfer
This EDMA transfer to the input configuration parameters is a 12-word TCPXEVT
frame-synchronized transfer. The parameters should be set as:
OPTIONS:
• ESIZE = 00 (element size is 32 bits)
• 2DS = 2DD = 0 (1 dimensional)
• SUM = 01 (autoincrement)
• DUM = 01 (autoincrement)
• LINK = 1 (linking of event parameters is enabled)
• FS = 1 (channel is frame synchronized)
• SOURCE ADDRESS: user input configuration parameters start address
(must be double-word aligned)
• ELEMENT COUNT: 000Ch
• ARRAY/FRAME COUNT: 0000h
• DESTINATION ADDRESS: TCPIC0 (5800 0000h)
• ELEMENT INDEX: don.t care
63
• ARRAY/FRAME INDEX: don.t care
• LINK ADDRESS: address in the EDMA PaRAM of the EDMA parameters
associated with the systematics and parities
• ELEMENT COUNT RELOAD: don.t care
Upon completion, this EDMA transfer is linked to the EDMA for systematics
and parities transfer parameters.
Systematics and Parities Transfer
This EDMA transfer to the systematics and parities memory is a TCPXEVT frame-
synchronized transfer. The parameters should be set as:
OPTIONS:
• ESIZE = 00 (element size is 32 bits)
• 2DS = 2DD = 0 (1 dimensional)
• SUM = 01 (autoincrement)
• DUM = 00 (fixed)
• LINK = 1 (linking of event parameters is enabled)
• FS = 1 (channel is frame synchronized)
• SOURCE ADDRESS: systematics and parities start address (must be
double-word aligned)
• ELEMENT COUNT : 





+×
×
×
)1(8
2
Framecount
RF
ceil
• ARRAY/FRAME COUNT: 1
4NWDSYPAR
−





×
× RF
ceil
• DESTINATION ADDRESS: TCPSP (5802 0000h)
• ELEMENT INDEX: don.t care
• ARRAY/FRAME INDEX: don.t care
• LINK ADDRESS: see cases 1, 2, and 3 below
• ELEMENT COUNT RELOAD: don.t care
Upon completion, this EDMA transfer is linked to one of the following:
1. The EDMA interleaver table transfer parameters, if there is a new one
to be loaded in the TCP (INTER bit is set to 1)
2. The EDMA input configuration parameters transfer parameters of the
next user-channel, if there is one ready to be decoded and no
interleaver table to be loaded in the TCP (INTER bit is cleared to 0)
3. Null EDMA transfer parameters (with all zeros), if there is no more
user-channel ready to be decoded and no interleaver table to be
loaded in the TCP (INTER bit is cleared to 0)
Interleaver Indexes Transfer
This EDMA transfer to the interleaver memory is a TCPXEVT frame-synchronized
transfer. The parameters should be set as:
OPTIONS:
• ESIZE = 00 (element size is 32 bits)
• 2DS = 2DD = 0 (1 dimensional)
• SUM = 01 (autoincrement)
• DUM = 00 (fixed)
64
• LINK = 1 (linking of event parameters is enabled)
• FS = 1 (channel is frame synchronized)
• SOURCE ADDRESS: interleaver table start address (must be double-word
ligned)
• ELEMENT COUNT: 





+×
×
)1(4
2
Framecount
F
ceil
• ARRAY/FRAME COUNT: 1
2NWDINTER
−





×
F
ceil
• DESTINATION ADDRESS: TCPINTER (5808 0000h)
• ELEMENT INDEX: don.t care
• ARRAY/FRAME INDEX: don.t care
• LINK ADDRESS: see cases 1 and 2 below
• ELEMENT COUNT RELOAD: don.t care
Upon completion this EDMA transfer is linked to one of the following:
1. The EDMA input configuration parameters transfer parameters of the
next user-channel, if there is one ready to be decoded
2. Null EDMA transfer parameters (with all zeros), if there is no more
user-channel ready to be decoded
The Receiver Channel
Hard-decisions Transfer
This EDMA transfer to the hard decisions buffer is a TCPREVT frame-synchronized
transfer. The parameters should be set as:
OPTIONS:
• ESIZE = 00 (element size is 32 bits)
• 2DS = 2DD = 0 (1 dimensional)
• SUM = 00 (fixed)
• DUM = 01 (autoincrement)
• LINK = 1 (linking of event parameters is enabled)
• FS = 1 (channel is frame synchronized)
• SOURCE ADDRESS: TCPHD (580A 0000h)
• ELEMENT COUNT: 





+×
×
)1(64
2
Framecount
F
ceil
• ARRAY/FRAME COUNT: 1
32NWDHD
−





×
F
ceil
• DESTINATION ADDRESS: user hard decisions start address (must be
double-word aligned)
• ELEMENT INDEX: don.t care
• ARRAY/FRAME INDEX: don.t care
• LINK ADDRESS: see cases 1, 2, and 3 below
• ELEMENT COUNT RELOAD: don.t care
Upon completion this EDMA transfer is linked to one of the following:
1. The EDMA hard decisions transfer parameters of the next user-
channel, if there is one ready to be decoded and the OUTF bit is
cleared to 0
65
2. The EDMA output parameters transfer parameters, if the OUTF bit is
set to 1
3. Null EDMA transfer parameters (with all zeros), if there is no more
user-channel ready to be decoded and the OUTF bit is cleared to 0
Output Parameters Transfer
This EDMA transfer is optional and depends on the OUTF bit in the TCP input
configuration register 0 (TCPIC0). This EDMA transfer is a TCPREVT frame-
synchronized transfer. The parameters should be set as:
OPTIONS:
• ESIZE = 00 (element size is 32 bits)
• 2DS = 2DD = 0 (1 dimensional)
• SUM = 01 (autoincrement)
• DUM = 01 (autoincrement)
• LINK = 1 (linking of event parameters is enabled)
• FS = 1 (channel is frame synchronized)
• SOURCE ADDRESS: TCPOUT (5800 0030h)
• ELEMENT COUNT: 0002h
• ARRAY/FRAME COUNT: 0000h
• DESTINATION ADDRESS: user output parameters start address (must be
double-word aligned)
• ELEMENT INDEX: don.t care
• ARRAY/FRAME INDEX: don.t care
• LINK ADDRESS: see cases 1 and 2 below
• ELEMENT COUNT RELOAD: don.t care
Upon completion, this EDMA transfer is linked to one of the following:
1. The hard decisions EDMA transfer parameters of the next user-
channel, if there is one ready to be decoded
2. Null EDMA transfer parameters (with all zeros), if there is no more
user-channel ready to be decoded
66
Transmitter
Receiver
67
6-codes
6.1 Transmitter
6.1.1 The randomizer
void randomizer(char dinr[],char doutr[]) //din input byte to randomizer
{ //dout output byte from randomizer
int i,j; //init is initialization vector
char shift,init[15];
for(i=0;i<15;i++)
init[i]=0xff;
for(i=0; i<384; i++)
{
shift=init[13]^init[14];
doutr[i]=dinr[i]^shift;
for(j=14;j>0;j--)
init[j]=init[j-1];
init[0]=shift;
}
}
6.1.2 the Interleaver
void interleave(char dini[],char douti[])
{
int k,m;
for(k=0;k<384;k++)
{
m=(384/12)*(k%12)+floor(k/12);
douti[m]=dini[k];
}
}
6.1.3 FFT
void FFT(COMPLEX *Y, int N) //input sample array, # of points
{
COMPLEX temp1,temp2; //temporary storage variables
int i,j,k; //loop counter variables
int upper_leg, lower_leg; //index of upper/lower butterfly leg
int leg_diff; //difference between upper/lower leg
int num_stages = 0; //number of FFT stages (iterations)
int index, step; //index/step through twiddle constant
i = 1; //log(base2) of N points= # of stages
do
{
num_stages +=1;
i = i*2;
}while (i!=N);
leg_diff = N/2; //difference between upper&lower legs
step = 512/N; //step between values in twiddle.h
for (i = 0;i < num_stages; i++) //for N-point FFT
{
68
index = 0;
for (j = 0; j < leg_diff; j++)
{
for (upper_leg = j; upper_leg < N; upper_leg += (2*leg_diff))
{
lower_leg = upper_leg+leg_diff;
temp1.real = (Y[upper_leg]).real + (Y[lower_leg]).real;
temp1.imag = (Y[upper_leg]).imag + (Y[lower_leg]).imag;
temp2.real = (Y[upper_leg]).real - (Y[lower_leg]).real;
temp2.imag = (Y[upper_leg]).imag - (Y[lower_leg]).imag;
(Y[lower_leg]).real = temp2.real*(w[index]).real
-temp2.imag*(w[index]).imag;
(Y[lower_leg]).imag = temp2.real*(w[index]).imag
+temp2.imag*(w[index]).real;
(Y[upper_leg]).real = temp1.real;
(Y[upper_leg]).imag = temp1.imag;
}
index += step;
}
leg_diff = leg_diff/2;
step *= 2;
}
j = 0;
for (i = 1; i < (N-1); i++) //bit reversal for resequencing data
{
k = N/2;
while (k <= j)
{
j = j - k;
k = k/2;
}
j = j + k;
if (i<j)
{
temp1.real = (Y[j]).real;
temp1.imag = (Y[j]).imag;
(Y[j]).real = (Y[i]).real;
(Y[j]).imag = (Y[i]).imag;
(Y[i]).real = temp1.real;
(Y[i]).imag = temp1.imag;
}
}
return;
}
6.1.4 twiddle
void twiddle()
{
short i;
for (i = 0 ; i<256 ; i++) // set up twiddle constants in w
{
w[i].real = cos(2*PI*i/512.0); //Re component of twiddle constants
w[i].imag =-sin(2*PI*i/512.0); //Im component of twiddle constants
}
69
}
6.1.5 IFFT
void iFFT(COMPLEX input[], int n)
{
short i;
for (i=0 ; i<n ;i++)
{
input[i].real=input[i].real;
input[i].imag=-input[i].imag;
}
FFT(input,n);
for (i=0 ; i<n ;i++)
{
input[i].real=(input[i].real/n);
input[i].imag=-(input[i].imag/n);//input is the final IFFT output
}
}
6.1.6 Mapper
void mapper(char dinm[], float doutIm[],float doutQm[])
{
short i;
for(i=0;i<384;i+=2)
{
if((dinm[i]=='000')&&(dinm[i+1]=='000'))
{doutIm[i/2]=-1;
doutQm[i/2]=-1;
}
else if((dinm[i]=='777')&&(dinm[i+1]=='777'))
{doutIm[i/2]=1;
doutQm[i/2]=1;
}
else if((dinm[i]=='000')&&(dinm[i+1]=='777'))
{doutIm[i/2]=-1;
doutQm[i/2]=1;
}
else if((dinm[i]=='777')&&(dinm[i+1]=='000'))
{doutIm[i/2]=1;
doutQm[i/2]=-1;
}
}
}
6.1.7 Framing and pilot insertion
void frame(float I[],float Q[],COMPLEX data_outf[])//data is the output data which is
input to the IFFT block
{
short i;
COMPLEX buf[201];
float pilots[8]={1 ,-1, 1, -1, 1, 1, 1, 1};//we have 8 pilots
//this part is for pilot insertion
for (i=0;i<12;i++)
{
70
buf[i].real=I[i];
buf[i].imag=Q[i];
}
buf[12].real=pilots[0];
buf[12].imag=0;
for (i=13;i<37;i++)
{
buf[i].real=I[i-1];
buf[i].imag=Q[i-1];
}
buf[37].real=pilots[1];
buf[37].imag=0;
for (i=38;i<62;i++)
{
buf[i].real=I[i-2];
buf[i].imag=Q[i-2];
}
buf[62].real=pilots[2];
buf[62].imag=0;
for (i=63;i<87;i++)
{
buf[i].real=I[i-3];
buf[i].imag=Q[i-3];
}
buf[87].real=pilots[3];
buf[87].imag=0;
for (i=88;i<100;i++)
{
buf[i].real=I[i-4];
buf[i].imag=Q[i-4];
}
//the DC subcarrier carries no information
buf[100].real=0;
buf[100].imag=0;
for (i=101;i<113;i++)
{
buf[i].real=I[i-5];
buf[i].imag=Q[i-5];
}
buf[113].real=pilots[4];
buf[113].imag=0;
for (i=114;i<138;i++)
{
buf[i].real=I[i-6];
buf[i].imag=Q[i-6];
}
buf[138].real=pilots[5];
buf[138].imag=0;
for (i=139;i<163;i++)
{
buf[i].real=I[i-7];
buf[i].imag=Q[i-7];
}
71
buf[163].real=pilots[6];
buf[163].imag=0;
for (i=164;i<188;i++)
{
buf[i].real=I[i-8];
buf[i].imag=Q[i-8];
}
buf[188].real=pilots[7];
buf[188].imag=0;
for (i=189;i<201;i++)
{
buf[i].real=I[i-9];
buf[i].imag=Q[i-9];
}
//this part is for zero padding to transform the 200 symbol frame to
//256 symbols to be input to IFFT
for (i=0;i<28;i++)
{
data_outf[i].real=0;
data_outf[i].imag=0;
}
for(i=28;i<229;i++)
{
data_outf[i].real=buf[i-28].real;
data_outf[i].imag=buf[i-28].imag;
}
for (i=229;i<256;i++)
{
data_outf[i].real=0;
data_outf[i].imag=0;
}
}
6.1.8 converting from float to complex
void after_ifft(COMPLEX samplesf[],float dout_testf[])
{
int i,j=0;
for(i=0;i<320;i++)
{
dout_testf[j]=samplesf[i].real;
dout_testf[j+1]=samplesf[i].imag;
j=j+2;
}
}
6.1.9 preamble generation
void preamble(COMPLEX short_pre[])
{
COMPLEX p[201],big_pre[128],short128[256];
int i,j,k;
/////////////////////////////////preamble values///////////////////////////////
72
p[0].real=1; p[0].imag=-1;
p[1].real=1; p[1].imag=-1;
p[2].real=-1; p[2].imag=-1;
p[3].real=1; p[3].imag=1;
p[4].real=1; p[4].imag=-1;
p[5].real=1; p[5].imag=-1;
p[6].real=-1; p[6].imag=1;
p[7].real=1; p[7].imag=-1;
p[8].real=1; p[8].imag=-1;
p[9].real=1; p[9].imag=-1;
p[10].real=1; p[10].imag=1;
p[11].real=-1; p[11].imag=-1;
p[12].real=1; p[12].imag=1;
p[13].real=1; p[13].imag=1;
p[14].real=-1; p[14].imag=-1;
p[15].real=1; p[15].imag=1;
p[16].real=-1; p[16].imag=-1;
p[17].real=-1; p[17].imag=-1;
p[18].real=1; p[18].imag=-1;
p[19].real=-1; p[19].imag=1;
p[20].real=1; p[20].imag=-1;
p[21].real=1; p[21].imag=-1;
p[22].real=-1; p[22].imag=-1;
p[23].real=1; p[23].imag=1;
p[24].real=1; p[24].imag=-1;
p[25].real=1; p[25].imag=-1;
p[26].real=-1; p[26].imag=1;
p[27].real=1; p[27].imag=-1;
p[28].real=1; p[28].imag=-1;
p[29].real=1; p[29].imag=-1;
p[30].real=1; p[30].imag=1;
p[31].real=-1; p[31].imag=-1;
p[32].real=1; p[32].imag=1;
p[33].real=1; p[33].imag=1;
p[34].real=-1; p[34].imag=-1;
p[35].real=1; p[35].imag=1;
p[36].real=-1; p[36].imag=-1;
p[37].real=-1; p[37].imag=-1;
p[38].real=1; p[38].imag=-1;
p[39].real=-1; p[39].imag=1;
p[40].real=1; p[40].imag=-1;
p[41].real=1; p[41].imag=-1;
p[42].real=-1; p[42].imag=-1;
p[43].real=1; p[43].imag=1;
p[44].real=1; p[44].imag=-1;
p[45].real=1; p[45].imag=-1;
p[46].real=-1; p[46].imag=1;
p[47].real=1; p[47].imag=-1;
p[48].real=1; p[48].imag=-1;
p[49].real=1; p[49].imag=-1;
p[50].real=1; p[50].imag=1;
p[51].real=-1; p[51].imag=-1;
p[52].real=1; p[52].imag=1;
p[53].real=1; p[53].imag=1;
73
p[54].real=-1; p[54].imag=-1;
p[55].real=1; p[55].imag=1;
p[56].real=-1; p[56].imag=-1;
p[57].real=-1; p[57].imag=-1;
p[58].real=1; p[58].imag=-1;
p[59].real=-1; p[59].imag=1;
p[60].real=1; p[60].imag=1;
p[61].real=1; p[61].imag=1;
p[62].real=1; p[62].imag=-1;
p[63].real=-1; p[63].imag=1;
p[64].real=1; p[64].imag=1;
p[65].real=1; p[65].imag=1;
p[66].real=-1; p[66].imag=-1;
p[67].real=1; p[67].imag=1;
p[68].real=1; p[68].imag=1;
p[69].real=1; p[69].imag=1;
p[70].real=-1; p[70].imag=1;
p[71].real=1; p[71].imag=-1;
p[72].real=-1; p[72].imag=1;
p[73].real=-1; p[73].imag=1;
p[74].real=1; p[74].imag=-1;
p[75].real=-1; p[75].imag=1;
p[76].real=1; p[76].imag=-1;
p[77].real=1; p[77].imag=-1;
p[78].real=1; p[78].imag=1;
p[79].real=-1; p[79].imag=-1;
p[80].real=-1; p[80].imag=-1;
p[81].real=-1; p[81].imag=-1;
p[82].real=-1; p[82].imag=1;
p[83].real=1; p[83].imag=-1;
p[84].real=-1; p[84].imag=-1;
p[85].real=-1; p[85].imag=-1;
p[86].real=1; p[86].imag=1;
p[87].real=-1; p[87].imag=-1;
p[88].real=-1; p[88].imag=-1;
p[89].real=-1; p[89].imag=-1;
p[90].real=1; p[90].imag=-1;
p[91].real=-1; p[91].imag=1;
p[92].real=1; p[92].imag=-1;
p[93].real=1; p[93].imag=-1;
p[94].real=-1; p[94].imag=1;
p[95].real=1; p[95].imag=-1;
p[96].real=-1; p[96].imag=1;
p[97].real=-1; p[97].imag=1;
p[98].real=-1; p[98].imag=-1;
p[99].real=1; p[99].imag=1;
p[100].real=0; p[100].imag=0;
p[101].real=-1; p[101].imag=-1;
p[102].real=1; p[102].imag=1;
p[103].real=-1; p[103].imag=1;
p[104].real=-1; p[104].imag=1;
p[105].real=-1; p[105].imag=-1;
p[106].real=1; p[106].imag=1;
p[107].real=1; p[107].imag=1;
74
p[108].real=1; p[108].imag=1;
p[109].real=-1; p[109].imag=-1;
p[110].real=1; p[110].imag=1;
p[111].real=1; p[111].imag=-1;
p[112].real=1; p[112].imag=-1;
p[113].real=1; p[113].imag=-1;
p[114].real=-1; p[114].imag=1;
p[115].real=-1; p[115].imag=1;
p[116].real=-1; p[116].imag=1;
p[117].real=-1; p[117].imag=1;
p[118].real=1; p[118].imag=-1;
p[119].real=-1; p[119].imag=-1;
p[120].real=-1; p[120].imag=-1;
p[121].real=-1; p[121].imag=1;
p[122].real=1; p[122].imag=-1;
p[123].real=1; p[123].imag=1;
p[124].real=1; p[124].imag=1;
p[125].real=-1; p[125].imag=1;
p[126].real=1; p[126].imag=-1;
p[127].real=1; p[127].imag=-1;
p[128].real=1; p[128].imag=-1;
p[129].real=-1; p[129].imag=1;
p[130].real=1; p[130].imag=-1;
p[131].real=-1; p[131].imag=-1;
p[132].real=-1; p[132].imag=-1;
p[133].real=-1; p[133].imag=-1;
p[134].real=1; p[134].imag=1;
p[135].real=1; p[135].imag=1;
p[136].real=1; p[136].imag=1;
p[137].real=1; p[137].imag=1;
p[138].real=-1; p[138].imag=-1;
p[139].real=-1; p[139].imag=1;
p[140].real=-1; p[140].imag=1;
p[141].real=1; p[141].imag=1;
p[142].real=-1; p[142].imag=-1;
p[143].real=1; p[143].imag=-1;
p[144].real=1; p[144].imag=-1;
p[145].real=1; p[145].imag=1;
p[146].real=-1; p[146].imag=-1;
p[147].real=-1; p[147].imag=-1;
p[148].real=-1; p[148].imag=-1;
p[149].real=1; p[149].imag=1;
p[150].real=-1; p[150].imag=-1;
p[151].real=-1; p[151].imag=1;
p[152].real=-1; p[152].imag=1;
p[153].real=-1; p[153].imag=1;
p[154].real=1; p[154].imag=-1;
p[155].real=1; p[155].imag=-1;
p[156].real=1; p[156].imag=-1;
p[157].real=1; p[157].imag=-1;
p[158].real=-1; p[158].imag=1;
p[159].real=1; p[159].imag=1;
p[160].real=1; p[160].imag=1;
p[161].real=-1; p[161].imag=-1;
75
p[162].real=1; p[162].imag=1;
p[163].real=-1; p[163].imag=1;
p[164].real=-1; p[164].imag=1;
p[165].real=-1; p[165].imag=-1;
p[166].real=1; p[166].imag=1;
p[167].real=1; p[167].imag=1;
p[168].real=1; p[168].imag=1;
p[169].real=-1; p[169].imag=-1;
p[170].real=1; p[170].imag=1;
p[171].real=1; p[171].imag=-1;
p[172].real=1; p[172].imag=-1;
p[173].real=1; p[173].imag=-1;
p[174].real=-1; p[174].imag=1;
p[175].real=-1; p[175].imag=1;
p[176].real=-1; p[176].imag=1;
p[177].real=-1; p[177].imag=1;
p[178].real=1; p[178].imag=-1;
p[179].real=-1; p[179].imag=-1;
p[180].real=-1; p[180].imag=-1;
p[181].real=1; p[181].imag=-1;
p[182].real=-1; p[182].imag=1;
p[183].real=-1; p[183].imag=-1;
p[184].real=-1; p[184].imag=-1;
p[185].real=1; p[185].imag=-1;
p[186].real=-1; p[186].imag=1;
p[187].real=-1; p[187].imag=1;
p[188].real=-1; p[188].imag=1;
p[189].real=1; p[189].imag=-1;
p[190].real=-1; p[190].imag=1;
p[191].real=1; p[191].imag=1;
p[192].real=1; p[192].imag=1;
p[193].real=1; p[193].imag=1;
p[194].real=-1; p[194].imag=-1;
p[195].real=-1; p[195].imag=-1;
p[196].real=-1; p[196].imag=-1;
p[197].real=-1; p[197].imag=-1;
p[198].real=1; p[198].imag=1;
p[199].real=1; p[199].imag=-1;
p[200].real=1; p[200].imag=-1;
for (i=0;i<128;i++)
{ if ((i<14)||(i>114))
{big_pre[i].real=0;
big_pre[i].imag=0;}
}
//////////////////////////////////////////////////////////////////////////
j=0;
k=14;
for (i=0;i<256;i++)
{
if (((i-100)%2)==0)
{
76
big_pre[k].real=sqrt(2)*p[i].real; // real part of the 128 element of the
long preamble
big_pre[k].imag=sqrt(2)*p[i].imag; // imag part of the 128
element of the short preamble
k+=1;
}
}
iFFT(big_pre,128); // generating ifft of the 128 element
j=0;
k=0;
for (i=0;i<256;i++)
{
short128[i]=big_pre[k]; // genearting 2 repetitions of the 128 element
k++;
if (k==128) //reseting k for repeating symbol
k=0;
}
j=192;
k=0;
//////////////////////////////////short preamble/////////////////////////////
for(i=0;i<320;i++)
{
if (i<64) // for generating guard time
{
short_pre[i]=short128[j];
j++;
}
else
{
short_pre[i]=short128[k];
k++;
}
}
}
6.1.10 adding guard band
void guardband(COMPLEX din[], COMPLEX dout[])
{
int i;
for(i=0;i<64;i++)
{
dout[i].real=din[192+i].real;
dout[i].imag=din[i+192].imag;
}
for(i=64;i<320;i++)
{
dout[i].real=din[i-64].real;
dout[i].imag=din[i-64].imag;
}
}
77
6.1.11 Turbo encoder
typedef unsigned short int ushort;
ushort Frame[384],s[3],q,input[186],enip; //s is the convolutional registers states
ushort Data[186],c0[186],c1[186],c0b[186],c1b[186],Data_int[186];
ushort tdata[3],tc0[3],tc1[3],tdatab[3],tc0b[3],tc1b[3];
int i,j,k;
////////////////////////////convolutional encoder////////////////////////////
void convolution (ushort X[],ushort Y0[],ushort Y1[],ushort flag)
{
if (flag==0)
for (i=0;i<186;i++)
{
enip=X[i]^s[1]^s[2];
Y0[i]= enip^s[0]^s[2];
Y1[i]=enip^s[0]^s[1]^s[2];
q=enip;
s[2]=s[1];
s[1]=s[0];
s[0]=q;
}
else
for(i=0;i<3;i++)
{
X[i]=s[1]^s[2];
enip=X[i]^s[1]^s[2];
Y0[i]= enip^s[0]^s[2];
Y1[i]=enip^s[0]^s[1]^s[2];
q=enip;
s[2]=s[1];
s[1]=s[0];
s[0]=q;
}
}
//////////////////////////////////////////////////////////////////////////
//////////////////////interleaver/////////////////////////////////////////
void interleave (ushort M[],ushort Mb[])
{
for (int i=0;i<186;i++)
{
k=(186/6)*(i%6)+floor(i/6);
Mb[k]=M[i];
}
}
/////////////////////////////////////////////////////////////////////////
////////////////////////Turbo Encoder Function/////////////////////////////////////////////
void Turbo_encoder (char input[], char frame[])
{
unsigned short int bag=0xff;
78
for (j=0;j<186;j++) //input data for testing must be removed
{
input[j]=bag^0xff;
bag=input[j];
78
}
for (i=0;i<186;i++)
{
Data[i]=input[i];
c0[j]=0x00;
c1[j]=0x00;
}
convolution(Data,c0,c1,0);
convolution(tdata,tc0,tc1,1);
interleave(Data,Data_int);
convolution (Data_int,c0b,c1b,0);
convolution(tdatab,tc0b,tc1b,1);
/////////////////////////////////////////////////////////////////////////////
///////////////////////Framing///////////////////////////////////////////////
j=0;
for (i=0;i<372;i++)
{
Frame[i]=Data[j];
if ((j%2)==0)
{
i=i+1;
Frame[i]=c0[j];
}
else
{
i=i+1;
Frame[i]=c0b[j];
}
j+=1;
}
j=0;
for(i=372;i<378;i++)
{
Frame[i]=tdata[j];
i=i+1 ;
Frame[i]=tc0[j];
j+=1;
}
j=0;
for(i=378;i<384;i++)
{
Frame[i]=tdatab[j];
i=i+1;
Frame[i]=tc0b[j];
j+=1;
}
79
6.2 Receiver
6.2.1 derandomizer
Same function as randomizer
6.2.2 De-interleaver
void deinterleave(char dind[],char doutd[])
{
int k,j;
for(j=0;j<384;j++)
{
k=12*j-383*floor(12*j/384);
doutd[k]=dind[j];
}
}
6.2.3 FFT
void FFT(COMPLEX *Y, int N) //input sample array, # of points
{
COMPLEX temp1,temp2; //temporary storage variables
int i,j,k; //loop counter variables
int upper_leg, lower_leg; //index of upper/lower butterfly leg
int leg_diff; //difference between upper/lower leg
int num_stages = 0; //number of FFT stages (iterations)
int index, step; //index/step through twiddle constant
i = 1; //log(base2) of N points= # of stages
do
{
num_stages +=1;
i = i*2;
}while (i!=N);
leg_diff = N/2; //difference between upper&lower legs
step = 512/N; //step between values in twiddle.h
for (i = 0;i < num_stages; i++) //for N-point FFT
{
index = 0;
for (j = 0; j < leg_diff; j++)
{
for (upper_leg = j; upper_leg < N; upper_leg += (2*leg_diff))
{
lower_leg = upper_leg+leg_diff;
temp1.real = (Y[upper_leg]).real + (Y[lower_leg]).real;
temp1.imag = (Y[upper_leg]).imag + (Y[lower_leg]).imag;
temp2.real = (Y[upper_leg]).real - (Y[lower_leg]).real;
temp2.imag = (Y[upper_leg]).imag - (Y[lower_leg]).imag;
(Y[lower_leg]).real = temp2.real*(w[index]).real
-temp2.imag*(w[index]).imag;
(Y[lower_leg]).imag = temp2.real*(w[index]).imag
+temp2.imag*(w[index]).real;
(Y[upper_leg]).real = temp1.real;
(Y[upper_leg]).imag = temp1.imag;
}
80
index += step;
}
leg_diff = leg_diff/2;
step *= 2;
}
j = 0;
for (i = 1; i < (N-1); i++) //bit reversal for resequencing data
{
k = N/2;
while (k <= j)
{
j = j - k;
k = k/2;
}
j = j + k;
if (i<j)
{
temp1.real = (Y[j]).real;
temp1.imag = (Y[j]).imag;
(Y[j]).real = (Y[i]).real;
(Y[j]).imag = (Y[i]).imag;
(Y[i]).real = temp1.real;
(Y[i]).imag = temp1.imag;
}
}
return;
}
6.2.4 Twiddle
void twiddle(int n)
{
short i;
for (i = 0 ; i<n ; i++) // set up twiddle constants in w
{
w[i].real = cos(PI*i/n); //Re component of twiddle constants
w[i].imag =-sin(PI*i/n); //Im component of twiddle constants
}
}
6.2.5 De-mapper
void demapper(float dinId[],float dinQd[],char doutd[])
{
short i;
for(i=0;i<384;i+=2)
{
if((dinId[i/2]<=0)&&(dinQd[i/2]<=0))
{doutd[i]='000';
doutd[i+1]='000';
}
else if((dinId[i/2]>0)&&(dinQd[i/2]>0))
{doutd[i]='777';
doutd[i+1]='777';
}
81
else if((dinId[i/2]<=0)&&(dinQd[i/2]>0))
{doutd[i]='000';
doutd[i+1]='777';
}
else if((dinId[i/2]>0)&(dinQd[i/2]<=0))
{doutd[i]='777';
doutd[i+1]='000';
}
}
}
6.2.6 remove pilots and padding
void remove_pilots_padding(COMPLEX data_inf[],float Ioutf[],float Qoutf[])
{
int i;
for(i=28;i<40;i++)
{
Ioutf[i-28]=data_inf[i].real;
Qoutf[i-28]=data_inf[i].imag;
}
for(i=41;i<65;i++)
{
Ioutf[i-29]=data_inf[i].real;
Qoutf[i-29]=data_inf[i].imag;
}
for(i=66;i<90;i++)
{
Ioutf[i-30]=data_inf[i].real;
Qoutf[i-30]=data_inf[i].imag;
}
for(i=91;i<115;i++)
{
Ioutf[i-31]=data_inf[i].real;
Qoutf[i-31]=data_inf[i].imag;
}
for(i=116;i<128;i++)
{
Ioutf[i-32]=data_inf[i].real;
Qoutf[i-32]=data_inf[i].imag;
}
for(i=129;i<141;i++)
{
Ioutf[i-33]=data_inf[i].real;
Qoutf[i-33]=data_inf[i].imag;
}
for(i=142;i<166;i++)
{
Ioutf[i-34]=data_inf[i].real;
Qoutf[i-34]=data_inf[i].imag;
}
for(i=167;i<191;i++)
{
Ioutf[i-35]=data_inf[i].real;
Qoutf[i-35]=data_inf[i].imag;
82
}
for(i=192;i<216;i++)
{
Ioutf[i-36]=data_inf[i].real;
Qoutf[i-36]=data_inf[i].imag;
}
for(i=217;i<229;i++)
{
Ioutf[i-37]=data_inf[i].real;
Qoutf[i-37]=data_inf[i].imag;
}
}
6.2.7 converting from complex to float
void before_fft(float din_testf[],COMPLEX samplesf[])
{
short i;
for(i=0;i<2*320;i+=2)
{
samplesf[i/2].real=din_testf[i];
samplesf[i/2].imag=din_testf[i+1];
}
}
6.2.8 Packet detection
int detection_of_packet(float reci,float recq,float m[])// reci&recq are the real and
imaginary of the input sample, m is the vector containing the previous division values
{
int i;
for(i=0;i<128;i++)
{
prei[i]=pre[i].real;
preq[i]=pre[i].imag;
}
for(i=0;i<255;i++)
{
testi[i]=testi[i+1];
testq[i]=testq[i+1];
}
testi[255]=reci;
testq[255]=recq;
for(i=0;i<128;i++)
{
second_frame.real=((testi[i]*prei[i])+(testq[i]*preq[i]));
second_frame.imag=((testq[i]*prei[i])-(testi[i]*preq[i]));
testmag=sqrt((second_frame.real*second_frame.real)+(second_frame.imag*second_
frame.imag));
second+=testmag ;
}
for(i=128;i<256;i++)
{
83
first_frame.real=(testi[i]*prei[i-128])+(testq[i]*preq[i-128]);
first_frame.imag=(testq[i]*prei[i-128])-(testi[i]*preq[i-128]);
testmag=sqrt((first_frame.real*first_frame.real)+(first_frame.imag*first_frame.imag));
first+=testmag ;
}
for(i=0;i<9;i++)
m[i]=m[i+1];
m[9]=first/second;
mean=(m[0]+m[1]+m[2]+m[3]+m[4]+m[5]+m[6]+m[7]+m[8]+m[9])/10;
var_cal=variance(m,mean);
if ((mean>(1+2*var_cal)))
flag=1;
if((flag==1)&&(mean>(max/2)))
{
if (mean>max)
{
max=mean;
count=0;
}
else
count++;
return 0;
}
else
if(flag==1)
return 1;
else
return 0;
}
6.2.9 calculating variance
float variance (float vec_of_num[],float new_mean)
{
int i;
float var=0;
for(i=0;i<10;i++)
var+=vec_of_num[i]*vec_of_num[i];
var=var/10;
var=var-(new_mean*new_mean);
return var;
}
6.2.10 channel estimation
void channel_estm(COMPLEX input[],COMPLEX out[])
{
int i;
float estmag,estphase,mag,phase;
for(i=0;i<28;i++)
{
out[i].imag=0;
out[i].real=0;
84
}
for(i=229;i<256;i++)
{
out[i].imag=0;
out[i].real=0;
}
estmag=sqrt((input[40].real*input[40].real)+(input[40].imag*input[40].imag));
//Estimating the error in magnitude
estphase=atan(input[40].imag/input[40].real); //Estimating the error in phase
for(i=28;i<53;i++)
{
mag=sqrt((input[i].real*input[i].real)+(input[i].imag*input[i].imag));
phase=atan(input[i].imag/input[i].real);
if(input[i].real<0)phase=phase+PI;
mag=mag/estmag; //correcting the error in magnitude
phase=phase-estphase; //correcting the error in phase
out[i].real=mag*cos(phase);
out[i].imag=mag*sin(phase);
}
estmag=sqrt((input[65].real*input[65].real)+(input[65].imag*input[65].imag));
estphase=atan(input[65].imag/input[65].real); //here we subrtact PI as the pilot was -1
for(i=53;i<78;i++)
{
mag=sqrt((input[i].real*input[i].real)+(input[i].imag*input[i].imag));
phase=atan(input[i].imag/input[i].real);
if(input[i].real<0)phase=phase+PI;
mag=mag/estmag; //correcting the error in magnitude
phase=phase-estphase; //correcting the error in phase
out[i].real=mag*cos(phase);
out[i].imag=mag*sin(phase);
}
estmag=sqrt((input[90].real*input[90].real)+(input[90].imag*input[90].imag));
estphase=atan(input[90].imag/input[90].real);
for(i=78;i<103;i++)
{
mag=sqrt((input[i].real*input[i].real)+(input[i].imag*input[i].imag));
phase=atan(input[i].imag/input[i].real);
if(input[i].real<0)phase=phase+PI;
mag=mag/estmag; //correcting the error in magnitude
phase=phase-estphase; //correcting the error in phase
out[i].real=mag*cos(phase);
out[i].imag=mag*sin(phase);
}
estmag=sqrt((input[115].real*input[115].real)+(input[115].imag*input[115].imag));
estphase=atan(input[115].imag/input[115].real);
for(i=103;i<128;i++)
{
mag=sqrt((input[i].real*input[i].real)+(input[i].imag*input[i].imag));
phase=atan(input[i].imag/input[i].real);
if(input[i].real<0)phase=phase+PI;
mag=mag/estmag; //correcting the error in magnitude
phase=phase-estphase; //correcting the error in phase
out[i].real=mag*cos(phase);
85
out[i].imag=mag*sin(phase);
}
out[128].real=0;out[128].imag=0;
estmag=sqrt((input[141].real*input[141].real)+(input[141].imag*input[141].imag));
estphase=atan(input[141].imag/input[141].real);
for(i=129;i<154;i++)
{
mag=sqrt((input[i].real*input[i].real)+(input[i].imag*input[i].imag));
phase=atan(input[i].imag/input[i].real);
if(input[i].real<0)phase=phase+PI;
mag=mag/estmag; //correcting the error in magnitude
phase=phase-estphase; //correcting the error in phase
out[i].real=mag*cos(phase);
out[i].imag=mag*sin(phase);
}
estmag=sqrt((input[166].real*input[166].real)+(input[166].imag*input[166].imag));
estphase=atan(input[166].imag/input[166].real);
for(i=154;i<179;i++)
{
mag=sqrt((input[i].real*input[i].real)+(input[i].imag*input[i].imag));
phase=atan(input[i].imag/input[i].real);
if(input[i].real<0)phase=phase+PI;
mag=mag/estmag; //correcting the error in magnitude
phase=phase-estphase; //correcting the error in phase
out[i].real=mag*cos(phase);
out[i].imag=mag*sin(phase);
}
estmag=sqrt((input[191].real*input[191].real)+(input[191].imag*input[191].imag));
estphase=atan(input[191].imag/input[191].real);
for(i=179;i<204;i++)
{
mag=sqrt((input[i].real*input[i].real)+(input[i].imag*input[i].imag));
phase=atan(input[i].imag/input[i].real);
if(input[i].real<0)phase=phase+PI;
mag=mag/estmag; //correcting the error in magnitude
phase=phase-estphase; //correcting the error in phase
out[i].real=mag*cos(phase);
out[i].imag=mag*sin(phase);
}
estmag=sqrt((input[216].real*input[216].real)+(input[216].imag*input[216].imag));
estphase=atan(input[216].imag/input[216].real);
for(i=204;i<229;i++)
{
mag=sqrt((input[i].real*input[i].real)+(input[i].imag*input[i].imag));
phase=atan(input[i].imag/input[i].real);
if(input[i].real<0)phase=phase+PI;
mag=mag/estmag; //correcting the error in magnitude
phase=phase-estphase; //correcting the error in phase
out[i].real=mag*cos(phase);
out[i].imag=mag*sin(phase);
}
}
86
6.2.11 Frequncy synchronization
//this function gets the offset frequency to be used for correction
float freq_sync(COMPLEX det[])
{
COMPLEX z;
int i;
float zreal,zimag,anglez,Ts,f_offset;
Ts=125*pow(10,-9); //sampling time
z.real=0;
z.imag=0;
for(i=0;i<128;i++)
{
zreal=(det[i].real*det[i+128].real)+(det[i].imag*det[i+128].imag);
z.real=zreal+z.real;
zimag=(det[i].imag*det[i+128].real)-(det[i].real*det[i+128].imag);
z.imag=zimag+z.imag;
}
anglez=atan(z.imag/z.real);
f_offset=(-1/(2*PI*128*Ts))*anglez; //offset frequency
return f_offset;
}
6.2.12 frequncy correction
void freq_correction(COMPLEX d_fault[],COMPLEX d_correct[])
{
int i;
float Ts; //sampling time;
COMPLEX correction;
Ts=125*pow(10,-9);
for(i=0;i<256;i++)
{
correction.real=cos(2*PI*Ts*freq_offset*(i+65));
correction.imag=sin(2*PI*Ts*freq_offset*(i+65));
d_correct[i].real=(d_fault[i].real*correction.real)+(d_fault[i].imag*correction.ima
g);
d_correct[i].imag=-
(d_fault[i].real*correction.imag)+(d_fault[i].imag*correction.real);
}
}
void removeguardband(COMPLEX din[],COMPLEX dout[])
{
int i;
for(i=0;i<256;i++)
{
dout[i].real=din[i+64].real;
dout[i].imag=din[i+64].imag;
}
}
87
6.2.13 Remove Guard band
void removeguardband(COMPLEX din[],COMPLEX dout[])
{
int i;
for(i=0;i<256;i++)
{
dout[i].real=din[i+64].real;
dout[i].imag=din[i+64].imag;
}
}
88
7- Conclusion
Conclusion :
Throughout this project we have learned much about one of the most important
wireless communication systems that will lead the wireless market in the following
few years ,and also Digital Signal Processor gave us a great experience in dealing
with Embedded Systems.
This project gave us a real opportunity to work as a team & to know how to manage
projects, disaster recovery & work under pressure.
In brief we have learned the following about WiMAX
WiMAX is a huge system; its complete implementation may take several years of
work.
In our project we've implemented almost most of the physical layer on the DSP kit.
We hope that the students in the upcoming years would complete the system.
Referring to figure 3.2, the system is composed of 4 parts:
1- BB physical layer
2- MAC layer (Network interface)
3- Digital IF stage
4- RF stage
We suggest the following stages as a step towards the complete implementation of
the system:
Stage 1: Completing the remaining parts of the physical layer which are:
• Adaptive modulation
• Power control
• Uplink and downlink subframes
Stage 2: Implementing the MAC common part sublayer of the system, this may need
more than one group.
Stage 3: Implementing the security sublayer
Stage 4: Implementing the digital IF stage
Stage 5: Implementing the RF stage
I
Appendix A
:Decoder&Turbo Encoder
2.1 Turbo Encoder:
Turbo code is a parallel or serial concatenated convolutional code constructed from
low-complexity recursive systematic convolutional (RSC) codes. We are only
concerned with parallel concatenated convolutional codes (PCCC). An example of
such a code is shown in Figure 1. The basic convolutional codes which are
concatenated in this scheme are usually two identical recursive codes, with a
relatively small number of states (i.e., 8-states for the example in Figure 1). The input
to the top encoder, labeled “Encoder 1,” is information sequence U, and the outputs
are parity sequences C0 andC1. The input to the bottom encoder, labeled “Encoder
2,” is block-interleaved version of the original information sequence, denoted U’, and
the output are parity sequences C0’ and C1’. The output of the overall encoder is
obtained through puncturing and multiplexing of systematic sequences U and U’ and
coded sequences C0,C1,C0’ and C1’. It usually consists of the systematic
component U, and two parity components C and C’, where C is obtained by
puncturing and multiplexing C0 and C1, and C’ is obtained by puncturing and
multiplexing C0’ and C1’.
As an example, rate 1/3 turbo code is obtained when the overall output consists of
multiplexed sequences U, C0 and C0’.
Figure1. Turbo Code with Recursive 8-State Encoders
Turbo encoding is performed on blocks of information bits of length N. To facilitate
the decoding process, the encoders are in state 0 at the beginning of the frame, and
they are also brought to state 0 at the end of the frame. This is achieved by
appending tail bits after the information bits. Since the encoder is recursive, the bit
sequence which brings the encoder into state zero is not necessarily a zero
sequence. Instead, it depends on the state of the encoder after the information bits
have been encoded.
II
2.2 Turbo Decoder:
The decoding of turbo codes is based on an iterative structure constructed from two
MAP decoders, one for each constituent encoder. A high-level block diagram of a
turbo decoder is
shown in Figure 2.
Figure2. Turbo Decoder
The decoder operates in the log-likelihood ratio domain, i.e., instead of operating on
a priori, aposteriori probabilities and channel likelihoods, it operates on the log-
likelihood ratio (LLR) of these quantities, defined as:
Each MAP decoder has three inputs: a prior LLR for systematic bits La(U), channel
LLR for systematic bits Lc(U) and channel LLR for parity bits Lc(C). The computation
of channel LLRs is discussed in section 2.2.1.
The output of each MAP decoder is called “extrinsic LLR” and is denoted Le(U). This
quantity will be described in section 2.2.2.
Initially, the a priori input into MAP1, La1(U), is zero. The output of MAP1, Le1(U), is
interleaved and sent to MAP2 as a prior input La2(U). The output of MAP2, Le2(U), is
deinterleaved and sent back to MAP1 as a prior input La1(U). This “loop” is
performed a certain number of iterations.
The desired effect is that the extrinsic LLRs increase in absolute value after each
iteration. This effectively improves reliability of the decoding, and decreases bit error
rate (BER).
It has been showed by exhaustive simulations that, after certain number of iterations,
further decoding does not yield any additional BER improvement. In order to reduce
processing delay of the decoding process, it is of interest to stop the decoding as
soon as this point has been reached. This can be performed by applying a stopping
further discussed in section 2.2.5.
After the iterative process has been terminated, the final LLR L(U) is computed as a
sum of extrinsic information at the output of each MAP decoder, Le1(U) and Le2(U),
and channel LLR for systematic bits Lc(U). The final LLR is sent to a threshold
device which generates binary (hard) decisions U^ based on the sign of the LLR, as
shown in section 2.2.6.
III
2.2.1 Channel LLR Computation
Binary outputs of the turbo encoder, denoted U, C and C’ in Figure 1, are modulated
and send over a noisy channel. Prior to modulation, signal point mapping is
performed as follows:
If the channel is considered to be fading channel with additive white Gaussian noise,
channel outputs corresponding to the systematic bits are:
where aU(t) is the fading channel coefficient, and nU(t) is the noise sample with zero
mean and variance No/2. Similarly, the channel outputs corresponding to the parity
bits are:
If the channel can be assumed to be non-fading, the fading coefficient is
aU(t)= aC(t)= aC'(t)= 1. Alternatively, the fading coefficient, along with noise variance
No can be approximately determined using channel estimation algorithms.
The channel likelihood for systematic bits XU(t) is the probability that value yU(t) has
been received, given that XU(t) has b !Unexpected End of Formulaeen
transmitted, and given that aU(t) is known. This is computed based on the
assumption that yU(t)-aU(t)XU(t) is a Gaussian variable with zero mean and variance
No/2. The channel likelihood is then computed as follows:
2.2.2 MAP Decoding
The algorithm which is used as a basis for MAP decoding is the Bahl Cocke Jelinek
Raviv (BCJR) algorithm, which exploits the trellis structure of a convolutional
code. Previous to the discovery of turbo codes, this algorithm has not been used for
decoding of convolutional codes due to the availability of a lower complexity Viterbi
algorithm (for maximum-likelihood decoding of convolutional codes). The Viterbi
IV
algorithm, however, delivers only hard decisions, and not probability distributions (or
LLR’s) and can therefore not directly be used in turbo decoding.
The notation for trellis branches used in the subsequent sections is shown in Figure
3. Branch start state is m’, and the end state is m. The symbol U(b) is the input label,
i.e., it represents the input into the encoder. The symbol C(b) is the output label, or
the corresponding output of the encoder which was in state m’ and received input
U(b).
Figure 3. Branch Notation
The BCJR algorithm for MAP decoding of convolutional codes consists of the
following steps:
Compute branch metric:
This quantity is similar to the local metrics used in Viterbi decoding. The branch
metrics represents the logarithm of the probability of branch b at time t, computed
only based on the knowledge of the channel and a priori LLRs of input and output
symbols associated with the branch (i.e., not path history through the trellis). For a
branch b which connects state m’ at time (t−1) and state m at time t, labeled with
input/output pair (U(b),C(b)), the branch metric is computed as:
where Lc(U(t))and Lc(C(t)) are systematic and parity channel LLRs, respectively, and
La(U(t)) is a priori LLR.
2- Compute forward state metric (α)
This quantity is similar to accumulated state metrics in Viterbi decoding, and
represents log-probability of state m at time t, given probabilities of states at previous
time instances (i.e., knowledge of trellis history). For state m at time t, the forward
state metric is computed as:
where the summation is performed over all states m’ at time t−1 which are connected
through a trellis branch to state m at time t.
3- Compute backward state metrics (β)
This quantity represents the accumulated state metrics, when the trellis is traversed
starting from the last stage. It is the log-probability of state m at time t, given
probabilities of states at future time instances (i.e., knowledge of trellis “future”). For
state m at time t, the backward state metric is computed as:
where the summation is performed over all states m’ at time t+1 which are connected
through a trellis branch to state m at time t.
3- Compute extrinsic LLR
The final output of MAP decoder is obtained by computing the total LLR of bit U(t),
given forward and backward state metrics as well as branch metrics for time t, and
V
subtracting the systematic channel LLR for bit U(t), LC(U(t)), and apriori LLR for bit
U(t), La(U(t)), both given at the input to the MAP decoder. The output therefore
represents only the “refinement” term, or extrinsic LLR:
where the summations in the numerator and denominator are performed over all
branches which are labeled with input labels 1 and 0, respectively.
It can be observed that the most computations involved in MAP decoding are based
on the logarithm of a sum of exponentials. Such an expression can be exactly
computed, two terms at a time, using the Jacobian logarithm :
i.e., as the maximum exponent and a correction term which is a function of the
absolute difference between exponents.
If the correction term is omitted and only max term is used to compute α,βand
extrinsic LLR, we obtain the so-called max-log-MAP approximation.
If the correction term is approximated using a small lookup table, we obtain the
max*-log-MAP approximation. This approximation yields significant BER
improvements and is usually preferred over the max-log-MAP solution, in spite of
slightly increased computational complexity.
2.2.3 Sliding Window MAP Decoding
One of the drawbacks of the MAP decoding algorithm is its large storage
requirements. Forward state metrics αand backward metrics βneed to be computed
and stored for all states and all stages in the trellis, since they are required for the
last step in the algorithm, extrinsic LLR computation. It is possible to combine α or
βaccumulation with extrinsic information, such that only αor βneeds to be stored.
This represents (N+K−1)*2^(K−1) values which need to be stored, for frame of N
information bits and code constraint length K.
In order to reduce memory requirements, large frames can be split into sliding
windows, and MAP decoding can be performed on each sliding window
independently. For non-sliding window MAP implementation, α and β are initialized
in such a manner that probability 1 is given to α0(0) and β N+K−1(0), since it is
known that the initial and the final states of the encoder are zero.
When the frame is split into independent sliding windows, the initial and final states
for each window are not known. Therefore, equal probability is given to all α’s at the
first stage in the window, and all β’s at the last stage of the window. In order to
achieve reliable decoding, the first segment of α’s as well as the last segment of β’s
should not be used in the final computation of extrinsic information. We call these
initial and final segments of the window “header prolog” and “tail prolog”, espectively,
and denote them P. The extrinsic LLR is only computed over the middle segment of
the sliding window, also called “reliability length” and denoted R. In order to obtain
extrinsic LLRs for all bits in the frame, the sliding windows should be organized in
such a manner that reliability segments of neighbouring windows do not overlap nor
form a gap. The header prolog should be overlapped with reliability length of the
previous sliding window, and the tail prolog should be overlapped with reliability
length of the following sliding window, as shown in Figure 4. Note also that the first
VI
window does not require header prolog, since the initial state is known, and for the
last window the K−1 tail bits are used instead of the prolog to initialize β’s.
With sufficiently large values for P and R, this approach does not result in any BER
degradation. A rule of thumb is to use P equal to 3 to 5 times the number of states.
Figure 4. Sliding Window MAP Processing
2.2.4 Interleaving/Deinterleaving
It is necessary to interleave or deinterleave extrinsic LLRs before they can be used
as apriori LLRs of the “other” MAP decoder. This function is typically performed using
a look-up table. If entry at location “i” in the lookup table has value “ii”, i.e., lut[i]=ii,
location “i” in the original frame will be copied to location “ii” in the interleaved frame.
Deinterleaving is performed using the lookup table in the reverse direction, i.e.,
location “ii” in the original frame will be copied to location “i” in the deinterleaved
frame. If frames are very long, it may not be feasible to store the interleaver lookup
table, in which case the table would need to be generated on the fly.
2.2.5 Stopping Criterion
Research results have confirmed that after a certain number of iterations, there is no
benefit in terms of BER of performing additional iterations. The most frequently used
number is 6−8 iterations, although the number of useful iterations is proportional to
the frame size. A safe approach would be to run the turbo decoder for a fixed (large)
number of iterations. This, however, increases processing delay and could waste
power. Recently, algorithms have been devised which can determine automatically if
more iterations would yield additional error corrections or not. Such algorithms are
called “stopping criteria” and are typically based on some statistics of the extrinsic
LLR.
The algorithm used in the TCP implementation is based on the computation of the
SNR of extrinsic information, and comparing it against a user-defined threshold.
2.2.6 Hard-Decision Generation
After the last iteration, the final LLR L(U) is computed as a sum of systematic
channel LLR LC(U), extrinsic LLR of first MAP, Le1(U) and deinterleaved extrinsic
LLR of second MAP, Le2(U).
The hard (binary) decision at the output of the turbo decoder is computed based on
the sign of the final LLR as follows:
VII
Appendix B
Turbo encoder Testing code
#include<iostream.h>
#include<fstream.h>
#include<math.h>
typedef unsigned short int ushort;
ushort Frame[36],s[3],q,input[10],enip; //s is the convolutional registers states
ushort Data[12],c0[12],c1[12],c0b[12],c1b[12],Data_int[12];
ushort tdata[3],tc0[3],tc1[3],tdatab[3],tc0b[3],tc1b[3];
////////////////////////////convolutional encoder////////////////////////////
int i;
void convolution (ushort X[],ushort Y0[],ushort Y1[],ushort flag)
{
if (flag==0)
for (i=0;i<12;i++)
{
enip=X[i]^s[1]^s[2];
Y0[i]= enip^s[0]^s[2];
Y1[i]=enip^s[0]^s[1]^s[2];
q=enip;
s[2]=s[1];
s[1]=s[0];
s[0]=q;
}
else
for(i=0;i<3;i++)
{
X[i]=s[1]^s[2];
enip=X[i]^s[1]^s[2];
Y0[i]= enip^s[0]^s[2];
Y1[i]=enip^s[0]^s[1]^s[2];
q=enip;
s[2]=s[1];
s[1]=s[0];
s[0]=q;
}
}
//////////////////////////////////////////////////////////////////////////
//////////////////////interleaver/////////////////////////////////////////
void interleave (ushort M[],ushort Mb[])
{ int k;
for ( i=0;i<12;i++)
{
k=(12/6)*(i%6)+floor(i/6);
Mb[k]=M[i];
}
}
/////////////////////////////////////////////////////////////////////////
////////////////////////main/////////////////////////////////////////////
void main (void)
{
int j;
ushort bag=0xff;
for (j=0;j<10;j++)
{
VIII
input[j]=bag^0xff;
bag=input[j];
}
for (i=0;i<12;i++)
{
if (i<10)
Data[i]=input[i];
else Data[i]=0x00;
c0[j]=0x00;
c1[j]=0x00;
}
convolution(Data,c0,c1,0);
convolution(tdata,tc0,tc1,1);
interleave(Data,Data_int);
convolution (Data_int,c0b,c1b,0);
convolution(tdatab,tc0b,tc1b,1);
/////////////////////////////////////////////////////////////////////////////
///////////////////////Framing///////////////////////////////////////////////
ofstream fout("m.txt");
j=0;
for (i=0;i<24;i++)
{
Frame[i]=Data[j];
if ((j%2)==0)
{i=i+1;
Frame[i]=c0[j];
}
else {i=i+1;
Frame[i]=c0b[j];
}
j+=1;
}
j=0;
for(i=24;i<30;i++)
{Frame[i]=tdata[j];
i=i+1 ;
Frame[i]=tc0[j];
j+=1;
}
j=0;
for(i=30;i<36;i++)
{Frame[i]=tdatab[j];
i=i+1;
Frame[i]=tc0b[j];
j+=1;
}
for (i=0;i<36;i++)
{
fout<<Frame[i] <<' ';
}
fout.close();
cout<<endl;
cin>>q;
}
IX
Appendix C
Matlab simulation code
This part is for the interleaver testing
%to see the effect of burst errors with interleaving
msg=randint(1,128*100);%original message consists of 100 symbols each one 192 bits which are
input to the interleaver
%In this part we encode using repition 3 code
coded_msg=repmat(msg,3,1);
coded_msg=reshape(coded_msg,1,38400);
datatx=coded_msg;
%this part is for the interleaver
k=0:383; % K is the index of the input bits, block size of the interleaver for BPSK modulation=384
m=(384/12)*mod(k,12)+floor(k/12);%indicies for the interleaver
data=coded_msg(1:384);
datatx=intrlv(data,m+1);
for k=1:99
h=k*384+1;
msg1=coded_msg(h:h+383);
intrlv1=intrlv(msg1,m+1);
datatx=[datatx intrlv1];%datatx is the interleaved version of the data
end
%in the next lines mapping to QPSK is made to form I,Q
I1=zeros(1,19200);
Q1=zeros(1,19200);
for i=2:2:38400
if(datatx(i-1)==0 && datatx(i)==0)
I1(i/2)=-1;
Q1(i/2)=1;
end
if(datatx(i-1)==0 && datatx(i)==1)
I1(i/2)=-1;
Q1(i/2)=-1;
end
if(datatx(i-1)==1 && datatx(i)==0)
I1(i/2)=1;
Q1(i/2)=1;
end
if(datatx(i-1)==1 && datatx(i)==1)
I1(i/2)=1;
Q1(i/2)=-1;
end
end
time=2E-6:2E-6:0.0384;%for simulation
I=[time;I1];
Q=[time;Q1];
I=I';% these I and Q shall go to simulink
Q=Q';
After that both I, Q enter simulink model.
The next part is for reception
%this part is to convert the complex received signal from simulink into the original
bits(demapping)
rxdata=reshape(rxdata,1,19201);
rxdata=rxdata(2:19201);
Irx=real(rxdata);
X
Qrx=imag(rxdata);
Irx=Irx>0;
Irx=2*Irx-1;
Qrx=Qrx>0;
Qrx=2*Qrx-1;
for i=2:2:38400
if(Irx(i/2)==-1 && Qrx(i/2)==1)
datarec(i-1)=0;
datarec(i)=0;
else if(Irx(i/2)==-1 && Qrx(i/2)==-1)
datarec(i-1)=0;
datarec(i)=1;
else if(Irx(i/2)==1 && Qrx(i/2)==1)
datarec(i-1)=1;
datarec(i)=0;
else if(Irx(i/2)==1 && Qrx(i/2)==-1)
datarec(i-1)=1;
datarec(i)=1;
end
end
end
end
end
%this part is for deinterleaving
k=0:383; %k is the index of the received bits
l=12*k-383*floor(12*k/384);%indicies for the deinterleaver
data1=datarec(1:384);
datarx=intrlv(data1,l+1);
for k=1:99
h=k*384+1;
msg1=datarec(h:h+383);
intrlv1=intrlv(msg1,l+1);
datarx=[datarx intrlv1];%datatx1 is the deinterleaved version of the data
end
decoded_data=zeros(1,12800);
%this part is for repition 3 decode
for k=1:3:38400
vector=datarx(k:k+2);
m=((k-1)/3)+1;
if sum(vector)>=2
decoded_data(m)=1;
else decoded_data(m)=0;
end
end
%here we get the BER
BER=1-sum(decoded_data==msg)/length(msg)
%these are the simulation results for BER versus Eb/No in a Rayleigh %fading channel with and
without an interleaver using a repitition 3 %code
ebno=[2 5 6 7 10 12 14 17 20];
BER1=[0.4551 0.4477 0.4607 0.4502 0.4322 0.4287 0.4141 0.3914 0.3951];%with interleaver
BER2=[0.6041 0.6202 0.6238 0.6293 0.6216 0.6141 0.6015 0.5830 0.5780];%without interleaver
plot(ebno,BER1)
hold
plot(ebno,BER2)
%these are the BER results for an AWGN channel versus Rayleigh fading %channel after
simulation using simulink and the above code
EbNo=[2 5 6 7 10 12 14 17 20]
BER3=[0.6041 0.6202 0.6238 0.6293 0.6216 0.6141 0.6015 0.5830 0.5780]
%BER3 is in Rayleigh fading channel
BER4=[0.0225 0.0058 0.0024 1.5e-5 0 0 0 0 0 ]
%BER4 is in AWGN channel
XI
plot(EbNo,BER3);
hold
plot(EbNo,BER4);
% this code is used to show the importance of adding a piolt to the data
% and how it improves BER, also it shows that if more piolts are used,
% better BER is obtained.
This part is for pilot testing
First we transmit:
I=randint(1,98);
Q=randint(1,98);
I=2*I-1;
I=[1 I 1]; % we add 2 BPSK pilots at the beginning and at the end of the data bits
%so their I=1 and Q=0
Q=2*Q-1;
Q=[0 Q 0];
data=I+j*Q;
time=0.1:0.1:10;
I=[time' I'];
Q=[time' Q'];
Then we enter simulink
After that we estimate the phase and frequency of the pilot to be used for correction:
amp1=abs(simout(2)); %amplitude of the 1st pilot
phase1=angle(simout(2));%phase of the 1st pilot
amp2=abs(simout(101)); %amplitude of the 2nd pilot
phase2=angle(simout(101));%phase of the 2nd pilot
%the next 2 lines correct the data using the 2 pilots
y=(simout(2:50)./amp1).*exp(-j*phase1);
y2=(simout(51:101)./amp2).*exp(-j*phase2);
%In this part we compare the received data after correction with a
%threshold(=0)
x=real(y);
x=x>0;
x=2*x-1;
z=imag(y);
z=z>0;
z=2*z-1;
rxdata(1:48)=x+j*z;%1st 50 bits of the data
x2=real(y2);
x2=x2>0;
x2=2*x2-1;
z2=imag(y2);
z2=z2>0;
z2=2*z2-1;
rxdata(49:98)=x2+j*z2;%last bits of the data
rx_data=rxdata(1:98);
tx_data=data(2:99);
tx_data=reshape(tx_data,size(rx_data));
error=(tx_data==rx_data);
ber=1-sum(error)/length(error)%To get the BER
This part is for packet detection algorithm
% This part is for preamble generation
pall=[1-i,1-i,-1-i,1+i,1-i,1-i,-1+i,1-i,1-i,1-i,1+i,-1-i,1+i,1+i,-1-i,1+i,-1-i,-1-i,1-i,-1+i,1-i,1-i,-1-i,1+i,1-i,1-
i,-1+i,1-i,1-i,1-i,1+i,-1-i,1+i,1+i,-1-i,1+i,-1-i,-1-i,1-i,-1+i,1-i,1-i,-1-i,1+i,1-i,1-i,-1+i,1-i,1-i,1-i,1+i,-1-
i,1+i,1+i,-1-i,1+i,-1-i,-1-i,1-i,-1+i,1+i,1+i,1-i,-1+i,1+i,1+i,-1-i,1+i,1+i,1+i,-1+i,1-i,-1+i,-1+i,1-i,-1+i,1-
i,1-i,1+i,-1-i,-1-i,-1-i,-1+i,1-i,-1-i,-1-i,1+i,-1-i,-1-i,-1-i,1-i,-1+i,1-i,1-i,-1+i,1-i,-1+i,-1+i,-1-i,1+i,0,-1-
i,1+i,-1+i,-1+i,-1-i,1+i,1+i,1+i,-1-i,1+i,1-i,1-i,1-i,-1+i,-1+i,-1+i,-1+i,1-i,-1-i,-1-i,-1+i,1-i,1+i,1+i,-1+i,1-
i,1-i,1-i,-1+i,1-i,-1-i,-1-i,-1-i,1+i,1+i,1+i,1+i,-1-i,-1+i,-1+i,1+i,-1-i,1-i,1-i,1+i,-1-i,-1-i,-1-i,1+i,-1-i,-1+i,-
1+i,-1+i,1-i,1-i,1-i,1-i,-1+i,1+i,1+i,-1-i,1+i,-1+i,-1+i,-1-i,1+i,1+i,1+i,-1-i,1+i,1-i,1-i,1-i,-1+i,-1+i,-1+i,-
1+i,1-i,-1-i,-1-i,1-i,-1+i,-1-i,-1-i,1-i,-1+i,-1+i,-1+i,1-i,-1+i,1+i,1+i,1+i,-1-i,-1-i,-1-i,-1-i,1+i,1-i,1-i,];
XII
pall2=[zeros(1,28) pall zeros(1,27)];
p464=[];
for j=1:length(pall2)
if mod((j-101),2)==0
p464=[p464 sqrt(2)*(pall2(j))];
end
end
timedom=ifft(p464);
timedom2=[];
for j=65:128
timedom2=[timedom2 timedom(j)];
end
preample=[timedom2 timedom timedom];
testvec=[conj(timedom) conj(timedom)];
rec=sqrt(.00015)*ones(1,256);
noise=sqrt(.00015)*((randn(1,700)+i*randn(1,700)));
noise(321:640)=noise(321:640)+preample;
for j=1:700
rec(1:255)=rec(2:256);
rec(256)=noise(j);
test=rec.*testvec;
test=(abs(test));
test=reshape(test,[],1);
division(j)=((sum(test(129:256)))./(sum(test(1:128))));
end
plot(division)
This part is frequency synchronization
pre_real=randint(1,128);%real part of the preamble to be repeated
Itx=[pre_real pre_real];
I1=[Itx(193:256) Itx randint(1,680)];
I1=2*I1-1;
pre_imag=randint(1,128 ;)
Qtx=[pre_imag pre_imag];
Q1=[Qtx(193:256) Qtx randint(1,680)];
Q1=2*Q1-1;
data=I1+j*Q1;
time=125e-9:125e-9:125e-6;
I=[time;I1];
I=I;'
Q=[time;Q1];
Q=Q;'
Ts=125e-9; %sampling time
%this part is after receiving for frequency offset estimation
drx=reshape(dout,1,10001);
drx=drx(2:10001);
d1=drx(1:100);
d2=drx(101:200);
d2=d2';
d2=reshape(d2,size(d1));
d=sum(d1.*d2);
f_offset=(-1/(2*pi*100*Ts))*angle(d)%frequency offset equals 10KHZ which is correct
Then we'll make frequency correction as follows:
%this part is for frequency correction
corr=zeros(1,10000);
for n=1:10000
%corr(n)=drx(n).*exp(-j*2*pi*0.01*f_offset*n);
corr(n)=drx(n).*(cos(2*pi*Ts*f_offset*n)-j*sin(2*pi*Ts*f_offset*n));
end
%assuming no noise the received signal after frequency offset etimation and correction is
XIII
%the same as the transmitted one.
%this part is for BER calculations with frequency offset
Irx1=real(drx);
Irx=Irx1>0;
Irx=2*Irx-1;
Qrx1=imag(drx);
Qrx=Qrx1>0;
Qrx=2*Qrx-1;
for i=1:1000
if((Irx(i)==I1(i))&&(Qrx(i)==Q1(i)))error(i)=0;
else error(i)=1;
end
end
BER=sum(error)/length(error(
EbNo=[1 2 3 4 5];
BER1=[0.0400 0.0170 0.0060 0.001 0.0007];%with frequency offset and correction
BER2=[0.0280 0.0180 0.0050 0.001 0.0006];%without frequency offset in AWGN
plot(EbNo,BER1);
hold
plot(EbNo,BER2);
% these are the BER results
Eb/No=[1 2 3 4 5]
BER=[0.0400 0.0170 0.0060 0.001 0.0007]%
%BER=[0.0280 0.0180 0.0050 0.001 0.0006]
XIV
Appendix D
List of Figures
Figure 1.1-- WiMAX standards comparison ……………………………………….……6
Figure 1.2-- END-TO-END ARCHITECTURE EVOLUTIONS……………….……..…9
Figure 1.3-- 802.16 reference architecture……………………………………………..10
Figure 1.4-- IEEE STD 802.16 protocol layering………………………………………11
Figure 1.5-- OFDMA vs. OFDM/TDMA ………………………………………...….12
Figure 2.1-- Fresnel zone clearance ……………………………………………...…..14
Figure 2.2-- NLOS vs. LOS …………………………………………………………..…15
Figure 2.3-- Effect of CPE location… ………………………………………………..…16
Figure 2.4-- Multi carrier vs. Single carrier…………………………………………..…17
Figure 2.5-- OFDM performance in frequency selective fading.………………..……17
Figure 2.6-- the effect of sub-channelization……………….………………….………18
Figure 2.7-- Relative cell radii for adaptive modulation………………………..……...19
Figure 2.8-- OFDM subcarriers……………………………………………..…..……….20
Figure 2.9-- downlink and uplink subframes………………………………...…………20
Figure 3.1-- basic configuration of a software radio terminal…………….…..………24
Figure 3.2-- DSP based hardware transceiver…………………………….…..………25
Figure 3.3-- System design………………………………………………………...……27
Figure 3.4-- transmitter block diagram…………………………………………….……29
Figure 3.5-- PRBS for data randomization……………………………………….…….29
Figure 3.6-- BPSK, QPSK, 16-QAM and 64-QAM constellations……………...……32
Figure 3.7-- Downlink and network entry preamble structure…………………..……34
Figure 3.8-- PEVEN time domain structure………………………………………….……35
Figure 3.9-- receiver block diagram ……………………………………………….……36
Figure 3.10-- the response of the double sliding window packet detection
Algorithm……………………………………………………………...…….37
Figure 3.11-- Double sliding window packet detection…………………………………38
Figure 3.12-- Effect of variance in symbol timing……………………………….………40
Figure 3.13-- SNR degradation due to frequency offset……………………...………..42
Figure 3.14-- link budget models ……………………………………………..………….46
Figure 3.15-- channel simulation simulink model……………………………….………47
Figure 4.1-- Interleaver test simulink model…………………………………...……….50
Figure 4.2-- BER curves with & without interleaver……………………………..…….51
Figure 4.3-- BER curves with and without fading………………………………..…….51
Figure 4.4-- Pilot test simulink model…………………………………………..……….52
Figure 4.5-- Output of packet detection algorithm……………………………………..53
Figure 4.6-- Frequency sync. test model……………………………………...………..53
Figure 4.7-- Performance of frequency correction algorithm …………………….….54
Figure 5.1-- EDMA Channel registers…………………………………………………..59
XV
Appendix E
List of Tables
Table 1—Modulation and coding combinations ………………………………….……21
Table 2—OFDM parameters…………………………………………………….….……28
Table 3-- block sizes of the bit interleaver………………………………………………31
Table 4—base station and CPE link budget analysis …………………………………46
Appendix F
Abbreviations and Acronyms
AAS Adaptive Antenna System
ADC Analog to Digital Converter
AP Access Point
ATM Asynchronous Transfer Mode
BB Baseband
BER Bit Error Rate
BPSK Binary Phase Shift Keying
BS Base Station
BWA Broadband Wireless Access
CP Cyclic Prefix
CPE Customer Premises Equipment
DFT Discrete Fourier Transform
DSP Digital Signal Processor
EDMA Enhanced Direct Memory Access
FCH Frame Contol Header
FDD Frequency Division Duplex
FEC Forward Error Correction
FFT Fast Fourier Transform
ICI Intercarrier Interference
IF Intermediate Frequency
IFFT Inverse Fast Fourier Transform
IP Internet Protocol
ISI Intersymbol Interference
LAN Local Area Network
LOS Line Of Sight
MAC Media Access Control
MAN Metropolitan Area Network
NLOS Non Line Of Sight
OFDM Orthogonal Frequency Division Multiplexing
OFDMA Orthogonal Frequency Division Multiple Access
PRBS Pseudo Random Binary Sequence
QOS Quality Of Service
QAM Quadrature Amplitude Modulation
QPSK Quadrature Phase Shift Keying
XVI
RAN Regional Access Network
RF Radio Frequency
RNSN Radio Network Serving Node
RTDX Real Time Data Exchange
RX Receiver
SFID Service Flow Identifier
SNR Signal to Noise Ratio
SS Subscriber Station
SWR Software Radio
TDD Time Division Duplex
TDMA Time Division Multiple Access
TX Transmitter
WiMAX Worldwide Interoperability for Microwave Access
Appendix G
Application notes & references
WiMAX standard 802.16-2004
Wireless Communications ' Theodore S.Rappaport'
Communication Systems 4th
Edition ' Haykin'
OFDM Wireless LANs ' John Terry'
A Technical Overview of the WirelessMAN Air Interface for Broadband Wireless
access.pdf
The Scientist and Engineer's Guide to Digital Signal Processing 'Steven W. Smith'

More Related Content

PDF
SON (Self Organizing Networks) An analysis of its benefits in the mobile domain
PDF
Student -gsm_architecturesahan
PDF
Mohammed Abu Aqel Cv 11 10 2012
PPTX
Fundamentals of Computer Networking - Shift Education of Technology
DOCX
networking report for sbit
DOCX
Report training
PPT
Ccna report
DOC
Wcdma p&amp;o-c-en-basal theory-1-201006-33
SON (Self Organizing Networks) An analysis of its benefits in the mobile domain
Student -gsm_architecturesahan
Mohammed Abu Aqel Cv 11 10 2012
Fundamentals of Computer Networking - Shift Education of Technology
networking report for sbit
Report training
Ccna report
Wcdma p&amp;o-c-en-basal theory-1-201006-33

What's hot (20)

PPTX
Internship report ppt
PDF
Gsm based campus display system project report
DOCX
Diaa CV Feb 2017 - LinkedIn
PDF
PROTECTED DESKTOP ACCESS BASED ON USE OF MOBILE PHONE
PPT
PPT
Ccna day1
PPT
WAN Design Project
PDF
Application-Aware Acceleration for Wireless Data Networks: Design Elements an...
PDF
Wireless gsm modem industrial gprs 3g 4g dtu with rs232 rs485 for m2 m smart ...
PPTX
Tags. troubleshooting and optimization startup sauna
PPT
Introduction to Computer Networks Lecture slides ppt
PDF
High Speed Token Ring
PPT
Ccna day1
PPT
DOCX
li-fi Bsnl final report
PPTX
Introduction to computer networks
DOCX
Course information outline
PPTX
Ipt Syllabus Changes Communications Systems
PDF
Microsoft Word Mobile Multi Media Applications
PDF
Scaling Networks Lab Manual 1st Edition Cisco Solutions Manual
Internship report ppt
Gsm based campus display system project report
Diaa CV Feb 2017 - LinkedIn
PROTECTED DESKTOP ACCESS BASED ON USE OF MOBILE PHONE
Ccna day1
WAN Design Project
Application-Aware Acceleration for Wireless Data Networks: Design Elements an...
Wireless gsm modem industrial gprs 3g 4g dtu with rs232 rs485 for m2 m smart ...
Tags. troubleshooting and optimization startup sauna
Introduction to Computer Networks Lecture slides ppt
High Speed Token Ring
Ccna day1
li-fi Bsnl final report
Introduction to computer networks
Course information outline
Ipt Syllabus Changes Communications Systems
Microsoft Word Mobile Multi Media Applications
Scaling Networks Lab Manual 1st Edition Cisco Solutions Manual
Ad

Viewers also liked (8)

PDF
BER PERFORMANCE ANALYSIS FOR WIMAX PHY LAYER UNDER DIFFERENT CHANNEL CONDITIONS
PDF
Gprs Tutorial
PDF
Wiley The.Umts.Network.And.Radio.Access.Technology.Air.Interface.Techniques.F...
PDF
Lte Advancedtechnologyintroduction 100401143915 Phpapp01
PDF
Ros Gra10
PDF
Pmcdsp v5
PDF
Hpi Gsm Air Interface
PDF
Mobile Wi Max Part1 Overview And Performance
BER PERFORMANCE ANALYSIS FOR WIMAX PHY LAYER UNDER DIFFERENT CHANNEL CONDITIONS
Gprs Tutorial
Wiley The.Umts.Network.And.Radio.Access.Technology.Air.Interface.Techniques.F...
Lte Advancedtechnologyintroduction 100401143915 Phpapp01
Ros Gra10
Pmcdsp v5
Hpi Gsm Air Interface
Mobile Wi Max Part1 Overview And Performance
Ad

Similar to Documentation (20)

PDF
Analysis of WiMAX Physical Layer Using Spatial Multiplexing Under Different F...
PDF
Simulation of IEEE 802.16e Physical Layer
PDF
Ew31992997
PDF
Scalable ofdma wp_mobile_wi_max_ic_stelecom
PDF
Wi MAX Deinter leaver’s Address Generation Unit through FPGA Implementation
PPT
Broadband Wireless 802.16
PPTX
WiMAX_Intro
PDF
Wifi Vs Wimax By Dr Walter Green
PDF
BER PERFORMANCE ANALYSIS FOR WIMAX PHY LAYER UNDER DIFFERENT CHANNEL CONDITIONS
PDF
BER PERFORMANCE ANALYSIS FOR WIMAX PHY LAYER UNDER DIFFERENT CHANNEL CONDITIONS
DOC
PPT
WiMAX (IEEE 802.16)
PDF
Wi max basic sl_v2_sergio_cruzes
PDF
Fundamentals of wi max
PDF
Fundamentals of WiMAX: A Technology Primer
PDF
Survey on mobile wimax
PDF
PDF
High frequency of low noise amplifier architecture for WiMAX application: A r...
PDF
Ofdma
PDF
Bit error rate analysis of wimax physical layer under sui and awgn channel mo...
Analysis of WiMAX Physical Layer Using Spatial Multiplexing Under Different F...
Simulation of IEEE 802.16e Physical Layer
Ew31992997
Scalable ofdma wp_mobile_wi_max_ic_stelecom
Wi MAX Deinter leaver’s Address Generation Unit through FPGA Implementation
Broadband Wireless 802.16
WiMAX_Intro
Wifi Vs Wimax By Dr Walter Green
BER PERFORMANCE ANALYSIS FOR WIMAX PHY LAYER UNDER DIFFERENT CHANNEL CONDITIONS
BER PERFORMANCE ANALYSIS FOR WIMAX PHY LAYER UNDER DIFFERENT CHANNEL CONDITIONS
WiMAX (IEEE 802.16)
Wi max basic sl_v2_sergio_cruzes
Fundamentals of wi max
Fundamentals of WiMAX: A Technology Primer
Survey on mobile wimax
High frequency of low noise amplifier architecture for WiMAX application: A r...
Ofdma
Bit error rate analysis of wimax physical layer under sui and awgn channel mo...

Documentation

  • 2. AcknowledgementAcknowledgementAcknowledgementAcknowledgement First of all we thank ALLAH for supporting us. Special thanks to Prof. Magdi Fekry for being so helpful with us. We are grateful to Eng. Mohammed Ismail for providing us with the WiMAX standard as well as helping us throughout our project. Special thanks to Nahdet El Mahrousa organization.
  • 3. Karim Mohamed Hassan Name com.gmail@elbehaidyE-MAIL 02-5563981 Phone 0105785825Mobile Mahmod Abdelaziz AbdelmonemName mahmoudabdelaziz@gmail.com E-MAIL 02-7540420Phone 0105538047Mobile Mostafa Ibrahim MohamedName .gmail@m2mostafaiE-MAIL -345074102Phone 0126777583Mobile Mina Michael AwadName com.hotmail@2000_michael_minaE-MAIL -409049202Phone 0122212650 Mobile Team members
  • 4. :Preface The explosive growth of the Internet over the last decade has lead to an increasing demand for high-speed Internet access. Broadband wireless access (BWA) is increasingly gaining popularity as an alternative technology to DSL lines and cable modems. Following the hugely successful global deployment of the 802.11 wireless local area network (LAN) standard, deployment of the IEEE 802.16d wireless metropolitan area network (MAN) standard is currently in progress. This technology aims to provide fixed broadband wireless access to residential and small business applications, as well as enable Internet access in countries without any existing wired infrastructure in place. Standardization efforts are also underway for the 802.16e version that attempts to provide mobility to the end user in a MAN environment. The WiMAX Forum (Worldwide Interoperability for Microwave Access) is an industry-led, non-profit corporation formed to promote and certify compatibility and interoperability of broadband wireless products. The organization is a non-profit association formed in 2003 by equipment and component suppliers to promote the adoption of IEEE 802.16 compliant equipment by operators of broadband wireless access systems. Software radio systems are potentially the next main improvement in mobile and wireless communications. The software radio techniques in handset design are facilitated thanks to technology evolution. The capability of such systems to support re-configuration in response to operator requirements is essential if the true potential of mobile communications has to be perceived. Moreover, customer expectations for new applications can be economically fulfilled by terminal and service reconfiguration. Our project implements the 802.16 physical standard using software; this gives a lot of flexibility and upgradeability for the system. The next title explains why we chose 802.16 (WiMAX) as our project. Why we chose WiMAX as our project: The idea of our project came from the importance of wireless communications in the recent few years, but wireless communications have many limitations due to the problems in propagation like fading and attenuation, WiMAX is based on OFDM which is a new modulation technique that can overcome many of the problems in wireless communications as well as providing high data rates which is the most interesting part that this new standard provides, also it provides a wide coverage area. People now are looking forward to having wireless access (Mobile communications, Internet, video conference,…) with high data rates, for that reason WiMAX is expected to be the dominant wireless communication system in Egypt in the next decade, and our project hopefully should be a successful first step towards the complete implementation of the whole Wimax standard , therefore we can have a final product that can compete the other markets in the future in one of the communication systems that are still under research.
  • 5. What we have made in our project: :ve'ject weIn our pro - Implemented the baseband physical layer of WiMAX on the above DSP kit (C6416 DSK) using C++ code where both the transmitter and the receiver are implemented on the kit. - Simulated the effect of the channel using MATLAB on the PC including: 1- Fading 2- Noise 3- Propagation loss 4- Frequency and phase offset The data is first generated on the PC and then transmitted to the kit which performs the transmission processing, after that the data goes back to the PC to take the channel effects sending it back to the kit to perform the reception receiving processing, finally the data goes back to the PC and compared with the transmitted data to get BER results. This documentation is organized as follows: Chapter 1 gives an overview of WiMAX and why it's used as well as its network structure and future Chapter 2 shows how WiMAX is suited for NLOS propagation including a brief explanation of OFDM system as well as other features of WiMAX physical standard Chapter 3 THIS CHAPTER IS THE CORE OF OUR PROJECT, it shows how we designed our system including the software design of the system blocks, it also discusses the link budget calculations for the proposed system Chapter 4 includes the simulations of the different blocks of the system on MATLAB as well as the simulation results, it also describes the testing phase of our project Chapter 5 explains our platform which is C6416DSK showing how we dealt with its peripherals and how we solved the problems associated with them like TCP and EDMA Chapter 6 shows the future work that could be made by our younger colleagues in the next years as a step towards the complete implementation of the WiMAX standard 010001001000 01100011……
  • 6. 1 CONTENTS Contents....................................................................................................................1 1. WiMAX……………………….……………………………………..………...…5 1.1 Introduction………………………………………………..………………...…5 1.2 What is WiMAX? ......................................................................................5 1.3 Why WiMAX? …………………………………………….……………….......6 1.3.1 WiMAX can offer very high data rates and extended coverage..6 1.3.2 WiMAX, more flexibility and security………………………………6 1.3.3 WiMAX, a very efficient radio solution………………………….…7 1.3.4 The WiMAX standard is beneficial to every link in the broadband wireless chain………………………………………………………………7 1.4 WiMAX Network requirements and architecture………………..………..…8 1.4.1 Network requirements………………………………………………8 1.4.2 END-TO-END ARCHITECTURE EVOLUTION…………….……9 1.4.3 NETWORK ARCHITECTURE……………………………….……10 1.4.3.1 Radio Network Serving Node (RNSN) ……..……10 1.4.3.2 Access Point (AP) ………………………….…………10 1.4.3.3 Subscriber Station (SS)…………………………………11 1.5 The WiMAX (802.16) MAC and PHY layers………..………………………11 1.5.1 MAC layer……………………………………..…………………….11 1.5.2 PHY layer……………………………………………………………11 1.6 WiMAX Future ………………………………………………………………12 2. NLOS propagation…………………………………………………………14 2.1 Introduction………………………………………….…………………………14 2.2 NLOS vs. LOS propagation………………………….………………………14 2.3 WiMAX Solutions for NLOS propagation ………………..…………………16 2.3.1 OFDM technology………………………………….………………16 2.3.2 Sub Channelization………………………………………………..17 2.3.3 Adaptive antenna systems………………………….…………….18 2.3.4 Transmit and Receive Diversity…………………………………..18 2.3.5 Adaptive modulation………………………………………….……19 2.3.6 Error Correction Techniques………………………………….…..19 2.3.7 Power Control………………………………………………..……..19 2.4 overview of 802.16 PHY layer……………………………………………….20 3. System design…………………………………………………..………….24 3.1 An introduction to software defined radio ………….……….……….24 3.2 The procedure of our project ……………………………………………26 3.3 Designing an OFDM system for our application……...……………………28 3.4 Software design of the system blocks…………………..…………………..29 3.4.1 The transmitter…………………………………...…………………29 3.4.1.1 Randomizer ………………………….……………….29 3.4.1.2 Convolutional turbo encoding ……………………..30 3.4.1.3 Interleaver …………………………………………….30 3.4.1.4 Mapper ……………………………………………….31 3.4.1.5 Inserting pilots…………………………..……………….32 3.4.1.6 Inverse Fast Fourier Transform (IFFT)…..……………33 3.4.1.7 Adding guard band…………………………..………….33 3.4.1.8 Transmission frame……………………….…………….34 3.4.2 The receiver……………………………………………..………….36 3.4.2.1 Packet detection and symbol timing………..…………36 3.4.2.2 Removing guard band………………………..…………41
  • 7. 2 3.4.2.3 Frequency offset estimation & frequency synchronization……………………………………………...……………41 3.4.2.4 FFT…………………………………………...…..………43 3.4.2.5 Channel estimation…………………………...…...……44 3.4.2.6 Removing pilots and padding………………...…..……44 3.4.2.7 De mapper………………………………………….……44 3.4.2.8- De interleaver………………………………………......44 3.4.2.9 Turbo decoding...........................................................45 3.4.2.10 De randomizer……………………………………….…45 3.5 Link budget analysis and channel simulation………………………………46 3.5.1 Link budget analysis……………………………………………….46 3.5.2 Channel simulation…………………………………………………47 3.6 future work …………………………………………………………….………48 4. Simulation&Testing……………………………………………………….....50 4.1 System simulation………………………………...………………………..…50 4.1.1 The effect of the interleaver……………..……………………..…50 4.1.2 The effect of the pilots…………………………………………..…52 4.1.3 Simulation of the packet detection algorithm………...............…52 4.2 System testing……………………………………………………………....…53 4.2.1 Testing the frequency synchronization algorithm………….……53 4.2.2 Testing of the turbo encoder………………………………………54 5. Platform……………………………………………………………...………57 5.1 Why we choose C6000 As our Platform……………………………………57 5.1.1 Advantages of designing with DSPs over other microprocessors……………………………………………………………..…….57 5.1.2Features of the C6000 devices include……………………..……57 5.2 Code Composer Studio………………………………………………………57 5.2.1 Creating a System Configuration…………………………………57 5.2.1.1 Project Management and Editing Tools………………58 5.3 Code Composer Studio Debug Tools………………………………………58 5.3.1Watch Window………………………………………………………58 5.3.2 Displaying Graphs……………………………………….…………58 5.4 Peripherals used in our project………………………………………………58 5.4.1 Enhancement Direct Memory Access (EDMA)……….…………58 5.4.1.1 EDMA configuration…………………………..…………60 5.4.1.2 EDMA problems we faced………………………...……60 5.4.2 JTAG (RTDX)……………………………………………….………60 5.4.2.1 What is JTAG? ………………………………….………60 5.4.2.2The role of RTDX in our project…………………..…….61 5.4.2.3 RTDX problems we faced during the project ..……61 5.4.3 TURBO CO-PROCESSOR (TCP) …………………………..61 5.4.3.1 Introduction ……………………………………………61 5.4.3.2 How to program TCP……………………………………62 5.4.3.2.1 TCP Configuration……………………………62 5.4.3.2.2 EDMA Configuration ……………………62
  • 8. 3 6. Codes………………………………………………………………………….…67 6.1 Transmitter………………………………….………………………………….67 6.1.1 The randomizer …………………..……………………………..67 6.1.2 the Interleaver ………………………………………………67 6.1.3 FFT ……………………….…………………………………………67 6.1.4 twiddle …………………………...………………………………….68 6.1.5 IFFT………………………………...………………………………..69 6.1.6 Mapper………………………………..……………………………..69 6.1.7 Framing and pilot insertion ……..……………………………69 6.1.8 converting from float to complex …………………………..71 6.1.9 preamble generation …………………………………………71 6.1.10 adding guard band …………………………………………….76 6.1.11 Turbo encoder ………………………………………………77 6.2 Receiver …………………………………………………………………….79 6.2.1 derandomizer ……………………………………………………..79 6.2.2 De-interleaver………………………………………………………79 6.2.3 FFT ……………………………………………………………..80 6.2.4 Twiddle ………………………………………………………….80 6.2.5 De-mapper ………………………………………………………..80 6.2.6 remove pilots and padding ………………………………….81 6.2.7 converting from complex to float ……………………………82 6.2.8 Packet detection ………………………………………………..82 6.2.9 calculating variance ………………………………………………83 6.2.10 channel estimation ……………………………………………83 6.2.11 Frequncy synchronization ……………………………………86 6.2.12 frequncy correction ……………………………………………86 6.2.13 Remove Guard band …………………………………………….87 7. Conclusion …………………………………………………………………….88 APPENDIX A Turbo Encoder & Decoder…………..………………………………….I APPENDIX B Turbo encoder testing code……………………………………………VII APPENDIX C Matlab simulation code …………………………………………………IX APPENDIX D List of Figures……………………………………………………………XIV APPENDIX E List of Tables……………………………..………………………………XV APPENDIX F Abbreviations and Acronyms…………..………………………………XV APPENDIX G Application notes & references…………..…………….......................XVI
  • 9. 4 Introduction What is WiMAX? Why WiMAX? WiMAX Network requirements and ARCHITECTURE The WiMAX (802.16) MAC and PHY layers WiMAX Future
  • 10. 5 1. WiMAX 1.1. Introduction Broadband Wireless Access (BWA) has been serving enterprises and operators for years, to the great satisfaction of its users. However, the new IP-based standard developed by the IEEE 802.16 is likely to accelerate adoption of the technology. It will expand the scope of usage thanks to: 1_the possibility of operating in licensed and unlicensed frequency bands, 2_unique performance under Non-Line-of-Sight (NLOS) conditions, 3_ Quality of Service (QoS) awareness, 4_extension to nomadicity, and more. In parallel, the WiMAX forum, backed by industry leaders, will encourage the widespread adoption of broadband wireless access by establishing a brand for the technology and pushing interoperability between products. In this chapter we'll deal with the following topics: 1- What is WiMAX and why we chose it. 2- WiMAX network requirements and architecture. 3- The future of WiMAX. 1.2. What is WiMAX? Worldwide Interoperability for Microwave Access (WiMAX) is the common name associated to the IEEE 802.16a/REVd/e standards. These standards are issued by the IEEE 802.16 subgroup that originally covered the Wireless Local Loop (WLL) technologies with radio spectrum from 10 to 66 GHz. Recently, these specifications were extended below 10 GHz. • In January 2003, the IEEE approved 802.16a as an amendment to IEEE 802.16- 2001, defining (Near) Line-Of- Sight capability • In July 2004, IEEE 802.16REVd, published under the name IEEE 802.16-2004, introduces support for indoor CPE (NLOS) through additional radio capabilities such as antenna beam forming and OFDM sub-channeling. • In 2005, an IEEE 802.16e introduced support for mobility. The WiMAX Forum intends to do for 802.16 what the Wi-Fi Alliance did for 802.11: • Harmonize standards and certify interoperability between equipment from different vendors. Standardized interoperable solutions will result in mass volume and bring down costs, • Promote and establish a brand for the technology.
  • 11. 6 Figure 1.1 WiMAX standards comparison 1.3. Why WiMAX? 1.3.1 WiMAX can offer very high data rates and extended coverage However, •75 Mbit/s capacity for the base station is achievable with a 20 MHz channel in best propagation conditions. But regulators will often allow only smaller channels (10 MHz or less) reducing the maximum bandwidth. • Even though 50 km is achievable under optimal conditions and with a reduced data rate (a few Mbit/s), the typical coverage will be around 5 km with indoor CPE (NLOS) and around 15 km with a CPE connected to an external antenna (LOS). 1.3.2 WiMAX, more flexibility and security Unlike WLAN, WiMAX provides a media access control (MAC) layer that uses a grant-request mechanism to authorize the exchange of data. This feature allows better exploitation of the radio resources, in particular with smart antennas, and independent management of the traffic of every user. This simplifies the support of real-time and voice applications. One of the inhibitors to widespread deployment of WLAN was the poor security feature of the first releases. WiMAX proposes the full range of security features to ensure secured data exchange: • Terminal authentication by exchanging certificates to prevent rogue devices, • User authentication using the Extensible Authentication Protocol (EAP), • Data encryption using the Data Encryption Standard (DES) or Advanced Encryption Standard (AES), both much more robust than the Wireless Equivalent Privacy (WEP)
  • 12. 7 initially used by WLAN. Furthermore, each service is encrypted with its own security association and private keys. 1.3.3 WiMAX, a very efficient radio solution WiMAX must be able to provide a reliable service over long distances to customers using indoor terminals or PC cards (like today's WLAN cards). These requirements, with limited transmit power to comply with health requirements, will limit the link budget. Subchanneling in uplink and smart antennas at the base station has to overcome these constraints. The WiMAX system relies on a new radio physical (PHY) layer and appropriate MAC layer to support all demands driven by the target applications. The PHY layer modulation is based on OFDM, in combination with a centralized MAC layer for optimized resource allocation and support of QoS for different types of services (VoIP, real-time and non real-time services, and best effort). The OFDM PHY layer is well adapted to the NLOS propagation environment in the 2 - 11 GHz frequency range. It is inherently robust when it comes to handling the significant delay spread caused by the typical NLOS reflections. Together with adaptive modulation, which is applied to each subscriber individually according to the radio channel capability, OFDM can provide a high spectral efficiency. WiMAX provides flexibility in terms of channelization, carrier frequency, and duplex mode (TDD and FDD) to meet a variety of requirements for available spectrum resources and targeted services. An important and very challenging function of the WiMAX system is the support of various advanced antenna techniques, which are essential to provide high spectral efficiency, capacity, system performance, and reliability: • Beam forming using smart antennas provides additional gain to bridge long distances or to increase indoor coverage; it reduces inter-cell interference and improves frequency reuse, • transmit diversity and MIMO techniques using multiple antennas take advantage of multipath reflections to improve reliability and capacity. 1.3.4 The WiMAX standard is beneficial to every link in the broadband wireless chain: Operators: - Wireless systems significantly reduce operator investment risk - Common Platform drives down costs, fosters healthy competition and encourages innovation -No more commitments to a single vendor Consumers: - Receive services in areas that were previously out of the broadband loop - More players in the market translate into more choices for receiving broadband access services - Quick “trickle down” effect of cost savings to consumers, translating into lower monthly rates
  • 13. 8 Component Makers: - Standardization creates a volume opportunity for chip set vendors/silicon suppliers Equipment Vendors: - Concentrate on specialization (i.e. Base Stations or CPEs) - no longer need to create an entire end-to-end solution as in proprietary model - Standards-based, common platform fosters rapid innovation and the addition of new components and services 1.4 WiMAX Network requirements and ARCHITECTURE 1.4.1 Network requirements: The architecture framework is based on the following requirements: • Applicability: The architecture shall be applicable to licensed and license-exempt 802.16 deployments. • Service Provider Categories: The architecture, especially the RAN, shall be suitable for adoption by all incumbent operator types. •Harmonization/Interworking: The architecture shall lend itself to integration with an existing IP operator core network (e.g., DSL, cable, or 3G) via interfaces that are IP- based and not operator-domain specific. This permits reuse of mobile client software across operator domains. •Provisioning and Management: The architecture shall accommodate a variety of online and offline client provisioning, enrollment, and management schemes based on open, broadly deployable Industry standards. •IP Connectivity: The architecture shall support a mix of IPv4 and IPv6 network interconnects and communication endpoints and a variety of standard IP context management schemes. •IP Services: The architecture shall support a broad range of TCP and UDP real- time and non-real-time applications. •Security: The architecture shall support Subscriber Station (SS) authorization, strong bilateral user authentication based on a variety of authentication mechanisms such as username/password, X.509 certificates, Subscriber Identity Module (SIM), Universal SIM (USIM), Removable User Identity Module (RUIM), and provide services such as data integrity, data replay protection, data confidentiality, and non- repudiation using the maximum key lengths permissible under global export regulations. •Mobility Management: The architecture shall scale from fixed access to fully mobile operation scenarios with scalable infrastructure evolution, eventually supporting low latency (< 100 msec) and virtually zero packet loss handovers at mobility speeds of 120 km/hr or higher.
  • 14. 9 1.4.2 END-TO-END ARCHITECTURE EVOLUTION Figure1.2 conceptually shows the architecture evolution for 802.16. A basic 802.16- 2004-based fixed access (indoor and outdoor) deployment is typically accomplished via a static provisioning relationship between an SS and an 802.16 AP. The collection of APs and interconnecting routers or switches included in the RAN can be logically viewed as a contiguous cloud with no inter-AP mobility requirements from a SS point of view. The RAN(s) interconnect via a logically centralized operator IP core network to one or more external networks as shown. The operator IP core may host services such as IP address management, Domain Name Service (DNS), media switching between IP packet-switched data and Public Switched Telephony Network (PSTN) circuit- switched data, 2.5G/3G/Wi-Fi harmonization and interworking, and VPN services. Going from Fixed access to Portability with Simple Mobility involving the use of Mobile SSs (MSS) such as laptops and Personal Device Assistants (PDA) introduces network infrastructure changes such as the need to support break-before-make micro- and macro-mobility handovers across APs with relaxed handover packet loss and latency (less than two seconds), cross-operator roaming, and the need to support reuse of user and MSS authorization credentials across logically partitioned RAN clouds. Going from Portability to Full Mobility requires support in the RAN for low (~zero) packet loss and low latency (<100 msec) make-before-break handovers and mechanisms such as Idle mode with paging for extended low-power operation. An important design consideration is QoS. Fixed Access and Portable usage models need only support acceptable QoS guarantees for stationary usage scenarios. Portability introduces the requirement to transfer the Service Level Agreement (SLA) across APs involved in a handover, although QoS may be relaxed during handovers. Full Mobility requires consistent QoS in all operating modes, including handovers. The 802.16 RAN will need to deliver Bandwidth and/or QoS on Demand as needed to support diverse real-time and non-real-time services over the 802.16 RAN. Besides the traditional Best Effort forwarding, the RAN will need to handle latency intolerant traffic generated by applications such as VoIP and interactive games. The decoupling of the RAN from an operator IP core network permits incremental migration to fully mobile operation. An operator must however give due consideration to the RAN topology (such as coverage overlap, user capacity, and range) to ensure that the physical network is future-proof for such an evolution. Figure 1.2 END-TO-END Architecture Evolutions
  • 15. 10 1.4.3 NETWORK ARCHITECTURE Figure1.3 shows an end-to-end reference architecture for 802.16. The network mainly can be divided into three major functional aggregations: the 802.16 SS/MSS, the 802.16 RAN, and interconnect to various operators IP core and application provider networks. The IP core network a) Manages the resources of the 802.16 RAN, b) Provides core network services such as address management, authentication, service authorization, and provisioning for 802.16 Figure 1.3 802.16 Reference Architecture The reference architecture, especially interconnectivity in the RAN and interconnects to remote IP networks, is based on extensive use of native IP suite of protocols. In the sections below, we describe three logical entities: the Radio Network Serving Node (RNSN), AP, and SS/MSS. 1.4.3.1 Radio Network Serving Node (RNSN) A Radio Network Service Node (RNSN) is a logical network entity that interfaces the RAN with the operator IP core network, Application Service Provider (ASP) networks, and other service networks such as IP Multimedia Subsystems (IMS), remote Enterprise Intranets, PSTN, and the Internet. 1.4.3.2 Access Point (AP): An 802.16 Access Point (referred to in the 802.16 standard as a base station) is a logical entity that provides the necessary air interface functions including SS/MSS admission control and UL/DL scheduling.
  • 16. 11 1.4.3.3 Subscriber Station (SS): An 802.16 SS is the end point of the network it may be one of the following: 1- The end user himself 2- A connection point that connects a group of users to the network AP. 1.5 The WiMAX (802.16) MAC and PHY layers 1.5.1 MAC layer: The MAC layer is composed of 3 layers:- a-Convergence sub layer provides any transformation or mapping of external network data received through the CS service access point b-MAC common part sub layer this includes classifying external network service data units (SDUs)and associating them to the proper MAC service flow identifier (SFID) which identifies the scheduling and the QOS parameters and connection identifier (CID) which identifies the connection between the AP and SS, it may also include such functions as payload header suppression (PHS) c-Security sub layer that provides authentication of network access and connection establishment to avoid theft of service, and it provides key exchange and encryption for data privacy. 1.5.2 PHY layer: (discussed later in section 2.3) Fig1.4 shows the MAC and PHY layers Figure 1.4 IEEE STD 802.16 Protocol layering
  • 17. 12 :WiMAX Future.61 The future of WiMAX is the new generaton of the 802.16 standard which is the 802.16e standard which depends basically on the orthogonal frequency multiple accesses (OFDMA) and that’s due to: OFDMA is a much more flexible and powerful way to achieve multiple-access with an OFDM modem. In OFDMA, the multiple-access is not only accommodated in the time domain, but also in the frequency domain, just like traditional FDMA, minus the guard-band overhead. As a result, an OFDMA system can support more users with minimum delay. The finer data rate granularity in OFDMA, as illustrated in Figure 1.5, is paramount to rich media applications with diverse QoS requirements. In additional, OFDMA has about an 18dB uplink budget advantage over OFDM-TDMA. Most importantly, OFDMA enables the exploitation of “multi-user diversity” that dramatically increases the spectral efficiency of a broadband wireless system. Figure 1.5 OFDMA vs. OFDM/TDMA
  • 18. 13 Introduction NLOS vs. LOS propagation WiMAX Solutions for NLOS propagation
  • 19. 14 2- NLOS propagation :Introduction.12 While many technologies currently available for fixed broadband wireless can only provide line of sight (LOS) coverage, the technology behind WiMAX has been optimized to provide excellent non line of sight (NLOS) coverage. WiMAX’s advanced technology provides the best of both worlds – large coverage distances of up to 50 km under LOS conditions and typical cell radii of up to 8 km under NLOS conditions. Here in this chapter we discuss the following topics: 1- NLOS vs LOS propagataion. 2- WiMAX Solutions for NLOS propagation. 3- Overview of 802.16 PHY standard. :propagationLOS.vsNLOS.22 The radio channel of a wireless communication system is often described as being either LOS or NLOS. In a LOS link, a signal travels over a direct and unobstructed path from the transmitter to the receiver. A LOS link requires that most of the first Fresnel zone is free of any obstruction, see Figure2.1.If this criteria is not met then there is a significant reduction in signal strength. The Fresnel clearance required depends on the operating frequency and the distance between the transmitter and receiver locations. Figure 2.1 Fresnel zone clearance In a NLOS link, a signal reaches the receiver through reflections, scattering, and diffractions. The signals arriving at the receiver consists of components from the direct path, multiple reflected paths, scattered energy, and diffracted propagation
  • 20. 15 paths. These signals have different delay spreads, attenuation, polarizations, and stability relative to the direct path. Figure 2.2 NLOS vs. LOS The multi path phenomena can also cause the polarization of the signal to be changed. Thus using polarization as a means of frequency re-use, as is normally done in LOS deployments can be problematic in NLOS applications. How a radio system uses these multi path signals to an advantage is the key to providing service in NLOS conditions. A product that merely increases power to penetrate obstructions (sometimes called “near line of sight”) is not NLOS technology because this approach still relies on a strong direct path without using energy present in the indirect signals. Both LOS and NLOS coverage conditions are governed by the propagation characteristics of their environment, path loss, and radio link budget. There are several advantages that make NLOS deployments desirable. For instance, strict planning requirements and antenna height restrictions often do not allow the antenna to be positioned for LOS. For large-scale contiguous cellular deployments, where frequency re-use is critical, lowering the antenna is advantageous to reduce the co channel interference between adjacent cell sites. This often forces the base stations to operate in NLOS conditions. LOS systems cannot reduce antenna heights because doing so would impact the required direct view path from the CPE to the Base Station. NLOS technology also reduces installation expenses by making under- the-eaves CPE installation a reality and easing the difficulty of locating adequate CPE mounting locations. The technology also reduces the need for pre installation site surveys and improves the accuracy of NLOS planning tools.
  • 21. 16 Figure 2.3 Effect of CPE location The NLOS technology and the enhanced features in WiMAX make it possible to use indoor customer premise equipment (CPE). This has two main challenges; firstly overcoming the building penetration losses and secondly, covering reasonable distances with the lower transmit powers and antenna gains that are usually associated with indoor CPEs. WiMAX makes this possible, and the NLOS coverage can be further improved by leveraging some of WiMAX’s optional capabilities. This is elaborated more in section 2.2. 2.3 WiMAX Solutions for NLOS propagation: WiMAX technology solves or mitigates the problems resulting from NLOS conditions by using: • OFDM technology. • Sub-Channelization. • Directional antennas. • Transmit and receive diversity. • Adaptive modulation. • Error correction techniques. • Power control. :FDM technologyO.1.32 Orthogonal frequency division multiplexing (OFDM) technology provides operators with an efficient means to overcome the challenges of NLOS propagation. The WiMAX OFDM waveform offers the advantage of being able to operate with the larger delay spread of the NLOS environment. By virtue of the OFDM symbol time and use of a cyclic prefix, the OFDM waveform eliminates the inter-symbol interference (ISI) problems and the complexities of adaptive equalization. Because the OFDM waveform is composed of multiple narrowband orthogonal carriers, selective fading is localized to a subset of carriers that are relatively easy to equalize. An example is shown below as a comparison between an OFDM signal and a single carrier signal, with the information being sent in parallel for OFDM and in series for single carrier.
  • 22. 17 Figure 2.4 Multi carrier vs. Single carrier The ability to overcome delay spread, multi-path, and ISI in an efficient manner allows for higher data rate throughput. As an example it is easier to equalize the individual OFDM carriers than it is to equalize the broader single carrier signal. Figure 2.5 OFDM performance in frequency selective fading For all of these reasons recent international standards such as those set by IEEE 802.16 have established OFDM as the preferred technology of choice. 2.3.2 Sub Channelization Sub Channelization in the uplink is an option within WiMAX. Without sub channelization, regulatory restrictions and the need for cost effective CPEs, typically cause the link budget to be asymmetrical, this causes the system range to be up link limited. Sub channeling enables the link budget to be balanced such that the system
  • 23. 18 gains are similar for both the up and down links. Sub channeling concentrates the transmit power into fewer OFDM carriers; this is what increases the system gain that can either be used to extend the reach of the system, overcome the building penetration losses, and or reduce the power consumption of the CPE. The use of sub channeling is further expanded in orthogonal frequency division multiple access (OFDMA) to enable a more flexible use of resources that can support nomadic or mobile operation. Figure 2.6 The effect of sub-channelization 2.3.3 Adaptive antenna systems: Directional antennas increase the fade margin by adding more gain this increases the link availability. Delay spread is further reduced by directional antennas at both the Base Station and CP. The antenna pattern suppresses any multi-path signals that arrive in the sidelobes and backlobes. The effectiveness of these methods has been proven and demonstrated in successful deployments, in which the service operates under significant NLOS fading. Adaptive antenna systems (AAS) are an optional part of the 802.16 standard. These have beam forming properties that can steer their focus to a particular direction or directions. This means that while transmitting, the signal can be limited to the required direction of the receiver; like a spotlight. Conversely when receiving, the AAS can be made to focus only in the direction from where the desired signal is coming from. They also have the property of suppressing cochannel interference from other locations. AASs are considered to be future developments that could eventually improve the spectrum re-use and capacity of a WiMAX network. 2.3.4 Transmit and Receive Diversity: Diversity schemes are used to take advantage of multi-path and reflectioned signals that occur in NLOS conditions. Diversity is an optional feature in WiMAX. The diversity algorithms offered by WiMAX in both the transmitter and receiver increase the system availability. The WiMAX transmit diversity option uses space time coding to provide transmit source independence; this reduces the fade margin requirement and combats interference. For receive diversity, various combining techniques are exist to improve the availability of the system. For instance, maximum ratio combining (MRC) takes advantage of two separate receive chains to help overcome fading and reduce path loss. Diversity has proven to be an effective tool for coping with the challenges of NLOS propagation.
  • 24. 19 :Adaptive modulation.5.32 Adaptive modulation allows the WiMAX system to adjust the signal modulation scheme depending on the signal to noise ratio (SNR) condition of the radio link. When the radio link is high in quality, the highest modulation scheme is used, giving the system more capacity. During a signal fade, the WiMAX system can shift to a lower modulation scheme to maintain the connection quality and link stability. This feature allows the system to overcome time-selective fading. The key feature of adaptive modulation is that it increases the range that a higher modulation scheme can be used over, since the system can flex to the actual fading conditions, as opposed to having a fixed scheme that is budgeted for the worst case conditions. Figure 2.7 Relative cell radii for adaptive modulation 2.3.6 Error Correction Techniques Error correction techniques have been incorporated into WiMAX to reduce the system signal to noise ratio requirements. Strong Reed Solomon FEC, convolutional encoding, and interleaving algorithms are used to detect and correct errors to improve throughput. These robust error correction techniques help to recover errored frames that may have been lost due to frequency selective fading or burst errors. Automatic repeat request (ARQ) is used to correct errors that cannot be corrected by the FEC, by having the errored information resent. This significantly improves the bit error rate (BER) performance for a similar threshold level. 2.3.7 Power Control Power control algorithms are used to improve the overall performance of the system, it is implemented by the base station sending power control information to each of the CPEs to regulate the transmit power level so that the level received at the base station is at a pre-determined level. In a dynamical changing fading environment this pre-determined performance level means that the CPE only transmits enough power to meet this requirement. The converse would be that the CPE transmit level is based on worst-case conditions. The power control reduces the overall power consumption of the CPE and the potential interference with other co-located base stations. For LOS the transmit power of the CPE is approximately proportional to it’s distance from the base station, for NLOS it is also heavily dependant on the clearance and obstructions.
  • 25. 20 :PHY layer.16802Overview of.42 Physical layer is the last layer of the transmitter in the WiMAX system before the RF section and after the MAC layer and the first layer in the receiver after the RF section and before the MAC layer. The 802.16-2004 standards describe four different air interfaces (physical layer). One of these interfaces is optimized for non-line-of-sight, RF frequencies < 11 GHz, and distances up to 30 km. Although the standard has officially named this PHY layer as Wireless MAN-OFDM. The basic characteristics of the air interface are 256 carriers OFDM, bandwidths that range from 1.25 MHz to 20 MHz, and carrier frequencies up to 11 GHz. In the WiMAX air interface, the basic OFDM symbols are based on a 256 point FFT. As with other OFDM systems, a portion of these 256 subcarriers are set aside (unused) for guard bands and the center frequency Subcarrier is not used because it is easily susceptible to RF carrier feed through. In WiMAX, only 200 subcarriers are actually used. These 200 carriers are allocated as 192 carriers for data and 8 carriers as pilots. The pilot carriers are always BPSK modulated and the data carriers are BPSK, QPSK, 16 QAM, or 64 QAM. Figure 2.8 OFDM subcarriers The system can be configured to use any bandwidth from 1.25 MHz to 20 MHz and regardless of the bandwidth; the symbols always contain 200 carriers. For narrow bandwidth systems, this implies the subcarriers are very closely spaced, which provides a relatively long symbol period (symbol period is defined as 1 / subcarrier spacing). These closely spaced subcarriers and long symbols help overcome channel impairments such as multipath. This long symbol period is a key differentiator between WiMAX systems and wireless LAN systems (relatively short symbols), which provides WiMAX with significant advantages for long distances and non-line-of-sight applications. WiMAX systems can be deployed as TDD, FDD, or half-duplex FDD. Figure2.10 shows a typical frame in a TDD configuration where the basestation and subscriber equipment each transmit on the same RF frequency, separated in time. The basestation transmits a downlink subframe, followed by a short gap called transmit/receive transition gap (TTG), and then individual subscribers transmit the uplink subframes. The subscribers are accurately synchronized such that their transmissions do not overlap each other as they arrive at the basestation. Following all uplink subframes, another short gap called receive/transmit transition gap (RTG) is allocated before the basestation can again start transmitting. Figure 2.9 downlink and uplink subframes
  • 26. 21 Notice each uplink subframe is preceded by a preamble. This is called a “short preamble” and allows the basestation to synchronize on each individual subscriber. Looking closer at the downlink, a downlink subframe always begins with a preamble, followed by a header, and one or more downlink bursts of data. These downlink bursts are generally made up of multiple symbols within the burst. Within each burst, the modulation type is constant; however, from burst to burst the modulation type can change. Bursts using robust modulation types such as BPSK and QPSK are required to be transmitted first, followed by less robust modulation types (16 and 64 QAM). Downlink subframes containing all four types of modulation would need to be in this order: BPSK followed by QPSK, 16 QAM, and finally 64 QAM. Every transmission on both the uplink and downlink always begins with a preamble. This preamble allows receivers to synchronize with the transmitter and is used for channel estimation. The downlink transmission begins with a long preamble.. These preamble symbols are transmitted with 3 dB more power than all other symbols in the downlink subframe, making them easier for the receivers to demodulate and decode correctly. A “short preamble” is used at the beginning of each uplink bursts. When using extremely long downlink bursts that contain many symbols, it may be desirable to insert a midamble (short preamble) in between the downlink bursts. This short preamble helps receivers resynchronize and perform additional channel estimation. Following the preamble is a frame control header (FCH). This FCH is implemented as a single symbol of BPSK modulation. This symbol contains 88 bits of overheard data that describes critical system information such as base station ID and the downlink burst profile that receivers need to decode the subframe. The FCH does not contain enough information to fully describe the network or downlink profile, but it does contain enough that receivers can start decoding the downlink bursts. The downlink bursts contain user data as well as control messages. The downlink bursts each contain one or more symbols. Each symbol in the burst contains between 12 and 108 bytes of payload data, depending on the modulation type and coding gain. Table …. shows the seven different combinations of modulation type and coding gain. For each of these combinations a specific amount of payload data is required for each symbol. Table 1 Modulation and coding combinations When necessary, padding adds bits so that the payload data is in correct block sizes that will map into an integer number of symbols. The Randomizer XOR’s the data with a pseudo random bit sequence to toggle some of the 1’s to 0’s and some 0’s to 1’s. This randomizer eliminates long strings of 1’s or 0’s in the payload data. A single tail byte is added and the bits are ready for turbo coding. These coding steps provide forward error correction and are very common coding methods used in digital
  • 27. 22 communication systems. This coding adds redundant data that helps identify and fix bits that are missing or corrupted. The final steps in coding involve interleaving, which is performed in two steps. After coding FFT is done to the bits then adding guard band to the frame then ending it. And the reverse of this operation is done to the frame in the receiver. To simplify transmitter and receiver designs, all symbols in the FCH and DL data bursts are transmitted with equal power. Because symbols use four different modulation types (BPSK, QPSK, etc.), it is necessary to scale each such that the average symbol power from each symbol is approximately equal.
  • 28. 23 An introduction to software defined radio The procedure of our project Designing an OFDM system for our application Software design of the system blocks Link budget analysis and channel simulation Future work
  • 29. 24 3- System design 3.1 An introduction to software defined radio: The challenge of modern wireless communications like WiMAX has considerably pushed the research towards the Software Radio. The presence of various standards for wireless communications and the great difference of services offered by mobile communication providers have led to the planning of a universal connection, that adapts itself to different requirements. The software radio terminals must be auto re-configurable, in order to match the different telecommunication standards. Software Radio (SWR) defines a radio system which has an operating range, bandwidth, level of power, type of modulation, channel coding and so on, all of them configurable by software without changing the hardware. The main rewards of a Software Radio terminal are: ♦ The marketing of a single product able to satisfy different customers through a software update. ♦ The support to the products can be simplified, and the hardware repair made easier. With the great variety of services that will be offered with 3G, the distribution will assume a remarkable role to interpret customer moods. ♦ For the customer, probably, it will be both a benediction and a curse: the strong dependence of the products from the software obliges the user to frequent updates, to always be able to utilize new services available from the provider. Figure3.1 shows the basic configuration of a software radio terminal Figure 3.1 basic configuration of a software radio terminal The Analog to Digital conversion (ADC) is moved as near as possible to the antenna, so to make filtering in digital processing. SWR arrangement capability to support different standards is mainly due to: ♦ The range of frequencies and bandwidth of the RF stage ♦ The greatest bandwidth assigned to a signal ♦ The sampling frequency of the ADCs ♦ The maximum dynamic range ♦ The computational capability of the digital processors (DSP in general). Software Radio Transceiver, in its widest meaning, defines a general TX/RX architecture that can be completely reconfigured, directly operating on an RF digitized information stream. Analog processing is limited at the RF front-end, where a pass-band image-rejection filter selects a large spectrum portion containing the desired services. After a LNA, an ADC converts the signal with the precision required
  • 30. 25 by the system specifications. The digital RF stream is then fed to a RF-BB physical layer DSP subsystem that: ♦ Centers the received signal spectrum to the band of services of interest ♦ Lowers the sampling frequency of the digital stream down to the minimum rate required by the standard specifications ♦ Operates the necessary filtering in order to reject the unwanted adjacent signals ♦ Demodulates, channel- and source-decodes the symbol flow and supplies the information bit-stream, for subsequent processing, to higher layers hardware and software In the following we propose a re-configurable platform able to implement the different standards, with currently available technology. In figure3.2 it is shown a block diagram of a possible complete transceiver that uses a DSP based hardware for the implementation of the different baseband and IF stage systems. Nowadays, the technology does not allow having a digital RF stage (Digital Front- End), so the SWR transceiver uses different analog RF stages, one for each considered standard. If a SWR approach is followed, the implementation of the different telecommunication standards can be reduced to the implementation and optimization of some basic processing blocks. Figure 3.2 DSP based hardware transceiver In WiMAX, flexibility is greatly required where SWR allows for the following: ♦ Easy upgrade from OFDM to OFDMA ♦ Software upgrade of the FFT size from 256 to 512 and 1024 ♦ The standard itself is up gradable to 802.16e ♦ Uplink subchannelization support ♦ Turbo coding support ♦ Support for adaptive modulation
  • 31. 26 In our project we're designing the BB physical layer of the system using software as we'll see in the rest of the chapter. The remaining portions of the system can be developed in the future work as we'll explain in chapter 6. 3.2 The procedure of our project: In this chapter we explain the steps through which we accomplished our project. We first divided ourselves into 2 groups: The 1st group had the following tasks in order: 1- Having an overview of the WiMAX system and understand its network structure in brief 2- Studying the 802.16 protocol on which WiMAX is based and concentrating on the physical layer, but sometimes we refer to the MAC layer to understand some points in the physical layer. 3- Proposing a model for our project to be implemented on our platform, this model has some assumptions which we put to let the implementation feasible. These assumptions shall be described for each block individually. The 2nd group had the following tasks in order: 1- Searching on the web for a suitable platform for our project, there were many like FPGA, DSP and ASIC. But finally they made a decision that DSP is the most suitable for us as we'll explain in chapter 5. 2- Selecting which DSP to work on and which one is more suitable for project 3- Studying the selected DSP kit which is C6416DSK and how to deal with its different peripherals as well how to program it 4- Interfacing the kit to the PC which was a very essential task in our project as we'll explain in the following section Then we come to the most critical part of our project where we integrate between the 2 groups such that the system is implemented on the selected platform but before coming to this step we shall first explain what we've actually made in our project.
  • 32. 27 In our project we've - Implemented the baseband downlink physical layer of WiMAX on the above DSP kit (C6416 DSK) using C++ code where both the transmitter and the receiver are implemented on the kit. - Simulated the effect of the channel using MATLAB on the PC including: 1- Fading 2- Noise 3- Propagation loss 4- Frequency and phase offset The data is first generated on the PC and then transmitted to the kit which performs the transmission processing, after that the data goes back to the PC to take the channel effects sending it back to the kit to perform receiving processing, finally the data goes back to the PC and compared with the transmitted data to get BER results. After this brief explanation of our project we shall explain the phases of integration of our project: Phase 1: Designing each block in the system individually using C++ code Phase 2: Testing each block individually as well as simulation on MATLAB, this part shall be explained in detail in the next chapter Phase 3: Integrating all the blocks together of both the transmitter and the receiver in an ideal channel with no noise, also the data transmitted is only 1 OFDM symbol. Phase 4: Adding preamble and more OFDM symbols to be transmitted in an ideal channel Phase 5: In this phase we start adding the channel effects, first we add noise only then we begin to add fading and phase delay and see how the performance becomes worse, then we add the channel estimation block and observe how it improved the performance. Phase 6: Here we test the packet detection algorithm and estimate the symbol timing as we'll explain in section 3.4.2.1 Phase 7: We begin to add frequency offset and see how it degrades the BER, and then we add the frequency synchronization function to see how it improves the BER. Now after explaining the phases of our project implementation we'll begin to explain the design issues that we were subject to in our project concerning the communication system: 1- Selecting the OFDM system parameters as well as the sampling time for our system. 2- The software design of the modules used in the transmitter and the receiver as well as the operation of each module and its benefit. 3- Link budget analysis and channel simulation on MATLAB. 010001001000 01100011…… Figure 3.3 System design
  • 33. 28 3.3 Designing an OFDM system for our application: WiMAX is a broadband wireless access communication system; this puts some constraints on the channel parameters like delay spread and other parameters as well. Since we are operating in a NLOS medium with coverage area within a few kilometers we can say that the delay spread is around 2 µseconds. So we'll choose the guard band Tg=4×delay spread=8µsec. Also we'll let the guard band equal to quarter the symbol duration, so The symbol duration Ts=5×Tg=40µsec And the subcarrier spacing=1/Ts=25 KHz And since the allocated bandwidth=5MHz So the number of subcarriers=bandwidth/subcarrier spacing= 200 subcarrier So the required FFT size=256 We'll take 192 subcarrier for the data and 8 for the pilots because we need the pilots for channel estimation and correction and actually 8 pilots are enough. Then in order to get the bit rate, we shall assume QPSK modulation so we've 2 bits/subcarrier I.e. we have 2×192 information bits / OFDM symbol So the bit rate Rb becomes: Rb=(2×192)/(Ts+Tg)=8Mbps If we use 16QAM modulation the bit rate will be 16Mbps. Finally we want to get the sampling time to be used while simulating the channel on MATLAB, We can simply get it by dividing Tg by the number of samples in the guard band which equal 64 samples (quarter the OFDM symbol) Tsample=8/64=125nsec So the parameters are: 2 µsecDelay spread 8 µsecGuard band duration 40 µsecSymbol duration 25 KHZSubcarrier spacing 5 MHZBandwidth 200Total # of subcarriers 192Data subcarriers 8Pilot subcarriers 256FFT size required 125 nsecSampling time Table 2 OFDM parameters
  • 34. 29 Convolutional turbo encoder Interleaver Mapper Adding guard band Pilot insertion IFFTRF Randomizer Data :Software design of the system blocks.43 As we've explained in the previous chapter, WiMAX physical layer is composed of many blocks, here in this chapter we introduce the blocks which we've implemented. First of all we've designed only the uplink as we've explained in the beginning of the chapter, also our project doesn't involve real time due to the delay on the PC to take the channel effects. :The transmitter.1.43 Its block diagram is as follows: Figure 3.4 Transmitter block diagram 3.4.1.1 Randomizer: Operation: It randomizes the bits input to it by modulo -2 addition of the data with the output of an LFSR with characteristic polynomial 1 +X14 +X15 . Figure 3.5 PRBS for data randomization Benefits: - It's considered a means of scrambling the data for more security. - Ensures more bit transitions to support clock recovery. INPUT: 184 bit of data. OUTPUT: 184 bit to the turbo encoder. Function prototype: void randomizer(char dinr[],char doutr[])//din input to, dout from randomizer
  • 35. 30 3.4.1.2 Convolutional turbo encoding: Operation: This block encodes the incoming data bits using a very efficient coding technique which is turbo coding. Before the data enters this block we add 1 byte of zero padding. For a detailed explanation of the turbo encoder look at appendix A Benefits: It makes a significant improvement in the BER for the same SNR, especially when it is used together with the interleaver. Also for the same BER it saves an amount of the transmitted power. Assumptions: Here we assumed coding rate=1/2. The other parameters shall be explained when we deal with the TCP peripheral associated with our platform in chapter5 INPUT: 184 bits (after zero padding) OUTPUT: 384 bits to the interleaver Function Prototype: void Turbo_encoder (char input[], char frame[]) //Frame is the decoded output 3.4.1.3 Interleaver: Operation: - After the encoder all the encoded bits shall be interleaved by a block interleaver with block size corresponding to number of coded bits per allocated subchannels per OFDM symbol Interleaving is done in two permutations according to two the functions: The first permutation is defined by the equation: mk=(Ncbps/12) ×Kmod12+floor(K/12) K=0,1,2,3,....,Ncbps1 (3.1) The second permutation is defined by the equation: j k=s×floor(mk/s)+(mk+Ncbps-floor(12×mk/Ncbps))mod(s) K=0,1,2,3,....,Ncbps-1 (3.2) Where: Ncpc= number of coded bits per subcarrier i.e. 1,2,4,6 for BPSK, QPSK, 16-QAM, 64- QAM S=ceil (Ncpc/2) Ncbps=number of bits at transmission per block. K=index of coded bits before 1st permutation. mk=index of coded bits after 1st permutation and before the second permutation jk=index of the coded bits after the second permutation and before the mapping.
  • 36. 31 Table 3 block sizes of the bit interleaver The first bit out of the interleaver shall map to the MSB in the constellation. Benefits: - The first step of interleaving is to rearrange the ordering of the bits to make certain that adjacent bits are not mapped onto adjacent carriers. This helps eliminate errors by reducing the chance that adjacent bits would be lost if a portion of the channel bandwidth is degraded with some type of spurious or band limited noise. - The second step of interleaving is to reorder the bits so that the original adjacent bits are alternately mapped into more or less reliable points on the IQ constellation. In complex modulation like 64 QAM, each IQ point represents multiple bits of data, and some of these bits are easier to detect (therefore, more reliable) than other bits. After interleaving, the coded bits are mapped to the IQ constellation, starting with carrier number –100 on up to carrier number +100. Assumptions: In our project we are working with QPSK modulation and in the default case of the interleaver which is 16 subchannels so finally the interleaver block size we used is 384. INPUT: 384 bit from encoder (QPSK, 16 subchannels) OUTPUT: 384 bit to the mapper (QPSK, 16 subchannels) Function Prototype: void interleave(char dini[],char douti[]) 3.4.1.4 Mapper: Operation: - The data out of the interleaver is entered serially to the constellation mapper, BPSK Gray-mapped QPSK, 16-QAM, 64-QAM shall be supported, where the support of 64-QAM is optional for license exempt band. The constellations shall be normalized by multiplying the constellation point by an indicated factor c to achieve equal average power. The constellation mapped data shall be subsequently modulated onto the allocated subcarriers in order of increasing the frequency index. The first mapped symbol of the mapper shall be modulated with allocated subcarrier with the lowest frequency offset index.
  • 37. 32 FIGURE 3.6 BPSK, QPSK, 16-QAM and 64-QAM constellations Benefits: Changing the modulation type (BPSK, QPSK, 16-QAM, 64-QAM) allow us to increase bit rate within the same symbol. Assumptions: In our project we used QPSK modulation. INPUT: 384 bit from interleaver (QPSK, 16 subchannels) OUTPUT: 192 symbol (QPSK modulation) Function Prototype: void mapper(char dinm[], float doutIm[],float doutQm[]) 3.4.1.5 Inserting pilots Operation: It adds pilots to the OFDM symbol at the locations specified in IEEE 802.16 standard. Benefits: It's used at the receiver for channel estimation as described in the channel estimation block. Assumptions: No assumptions. INPUT: 192 bits from the mapper OUTPUT: 200 bits
  • 38. 33 Function Prototype: void frame(float I[],float Q[],COMPLEX data_outf[])//data is the output, I and Q are the inputs before pilot insersion 3.4.1.6 Inverse Fast Fourier Transform (IFFT): Operation: It constructs the time domain OFDM symbol by calculating the 256 point inverse discrete Fourier transform but in a more efficient way which is called FFT. Refer to chapter 12 of 'The Scientist and Engineer's Guide to Digital Signal Processing' to have a better understand of the FFT and IFFT. When we call this function we first call the twiddle function that calculates the phases of the exponentials used in the FFT function. Then, because we want to make an IFFT function using FFT so we'll do the following: 1- Change the sign of the imaginary part of the input data 2- Get its FFT after calculating the twiddle factors 3- Change the sign of the imaginary part of the output data Note: Before entering the IFFT function we have to add zero padding to increase the input samples from 200 to 256 because the algorithm works better when the input samples is a power of 2. We add 28 zeros at the beginning of the symbol and 27 at the end so as not to add any frequency components this is why we don't put them all at the end of the symbol. Benefits: It is the simplest way to implement multicarrier modulation, and thanks to it OFDM became feasible. INPUT: 200 bits after pilot insertion+56 mapping OUTPUT: 256 symbols Function Prototype: void iFFT(COMPLEX input[], int n) // n is the IFFT size 3.4.1.7 Adding guard band Operation: It takes the last 64 symbols output from the IFFT block and puts them at the beginning of the symbol Benefits: - To account for the delay spread of the channel impulse response thus avoiding intercarrier interference. - To avoid ISI Assumptions: In the standard the guard band varies from 1/8 to 1/4 of the symbol duration, here we've assumed that the guard band is 1/4 the OFDM symbol which is 64 samples. INPUT: 256 symbols from the FFT
  • 39. 34 )(22 )()(644 kAllk PconjP ××=× OUTPUT: 320 symbols Function Prototype: void guardband(COMPLEX din[], COMPLEX dout[]) 3.4.1.8 Transmission frame: In this section we describe the frame structure which we proposed, it has some differences from the 802.16 protocol. The frame is composed of a group of OFDM symbols preceded by a preamble. The preamble structure is as follows: Each preamble consists of either one of 2 OFDM symbols .The OFDM symbols are defined by the values of the composing sub carrier. Each OFDM symbol contains a cyclic prefix, which length is the same as the cyclic prefix (CP) of the data. The first preamble is the downlink preamble. It consists of 2 consecutive OFDM symbols .The first OFDM symbol consists of sub carriers of indices which is multiple of 4. As a result the time domain wave form consists of four repetitions of 64 sample fragment preceded by a CP. the second OFDM symbol consists of even sub carriers. As a result the time domain waveform consists of two repetitions of 128 sample fragment preceded by a CP .The compilation of the two OFDM symbols is called long preamble. FIGURE 3.7 Downlink and network entry preamble structure The frequency domain sequence for all full band width preambles are derived from the sequence The frequency domain sequence of 4 times 64 is P4*64 is defined by: kmod4=0 (3.3) 0 kmod4≠0
  • 40. 35 )(2 kAlleven PP ×= In last equation the factor of 2 equates the root mean square power with that of data section. The additional 2 is related to the 3db boost. In the uplink the data preamble consists of one OFDM symbol which consists only of the even sub carriers .The time domain sequence consists of 2 times 128 samples preceded by a CP. The values of the sub carriers are set according to Peven. This Preamble is referred as short preamble. FIGURE 3.8 PEVEN time domain structure kmod2=0 (3.4) 0 kmod2≠0 In Peven 2 is related to the 3db boost. In our project we used the short preamble in the downlink instead of the long preamble, also we'll make use of the 2 repeated 128 data symbols in the double sliding window algorithm used in symbol timing as we'll explain in section 3.4.2.1 which gives us better performance. Also we've made another assumption which is: We didn't apply the adaptive modulation technique thus we didn't add the FCH header in the frame which is used to identify the burst profile (modulation + coding) as well as other functions.
  • 41. 36 3.4.2 The receiver: Its block diagram is s follows: The first stage of the receiver is packet detection and symbol timing; Synchronization is an essential task for any digital communication system. Without accurate synchronization algorithms, it is not possible to reliably receive the transmitted data. From the digital Base band algorithm design engineer's perspective, synchronization algorithms are the major design Problem that has to be solved to build a successful product. 3.4.2.1 Packet detection and symbol timing: A-Packet Detection Packet detection is the task of finding an approximate estimate of the start of the preamble of an incoming data packet. As such it is the first synchronization algorithm that is performed, so the rest of the synchronization process is dependent on good packet detection performance. Packet detection is made by comparing a certain decision variable mn with a threshold, if it's greater than the threshold then the packet is present, if not then the packet isn't present. The performance of the packet detection algorithm can be summarized with two probabilities: probability of detection PD and probability of false alarm PFA. PD is the probability of detecting a packet when it is truly present, thus high PD is a desirable quality for the test. PFA is the probability that the test incorrectly decides that a packet is present, when actually there is none, thus PFA should be as small as possible. In general, increasing PD increases PFA and decreasing PFA decreases PD, hence the algorithm designer must settle for some balanced compromise between the two conflicting goals. Generally it can be said that a false alarm is a less severe error than not detecting a packet at all. The reason is that after a false alarm, the receiver will try to synchronize to nonexistent packet and will detect its error at the first received data integrity check. On the other hand, not detecting a packet always results in lost data. A false alarm can also result in lost data, in case an actual data packet starts during the time the receiver has not yet detected its mistake. In this case, the receiver will not be able to Packet detection & symbol timing Channel estimation Turbo Decoder De-MapperDe-interleaver RF De-randomizer Data Removing guard band Frequency synchronization Pilot removal FFT Figure 3.9 Receiver block diagram
  • 42. 37 catch that packet. The probability of this occurring depends on several issues like the network load and the time it takes for the receiver to detect its mistake. In conclusion, a little higher PFA can be tolerated to guarantee good PD. In WiMAX the preamble is used for packet detection, it's composed of 1 symbol of 2 repeated portions which shall be useful here in packet detection as we shall see in the next section; also it will be useful for frequency synchronization which is explained in section 3.4.2.3 Double Sliding Window Packet Detection This algorithm makes use of the repeated preamble symbol; it calculates two consecutive sliding windows of the received energy. The basic principle is to form the decision variable mn as a ratio of the total energy contained inside the two windows. Figure 3.10 shows the windows A and B and the response of mn to a received packet. In Figure 3.10, the A and B windows are considered stationary relative to the packet that slides over them to the right. It can be seen that when only noise is received the response is flat, since both windows contain ideally the same amount of noise energy. When the packet edge starts to cover the A window, the energy in the A window gets higher until the point where A is totally contained inside the start of the packet. This point is the peak of the triangle shaped mn and the position of the packet in Figure 3.10 corresponds to this sample index n. After this point B window starts to also collect signal energy, and when it is also completely inside the received packet, the response of mn is flat again. Thus the response of mn can be thought of as a differentiator, in that its value is large when the input energy level changes rapidly. The packet detection is declared when mn crosses over the threshold value Th. Figure 3.10.The response of the double sliding window packet detection algorithm. The following equations shows the calculation of the A&B windows values (3.6)
  • 43. 38 Then the decision variable is formed by dividing the value of the an by bn (3.7) A simulated response of the variable mn is shown in Figure 3.11. The figure is a preamble with 10dB SNR. The figure clearly shows how the value of mn does not depend on the total received power. Figure 3.11Double sliding window packet detection. After the peak, the response levels off to the same value as before the peak, although the received energy level is much higher. An additional benefit of this approach is that, at the peak point of mn the value of an contains the sum of signal energy S and noise energy N and the bn value is equal to noise energy N, thus the value of mn at the peak point can be used to estimate the received SNR. The following equations are the ratio an and bn at the peak point and the SNR estimate calculated from the ratio.
  • 44. 39 (3.8) (3.9) :Symbol timing-B Symbol timing refers to the task of finding the precise moment of when individual OFDM symbols start and end. The symbol timing result defines the DFT window; i.e., the set of samples used to calculate DFT of each received OFDM symbol. The DFT result is then used to demodulate the subcarriers of the symbol. The approach to symbol timing is different for WiMAX and broadcast OFDM systems. A WiMAX receiver cannot afford to spend any time beyond the preamble to find the symbol timing, whereas a broadcast transmission receiver can spend several symbols to acquire an accurate symbol timing estimate. All what we have to do is just take the sample at which the decision variable reaches its maximum value, this sample represents the middle of the preamble symbol, so we just bypass 128 samples to be at the beginning of the next OFDM symbol. In the next part we discuss how to optimize the symbol timing in a multipath channel. Optimization of Symbol Timing in a Multipath Channel The performance of the symbol timing algorithm directly influences the effective multipath tolerance of an OFDM system. An OFDM receiver achieves maximum multipath tolerance when symbol timing is fixed to the first sample of an OFDM symbol. Figure 3.12 shows three consecutive OFDM symbols, their respective cyclic prefixes (CP), and the effect of symbol timing on the DFT window. The ideal timing for symbol 2 is shown as the ideal DFT window in Figure 3.12 (a). In this case the DFT window does not contain any samples from the CP; hence the maximum length of the channel impulse response (CIR) that does not cause intersymbol interference (ISI) is equal to the CP length. This is the maximum possible ISI free multipath length for an OFDM system. In practice, it is impossible to fix the symbol timing point perfectly to the first sample of the OFDM symbol. There will always be some variability in the symbol timing estimate around its mean value. In addition to the ideal symbol timing, Figure 3.12 shows the probability density function (PDF) of a realistic symbol timing estimate with the mean value equal to the ideal symbol timing. The PDF shows how the actual symbol timing estimate can be before or after the ideal value. The effect on the DFT window is shown as the DFT window range; that is, the range within which the DFT window will fall. When the symbol timing point is estimated before the ideal value, the start of the DFT window will contain samples from the CP and the last samples of the symbol are not used at all. This case does not cause serious problems, because the CP is equal to the last samples of the symbol so the circular convolution property of DFT is still satisfied. It is possible that some ISI is caused by the early symbol timing estimate, if the CIR is long enough to reach the first samples of the DFT window. For a properly designed OFDM system, the amount of this interference is negligible, because the last taps of the CIR are small. Next consider the case when the symbol timing estimate is after the ideal value. In this case, the start of the DFT window will be after the first sample of the symbol and the last samples are taken from the beginning of the CP of the next
  • 45. 40 symbol. For example, in Figure 3.12(a), this would mean that the DFT window for symbol 2 would contain samples from the CP 3. When this happens, significant ISI is created by the samples form CP of the next symbol. Additionally the circular convolution property required for the orthogonality of the subcarriers is no longer true, hence intercarrier interference is generated. The end result of a late symbol timing estimate is a significant performance loss. Fortunately, there is a simple solution for this problem. Since early symbol timing does not create significant problems, the mean value of the symbol timing point can be shifted inside the CP. This is shown in Figure 3.12(b). After the shift, the PDF of the symbol timing estimate is entirely contained inside the CP 2, hence the DFT range is also within CP 2 and symbol 2. This means that the circular convolution is preserved and no ISI is caused by the samples from CP 3. The optimal amount of the shift depends on the OFDM system parameters and the performance of the symbol timing algorithm. We shall take the shift equal to 4 samples as a design parameter as we already have 64 samples for the CP so it doesn't matter if we reduce them to be effectively 60 samples instead of 64. The drawback of the shift of the mean symbol timing point is reduced multipath tolerance of the OFDM system. The shift effectively shortens the CP by the amount of the shift, because some samples of the CP are always used for the DFT window. This means that a CIR shorter that the CP can cause ISI; however, as was mentioned earlier, the last taps of the CIR are quite small, so the effect on performance is not serious. Nevertheless the OFDM system designer should keep the symbol timing in mind and put some samples in to the CP in addition to the maximum expected CIR length. Figure 3.12 Effect of variance in symbol timing Function Prototype: int detection_of_packet(float reci,float recq,float[]) //reci&recq are the real and imaginary of the input sample, m is the vector containing the previous division values
  • 46. 41 3.4.2.2 Removing guard band: This block is just the reverse operation of the adding guard band block. Function Prototype: void removeguardband(COMPLEX din[],COMPLEX dout[]) 3.4.2.3 Frequency offset estimation & frequency synchronization: One of the main drawbacks of OFDM is its sensitivity to carrier frequency offset. The effect of carrier frequency error on SNR will be introduced in the next chapter when we discuss the simulation results. The degradation is caused by two main phenomena: reduction of amplitude of the desired subcarrier and ICI caused by neighboring carriers. The amplitude loss occurs because the desired subcarrier is no longer sampled at the peak of the sinc-function of DFT. Adjacent carriers cause interference, because they are not sampled at the zero-crossings of they sinc- functions. For relatively small frequency errors, the degradation in SNR in dB was approximated by: (3.10) where f∆ is the frequency error as a fraction of the subcarrier spacing and T is the sampling period. The performance effect varies strongly with the modulation used; naturally, constellations with fewer points can tolerate larger frequency errors than large constellations. Figure 3.13 illustrates the effect for QPSK and 64-QAM constellations. The figure shows that the 64QAM, the largest constellation in IEEE802.16, cannot tolerate more than 1% error in the carrier frequency for a negligible SNR loss of 0.5dB, whereas QPSK modulation can tolerate up to 5% error for the same SNR loss.
  • 47. 42 Figure 3.13 SNR degradation due to frequency offset Figure 3.13 SNR degradation due to frequency offset for QPSK and 64-QAM There are several approaches for frequency synchronization; here we shall use the time domain approach as follows: We first derive a data-aided maximum-likelihood estimator that operates on the received time domain signal. The training information required is at least two consecutive repeated symbols as those used in the preamble of WiMAX standard. Let the transmitted signal be sn, then the complex baseband model of the passband signal yn is (3.11) where ftx is the transmitter carrier frequency. After the receiver downconverts the signal with a carrier frequency frx, the received complex baseband signal rn, ignoring noise for the moment, is (3.12) where f∆ = ftx - frx is the difference between the transmitter and receiver carrier frequencies. Let D be the delay between the identical samples of the two repeated symbols which equals 128 in 802.16. Then the frequency offset estimator is developed as follows, starting with an intermediate variable z
  • 48. 43 (3.13) So we get that the variable z is a sum of complex variables with an angle proportional to the frequency offset. Finally, the frequency error estimator is formed as (3.14) where the z operator takes the angle of its argument. In the next part we discuss the operating range of this algorithm to see the maximum frequency offset I can detect. The range is directly related to the length of the repeated symbols. The angle of z is of the form -2 f∆ DTs, which is unambiguously defined only in the range from –Π to Π. Thus if the absolute value of the frequency error is larger than the limit of equation 3.15 the estimate will be incorrect: (3.15) So in our system since D=128 and Ts=125nsec so the maximum detectable frequency offset f∆ = 31.25KHZ Function Prototype: float freq_sync(COMPLEX det[])//this function gets the offset frequency to be used for correction using the input det void freq_correction(COMPLEX d_fault[],COMPLEX d_correct[]) //this function corrects the offset 3.4.2.4 FFT: Operation: It calculates the FFT of the input samples. To know more about its operation refer to chapter 12 of 'The Scientist and Engineer's Guide to Digital Signal Processing' Its operation is even simpler than IFFT as we just call the twiddle function and then the FFT function. INPUT: 256 symbols from the mapper OUTPUT: 256 bits
  • 49. 44 ))j/Nfloor(12(jfloor(j/s)sM mod(s)cbpsj ×++×= Function Prototype: void FFT(COMPLEX *Y, int N)// N is the FFT size 3.4.2.5 Channel estimation: Operation: It uses the pilots, estimates their amplitudes and phases and uses them to correct the other samples as we already know the amplitude and phase of the pilots prior to transmission. Benefits: There are no assumptions for this block as there is no standard for synchronization or channel estimation INPUT: 256 bits from the FFT OUTPUT: 256 bits Function prototype: void channel_estm(COMPLEX input[],COMPLEX out[]) 3.4.2.6 Removing pilots and padding This block just removes the pilots after channel estimation; also it removes the zero padding that was added prior to transmission. Function Prototype: void remove_pilots_padding(COMPLEX data_inf[],float Ioutf[],float Qoutf[]) //Data_inf is the input, Ioutf,Qoutf are the complex outputs 3.4.2.7 De mapper Operation: After removing the pilots the de-mapper reverses the action of the mapper in the transmitter. INPUT: 192 symbol (QPSK modulation) OUTPUT: 384 bit to the interleaver (QPSK , 16 subchannels) Function Prototype: void demapper(float dinId[],float dinQd[],char doutd[]) 3.4.2.8- De interleaver Operation: It reverses the effect of the interleaver and is done in two permutations The first permutation is defined by the equation: j=0,1,2,3,....,Ncbps-1 (3.16) The second permutation is defined by the equation: )/Nmfloor(121)-(N-m12K cbpsjcbpsjj ×××= j=0,1,2,3,....,Ncbps-1
  • 50. 45 (3.17) The first permutation in the de-interleaver is the reverse of the second permutation in the interleaver and, the second permutation in the de- interleaver is the reverse of the first permutation in the interleaver INPUT: 384 bit from de-mapper (QPSK, 16 subchannels) OUTPUT: 384 bit to the encoder (QPSK, 16 subchannels) Function Prototype: void deinterleave(char dind[],char doutd[]) 3.4.2.9 Turbo decoding Operation: It decodes the bits which were previously encoded at the transmitter using the TCP associated with our platform. For more details about this peripheral look at chapter 5 that explains in some detail how we configured this block to achieve the required performance. Also the theory behind turbo decoding is explained in appendix A Benefit: It improves the BER Assumptions: We used the turbo code standard IS2000 instead of that in 802.16 protocol INPUT: 384 bits OUTPUT: 184 bits 3.4.2.10 De randomizer Operation: It reverses the action of the randomizer in the transmitter INPUT: 184 bits from the turbo encoder. OUTPUT: 184 data bits.
  • 51. 46 3.5 Link budget analysis and channel simulation: 3.5.1 Link budget analysis: Figure 3.14 Link budget is one of the most important design issues in any communication link. In WiMAX the link between the transmitter and the receiver has so many problems like fading, attenuation as well as other losses due to the fact that the Fresnel zone isn't clear enough. So actually link budget includes both the path loss model due to attenuation in the path as well as the clearance model. To start our analysis we shall study both the uplink and the downlink to see which of them is considered a limit on the link, the following table includes the parameters of both the base station and the Customer Premises Equipment (CPE) to start our analysis: Uplink(CPE to base station) Downlink(Base station to CPE) 2432Transmitted power(dBm) -115-103Sensitivity of receiver(dBm) 06Combiner loss at Tx(dB) 03Feeder loss at Tx(dB) 317Antenna gain Tx(dBi) 1010Fading margin(dB) 33Interference margin(dB) 11Antenna body loss(dB) 77AAS & Diversity gain(dB) Table 4 base station and CPE link budget analysis Where AAS stands for: Adaptive Antenna System The next step is to calculate the maximum allowable path loss in both the uplink and the downlink: In downlink, the max. Path loss allowed = 136dB In uplink, the max. allowable path loss = 135dB So it's obvious that we're limited by the uplink not the downlink, therefore we let the maximum path loss equal to 135dB to get the maximum cell radius. But also we note that the link budget is almost balanced which is quite good. After that we begin to use Okumura's model to calculate the path loss due to both attenuation and non-clearance assuming that the cell radius is 3Km. The equation for path loss calculation is as follows: PL(dB)= Lf(f,d) + Am(f,d) – G(hte) – G(hre) – Garea
  • 52. 47 50 Tx Antenna Gain simout To Workspace 2 Rx Antenna Gain1 Product Phase/ Frequency Offset Phase/ Frequency Offset Multipath Rayleigh Fading Multipath Rayleigh Fading Channel Gaussian Gaussian Noise Generator Q From Workspace1 I From Workspace j Constant Add1 Add where: PL Overall Path Loss; Lf Free space path loss Am Median attenuation relative to free space G (hte) Base station antenna height gain factor G (hre) Mobile antenna height gain factor Garea The gain due to the type of the environment(assuming suburban environment) D is the distance between the base station and the CPE So if we take hte=200m, hre= 3m, d=3km, f=2.5GHZ Lf=20*log(4*pi* d/ λ) =110 dB. G(hte)= 20log(hte/200)=0 dB. G(hre)= 20log(hre/3)=0 dB. PL=110+25-0-0-12=123 dB. PL= 123 dB, which is less than the maximum allowable path loss, so it's Ok to work under these conditions for a distance of 3Km or even more. Also if we're operating in a rural environment the path loss becomes: PL= 108dB which means that we can increase the cell radius much more than 3km (theoretically). :Channel simulation.25.3 Now after we've finished the link budget analysis we want to design our channel using MATALB simulink to take the effect of the previous effects. The channel model will be as follows: Figure 3.15 channel simulation simulink model The parameters of the channel will be chosen as follows: 1- Path loss =93.56 dB according to the above calculations. 2-Tx antenna gain=17dBi 3- Rx antenna gain =3dBi 4- Rayleigh fading channel block: In this block we assume 3 paths with different gains and maximum delay spread equal to 2 µsec. 5- Guassian noise generator to add noise to the transmitted data. 6- Frequency and phase offset block: we add frequency offset = 10KHZ where the maximum correctable frequency offset = 1/(2*128*Ts) = 31.25KHZ as explained in section 3.3 in the frequency synchronization block in the receiver. Also we add phase offset to account for the path delay between the Tx and the Rx, where the phase offset is calculated as follows: Phase offset = (2 * PI / λ) * D = 0, where D = 3KM , λ = 3 e8 /2.5 e9 Finally we scale the data before entering the channel such that its power = 32dBm
  • 53. 48 3.6 Future Work: WiMAX is a huge system; its complete implementation may take several years of work. In our project we've implemented almost most of the physical layer on the DSP kit. We hope that the students in the upcoming years would complete the system. Referring to figure 3.2, the system is composed of 4 parts: 1- BB physical layer 2- MAC layer (Network interface) 3- Digital IF stage 4- RF stage We suggest the following stages as a step towards the complete implementation of the system: Stage 1: Completing the remaining parts of the physical layer which are: • Adaptive modulation • Power control • Uplink and downlink subframes Stage 2: Implementing the MAC common part sublayer of the system, this may need more than one group. Stage 3: Implementing the security sublayer Stage 4: Implementing the digital IF stage Stage 5: Implementing the RF stage
  • 55. 50 50 Tx Antenna Gain rxdata To Workspace 3 Rx Antenna Gain1 Product Multipath Rayleigh Fading Multipath Rayleigh Fading Channel Q From Workspace1 I From Workspace Free Space Path Loss 80 dB Free Space Path Loss j Constant Add AWGN AWGN Channel 4- System simulation & testing Simulation is an important step in the design of any system because it shows the expected performance of our system; it's also used to check that the algorithms we used operate properly with no logical errors. Testing is also very useful; as we test each block individually on the platform before interconnecting all the blocks together, this may seem to take longer time but actually it's more time efficient. This chapter is divided into 2 main sections: 1- System simulation 2- System testing :System simulation4.1 In this part we shall use MATLAB to simulate some of the blocks used in our system to see their effect on the system performance. 4.1.1 The effect of the interleaver: To show this we shall simulate a QPSK system using repetition 3 coding with and without the interleaver in a fading channel. The code used for the simulation on Matlab is in Appendix C. The simulink model used is shown in figure 4.1 below: Figure 4.1 Interleaver test simulink model The simulink model takes I and Q from the workspace to add the channel effects as follows: - The path loss=86dB for a carrier frequency of 2.5GHZ and the distance=100m - The symbol rate = 500Ksps (i.e. bit rate =1Mbps) - AWGN block represents the noise effect where the SNR is changed from this block. - The fading channel blocks adds fading to the signal to see its effect on the BER where the delay spread=2µsec as the application is broadband wireless access where the delay spread is relatively large. Then we receive the data from the simulink after adding fading and noise as well as the propagation loss effect. After that demapping and decoding is made then a decision is made to the favor of a zero or a one according to the majority rule (repetition 3 coding) The code for that is also in the appendix. The code also includes BER calculations. Then we repeat the same steps but without the interleaver to see its effect on the performance of the communication link.
  • 56. 51 2 4 6 8 10 12 14 16 18 20 10 -5 10 -4 10 -3 10 -2 10 -1 10 0 Eb/No BER BER curves in AWGN versus Rayleigh fading channel with delay spread 2microsec Rayleigh Fading Channel AWGN Channel The BER curves will be as follows: 2 4 6 8 10 12 14 16 18 20 10 -0.4 10 -0.3 Eb/No BER BER curves with and without interleaver in a 2microsec rms Rayleigh fading channel BER with interleaver BER without interleaver Figure 4.2 BER curves with & without interleaver In the next part we shall show the difference in the BER between a fading channel and the AWGN channel using codes similar to that above but the only difference is that we shall remove the Rayleigh fading channel block one time and put it another time. The BER curves will be as follows: Figure 4.3 BER curves with and without fading Comment: The interleaver has no effect in case of AWGN channel since the location of the bits won't change the performance but it has a significant effect in case of fading channels.
  • 57. 52 50 Tx Antenna Gain rxdata To Workspace 3 Rx Antenna Gain1 Product Phase/ Frequency Offset Phase/ Frequency Offset Multipath Rayleigh Fading Multipath Rayleigh Fading Channel Q From Workspace1 I From Workspace Free Space Path Loss 80 dB Free Space Path Loss j Constant Add AWGN AWGN Channel 4.1.2 The effect of the pilots: Since our system is operating in a fading environment, pilots are necessary to estimate the magnitude and phase effects of the channel to be used for correcting the information bits. Here we simulate the effect of using a pilot with a sample of 100 data bits in a Rayleigh fading channel, 1st we use only one pilot and we find that it will correct around 50 errors due the fading effect but if we use 2 pilots we can correct almost all of the 100 errors due to the channel effect. The code for simulation of pilot effect is in the appendix Then we use simulink to add fading, noise as well as phase offset (delay) The simulink model is as follows: Figure 4.4 Pilot test simulink model Then the objective is to estimate the magnitude and the phase of the pilots to be used for correction. The code for that is in the appendix. This code was in case of using 2 pilots, the 2 pilots were able to correct almost all of the channel errors in the 100 bit sample due to fading. In case of using 1 pilot a similar code is used but it won't be able to correct all the errors (only 50 of them) Conclusion: From the previous simulation we got that pilots are very necessary in case of multipath fading channels because they estimate the magnitude and phase offset due to the channel (i.e. channel estimation). Therefore in Wimax we use 8 pilots in the 256 OFDM symbol to make up for the channel effects where the channel can be modeled as a Rayleigh fading channel with 2µsec delay spread because Wimax is used for BWA (Broadband Wireless Access) applications. 4.1.3 Simulation of the packet detection algorithm: Here we test the double sliding window packet detection algorithm explained in chapter 3 using MATLAB. In figure 4.5 below we display the output from the correlator where we first enter noise then the preamble, so the output of the correlator increases till it reaches its maximum at the midpoint of the preamble, the preamble starts at sample 321 and its length is 256. The SNR=3.3dB
  • 58. 53 d o u t T o W o rksp a ce P ro d u c t P h a se / F re q u e n cy O ffse t P h a se / F re q u e n cy O ffse t Q F ro m W o rksp a c e 1 I F ro m W o rksp a ce j C o n sta n t A d d A W G N A W G N C h a n n e l Figure 4.5 Output of packet detection algorithm The MATLAB code used for simulation is in the appendix. 4.2 System testing: :Testing the frequency synchronization algorithm4.2.1 In this part we test the frequency synchronization function using MATLAB, also we'll show the effect of frequency offset on the BER where it's required to increase the SNR to achieve the same BER without frequency offset. This indicates the importance of frequency synchronization. The MATLAB code used is in the appendix Then the data enters simulink including 10KHZ frequency offset as shown in figure 4.6 After that dout is processed to get the frequency offset Figure 4.6 Frequency sync. test model
  • 59. 54 Then after that frequency correction is applied to the output The BER rate with the frequency correction is as follows: Figure 4.7 Performance of frequency correction algorithm As we see that the BER after frequency correction is almost the same as without frequency offset. Conclusion: Frequency synchronization is very essential but there is an upper limit on the frequency offset which is increased as we increase the length of the preamble as we explained in chapter 3, but as the preamble length increases we'll have more overhead so it's a compromise. 4.2.2 Testing of the turbo encoder: We tested the code of the turbo encoder using 12 bits as input and the same interleaver of our system, and then we compared its output with the manual trace we made. The input data we entered to the convolutional encoder is 0 1 0 1 0 1 0 1 0 1 0 0, then it is interleaved and entered to a convolutional encoder similar to the 1st one after interleaving data will be in this format 0 0 1 1 0 0 1 1 0 0 1 0, then the output frame is punctured according to the following combination Output combination of data U0A0 U1A'1 U2A2 U3A'3…………………U11A'11 Tail bits U12A12 U13A13 U14A14 U'122A'12 U'13A'13 U'14A'14 The output frame of the testing code we used is 0 0 1 0 0 1 1 0 0 0 1 0 0 0 1 0 0 0 1 1 0 1 0 1 0 0 0 1 1 1 1 1 0 0 0 0
  • 60. 55 After that we performed a manual trace to check on our code and it is as follows: U I/p state A U' I/p' state A' 0 0 000 0 1 1 100 1 0 0 010 1 1 0 001 0 0 1 100 0 1 1 110 0 0 1 111 0 1 1 111 1 0 0 011 0 1 1 101 0 0 1 110 1 0 1 111 0 0 0 000 0 0 0 000 0 1 1 100 1 1 1 110 0 0 1 111 0 0 0 011 0 1 1 101 0 1 0 010 0 0 1 101 1 0 1 110 1 1 0 011 1 0 0 001 1 Tail 0 0 011 0 0 0 001 1 1 0 000 1 1 0 000 1 0 0 000 0 0 0 000 0 Then by using the puncturing scheme mentioned above we get the Output frame 0 0 1 0 0 1 1 0 0 0 1 0 0 0 1 0 0 0 1 1 0 1 0 1 0 0 0 1 1 1 1 1 0 0 0 0 By comparing it with the output of the code we find that they are similar
  • 61. 56 Why we choose C6000 As our Platform Code Composer Studio Code Composer Studio Debug Tools Peripherals used in our project
  • 62. 57 5- Platform 5.1 Why we choose C6000 As our Platform 5.1.1 Advantages of designing with DSPs over other microprocessors: Single-cycle multiply accumulate operations Real-time performance, simulation and emulation Flexibility Reliability Increased system performance Reduced system cost 5.1.2Features of the C6000 devices include: ⇒ Advanced CPU with eight functional units, including two multipliers and six arithmetic units. ⇒ Executes up to eight instructions per cycle for up to ten times the performance of other DSPs. ⇒ Reduces code size, program fetches, and power consumption ⇒ Efficient code execution on independent functional units ⇒ Industry’s most efficient C compiler on DSP benchmark suite ⇒ 8/16/32-bit data support, providing efficient memory support for a variety of applications ⇒ 40-bit arithmetic options, which add extra precision for vocoders and other computationally intensive applications. ⇒ 32 x 32–bit integer multiply with 32– or 64–bit result ⇒ A complete development tool includes the following: C compiler Assembly optimizer Assembler Linker Evaluation tools 5.2 Code Composer Studio: 5.2.1 Creating a System Configuration: CCStudio Setup allows you to configure the CCStudio IDE software to work with different hardware or simulator targets. You can quickly begin working using the default configuration or one of the standard configuration files supplied with CCStudio IDE. For C6000 system, the C64x simulator is the default configuration. CCStudio Setup provides you with the option of creating a configuration using standard configuration files, or creating a customized configuration using your own configuration files. When using the Kit with CCStudio make sure its configuration points to real target not simulator.
  • 63. 58 5.2.1.1 Project Management and Editing Tools: The project manager organizes files into folders for source files; include files, libraries, and DSP/BIOS configuration files. Source files that are generated by DSP/BIOS are placed in the Generated files folder. The CCStudio IDE finds files by searching for project files in the following path order when building the program: The folder that contains the source file. The folders listed in the Include Search Path for the compiler or assembler options (from left to right). 5.3 Code Composer Studio Debug Tools: 5.3.1 Watch Window When debugging a program, it is often helpful to understand how the value of a variable changes during program execution. The Watch window allows you to monitor the values of local and global variables and C/C++ expressions. In the Watch Locals tab, the debugger automatically displays the Name, Value, and Type of the variables that are local to the currently executing function. In the Watch tab, the debugger displays the Name, Value, and Type of the local and global variables and expressions that you specify. 5.3.2 Displaying Graphs If you ran a program using only breakpoints and watch windows, you would not see much information about what the program was doing. You could set watch variables on addresses within the inp_buffer and out_buffer arrays, but you would need to watch a lot of variables and the display would be numeric rather than visual. CCStudio IDE provides a variety of ways to graph data processed by your program. In the Graph Property Dialog, change the Graph Title, Start Address, Acquisition Buffer Size, Display Data Size, DSP Data Type, Autoscale and Maximum Y-value properties to the values shown here. Scroll down or resize the dialog box to see all the properties. 5.4 Peripherals used in our project I. EDMA II. JTAG For RTDX III. TURBO CO-PROCESSOR (TCP) 5.4.1 Enhancement Direct Memory Access (EDMA) The EDMA is a peripheral that can be set up to copy data from one place to another without the CPU’s intervention. The EDMA can be setup to copy data or program from a source (external/internal memory, or a serial port) to a destination (e.g. internal memory). After this transfer completes, the EDMA can “auto initialize” itself and perform the same transfer again, or it can be reprogrammed.
  • 64. 59 5.4.1.1 EDMA configuration The EDMA in Our Platform TMS320C6416 Contains 64 Channel each channel contains 6 32-bits registers as appear in figure 5.1 Figure 5.1 EDMA Channel registers Looking at the EDMA parameters one register at a time: 1. Options: contains many fields as follows ESIZE in which we choose our element size which will be transferred we have 3 choices as follows: ℵ 00 : 32-Bit ℵ 01 : 16-Bit ℵ 10 : 8-Bits SUM & DUM fields indicate how the source and destination addresses are to be modified between element reads and writes. Here we have 4 choices : I. 00: Fixed means that the pointer remains fixed after reading or writing. II. 01: Increment by element size after each reading or writing. III. 10: Decrement by element size after each reading or writing. IV. 11 : Index which mean that the pointer increase after each reading by the value in the index register Frame Sync (FS) field indicates how much data should be moved whenever the EDMA is triggered to run. if we want to move the whole frame of data when the CPU starts the EDMA channel, we should set FS = 1. and, when we use the EDMA only moves one element per trigger event ,we should set FS =0. PRIORITY field which indicate the priority of this channel is it high priority or low. 2DS & 2DD fields which indicate if the source is two dimensional array or not and the same for the destination LINK field which indicate is this channel link to another channel or not 2. Source: Should have the source address. 3. Transfer Counter: this register contain two fields I. ELEMENT COUNT: It Will contain the number of elements we want to transfer. II. FRAME COUNT: It will contain the number of frames we want to transfer. 4. Destination: Should have the destination address.
  • 65. 60 5. Index: this register contain two fields : II. ELEMENT INDEX: which will contain the number of bytes that the pointer of source must be updated by after reading from source 1 element the same for destination according to which of them is configure to be indexed. III. FRAME INDEX: which will contain the number of bytes that the pointer of source will be updated by after transfer 1 complete frame 6. Reload/Linking: will contain the channel number which we will link to it. 5.4.1.2 EDMA problems we faced • in our project as to add the channel effects (noise ,fading ,path loss ,etc…..) we use RTDX to exchange data between Platform & PC to add channel effects on MATLAB so the EDMA use is to Take frame by frame from BIG Buffer - Output from MATLAB after adding Channel effect – in memory to execute the receiver algorithm on this frame HERE APPEAR THE PROBLEM which is how to update the source to continue in the BIG Buffer and don't return to start from the begin of the Buffer as the EDMA doesn't design for this operation . Solution: so we solved this problem by define a pointer to the start of the buffer and then increase it by the size of the frame then close the channel and RE-Configure it again with the new SOURCE " pointer ". 5.4.2 JTAG (RTDX) 5.4.2.1 What is JTAG? JTAG is a built-in interface in our platform in which we used to transfer data in a full duplex manner to and from the computer. Real-Time Data Exchange (RTDX) provides real-time, continuous visibility into the way target applications operate in the real world. RTDX allows system developers to transfer data between a host and target devices without interfering with the target application. The data can be analyzed and visualized on the host using any host client. RTDX consists of both target and host components. A small RTDX software library runs on the target application. The target application makes function calls to this library's API in order to pass data to or from it. This library makes use of a scan- based emulator to move data to or from the host platform via the JTAG interface. Data transfer to the host occurs in real-time while the target application is running. On the host platform, an RTDX Host library operates in conjunction with Code Composer™. Displays and analysis tools communicate with RTDX via an easy-to- use COM API to obtain the target data and/or to send data to the target application. HOST and TARGET applications may be written using C, C++, Visual Basic or any other language that can deal with the JTAG interface.
  • 66. 61 5.4.2.2The role of RTDX in our project: Is to send the data From the data source (computer) to the transmitter (KIT). From the transmitter (KIT) to the computer to add the channel effect then back to the KIT. From the receiver (KIT) to the data destination (computer) to estimate the channel effects on the transmitted data. We used the matlab to handle the RTDX since the matlab has a powerful, easy to use link for Code Composer Studio, (refer to tutorials in matlab help for RTDX links). The RTDX may have more than one channel with more than one buffer assigned to each channel to carry the data to be transferred or received; such buffers may have varying sizes according to user requirements. Refer to CCS help for RTDX options and etc… 5.4.2.3 RTDX problems we faced during the project: a. we used the CCS RTDX tutorials for creating the HOST and TARGET applications using C++ and we successfully sent and received a maximum of 600 bytes per transfer which wasn’t sufficient for us. b. RTDX data rate exchange wasn’t suitable for real-time data source. Solution: we used matlab for HOST (computer) application and matlab RTDX tutorial for TARGET (KIT) application and we successfully sent a maximum of 10,000 bytes wich was sufficient enough for us. c. Using matlab we couldn’t establish more than one transfer per channel. Solution: we used multiple channels when needed. 5.4.3 TURBO CO-PROCESSOR (TCP) 5.4.3.1 Introduction The turbo coprocessor (TCP) is a programmable peripheral for decoding of IS2000/3GPP turbo codes, integrated into TI’s TMS320C6416 DSP device. The coprocessor operates either as a complete turbo decoder including the iterative structure (standalone processing mode), or it can operate as a single maximum A posterior (MAP) decoder (shared processing mode). In the standalone processing mode, the inputs into the TCP are channel-soft decisions for systematic and parity bits; the outputs are hard decisions. In the shared processing mode, the inputs are channel-soft decisions for systematic and parity bits and apriori information for systematic bits, and the outputs are extrinsic information for systematic bits. The TCP programmable parameters are: • Code rate (1/2, 1/3 or 1/4) • Frame length • Maximum number of iterations • Threshold for early stopping criterion
  • 67. 62 5.4.3.2 How to program TCP TCP Programming includes two Phases: a) TCP Configuration. b) EDMA Configuration for TCP transmit and receive Channels. 5.4.3.2.1 TCP Configuration The TCP parameters are adjusted so as to perform the required decoding operation. They are follows: • Operation mode: Stand alone mode. • Code rate: 1/2 • Frame length: 186 • Reliability length: 62 • Prolog size: 24 • Maximum number of iterations: 8 • SNR threshold: 20 Comments on the above parameters: The maximum number of iterations, prolog size, SNR threshold and reliability length are explained in the appendix. For more information about how to program the TCP including setting its tail bits, forming the interleaver table and allocating memory for the input and the hard decision output refer to 'spra 749a' and 'spru534b.pdf' 5.4.3.2.2 EDMA Configuration The EDMA contain two different channels for TCP one for receive from TCP and the other to Transmit to TCP The Transmit Channel Input Configuration Parameters Transfer This EDMA transfer to the input configuration parameters is a 12-word TCPXEVT frame-synchronized transfer. The parameters should be set as: OPTIONS: • ESIZE = 00 (element size is 32 bits) • 2DS = 2DD = 0 (1 dimensional) • SUM = 01 (autoincrement) • DUM = 01 (autoincrement) • LINK = 1 (linking of event parameters is enabled) • FS = 1 (channel is frame synchronized) • SOURCE ADDRESS: user input configuration parameters start address (must be double-word aligned) • ELEMENT COUNT: 000Ch • ARRAY/FRAME COUNT: 0000h • DESTINATION ADDRESS: TCPIC0 (5800 0000h) • ELEMENT INDEX: don.t care
  • 68. 63 • ARRAY/FRAME INDEX: don.t care • LINK ADDRESS: address in the EDMA PaRAM of the EDMA parameters associated with the systematics and parities • ELEMENT COUNT RELOAD: don.t care Upon completion, this EDMA transfer is linked to the EDMA for systematics and parities transfer parameters. Systematics and Parities Transfer This EDMA transfer to the systematics and parities memory is a TCPXEVT frame- synchronized transfer. The parameters should be set as: OPTIONS: • ESIZE = 00 (element size is 32 bits) • 2DS = 2DD = 0 (1 dimensional) • SUM = 01 (autoincrement) • DUM = 00 (fixed) • LINK = 1 (linking of event parameters is enabled) • FS = 1 (channel is frame synchronized) • SOURCE ADDRESS: systematics and parities start address (must be double-word aligned) • ELEMENT COUNT :       +× × × )1(8 2 Framecount RF ceil • ARRAY/FRAME COUNT: 1 4NWDSYPAR −      × × RF ceil • DESTINATION ADDRESS: TCPSP (5802 0000h) • ELEMENT INDEX: don.t care • ARRAY/FRAME INDEX: don.t care • LINK ADDRESS: see cases 1, 2, and 3 below • ELEMENT COUNT RELOAD: don.t care Upon completion, this EDMA transfer is linked to one of the following: 1. The EDMA interleaver table transfer parameters, if there is a new one to be loaded in the TCP (INTER bit is set to 1) 2. The EDMA input configuration parameters transfer parameters of the next user-channel, if there is one ready to be decoded and no interleaver table to be loaded in the TCP (INTER bit is cleared to 0) 3. Null EDMA transfer parameters (with all zeros), if there is no more user-channel ready to be decoded and no interleaver table to be loaded in the TCP (INTER bit is cleared to 0) Interleaver Indexes Transfer This EDMA transfer to the interleaver memory is a TCPXEVT frame-synchronized transfer. The parameters should be set as: OPTIONS: • ESIZE = 00 (element size is 32 bits) • 2DS = 2DD = 0 (1 dimensional) • SUM = 01 (autoincrement) • DUM = 00 (fixed)
  • 69. 64 • LINK = 1 (linking of event parameters is enabled) • FS = 1 (channel is frame synchronized) • SOURCE ADDRESS: interleaver table start address (must be double-word ligned) • ELEMENT COUNT:       +× × )1(4 2 Framecount F ceil • ARRAY/FRAME COUNT: 1 2NWDINTER −      × F ceil • DESTINATION ADDRESS: TCPINTER (5808 0000h) • ELEMENT INDEX: don.t care • ARRAY/FRAME INDEX: don.t care • LINK ADDRESS: see cases 1 and 2 below • ELEMENT COUNT RELOAD: don.t care Upon completion this EDMA transfer is linked to one of the following: 1. The EDMA input configuration parameters transfer parameters of the next user-channel, if there is one ready to be decoded 2. Null EDMA transfer parameters (with all zeros), if there is no more user-channel ready to be decoded The Receiver Channel Hard-decisions Transfer This EDMA transfer to the hard decisions buffer is a TCPREVT frame-synchronized transfer. The parameters should be set as: OPTIONS: • ESIZE = 00 (element size is 32 bits) • 2DS = 2DD = 0 (1 dimensional) • SUM = 00 (fixed) • DUM = 01 (autoincrement) • LINK = 1 (linking of event parameters is enabled) • FS = 1 (channel is frame synchronized) • SOURCE ADDRESS: TCPHD (580A 0000h) • ELEMENT COUNT:       +× × )1(64 2 Framecount F ceil • ARRAY/FRAME COUNT: 1 32NWDHD −      × F ceil • DESTINATION ADDRESS: user hard decisions start address (must be double-word aligned) • ELEMENT INDEX: don.t care • ARRAY/FRAME INDEX: don.t care • LINK ADDRESS: see cases 1, 2, and 3 below • ELEMENT COUNT RELOAD: don.t care Upon completion this EDMA transfer is linked to one of the following: 1. The EDMA hard decisions transfer parameters of the next user- channel, if there is one ready to be decoded and the OUTF bit is cleared to 0
  • 70. 65 2. The EDMA output parameters transfer parameters, if the OUTF bit is set to 1 3. Null EDMA transfer parameters (with all zeros), if there is no more user-channel ready to be decoded and the OUTF bit is cleared to 0 Output Parameters Transfer This EDMA transfer is optional and depends on the OUTF bit in the TCP input configuration register 0 (TCPIC0). This EDMA transfer is a TCPREVT frame- synchronized transfer. The parameters should be set as: OPTIONS: • ESIZE = 00 (element size is 32 bits) • 2DS = 2DD = 0 (1 dimensional) • SUM = 01 (autoincrement) • DUM = 01 (autoincrement) • LINK = 1 (linking of event parameters is enabled) • FS = 1 (channel is frame synchronized) • SOURCE ADDRESS: TCPOUT (5800 0030h) • ELEMENT COUNT: 0002h • ARRAY/FRAME COUNT: 0000h • DESTINATION ADDRESS: user output parameters start address (must be double-word aligned) • ELEMENT INDEX: don.t care • ARRAY/FRAME INDEX: don.t care • LINK ADDRESS: see cases 1 and 2 below • ELEMENT COUNT RELOAD: don.t care Upon completion, this EDMA transfer is linked to one of the following: 1. The hard decisions EDMA transfer parameters of the next user- channel, if there is one ready to be decoded 2. Null EDMA transfer parameters (with all zeros), if there is no more user-channel ready to be decoded
  • 72. 67 6-codes 6.1 Transmitter 6.1.1 The randomizer void randomizer(char dinr[],char doutr[]) //din input byte to randomizer { //dout output byte from randomizer int i,j; //init is initialization vector char shift,init[15]; for(i=0;i<15;i++) init[i]=0xff; for(i=0; i<384; i++) { shift=init[13]^init[14]; doutr[i]=dinr[i]^shift; for(j=14;j>0;j--) init[j]=init[j-1]; init[0]=shift; } } 6.1.2 the Interleaver void interleave(char dini[],char douti[]) { int k,m; for(k=0;k<384;k++) { m=(384/12)*(k%12)+floor(k/12); douti[m]=dini[k]; } } 6.1.3 FFT void FFT(COMPLEX *Y, int N) //input sample array, # of points { COMPLEX temp1,temp2; //temporary storage variables int i,j,k; //loop counter variables int upper_leg, lower_leg; //index of upper/lower butterfly leg int leg_diff; //difference between upper/lower leg int num_stages = 0; //number of FFT stages (iterations) int index, step; //index/step through twiddle constant i = 1; //log(base2) of N points= # of stages do { num_stages +=1; i = i*2; }while (i!=N); leg_diff = N/2; //difference between upper&lower legs step = 512/N; //step between values in twiddle.h for (i = 0;i < num_stages; i++) //for N-point FFT {
  • 73. 68 index = 0; for (j = 0; j < leg_diff; j++) { for (upper_leg = j; upper_leg < N; upper_leg += (2*leg_diff)) { lower_leg = upper_leg+leg_diff; temp1.real = (Y[upper_leg]).real + (Y[lower_leg]).real; temp1.imag = (Y[upper_leg]).imag + (Y[lower_leg]).imag; temp2.real = (Y[upper_leg]).real - (Y[lower_leg]).real; temp2.imag = (Y[upper_leg]).imag - (Y[lower_leg]).imag; (Y[lower_leg]).real = temp2.real*(w[index]).real -temp2.imag*(w[index]).imag; (Y[lower_leg]).imag = temp2.real*(w[index]).imag +temp2.imag*(w[index]).real; (Y[upper_leg]).real = temp1.real; (Y[upper_leg]).imag = temp1.imag; } index += step; } leg_diff = leg_diff/2; step *= 2; } j = 0; for (i = 1; i < (N-1); i++) //bit reversal for resequencing data { k = N/2; while (k <= j) { j = j - k; k = k/2; } j = j + k; if (i<j) { temp1.real = (Y[j]).real; temp1.imag = (Y[j]).imag; (Y[j]).real = (Y[i]).real; (Y[j]).imag = (Y[i]).imag; (Y[i]).real = temp1.real; (Y[i]).imag = temp1.imag; } } return; } 6.1.4 twiddle void twiddle() { short i; for (i = 0 ; i<256 ; i++) // set up twiddle constants in w { w[i].real = cos(2*PI*i/512.0); //Re component of twiddle constants w[i].imag =-sin(2*PI*i/512.0); //Im component of twiddle constants }
  • 74. 69 } 6.1.5 IFFT void iFFT(COMPLEX input[], int n) { short i; for (i=0 ; i<n ;i++) { input[i].real=input[i].real; input[i].imag=-input[i].imag; } FFT(input,n); for (i=0 ; i<n ;i++) { input[i].real=(input[i].real/n); input[i].imag=-(input[i].imag/n);//input is the final IFFT output } } 6.1.6 Mapper void mapper(char dinm[], float doutIm[],float doutQm[]) { short i; for(i=0;i<384;i+=2) { if((dinm[i]=='000')&&(dinm[i+1]=='000')) {doutIm[i/2]=-1; doutQm[i/2]=-1; } else if((dinm[i]=='777')&&(dinm[i+1]=='777')) {doutIm[i/2]=1; doutQm[i/2]=1; } else if((dinm[i]=='000')&&(dinm[i+1]=='777')) {doutIm[i/2]=-1; doutQm[i/2]=1; } else if((dinm[i]=='777')&&(dinm[i+1]=='000')) {doutIm[i/2]=1; doutQm[i/2]=-1; } } } 6.1.7 Framing and pilot insertion void frame(float I[],float Q[],COMPLEX data_outf[])//data is the output data which is input to the IFFT block { short i; COMPLEX buf[201]; float pilots[8]={1 ,-1, 1, -1, 1, 1, 1, 1};//we have 8 pilots //this part is for pilot insertion for (i=0;i<12;i++) {
  • 75. 70 buf[i].real=I[i]; buf[i].imag=Q[i]; } buf[12].real=pilots[0]; buf[12].imag=0; for (i=13;i<37;i++) { buf[i].real=I[i-1]; buf[i].imag=Q[i-1]; } buf[37].real=pilots[1]; buf[37].imag=0; for (i=38;i<62;i++) { buf[i].real=I[i-2]; buf[i].imag=Q[i-2]; } buf[62].real=pilots[2]; buf[62].imag=0; for (i=63;i<87;i++) { buf[i].real=I[i-3]; buf[i].imag=Q[i-3]; } buf[87].real=pilots[3]; buf[87].imag=0; for (i=88;i<100;i++) { buf[i].real=I[i-4]; buf[i].imag=Q[i-4]; } //the DC subcarrier carries no information buf[100].real=0; buf[100].imag=0; for (i=101;i<113;i++) { buf[i].real=I[i-5]; buf[i].imag=Q[i-5]; } buf[113].real=pilots[4]; buf[113].imag=0; for (i=114;i<138;i++) { buf[i].real=I[i-6]; buf[i].imag=Q[i-6]; } buf[138].real=pilots[5]; buf[138].imag=0; for (i=139;i<163;i++) { buf[i].real=I[i-7]; buf[i].imag=Q[i-7]; }
  • 76. 71 buf[163].real=pilots[6]; buf[163].imag=0; for (i=164;i<188;i++) { buf[i].real=I[i-8]; buf[i].imag=Q[i-8]; } buf[188].real=pilots[7]; buf[188].imag=0; for (i=189;i<201;i++) { buf[i].real=I[i-9]; buf[i].imag=Q[i-9]; } //this part is for zero padding to transform the 200 symbol frame to //256 symbols to be input to IFFT for (i=0;i<28;i++) { data_outf[i].real=0; data_outf[i].imag=0; } for(i=28;i<229;i++) { data_outf[i].real=buf[i-28].real; data_outf[i].imag=buf[i-28].imag; } for (i=229;i<256;i++) { data_outf[i].real=0; data_outf[i].imag=0; } } 6.1.8 converting from float to complex void after_ifft(COMPLEX samplesf[],float dout_testf[]) { int i,j=0; for(i=0;i<320;i++) { dout_testf[j]=samplesf[i].real; dout_testf[j+1]=samplesf[i].imag; j=j+2; } } 6.1.9 preamble generation void preamble(COMPLEX short_pre[]) { COMPLEX p[201],big_pre[128],short128[256]; int i,j,k; /////////////////////////////////preamble values///////////////////////////////
  • 77. 72 p[0].real=1; p[0].imag=-1; p[1].real=1; p[1].imag=-1; p[2].real=-1; p[2].imag=-1; p[3].real=1; p[3].imag=1; p[4].real=1; p[4].imag=-1; p[5].real=1; p[5].imag=-1; p[6].real=-1; p[6].imag=1; p[7].real=1; p[7].imag=-1; p[8].real=1; p[8].imag=-1; p[9].real=1; p[9].imag=-1; p[10].real=1; p[10].imag=1; p[11].real=-1; p[11].imag=-1; p[12].real=1; p[12].imag=1; p[13].real=1; p[13].imag=1; p[14].real=-1; p[14].imag=-1; p[15].real=1; p[15].imag=1; p[16].real=-1; p[16].imag=-1; p[17].real=-1; p[17].imag=-1; p[18].real=1; p[18].imag=-1; p[19].real=-1; p[19].imag=1; p[20].real=1; p[20].imag=-1; p[21].real=1; p[21].imag=-1; p[22].real=-1; p[22].imag=-1; p[23].real=1; p[23].imag=1; p[24].real=1; p[24].imag=-1; p[25].real=1; p[25].imag=-1; p[26].real=-1; p[26].imag=1; p[27].real=1; p[27].imag=-1; p[28].real=1; p[28].imag=-1; p[29].real=1; p[29].imag=-1; p[30].real=1; p[30].imag=1; p[31].real=-1; p[31].imag=-1; p[32].real=1; p[32].imag=1; p[33].real=1; p[33].imag=1; p[34].real=-1; p[34].imag=-1; p[35].real=1; p[35].imag=1; p[36].real=-1; p[36].imag=-1; p[37].real=-1; p[37].imag=-1; p[38].real=1; p[38].imag=-1; p[39].real=-1; p[39].imag=1; p[40].real=1; p[40].imag=-1; p[41].real=1; p[41].imag=-1; p[42].real=-1; p[42].imag=-1; p[43].real=1; p[43].imag=1; p[44].real=1; p[44].imag=-1; p[45].real=1; p[45].imag=-1; p[46].real=-1; p[46].imag=1; p[47].real=1; p[47].imag=-1; p[48].real=1; p[48].imag=-1; p[49].real=1; p[49].imag=-1; p[50].real=1; p[50].imag=1; p[51].real=-1; p[51].imag=-1; p[52].real=1; p[52].imag=1; p[53].real=1; p[53].imag=1;
  • 78. 73 p[54].real=-1; p[54].imag=-1; p[55].real=1; p[55].imag=1; p[56].real=-1; p[56].imag=-1; p[57].real=-1; p[57].imag=-1; p[58].real=1; p[58].imag=-1; p[59].real=-1; p[59].imag=1; p[60].real=1; p[60].imag=1; p[61].real=1; p[61].imag=1; p[62].real=1; p[62].imag=-1; p[63].real=-1; p[63].imag=1; p[64].real=1; p[64].imag=1; p[65].real=1; p[65].imag=1; p[66].real=-1; p[66].imag=-1; p[67].real=1; p[67].imag=1; p[68].real=1; p[68].imag=1; p[69].real=1; p[69].imag=1; p[70].real=-1; p[70].imag=1; p[71].real=1; p[71].imag=-1; p[72].real=-1; p[72].imag=1; p[73].real=-1; p[73].imag=1; p[74].real=1; p[74].imag=-1; p[75].real=-1; p[75].imag=1; p[76].real=1; p[76].imag=-1; p[77].real=1; p[77].imag=-1; p[78].real=1; p[78].imag=1; p[79].real=-1; p[79].imag=-1; p[80].real=-1; p[80].imag=-1; p[81].real=-1; p[81].imag=-1; p[82].real=-1; p[82].imag=1; p[83].real=1; p[83].imag=-1; p[84].real=-1; p[84].imag=-1; p[85].real=-1; p[85].imag=-1; p[86].real=1; p[86].imag=1; p[87].real=-1; p[87].imag=-1; p[88].real=-1; p[88].imag=-1; p[89].real=-1; p[89].imag=-1; p[90].real=1; p[90].imag=-1; p[91].real=-1; p[91].imag=1; p[92].real=1; p[92].imag=-1; p[93].real=1; p[93].imag=-1; p[94].real=-1; p[94].imag=1; p[95].real=1; p[95].imag=-1; p[96].real=-1; p[96].imag=1; p[97].real=-1; p[97].imag=1; p[98].real=-1; p[98].imag=-1; p[99].real=1; p[99].imag=1; p[100].real=0; p[100].imag=0; p[101].real=-1; p[101].imag=-1; p[102].real=1; p[102].imag=1; p[103].real=-1; p[103].imag=1; p[104].real=-1; p[104].imag=1; p[105].real=-1; p[105].imag=-1; p[106].real=1; p[106].imag=1; p[107].real=1; p[107].imag=1;
  • 79. 74 p[108].real=1; p[108].imag=1; p[109].real=-1; p[109].imag=-1; p[110].real=1; p[110].imag=1; p[111].real=1; p[111].imag=-1; p[112].real=1; p[112].imag=-1; p[113].real=1; p[113].imag=-1; p[114].real=-1; p[114].imag=1; p[115].real=-1; p[115].imag=1; p[116].real=-1; p[116].imag=1; p[117].real=-1; p[117].imag=1; p[118].real=1; p[118].imag=-1; p[119].real=-1; p[119].imag=-1; p[120].real=-1; p[120].imag=-1; p[121].real=-1; p[121].imag=1; p[122].real=1; p[122].imag=-1; p[123].real=1; p[123].imag=1; p[124].real=1; p[124].imag=1; p[125].real=-1; p[125].imag=1; p[126].real=1; p[126].imag=-1; p[127].real=1; p[127].imag=-1; p[128].real=1; p[128].imag=-1; p[129].real=-1; p[129].imag=1; p[130].real=1; p[130].imag=-1; p[131].real=-1; p[131].imag=-1; p[132].real=-1; p[132].imag=-1; p[133].real=-1; p[133].imag=-1; p[134].real=1; p[134].imag=1; p[135].real=1; p[135].imag=1; p[136].real=1; p[136].imag=1; p[137].real=1; p[137].imag=1; p[138].real=-1; p[138].imag=-1; p[139].real=-1; p[139].imag=1; p[140].real=-1; p[140].imag=1; p[141].real=1; p[141].imag=1; p[142].real=-1; p[142].imag=-1; p[143].real=1; p[143].imag=-1; p[144].real=1; p[144].imag=-1; p[145].real=1; p[145].imag=1; p[146].real=-1; p[146].imag=-1; p[147].real=-1; p[147].imag=-1; p[148].real=-1; p[148].imag=-1; p[149].real=1; p[149].imag=1; p[150].real=-1; p[150].imag=-1; p[151].real=-1; p[151].imag=1; p[152].real=-1; p[152].imag=1; p[153].real=-1; p[153].imag=1; p[154].real=1; p[154].imag=-1; p[155].real=1; p[155].imag=-1; p[156].real=1; p[156].imag=-1; p[157].real=1; p[157].imag=-1; p[158].real=-1; p[158].imag=1; p[159].real=1; p[159].imag=1; p[160].real=1; p[160].imag=1; p[161].real=-1; p[161].imag=-1;
  • 80. 75 p[162].real=1; p[162].imag=1; p[163].real=-1; p[163].imag=1; p[164].real=-1; p[164].imag=1; p[165].real=-1; p[165].imag=-1; p[166].real=1; p[166].imag=1; p[167].real=1; p[167].imag=1; p[168].real=1; p[168].imag=1; p[169].real=-1; p[169].imag=-1; p[170].real=1; p[170].imag=1; p[171].real=1; p[171].imag=-1; p[172].real=1; p[172].imag=-1; p[173].real=1; p[173].imag=-1; p[174].real=-1; p[174].imag=1; p[175].real=-1; p[175].imag=1; p[176].real=-1; p[176].imag=1; p[177].real=-1; p[177].imag=1; p[178].real=1; p[178].imag=-1; p[179].real=-1; p[179].imag=-1; p[180].real=-1; p[180].imag=-1; p[181].real=1; p[181].imag=-1; p[182].real=-1; p[182].imag=1; p[183].real=-1; p[183].imag=-1; p[184].real=-1; p[184].imag=-1; p[185].real=1; p[185].imag=-1; p[186].real=-1; p[186].imag=1; p[187].real=-1; p[187].imag=1; p[188].real=-1; p[188].imag=1; p[189].real=1; p[189].imag=-1; p[190].real=-1; p[190].imag=1; p[191].real=1; p[191].imag=1; p[192].real=1; p[192].imag=1; p[193].real=1; p[193].imag=1; p[194].real=-1; p[194].imag=-1; p[195].real=-1; p[195].imag=-1; p[196].real=-1; p[196].imag=-1; p[197].real=-1; p[197].imag=-1; p[198].real=1; p[198].imag=1; p[199].real=1; p[199].imag=-1; p[200].real=1; p[200].imag=-1; for (i=0;i<128;i++) { if ((i<14)||(i>114)) {big_pre[i].real=0; big_pre[i].imag=0;} } ////////////////////////////////////////////////////////////////////////// j=0; k=14; for (i=0;i<256;i++) { if (((i-100)%2)==0) {
  • 81. 76 big_pre[k].real=sqrt(2)*p[i].real; // real part of the 128 element of the long preamble big_pre[k].imag=sqrt(2)*p[i].imag; // imag part of the 128 element of the short preamble k+=1; } } iFFT(big_pre,128); // generating ifft of the 128 element j=0; k=0; for (i=0;i<256;i++) { short128[i]=big_pre[k]; // genearting 2 repetitions of the 128 element k++; if (k==128) //reseting k for repeating symbol k=0; } j=192; k=0; //////////////////////////////////short preamble///////////////////////////// for(i=0;i<320;i++) { if (i<64) // for generating guard time { short_pre[i]=short128[j]; j++; } else { short_pre[i]=short128[k]; k++; } } } 6.1.10 adding guard band void guardband(COMPLEX din[], COMPLEX dout[]) { int i; for(i=0;i<64;i++) { dout[i].real=din[192+i].real; dout[i].imag=din[i+192].imag; } for(i=64;i<320;i++) { dout[i].real=din[i-64].real; dout[i].imag=din[i-64].imag; } }
  • 82. 77 6.1.11 Turbo encoder typedef unsigned short int ushort; ushort Frame[384],s[3],q,input[186],enip; //s is the convolutional registers states ushort Data[186],c0[186],c1[186],c0b[186],c1b[186],Data_int[186]; ushort tdata[3],tc0[3],tc1[3],tdatab[3],tc0b[3],tc1b[3]; int i,j,k; ////////////////////////////convolutional encoder//////////////////////////// void convolution (ushort X[],ushort Y0[],ushort Y1[],ushort flag) { if (flag==0) for (i=0;i<186;i++) { enip=X[i]^s[1]^s[2]; Y0[i]= enip^s[0]^s[2]; Y1[i]=enip^s[0]^s[1]^s[2]; q=enip; s[2]=s[1]; s[1]=s[0]; s[0]=q; } else for(i=0;i<3;i++) { X[i]=s[1]^s[2]; enip=X[i]^s[1]^s[2]; Y0[i]= enip^s[0]^s[2]; Y1[i]=enip^s[0]^s[1]^s[2]; q=enip; s[2]=s[1]; s[1]=s[0]; s[0]=q; } } ////////////////////////////////////////////////////////////////////////// //////////////////////interleaver///////////////////////////////////////// void interleave (ushort M[],ushort Mb[]) { for (int i=0;i<186;i++) { k=(186/6)*(i%6)+floor(i/6); Mb[k]=M[i]; } } ///////////////////////////////////////////////////////////////////////// ////////////////////////Turbo Encoder Function///////////////////////////////////////////// void Turbo_encoder (char input[], char frame[]) { unsigned short int bag=0xff; 78 for (j=0;j<186;j++) //input data for testing must be removed { input[j]=bag^0xff; bag=input[j];
  • 83. 78 } for (i=0;i<186;i++) { Data[i]=input[i]; c0[j]=0x00; c1[j]=0x00; } convolution(Data,c0,c1,0); convolution(tdata,tc0,tc1,1); interleave(Data,Data_int); convolution (Data_int,c0b,c1b,0); convolution(tdatab,tc0b,tc1b,1); ///////////////////////////////////////////////////////////////////////////// ///////////////////////Framing/////////////////////////////////////////////// j=0; for (i=0;i<372;i++) { Frame[i]=Data[j]; if ((j%2)==0) { i=i+1; Frame[i]=c0[j]; } else { i=i+1; Frame[i]=c0b[j]; } j+=1; } j=0; for(i=372;i<378;i++) { Frame[i]=tdata[j]; i=i+1 ; Frame[i]=tc0[j]; j+=1; } j=0; for(i=378;i<384;i++) { Frame[i]=tdatab[j]; i=i+1; Frame[i]=tc0b[j]; j+=1; }
  • 84. 79 6.2 Receiver 6.2.1 derandomizer Same function as randomizer 6.2.2 De-interleaver void deinterleave(char dind[],char doutd[]) { int k,j; for(j=0;j<384;j++) { k=12*j-383*floor(12*j/384); doutd[k]=dind[j]; } } 6.2.3 FFT void FFT(COMPLEX *Y, int N) //input sample array, # of points { COMPLEX temp1,temp2; //temporary storage variables int i,j,k; //loop counter variables int upper_leg, lower_leg; //index of upper/lower butterfly leg int leg_diff; //difference between upper/lower leg int num_stages = 0; //number of FFT stages (iterations) int index, step; //index/step through twiddle constant i = 1; //log(base2) of N points= # of stages do { num_stages +=1; i = i*2; }while (i!=N); leg_diff = N/2; //difference between upper&lower legs step = 512/N; //step between values in twiddle.h for (i = 0;i < num_stages; i++) //for N-point FFT { index = 0; for (j = 0; j < leg_diff; j++) { for (upper_leg = j; upper_leg < N; upper_leg += (2*leg_diff)) { lower_leg = upper_leg+leg_diff; temp1.real = (Y[upper_leg]).real + (Y[lower_leg]).real; temp1.imag = (Y[upper_leg]).imag + (Y[lower_leg]).imag; temp2.real = (Y[upper_leg]).real - (Y[lower_leg]).real; temp2.imag = (Y[upper_leg]).imag - (Y[lower_leg]).imag; (Y[lower_leg]).real = temp2.real*(w[index]).real -temp2.imag*(w[index]).imag; (Y[lower_leg]).imag = temp2.real*(w[index]).imag +temp2.imag*(w[index]).real; (Y[upper_leg]).real = temp1.real; (Y[upper_leg]).imag = temp1.imag; }
  • 85. 80 index += step; } leg_diff = leg_diff/2; step *= 2; } j = 0; for (i = 1; i < (N-1); i++) //bit reversal for resequencing data { k = N/2; while (k <= j) { j = j - k; k = k/2; } j = j + k; if (i<j) { temp1.real = (Y[j]).real; temp1.imag = (Y[j]).imag; (Y[j]).real = (Y[i]).real; (Y[j]).imag = (Y[i]).imag; (Y[i]).real = temp1.real; (Y[i]).imag = temp1.imag; } } return; } 6.2.4 Twiddle void twiddle(int n) { short i; for (i = 0 ; i<n ; i++) // set up twiddle constants in w { w[i].real = cos(PI*i/n); //Re component of twiddle constants w[i].imag =-sin(PI*i/n); //Im component of twiddle constants } } 6.2.5 De-mapper void demapper(float dinId[],float dinQd[],char doutd[]) { short i; for(i=0;i<384;i+=2) { if((dinId[i/2]<=0)&&(dinQd[i/2]<=0)) {doutd[i]='000'; doutd[i+1]='000'; } else if((dinId[i/2]>0)&&(dinQd[i/2]>0)) {doutd[i]='777'; doutd[i+1]='777'; }
  • 86. 81 else if((dinId[i/2]<=0)&&(dinQd[i/2]>0)) {doutd[i]='000'; doutd[i+1]='777'; } else if((dinId[i/2]>0)&(dinQd[i/2]<=0)) {doutd[i]='777'; doutd[i+1]='000'; } } } 6.2.6 remove pilots and padding void remove_pilots_padding(COMPLEX data_inf[],float Ioutf[],float Qoutf[]) { int i; for(i=28;i<40;i++) { Ioutf[i-28]=data_inf[i].real; Qoutf[i-28]=data_inf[i].imag; } for(i=41;i<65;i++) { Ioutf[i-29]=data_inf[i].real; Qoutf[i-29]=data_inf[i].imag; } for(i=66;i<90;i++) { Ioutf[i-30]=data_inf[i].real; Qoutf[i-30]=data_inf[i].imag; } for(i=91;i<115;i++) { Ioutf[i-31]=data_inf[i].real; Qoutf[i-31]=data_inf[i].imag; } for(i=116;i<128;i++) { Ioutf[i-32]=data_inf[i].real; Qoutf[i-32]=data_inf[i].imag; } for(i=129;i<141;i++) { Ioutf[i-33]=data_inf[i].real; Qoutf[i-33]=data_inf[i].imag; } for(i=142;i<166;i++) { Ioutf[i-34]=data_inf[i].real; Qoutf[i-34]=data_inf[i].imag; } for(i=167;i<191;i++) { Ioutf[i-35]=data_inf[i].real; Qoutf[i-35]=data_inf[i].imag;
  • 87. 82 } for(i=192;i<216;i++) { Ioutf[i-36]=data_inf[i].real; Qoutf[i-36]=data_inf[i].imag; } for(i=217;i<229;i++) { Ioutf[i-37]=data_inf[i].real; Qoutf[i-37]=data_inf[i].imag; } } 6.2.7 converting from complex to float void before_fft(float din_testf[],COMPLEX samplesf[]) { short i; for(i=0;i<2*320;i+=2) { samplesf[i/2].real=din_testf[i]; samplesf[i/2].imag=din_testf[i+1]; } } 6.2.8 Packet detection int detection_of_packet(float reci,float recq,float m[])// reci&recq are the real and imaginary of the input sample, m is the vector containing the previous division values { int i; for(i=0;i<128;i++) { prei[i]=pre[i].real; preq[i]=pre[i].imag; } for(i=0;i<255;i++) { testi[i]=testi[i+1]; testq[i]=testq[i+1]; } testi[255]=reci; testq[255]=recq; for(i=0;i<128;i++) { second_frame.real=((testi[i]*prei[i])+(testq[i]*preq[i])); second_frame.imag=((testq[i]*prei[i])-(testi[i]*preq[i])); testmag=sqrt((second_frame.real*second_frame.real)+(second_frame.imag*second_ frame.imag)); second+=testmag ; } for(i=128;i<256;i++) {
  • 88. 83 first_frame.real=(testi[i]*prei[i-128])+(testq[i]*preq[i-128]); first_frame.imag=(testq[i]*prei[i-128])-(testi[i]*preq[i-128]); testmag=sqrt((first_frame.real*first_frame.real)+(first_frame.imag*first_frame.imag)); first+=testmag ; } for(i=0;i<9;i++) m[i]=m[i+1]; m[9]=first/second; mean=(m[0]+m[1]+m[2]+m[3]+m[4]+m[5]+m[6]+m[7]+m[8]+m[9])/10; var_cal=variance(m,mean); if ((mean>(1+2*var_cal))) flag=1; if((flag==1)&&(mean>(max/2))) { if (mean>max) { max=mean; count=0; } else count++; return 0; } else if(flag==1) return 1; else return 0; } 6.2.9 calculating variance float variance (float vec_of_num[],float new_mean) { int i; float var=0; for(i=0;i<10;i++) var+=vec_of_num[i]*vec_of_num[i]; var=var/10; var=var-(new_mean*new_mean); return var; } 6.2.10 channel estimation void channel_estm(COMPLEX input[],COMPLEX out[]) { int i; float estmag,estphase,mag,phase; for(i=0;i<28;i++) { out[i].imag=0; out[i].real=0;
  • 89. 84 } for(i=229;i<256;i++) { out[i].imag=0; out[i].real=0; } estmag=sqrt((input[40].real*input[40].real)+(input[40].imag*input[40].imag)); //Estimating the error in magnitude estphase=atan(input[40].imag/input[40].real); //Estimating the error in phase for(i=28;i<53;i++) { mag=sqrt((input[i].real*input[i].real)+(input[i].imag*input[i].imag)); phase=atan(input[i].imag/input[i].real); if(input[i].real<0)phase=phase+PI; mag=mag/estmag; //correcting the error in magnitude phase=phase-estphase; //correcting the error in phase out[i].real=mag*cos(phase); out[i].imag=mag*sin(phase); } estmag=sqrt((input[65].real*input[65].real)+(input[65].imag*input[65].imag)); estphase=atan(input[65].imag/input[65].real); //here we subrtact PI as the pilot was -1 for(i=53;i<78;i++) { mag=sqrt((input[i].real*input[i].real)+(input[i].imag*input[i].imag)); phase=atan(input[i].imag/input[i].real); if(input[i].real<0)phase=phase+PI; mag=mag/estmag; //correcting the error in magnitude phase=phase-estphase; //correcting the error in phase out[i].real=mag*cos(phase); out[i].imag=mag*sin(phase); } estmag=sqrt((input[90].real*input[90].real)+(input[90].imag*input[90].imag)); estphase=atan(input[90].imag/input[90].real); for(i=78;i<103;i++) { mag=sqrt((input[i].real*input[i].real)+(input[i].imag*input[i].imag)); phase=atan(input[i].imag/input[i].real); if(input[i].real<0)phase=phase+PI; mag=mag/estmag; //correcting the error in magnitude phase=phase-estphase; //correcting the error in phase out[i].real=mag*cos(phase); out[i].imag=mag*sin(phase); } estmag=sqrt((input[115].real*input[115].real)+(input[115].imag*input[115].imag)); estphase=atan(input[115].imag/input[115].real); for(i=103;i<128;i++) { mag=sqrt((input[i].real*input[i].real)+(input[i].imag*input[i].imag)); phase=atan(input[i].imag/input[i].real); if(input[i].real<0)phase=phase+PI; mag=mag/estmag; //correcting the error in magnitude phase=phase-estphase; //correcting the error in phase out[i].real=mag*cos(phase);
  • 90. 85 out[i].imag=mag*sin(phase); } out[128].real=0;out[128].imag=0; estmag=sqrt((input[141].real*input[141].real)+(input[141].imag*input[141].imag)); estphase=atan(input[141].imag/input[141].real); for(i=129;i<154;i++) { mag=sqrt((input[i].real*input[i].real)+(input[i].imag*input[i].imag)); phase=atan(input[i].imag/input[i].real); if(input[i].real<0)phase=phase+PI; mag=mag/estmag; //correcting the error in magnitude phase=phase-estphase; //correcting the error in phase out[i].real=mag*cos(phase); out[i].imag=mag*sin(phase); } estmag=sqrt((input[166].real*input[166].real)+(input[166].imag*input[166].imag)); estphase=atan(input[166].imag/input[166].real); for(i=154;i<179;i++) { mag=sqrt((input[i].real*input[i].real)+(input[i].imag*input[i].imag)); phase=atan(input[i].imag/input[i].real); if(input[i].real<0)phase=phase+PI; mag=mag/estmag; //correcting the error in magnitude phase=phase-estphase; //correcting the error in phase out[i].real=mag*cos(phase); out[i].imag=mag*sin(phase); } estmag=sqrt((input[191].real*input[191].real)+(input[191].imag*input[191].imag)); estphase=atan(input[191].imag/input[191].real); for(i=179;i<204;i++) { mag=sqrt((input[i].real*input[i].real)+(input[i].imag*input[i].imag)); phase=atan(input[i].imag/input[i].real); if(input[i].real<0)phase=phase+PI; mag=mag/estmag; //correcting the error in magnitude phase=phase-estphase; //correcting the error in phase out[i].real=mag*cos(phase); out[i].imag=mag*sin(phase); } estmag=sqrt((input[216].real*input[216].real)+(input[216].imag*input[216].imag)); estphase=atan(input[216].imag/input[216].real); for(i=204;i<229;i++) { mag=sqrt((input[i].real*input[i].real)+(input[i].imag*input[i].imag)); phase=atan(input[i].imag/input[i].real); if(input[i].real<0)phase=phase+PI; mag=mag/estmag; //correcting the error in magnitude phase=phase-estphase; //correcting the error in phase out[i].real=mag*cos(phase); out[i].imag=mag*sin(phase); } }
  • 91. 86 6.2.11 Frequncy synchronization //this function gets the offset frequency to be used for correction float freq_sync(COMPLEX det[]) { COMPLEX z; int i; float zreal,zimag,anglez,Ts,f_offset; Ts=125*pow(10,-9); //sampling time z.real=0; z.imag=0; for(i=0;i<128;i++) { zreal=(det[i].real*det[i+128].real)+(det[i].imag*det[i+128].imag); z.real=zreal+z.real; zimag=(det[i].imag*det[i+128].real)-(det[i].real*det[i+128].imag); z.imag=zimag+z.imag; } anglez=atan(z.imag/z.real); f_offset=(-1/(2*PI*128*Ts))*anglez; //offset frequency return f_offset; } 6.2.12 frequncy correction void freq_correction(COMPLEX d_fault[],COMPLEX d_correct[]) { int i; float Ts; //sampling time; COMPLEX correction; Ts=125*pow(10,-9); for(i=0;i<256;i++) { correction.real=cos(2*PI*Ts*freq_offset*(i+65)); correction.imag=sin(2*PI*Ts*freq_offset*(i+65)); d_correct[i].real=(d_fault[i].real*correction.real)+(d_fault[i].imag*correction.ima g); d_correct[i].imag=- (d_fault[i].real*correction.imag)+(d_fault[i].imag*correction.real); } } void removeguardband(COMPLEX din[],COMPLEX dout[]) { int i; for(i=0;i<256;i++) { dout[i].real=din[i+64].real; dout[i].imag=din[i+64].imag; } }
  • 92. 87 6.2.13 Remove Guard band void removeguardband(COMPLEX din[],COMPLEX dout[]) { int i; for(i=0;i<256;i++) { dout[i].real=din[i+64].real; dout[i].imag=din[i+64].imag; } }
  • 93. 88 7- Conclusion Conclusion : Throughout this project we have learned much about one of the most important wireless communication systems that will lead the wireless market in the following few years ,and also Digital Signal Processor gave us a great experience in dealing with Embedded Systems. This project gave us a real opportunity to work as a team & to know how to manage projects, disaster recovery & work under pressure. In brief we have learned the following about WiMAX WiMAX is a huge system; its complete implementation may take several years of work. In our project we've implemented almost most of the physical layer on the DSP kit. We hope that the students in the upcoming years would complete the system. Referring to figure 3.2, the system is composed of 4 parts: 1- BB physical layer 2- MAC layer (Network interface) 3- Digital IF stage 4- RF stage We suggest the following stages as a step towards the complete implementation of the system: Stage 1: Completing the remaining parts of the physical layer which are: • Adaptive modulation • Power control • Uplink and downlink subframes Stage 2: Implementing the MAC common part sublayer of the system, this may need more than one group. Stage 3: Implementing the security sublayer Stage 4: Implementing the digital IF stage Stage 5: Implementing the RF stage
  • 94. I Appendix A :Decoder&Turbo Encoder 2.1 Turbo Encoder: Turbo code is a parallel or serial concatenated convolutional code constructed from low-complexity recursive systematic convolutional (RSC) codes. We are only concerned with parallel concatenated convolutional codes (PCCC). An example of such a code is shown in Figure 1. The basic convolutional codes which are concatenated in this scheme are usually two identical recursive codes, with a relatively small number of states (i.e., 8-states for the example in Figure 1). The input to the top encoder, labeled “Encoder 1,” is information sequence U, and the outputs are parity sequences C0 andC1. The input to the bottom encoder, labeled “Encoder 2,” is block-interleaved version of the original information sequence, denoted U’, and the output are parity sequences C0’ and C1’. The output of the overall encoder is obtained through puncturing and multiplexing of systematic sequences U and U’ and coded sequences C0,C1,C0’ and C1’. It usually consists of the systematic component U, and two parity components C and C’, where C is obtained by puncturing and multiplexing C0 and C1, and C’ is obtained by puncturing and multiplexing C0’ and C1’. As an example, rate 1/3 turbo code is obtained when the overall output consists of multiplexed sequences U, C0 and C0’. Figure1. Turbo Code with Recursive 8-State Encoders Turbo encoding is performed on blocks of information bits of length N. To facilitate the decoding process, the encoders are in state 0 at the beginning of the frame, and they are also brought to state 0 at the end of the frame. This is achieved by appending tail bits after the information bits. Since the encoder is recursive, the bit sequence which brings the encoder into state zero is not necessarily a zero sequence. Instead, it depends on the state of the encoder after the information bits have been encoded.
  • 95. II 2.2 Turbo Decoder: The decoding of turbo codes is based on an iterative structure constructed from two MAP decoders, one for each constituent encoder. A high-level block diagram of a turbo decoder is shown in Figure 2. Figure2. Turbo Decoder The decoder operates in the log-likelihood ratio domain, i.e., instead of operating on a priori, aposteriori probabilities and channel likelihoods, it operates on the log- likelihood ratio (LLR) of these quantities, defined as: Each MAP decoder has three inputs: a prior LLR for systematic bits La(U), channel LLR for systematic bits Lc(U) and channel LLR for parity bits Lc(C). The computation of channel LLRs is discussed in section 2.2.1. The output of each MAP decoder is called “extrinsic LLR” and is denoted Le(U). This quantity will be described in section 2.2.2. Initially, the a priori input into MAP1, La1(U), is zero. The output of MAP1, Le1(U), is interleaved and sent to MAP2 as a prior input La2(U). The output of MAP2, Le2(U), is deinterleaved and sent back to MAP1 as a prior input La1(U). This “loop” is performed a certain number of iterations. The desired effect is that the extrinsic LLRs increase in absolute value after each iteration. This effectively improves reliability of the decoding, and decreases bit error rate (BER). It has been showed by exhaustive simulations that, after certain number of iterations, further decoding does not yield any additional BER improvement. In order to reduce processing delay of the decoding process, it is of interest to stop the decoding as soon as this point has been reached. This can be performed by applying a stopping further discussed in section 2.2.5. After the iterative process has been terminated, the final LLR L(U) is computed as a sum of extrinsic information at the output of each MAP decoder, Le1(U) and Le2(U), and channel LLR for systematic bits Lc(U). The final LLR is sent to a threshold device which generates binary (hard) decisions U^ based on the sign of the LLR, as shown in section 2.2.6.
  • 96. III 2.2.1 Channel LLR Computation Binary outputs of the turbo encoder, denoted U, C and C’ in Figure 1, are modulated and send over a noisy channel. Prior to modulation, signal point mapping is performed as follows: If the channel is considered to be fading channel with additive white Gaussian noise, channel outputs corresponding to the systematic bits are: where aU(t) is the fading channel coefficient, and nU(t) is the noise sample with zero mean and variance No/2. Similarly, the channel outputs corresponding to the parity bits are: If the channel can be assumed to be non-fading, the fading coefficient is aU(t)= aC(t)= aC'(t)= 1. Alternatively, the fading coefficient, along with noise variance No can be approximately determined using channel estimation algorithms. The channel likelihood for systematic bits XU(t) is the probability that value yU(t) has been received, given that XU(t) has b !Unexpected End of Formulaeen transmitted, and given that aU(t) is known. This is computed based on the assumption that yU(t)-aU(t)XU(t) is a Gaussian variable with zero mean and variance No/2. The channel likelihood is then computed as follows: 2.2.2 MAP Decoding The algorithm which is used as a basis for MAP decoding is the Bahl Cocke Jelinek Raviv (BCJR) algorithm, which exploits the trellis structure of a convolutional code. Previous to the discovery of turbo codes, this algorithm has not been used for decoding of convolutional codes due to the availability of a lower complexity Viterbi algorithm (for maximum-likelihood decoding of convolutional codes). The Viterbi
  • 97. IV algorithm, however, delivers only hard decisions, and not probability distributions (or LLR’s) and can therefore not directly be used in turbo decoding. The notation for trellis branches used in the subsequent sections is shown in Figure 3. Branch start state is m’, and the end state is m. The symbol U(b) is the input label, i.e., it represents the input into the encoder. The symbol C(b) is the output label, or the corresponding output of the encoder which was in state m’ and received input U(b). Figure 3. Branch Notation The BCJR algorithm for MAP decoding of convolutional codes consists of the following steps: Compute branch metric: This quantity is similar to the local metrics used in Viterbi decoding. The branch metrics represents the logarithm of the probability of branch b at time t, computed only based on the knowledge of the channel and a priori LLRs of input and output symbols associated with the branch (i.e., not path history through the trellis). For a branch b which connects state m’ at time (t−1) and state m at time t, labeled with input/output pair (U(b),C(b)), the branch metric is computed as: where Lc(U(t))and Lc(C(t)) are systematic and parity channel LLRs, respectively, and La(U(t)) is a priori LLR. 2- Compute forward state metric (α) This quantity is similar to accumulated state metrics in Viterbi decoding, and represents log-probability of state m at time t, given probabilities of states at previous time instances (i.e., knowledge of trellis history). For state m at time t, the forward state metric is computed as: where the summation is performed over all states m’ at time t−1 which are connected through a trellis branch to state m at time t. 3- Compute backward state metrics (β) This quantity represents the accumulated state metrics, when the trellis is traversed starting from the last stage. It is the log-probability of state m at time t, given probabilities of states at future time instances (i.e., knowledge of trellis “future”). For state m at time t, the backward state metric is computed as: where the summation is performed over all states m’ at time t+1 which are connected through a trellis branch to state m at time t. 3- Compute extrinsic LLR The final output of MAP decoder is obtained by computing the total LLR of bit U(t), given forward and backward state metrics as well as branch metrics for time t, and
  • 98. V subtracting the systematic channel LLR for bit U(t), LC(U(t)), and apriori LLR for bit U(t), La(U(t)), both given at the input to the MAP decoder. The output therefore represents only the “refinement” term, or extrinsic LLR: where the summations in the numerator and denominator are performed over all branches which are labeled with input labels 1 and 0, respectively. It can be observed that the most computations involved in MAP decoding are based on the logarithm of a sum of exponentials. Such an expression can be exactly computed, two terms at a time, using the Jacobian logarithm : i.e., as the maximum exponent and a correction term which is a function of the absolute difference between exponents. If the correction term is omitted and only max term is used to compute α,βand extrinsic LLR, we obtain the so-called max-log-MAP approximation. If the correction term is approximated using a small lookup table, we obtain the max*-log-MAP approximation. This approximation yields significant BER improvements and is usually preferred over the max-log-MAP solution, in spite of slightly increased computational complexity. 2.2.3 Sliding Window MAP Decoding One of the drawbacks of the MAP decoding algorithm is its large storage requirements. Forward state metrics αand backward metrics βneed to be computed and stored for all states and all stages in the trellis, since they are required for the last step in the algorithm, extrinsic LLR computation. It is possible to combine α or βaccumulation with extrinsic information, such that only αor βneeds to be stored. This represents (N+K−1)*2^(K−1) values which need to be stored, for frame of N information bits and code constraint length K. In order to reduce memory requirements, large frames can be split into sliding windows, and MAP decoding can be performed on each sliding window independently. For non-sliding window MAP implementation, α and β are initialized in such a manner that probability 1 is given to α0(0) and β N+K−1(0), since it is known that the initial and the final states of the encoder are zero. When the frame is split into independent sliding windows, the initial and final states for each window are not known. Therefore, equal probability is given to all α’s at the first stage in the window, and all β’s at the last stage of the window. In order to achieve reliable decoding, the first segment of α’s as well as the last segment of β’s should not be used in the final computation of extrinsic information. We call these initial and final segments of the window “header prolog” and “tail prolog”, espectively, and denote them P. The extrinsic LLR is only computed over the middle segment of the sliding window, also called “reliability length” and denoted R. In order to obtain extrinsic LLRs for all bits in the frame, the sliding windows should be organized in such a manner that reliability segments of neighbouring windows do not overlap nor form a gap. The header prolog should be overlapped with reliability length of the previous sliding window, and the tail prolog should be overlapped with reliability length of the following sliding window, as shown in Figure 4. Note also that the first
  • 99. VI window does not require header prolog, since the initial state is known, and for the last window the K−1 tail bits are used instead of the prolog to initialize β’s. With sufficiently large values for P and R, this approach does not result in any BER degradation. A rule of thumb is to use P equal to 3 to 5 times the number of states. Figure 4. Sliding Window MAP Processing 2.2.4 Interleaving/Deinterleaving It is necessary to interleave or deinterleave extrinsic LLRs before they can be used as apriori LLRs of the “other” MAP decoder. This function is typically performed using a look-up table. If entry at location “i” in the lookup table has value “ii”, i.e., lut[i]=ii, location “i” in the original frame will be copied to location “ii” in the interleaved frame. Deinterleaving is performed using the lookup table in the reverse direction, i.e., location “ii” in the original frame will be copied to location “i” in the deinterleaved frame. If frames are very long, it may not be feasible to store the interleaver lookup table, in which case the table would need to be generated on the fly. 2.2.5 Stopping Criterion Research results have confirmed that after a certain number of iterations, there is no benefit in terms of BER of performing additional iterations. The most frequently used number is 6−8 iterations, although the number of useful iterations is proportional to the frame size. A safe approach would be to run the turbo decoder for a fixed (large) number of iterations. This, however, increases processing delay and could waste power. Recently, algorithms have been devised which can determine automatically if more iterations would yield additional error corrections or not. Such algorithms are called “stopping criteria” and are typically based on some statistics of the extrinsic LLR. The algorithm used in the TCP implementation is based on the computation of the SNR of extrinsic information, and comparing it against a user-defined threshold. 2.2.6 Hard-Decision Generation After the last iteration, the final LLR L(U) is computed as a sum of systematic channel LLR LC(U), extrinsic LLR of first MAP, Le1(U) and deinterleaved extrinsic LLR of second MAP, Le2(U). The hard (binary) decision at the output of the turbo decoder is computed based on the sign of the final LLR as follows:
  • 100. VII Appendix B Turbo encoder Testing code #include<iostream.h> #include<fstream.h> #include<math.h> typedef unsigned short int ushort; ushort Frame[36],s[3],q,input[10],enip; //s is the convolutional registers states ushort Data[12],c0[12],c1[12],c0b[12],c1b[12],Data_int[12]; ushort tdata[3],tc0[3],tc1[3],tdatab[3],tc0b[3],tc1b[3]; ////////////////////////////convolutional encoder//////////////////////////// int i; void convolution (ushort X[],ushort Y0[],ushort Y1[],ushort flag) { if (flag==0) for (i=0;i<12;i++) { enip=X[i]^s[1]^s[2]; Y0[i]= enip^s[0]^s[2]; Y1[i]=enip^s[0]^s[1]^s[2]; q=enip; s[2]=s[1]; s[1]=s[0]; s[0]=q; } else for(i=0;i<3;i++) { X[i]=s[1]^s[2]; enip=X[i]^s[1]^s[2]; Y0[i]= enip^s[0]^s[2]; Y1[i]=enip^s[0]^s[1]^s[2]; q=enip; s[2]=s[1]; s[1]=s[0]; s[0]=q; } } ////////////////////////////////////////////////////////////////////////// //////////////////////interleaver///////////////////////////////////////// void interleave (ushort M[],ushort Mb[]) { int k; for ( i=0;i<12;i++) { k=(12/6)*(i%6)+floor(i/6); Mb[k]=M[i]; } } ///////////////////////////////////////////////////////////////////////// ////////////////////////main///////////////////////////////////////////// void main (void) { int j; ushort bag=0xff; for (j=0;j<10;j++) {
  • 101. VIII input[j]=bag^0xff; bag=input[j]; } for (i=0;i<12;i++) { if (i<10) Data[i]=input[i]; else Data[i]=0x00; c0[j]=0x00; c1[j]=0x00; } convolution(Data,c0,c1,0); convolution(tdata,tc0,tc1,1); interleave(Data,Data_int); convolution (Data_int,c0b,c1b,0); convolution(tdatab,tc0b,tc1b,1); ///////////////////////////////////////////////////////////////////////////// ///////////////////////Framing/////////////////////////////////////////////// ofstream fout("m.txt"); j=0; for (i=0;i<24;i++) { Frame[i]=Data[j]; if ((j%2)==0) {i=i+1; Frame[i]=c0[j]; } else {i=i+1; Frame[i]=c0b[j]; } j+=1; } j=0; for(i=24;i<30;i++) {Frame[i]=tdata[j]; i=i+1 ; Frame[i]=tc0[j]; j+=1; } j=0; for(i=30;i<36;i++) {Frame[i]=tdatab[j]; i=i+1; Frame[i]=tc0b[j]; j+=1; } for (i=0;i<36;i++) { fout<<Frame[i] <<' '; } fout.close(); cout<<endl; cin>>q; }
  • 102. IX Appendix C Matlab simulation code This part is for the interleaver testing %to see the effect of burst errors with interleaving msg=randint(1,128*100);%original message consists of 100 symbols each one 192 bits which are input to the interleaver %In this part we encode using repition 3 code coded_msg=repmat(msg,3,1); coded_msg=reshape(coded_msg,1,38400); datatx=coded_msg; %this part is for the interleaver k=0:383; % K is the index of the input bits, block size of the interleaver for BPSK modulation=384 m=(384/12)*mod(k,12)+floor(k/12);%indicies for the interleaver data=coded_msg(1:384); datatx=intrlv(data,m+1); for k=1:99 h=k*384+1; msg1=coded_msg(h:h+383); intrlv1=intrlv(msg1,m+1); datatx=[datatx intrlv1];%datatx is the interleaved version of the data end %in the next lines mapping to QPSK is made to form I,Q I1=zeros(1,19200); Q1=zeros(1,19200); for i=2:2:38400 if(datatx(i-1)==0 && datatx(i)==0) I1(i/2)=-1; Q1(i/2)=1; end if(datatx(i-1)==0 && datatx(i)==1) I1(i/2)=-1; Q1(i/2)=-1; end if(datatx(i-1)==1 && datatx(i)==0) I1(i/2)=1; Q1(i/2)=1; end if(datatx(i-1)==1 && datatx(i)==1) I1(i/2)=1; Q1(i/2)=-1; end end time=2E-6:2E-6:0.0384;%for simulation I=[time;I1]; Q=[time;Q1]; I=I';% these I and Q shall go to simulink Q=Q'; After that both I, Q enter simulink model. The next part is for reception %this part is to convert the complex received signal from simulink into the original bits(demapping) rxdata=reshape(rxdata,1,19201); rxdata=rxdata(2:19201); Irx=real(rxdata);
  • 103. X Qrx=imag(rxdata); Irx=Irx>0; Irx=2*Irx-1; Qrx=Qrx>0; Qrx=2*Qrx-1; for i=2:2:38400 if(Irx(i/2)==-1 && Qrx(i/2)==1) datarec(i-1)=0; datarec(i)=0; else if(Irx(i/2)==-1 && Qrx(i/2)==-1) datarec(i-1)=0; datarec(i)=1; else if(Irx(i/2)==1 && Qrx(i/2)==1) datarec(i-1)=1; datarec(i)=0; else if(Irx(i/2)==1 && Qrx(i/2)==-1) datarec(i-1)=1; datarec(i)=1; end end end end end %this part is for deinterleaving k=0:383; %k is the index of the received bits l=12*k-383*floor(12*k/384);%indicies for the deinterleaver data1=datarec(1:384); datarx=intrlv(data1,l+1); for k=1:99 h=k*384+1; msg1=datarec(h:h+383); intrlv1=intrlv(msg1,l+1); datarx=[datarx intrlv1];%datatx1 is the deinterleaved version of the data end decoded_data=zeros(1,12800); %this part is for repition 3 decode for k=1:3:38400 vector=datarx(k:k+2); m=((k-1)/3)+1; if sum(vector)>=2 decoded_data(m)=1; else decoded_data(m)=0; end end %here we get the BER BER=1-sum(decoded_data==msg)/length(msg) %these are the simulation results for BER versus Eb/No in a Rayleigh %fading channel with and without an interleaver using a repitition 3 %code ebno=[2 5 6 7 10 12 14 17 20]; BER1=[0.4551 0.4477 0.4607 0.4502 0.4322 0.4287 0.4141 0.3914 0.3951];%with interleaver BER2=[0.6041 0.6202 0.6238 0.6293 0.6216 0.6141 0.6015 0.5830 0.5780];%without interleaver plot(ebno,BER1) hold plot(ebno,BER2) %these are the BER results for an AWGN channel versus Rayleigh fading %channel after simulation using simulink and the above code EbNo=[2 5 6 7 10 12 14 17 20] BER3=[0.6041 0.6202 0.6238 0.6293 0.6216 0.6141 0.6015 0.5830 0.5780] %BER3 is in Rayleigh fading channel BER4=[0.0225 0.0058 0.0024 1.5e-5 0 0 0 0 0 ] %BER4 is in AWGN channel
  • 104. XI plot(EbNo,BER3); hold plot(EbNo,BER4); % this code is used to show the importance of adding a piolt to the data % and how it improves BER, also it shows that if more piolts are used, % better BER is obtained. This part is for pilot testing First we transmit: I=randint(1,98); Q=randint(1,98); I=2*I-1; I=[1 I 1]; % we add 2 BPSK pilots at the beginning and at the end of the data bits %so their I=1 and Q=0 Q=2*Q-1; Q=[0 Q 0]; data=I+j*Q; time=0.1:0.1:10; I=[time' I']; Q=[time' Q']; Then we enter simulink After that we estimate the phase and frequency of the pilot to be used for correction: amp1=abs(simout(2)); %amplitude of the 1st pilot phase1=angle(simout(2));%phase of the 1st pilot amp2=abs(simout(101)); %amplitude of the 2nd pilot phase2=angle(simout(101));%phase of the 2nd pilot %the next 2 lines correct the data using the 2 pilots y=(simout(2:50)./amp1).*exp(-j*phase1); y2=(simout(51:101)./amp2).*exp(-j*phase2); %In this part we compare the received data after correction with a %threshold(=0) x=real(y); x=x>0; x=2*x-1; z=imag(y); z=z>0; z=2*z-1; rxdata(1:48)=x+j*z;%1st 50 bits of the data x2=real(y2); x2=x2>0; x2=2*x2-1; z2=imag(y2); z2=z2>0; z2=2*z2-1; rxdata(49:98)=x2+j*z2;%last bits of the data rx_data=rxdata(1:98); tx_data=data(2:99); tx_data=reshape(tx_data,size(rx_data)); error=(tx_data==rx_data); ber=1-sum(error)/length(error)%To get the BER This part is for packet detection algorithm % This part is for preamble generation pall=[1-i,1-i,-1-i,1+i,1-i,1-i,-1+i,1-i,1-i,1-i,1+i,-1-i,1+i,1+i,-1-i,1+i,-1-i,-1-i,1-i,-1+i,1-i,1-i,-1-i,1+i,1-i,1- i,-1+i,1-i,1-i,1-i,1+i,-1-i,1+i,1+i,-1-i,1+i,-1-i,-1-i,1-i,-1+i,1-i,1-i,-1-i,1+i,1-i,1-i,-1+i,1-i,1-i,1-i,1+i,-1- i,1+i,1+i,-1-i,1+i,-1-i,-1-i,1-i,-1+i,1+i,1+i,1-i,-1+i,1+i,1+i,-1-i,1+i,1+i,1+i,-1+i,1-i,-1+i,-1+i,1-i,-1+i,1- i,1-i,1+i,-1-i,-1-i,-1-i,-1+i,1-i,-1-i,-1-i,1+i,-1-i,-1-i,-1-i,1-i,-1+i,1-i,1-i,-1+i,1-i,-1+i,-1+i,-1-i,1+i,0,-1- i,1+i,-1+i,-1+i,-1-i,1+i,1+i,1+i,-1-i,1+i,1-i,1-i,1-i,-1+i,-1+i,-1+i,-1+i,1-i,-1-i,-1-i,-1+i,1-i,1+i,1+i,-1+i,1- i,1-i,1-i,-1+i,1-i,-1-i,-1-i,-1-i,1+i,1+i,1+i,1+i,-1-i,-1+i,-1+i,1+i,-1-i,1-i,1-i,1+i,-1-i,-1-i,-1-i,1+i,-1-i,-1+i,- 1+i,-1+i,1-i,1-i,1-i,1-i,-1+i,1+i,1+i,-1-i,1+i,-1+i,-1+i,-1-i,1+i,1+i,1+i,-1-i,1+i,1-i,1-i,1-i,-1+i,-1+i,-1+i,- 1+i,1-i,-1-i,-1-i,1-i,-1+i,-1-i,-1-i,1-i,-1+i,-1+i,-1+i,1-i,-1+i,1+i,1+i,1+i,-1-i,-1-i,-1-i,-1-i,1+i,1-i,1-i,];
  • 105. XII pall2=[zeros(1,28) pall zeros(1,27)]; p464=[]; for j=1:length(pall2) if mod((j-101),2)==0 p464=[p464 sqrt(2)*(pall2(j))]; end end timedom=ifft(p464); timedom2=[]; for j=65:128 timedom2=[timedom2 timedom(j)]; end preample=[timedom2 timedom timedom]; testvec=[conj(timedom) conj(timedom)]; rec=sqrt(.00015)*ones(1,256); noise=sqrt(.00015)*((randn(1,700)+i*randn(1,700))); noise(321:640)=noise(321:640)+preample; for j=1:700 rec(1:255)=rec(2:256); rec(256)=noise(j); test=rec.*testvec; test=(abs(test)); test=reshape(test,[],1); division(j)=((sum(test(129:256)))./(sum(test(1:128)))); end plot(division) This part is frequency synchronization pre_real=randint(1,128);%real part of the preamble to be repeated Itx=[pre_real pre_real]; I1=[Itx(193:256) Itx randint(1,680)]; I1=2*I1-1; pre_imag=randint(1,128 ;) Qtx=[pre_imag pre_imag]; Q1=[Qtx(193:256) Qtx randint(1,680)]; Q1=2*Q1-1; data=I1+j*Q1; time=125e-9:125e-9:125e-6; I=[time;I1]; I=I;' Q=[time;Q1]; Q=Q;' Ts=125e-9; %sampling time %this part is after receiving for frequency offset estimation drx=reshape(dout,1,10001); drx=drx(2:10001); d1=drx(1:100); d2=drx(101:200); d2=d2'; d2=reshape(d2,size(d1)); d=sum(d1.*d2); f_offset=(-1/(2*pi*100*Ts))*angle(d)%frequency offset equals 10KHZ which is correct Then we'll make frequency correction as follows: %this part is for frequency correction corr=zeros(1,10000); for n=1:10000 %corr(n)=drx(n).*exp(-j*2*pi*0.01*f_offset*n); corr(n)=drx(n).*(cos(2*pi*Ts*f_offset*n)-j*sin(2*pi*Ts*f_offset*n)); end %assuming no noise the received signal after frequency offset etimation and correction is
  • 106. XIII %the same as the transmitted one. %this part is for BER calculations with frequency offset Irx1=real(drx); Irx=Irx1>0; Irx=2*Irx-1; Qrx1=imag(drx); Qrx=Qrx1>0; Qrx=2*Qrx-1; for i=1:1000 if((Irx(i)==I1(i))&&(Qrx(i)==Q1(i)))error(i)=0; else error(i)=1; end end BER=sum(error)/length(error( EbNo=[1 2 3 4 5]; BER1=[0.0400 0.0170 0.0060 0.001 0.0007];%with frequency offset and correction BER2=[0.0280 0.0180 0.0050 0.001 0.0006];%without frequency offset in AWGN plot(EbNo,BER1); hold plot(EbNo,BER2); % these are the BER results Eb/No=[1 2 3 4 5] BER=[0.0400 0.0170 0.0060 0.001 0.0007]% %BER=[0.0280 0.0180 0.0050 0.001 0.0006]
  • 107. XIV Appendix D List of Figures Figure 1.1-- WiMAX standards comparison ……………………………………….……6 Figure 1.2-- END-TO-END ARCHITECTURE EVOLUTIONS……………….……..…9 Figure 1.3-- 802.16 reference architecture……………………………………………..10 Figure 1.4-- IEEE STD 802.16 protocol layering………………………………………11 Figure 1.5-- OFDMA vs. OFDM/TDMA ………………………………………...….12 Figure 2.1-- Fresnel zone clearance ……………………………………………...…..14 Figure 2.2-- NLOS vs. LOS …………………………………………………………..…15 Figure 2.3-- Effect of CPE location… ………………………………………………..…16 Figure 2.4-- Multi carrier vs. Single carrier…………………………………………..…17 Figure 2.5-- OFDM performance in frequency selective fading.………………..……17 Figure 2.6-- the effect of sub-channelization……………….………………….………18 Figure 2.7-- Relative cell radii for adaptive modulation………………………..……...19 Figure 2.8-- OFDM subcarriers……………………………………………..…..……….20 Figure 2.9-- downlink and uplink subframes………………………………...…………20 Figure 3.1-- basic configuration of a software radio terminal…………….…..………24 Figure 3.2-- DSP based hardware transceiver…………………………….…..………25 Figure 3.3-- System design………………………………………………………...……27 Figure 3.4-- transmitter block diagram…………………………………………….……29 Figure 3.5-- PRBS for data randomization……………………………………….…….29 Figure 3.6-- BPSK, QPSK, 16-QAM and 64-QAM constellations……………...……32 Figure 3.7-- Downlink and network entry preamble structure…………………..……34 Figure 3.8-- PEVEN time domain structure………………………………………….……35 Figure 3.9-- receiver block diagram ……………………………………………….……36 Figure 3.10-- the response of the double sliding window packet detection Algorithm……………………………………………………………...…….37 Figure 3.11-- Double sliding window packet detection…………………………………38 Figure 3.12-- Effect of variance in symbol timing……………………………….………40 Figure 3.13-- SNR degradation due to frequency offset……………………...………..42 Figure 3.14-- link budget models ……………………………………………..………….46 Figure 3.15-- channel simulation simulink model……………………………….………47 Figure 4.1-- Interleaver test simulink model…………………………………...……….50 Figure 4.2-- BER curves with & without interleaver……………………………..…….51 Figure 4.3-- BER curves with and without fading………………………………..…….51 Figure 4.4-- Pilot test simulink model…………………………………………..……….52 Figure 4.5-- Output of packet detection algorithm……………………………………..53 Figure 4.6-- Frequency sync. test model……………………………………...………..53 Figure 4.7-- Performance of frequency correction algorithm …………………….….54 Figure 5.1-- EDMA Channel registers…………………………………………………..59
  • 108. XV Appendix E List of Tables Table 1—Modulation and coding combinations ………………………………….……21 Table 2—OFDM parameters…………………………………………………….….……28 Table 3-- block sizes of the bit interleaver………………………………………………31 Table 4—base station and CPE link budget analysis …………………………………46 Appendix F Abbreviations and Acronyms AAS Adaptive Antenna System ADC Analog to Digital Converter AP Access Point ATM Asynchronous Transfer Mode BB Baseband BER Bit Error Rate BPSK Binary Phase Shift Keying BS Base Station BWA Broadband Wireless Access CP Cyclic Prefix CPE Customer Premises Equipment DFT Discrete Fourier Transform DSP Digital Signal Processor EDMA Enhanced Direct Memory Access FCH Frame Contol Header FDD Frequency Division Duplex FEC Forward Error Correction FFT Fast Fourier Transform ICI Intercarrier Interference IF Intermediate Frequency IFFT Inverse Fast Fourier Transform IP Internet Protocol ISI Intersymbol Interference LAN Local Area Network LOS Line Of Sight MAC Media Access Control MAN Metropolitan Area Network NLOS Non Line Of Sight OFDM Orthogonal Frequency Division Multiplexing OFDMA Orthogonal Frequency Division Multiple Access PRBS Pseudo Random Binary Sequence QOS Quality Of Service QAM Quadrature Amplitude Modulation QPSK Quadrature Phase Shift Keying
  • 109. XVI RAN Regional Access Network RF Radio Frequency RNSN Radio Network Serving Node RTDX Real Time Data Exchange RX Receiver SFID Service Flow Identifier SNR Signal to Noise Ratio SS Subscriber Station SWR Software Radio TDD Time Division Duplex TDMA Time Division Multiple Access TX Transmitter WiMAX Worldwide Interoperability for Microwave Access Appendix G Application notes & references WiMAX standard 802.16-2004 Wireless Communications ' Theodore S.Rappaport' Communication Systems 4th Edition ' Haykin' OFDM Wireless LANs ' John Terry' A Technical Overview of the WirelessMAN Air Interface for Broadband Wireless access.pdf The Scientist and Engineer's Guide to Digital Signal Processing 'Steven W. Smith'