IN-VEHICLE POWERLINE COMMUNICATION USING SOFTWARE-DEFINED RADIO by

ROEE BAR B.Sc., Technion - Israel Institute of Technology, 2007

A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF

MASTER OF APPLIED SCIENCE

in

THE FACULTY OF GRADUATE AND POSTDOCTORAL STUDIES (Electrical and Computer Engineering)

The University of British Columbia (Vancouver)

August 2016

c Roee Bar, 2016 Abstract

Powerline communication is an attractive solution for in-vehicle communi- cation. However, the research of communication over powerlines requires field-testing and full access to communication protocol layers, particularly to the physical and the Media Access Control (MAC) layers. This ability can be accomplished through the use of software-defined radio along with real- time signal processing executed on a personal computer. In this work, we present the design and implementation of an IEEE 1901-based transceiver aimed for vehicular powerlines, written for GNU Radio and operated on Ettus Universal Software Radio Peripheral (USRP) N210 hardware. The software components include a C++ physical layer signal processing li- brary and several complementary GNU Radio blocks including a MAC layer block written in Python. The implemented capabilities include sev- eral channel estimation methods, a noise power spectral density estimator and an adaptive bit loading algorithm. We make all the software compo- nents available as an open source project to facilitate further development by the broader research community. We then show experimental results obtained with the system applied to a vehicle harness and a real vehicle powerline network. In the first part of the experiments, we demonstrate the correctness of the implementation, compare between several channel estimation methods, and test the system performance. In the second part, we examine the feasibility of reliable communication with IEEE 1901 over powerlines in a car. Our experiments show that IEEE 1901 along with the implemented receiver algorithm are capable of operating in the scenarios tested. The vehicular impulsive noise is identified as the primary cause for errors. In particular, our experiments show that it affects mainly the frame synchronization. Hence we believe that further investigations of in-vehicle

ii powerline communication should focus on alleviating the effect of impulse noise on synchronization.

iii Preface

The work presented in this thesis was completed in the Department of Elec- trical and Computer Engineering at the University of British Columbia un- der the supervision of Dr. Lutz Lampe. This thesis is original, unpublished, independent work by the author, R. Bar. This includes, but is not limited to, literature review, simulation design and implementation, coding, data analysis, and manuscript writing. Dr. Lampe contributed to the work as a secondary author by providing guidance and supervision throughout.

iv Table of Contents

Abstract ...... ii

Preface...... iv

Table of Contents...... v

List of Tables ...... ix

List of Figures...... x

List of Symbols...... xii

Glossary...... xiv

Acknowledgements ...... xvi

Dedication...... xvii

1 Introduction...... 1 1.1 In-Vehicle Communication Networks ...... 2 1.1.1 Communication Protocols...... 2 1.1.2 Next Generation Network...... 3 1.2 Powerline Communication...... 4 1.2.1 Powerline Communication Standards...... 5 IEEE 1901 ...... 7 1.3 Software-Defined Radio-Based Implementation ...... 7 1.4 Related Works...... 9 1.5 Contribution...... 10 1.6 Organization...... 10

v 2 Powerline Communication System Description...... 12 2.1 PHY Transmitter ...... 12 2.1.1 Overview ...... 12 2.1.2 Preamble Generation...... 14 2.1.3 Encoder ...... 15 Frame Control Encoder ...... 15 Payload Encoder...... 16 Turbo Convolutional Encoder...... 17 2.1.4 Symbol Generation...... 18 2.2 PHY Receiver ...... 20 2.2.1 Overview ...... 20 2.2.2 Frame Detection ...... 21 2.2.3 Symbol Alignment...... 22 2.2.4 Phase Estimation...... 23 2.2.5 Symbol Demodulation...... 25 2.2.6 Decoder ...... 27 Frame Control Decoder ...... 27 Payload Decoder...... 28 2.3 Channel Estimation...... 29 2.3.1 Sounding Method ...... 29 2.3.2 Payload Method ...... 31 2.3.3 Preamble Method...... 34 2.4 Noise Power Spectral Density Estimation...... 34 2.5 Adaptive Bit Loading...... 35 2.5.1 Incremental Algorithm...... 37 2.6 MAC Layer ...... 38 2.6.1 MAC Frame...... 38 2.6.2 MAC Protocol Data Unit (MPDU)...... 39 2.6.3 Channel Access...... 39 Sounding Process...... 40 2.7 Impulse Noise Model...... 40 2.7.1 Damped Sine Wave...... 42 Fourier Analysis ...... 43

vi 2.7.2 Periodic Impulse Noise ...... 45

3 Implementation Details...... 46 3.1 Overview...... 46 3.1.1 Development Platform...... 46 3.1.2 Structure...... 47 3.2 Ettus USRP N210...... 48 3.3 Lightplc ...... 49 3.4 GNU Radio Blocks ...... 51 3.4.1 PHY Hierarchical Block...... 51 3.4.2 PHY Rx Block...... 52 State Machine...... 53 Incoming Messages...... 54 3.4.3 PHY Tx Block...... 55 State Machine...... 55 Incoming Messages...... 56 3.4.4 MAC Block ...... 56 State Machine...... 57 Incoming Messages...... 57 User Parameters ...... 60 3.4.5 APP Layer Blocks...... 61 3.4.6 Impulse Source Block ...... 61 3.4.7 Transceiver ...... 61 3.5 Known Limitations...... 63

4 Experimental Results...... 65 4.1 System Setup ...... 65 4.1.1 PHY Parameters ...... 66 4.1.2 MAC Layer Parameters ...... 67 4.1.3 Power Spectral Density ...... 69 4.2 Car Cable Harness (White Noise)...... 70 4.2.1 Channel Estimation ...... 72 Comparison of Channel Estimation Methods . . . . . 73

vii 4.2.2 Bit Loading ...... 74 Bit Error Rate...... 76 4.2.3 Summary ...... 78 4.3 Car Cable Harness (Impulse Noise)...... 79 4.3.1 Noise Generation...... 79 4.3.2 Noise PSD...... 81 4.3.3 Bit Loading ...... 81 4.3.4 Performance...... 82 Bit Error Rate...... 83 PHY Rate ...... 84 Sync Error...... 85 Block Error ...... 86 4.3.5 Summary ...... 86 4.4 Real Car ...... 88 4.4.1 Results...... 89 Car-Off...... 89 Turn-Signal-On...... 90 Lights-Toggle...... 90 Wipers-On...... 91 Engine-On...... 93 4.4.2 Summary ...... 94

5 Conclusions...... 97 5.1 Conclusions ...... 97 5.2 Future Work...... 98

Bibliography ...... 100

A Derivations ...... 107 A.1 Rice Parameter Estimation...... 107 A.2 OFDM Symbol Energy...... 108 A.2.1 Generated Symbol ...... 108 A.2.2 Received Symbol...... 109

viii List of Tables

2.1 Modulation Types in IEEE 1901...... 19

4.1 Modified IEEE 1901 Properties ...... 68 4.2 Implementation-Specific Parameters...... 68 4.3 Impulse Noise Parameters...... 80 4.4 Car Car-Off Results...... 90 4.5 Car Lights-Toggle Results ...... 93 4.6 Car Wipers-On Results...... 93 4.7 Car Engine-On Results...... 95

ix List of Figures

2.1 PPDU Structure...... 13 2.2 Preamble Structure...... 15 2.3 PPDU Generation...... 16 2.4 IEEE 1901 Constituent Encoder...... 18 2.5 Modified Constituent Encoder ...... 18 2.6 PPDU Receive Path...... 21 2.7 Preamble Correlation...... 23 2.8 Master-Slave Channel Access...... 41 2.9 Damped Sine Wave...... 43 2.10 Damped Sine Wave Fourier Transform...... 44

3.1 Implementation Block Diagram...... 47 3.2 USRP N210 Architecture...... 49 3.3 PHY Hierarchical Block ...... 52 3.4 PHY Rx State Machine...... 53 3.5 PHY Tx State Machine...... 55 3.6 MAC Master State Machine...... 58 3.7 MAC Slave State Machine...... 59 3.8 Two-Transceiver Flow Graph ...... 62

4.1 IEEE 1901 Spectrum...... 67 4.2 OFDM Power Spectral Density ...... 70 4.3 Car Cable Harness ...... 71 4.4 Car Cable Harness Diagram...... 72 4.5 Car Cable Harness Channel Estimation ...... 73 4.6 Channel Estimation Methods Comparison...... 75 4.7 Number of Payload OFDM Symbols...... 76

x 4.8 Channel Estimation Methods PHY Rate...... 77 4.9 Channel Estimation Methods BER ...... 78 4.10 Car Cable Harness Noise PSD Estimation...... 82 4.11 Car Cable Harness SNR Estimation...... 83 4.12 Car Cable Harness Tone Map...... 84 4.13 Car Cable Harness Bit Error...... 85 4.14 Car Cable Harness PHY Rate ...... 86 4.15 Car Cable Harness Synchronization Error...... 87 4.16 Car Cable Harness Block Error ...... 88 4.17 Car Experiment Diagram...... 89 4.18 Car Channel in Lights-Toggle...... 91 4.19 Car Block Error Rate in Lights-Toggle ...... 92 4.20 Car Block Success and Sync Error in Wipers-On ...... 94

xi List of Symbols

General Notation

x(t) continuous time form of a signal x[n] discrete time form of a signal X[k] discrete Fourier transform of x[n] x∗ complex conjugate of x x vector form of a signal

Mathematical Symbols, Functions and Operations √ j = −1

ejt = cos(t) + j sin(t) ( ) 0 n 6= 0 δ[n] = 1 n = 0 ( ) 0 x < 0 u(x) = 1 x ≥ 0

1 ∗ Re(x) = 2 (x + x ) R ∞ −2πξt X(ξ) = F (x(t)) = −∞ x(t)e dt

Powerline Communication System Description (Chapter2)

N the number of samples or carriers in an OFDM symbol (2048) M the number of samples or carriers in a SYNCP/SYNCM symbol (256) T the sampling interval r(t) a received signal

xii s(t) a transmitted signal w(t) noise h(t) a channel impulse response

xiii Glossary

ADC Analog to Digital Converter APP Application BER Bit Error Rate BPSK Binary Phase-Shift Keying CRC Cyclic Redundancy Check DAC Digital to Analog Converter DC Direct Current DDC Digital Down Converter DFT Discrete Fourier Transform DUC Digital Up Converter FEC Forward Error Correction FPGA Field-Programmable Gate Array IDFT Inverse Discrete Fourier Transform i.i.d Independent and Identically Distributed LPF Low Pass Filter MAC Media Access Control MAP Maximum A Posteriori MPDU MAC Protocol Data Unit NMSE Normalized Mean Square Error OFDM Orthogonal Frequency-Division Multiplexing PC Personal Computer PHY Physical Layer PLC Powerline Communication PPDU PHY Protocol Data Unit PSD Power Spectral Density QAM Quadrature Amplitude Modulation

xiv QPSK Quaternary Phase-Shift Keying RF Radio Frequency ROBO Robust OFDM SIMD Single Instruction Multiple Data SDR Software-Defined Radio SNR Signal to Noise Ratio USRP Universal Software Radio Peripheral VNA Vector Network Analyzer

xv Acknowledgements

First I would like to thank Dr. Lutz Lampe for his guidance throughout my Master thesis work. It was a pleasure working with such a supportive and insightful supervision. I would like to acknowledge Auto21 for research funding during my project. I also greatly appreciate my previous teach- ers at the Technion for providing me a solid foundation. I am also deeply grateful for my family overseas for unconditional support. Finally, I would like to thank my caring and supportive wife, Tali. Over the past two years, she has made countless sacrifices and was dedicated to making sure I get enough food, sleep, and air. My heartfelt thanks.

xvi To Alma and Iddo with love, Aba

xvii Chapter 1

Introduction

Powerline Communication (PLC) is an attractive solution for in-vehicle communication. It brings some important advantages such as the need for fewer wires and an easier installation. For this reason, the PLC has been adopted in recent standards for communication between plug-in electrical vehicles and the charging infrastructure [1,2,3]. For in-vehicle communi- cation, PLC can be a stand-alone solution or a complementary solution as a backup or extension of an existing network. However, the vehicular pow- erlines are a harsh environment for communication. The main challenges are a high amplitude impulse noise and a time-varying channel impulse response. Hence, extensive in-situ testing of PLC solutions is necessary for design choices and verification of their suitability for in-vehicle communi- cation. In this work, we present a Software-Defined Radio1 (SDR) implemen- tation of a PLC transceiver that facilitates a field-test-guided design and verification. It is based on the IEEE 1901 standard comprising an IEEE 1901-based physical layer (PHY) as well as a minimal Media Access Control (MAC) layer. The implemented system has been used to perform measure- ments on an actual vehicle powerline, and we present here the results of our experiments. In the next section, we briefly review current in-vehicle communication networks and popular protocols. We then discuss the main challenges for in-vehicle PLC and describe the benefits of SDR for PLC research. 1We use the term software-defined radio even though we use the platform for wired- based communication rather than wireless communication.

1 Chapter 1. Introduction

1.1 In-Vehicle Communication Networks

A typical vehicle nowadays includes a multitude of sensors and processors for various purposes. In addition, electronic devices are increasingly re- placing the mechanical systems. All these and other electronic units have a need for a digital communication network that supports different types of data traffic. The data traffic types are often separated in categories as follows [4,5]. Control Data: This includes all data related to subsystems that control various aspects of the vehicle. Control data requires relatively low data rate with either high or low latency. Controlling safety critical systems such as suspension and braking systems requires low latency. Non-safety critical systems such as electronically controlled mirrors can use high latency. Safety Data: This data is related to driver-assist safety systems. Safety data usually requires low latency while the data rate depends on the ap- plication. Systems such as reversing cameras and lane departure detection cameras require high data rate while parking sensors and infrared sensors for nighttime pedestrian detection require less data rate. Infotainment Data: This includes all entertainment and driver informa- tion network traffic used in navigation systems, audio and visual entertain- ment, and more. Such systems usually demand high data rate.

1.1.1 Communication Protocols

Several automotive communication protocols are used to address the var- ious applications data rate and latency requirements. The most common protocols are Controller Area Network (CAN) [6], Media Oriented Systems Transport (MOST) [7], FlexRay [8], Local Interconnected Network (LIN) [9] and Low-Voltage Differential Signaling (LVDS) [10]. CAN: This protocol has been developed by Robert Bosch GmbH and was released in 1986. CAN is typically used to transmit control traffic be- tween electronic control units within the vehicle. It allows a maximum bus speed of 1 Mbps over a distance of up to 40 m. It is currently very popular in

2 Chapter 1. Introduction the automotive domain as a communication bus for event-triggered com- munication. Suitable for low bandwidth control applications with a high or low latency. MOST: This protocol has been developed to primarily support multi- media data. The maximum possible bandwidth supported by MOST150 is 150 Mbps. FlexRay: This protocol has been developed specifically for automotive networking by the FlexRay Consortium, which disbanded in 2009. Its key benefits over CAN are its flexibility, higher maximum data rate (10 Mbps), and its deterministic channel access behavior. It is suitable for low data rate and low latency applications. LIN: The LIN protocol was developed in the late 1990s by the LIN Con- sortium as a low-cost alternative to CAN for less important vehicular net- work elements. It is suitable for low data rate and high latency applications. LVDS: This is a high-speed signaling standard that uses twisted pair copper cables. The standard is attractive for automotive camera usage due to high data rate capabilities (up to 655 Mbps).

1.1.2 Next Generation Network

Recently, there has been a request by the automotive industry for a stan- dardization of in-vehicle networking between manufacturers. This may lead to a greater reuse and interoperability between the original equipment manufacturers and the manufacturers. A thorough analysis of the future in-vehicle network was done in [5]. The authors argue that a significant industry interest in Ethernet through groups such as AVnu and OPENSIG alliances suggests that Ethernet-based network is most likely the dominant standard in the next generation network [5, 11]. The advantages of a wide- scale adoption of Ethernet include high data rate capabilities, cost effec- tiveness, flexibility and a recognized IEEE standard (with the benefits of a continuing improvement and vehicle-specific features). However, Ethernet does not address all requirements, and there is still a need for complemen- tary protocols. For example, in a case of a network malfunction, a backup

3 Chapter 1. Introduction network is required for safety-critical units. PLC can address this and more, as discussed in the next section.

1.2 Powerline Communication

Powerline communication uses electrical wiring to carry data while allow- ing electric power transmission over the same wires. PLC can potentially reach every device connected to the powerline without adding extra wires. These features are specifically attractive for vehicular networks which contain many devices linked by the same powerline. Although PLC may not be the primary intra-vehicle network, PLC is a good candidate for a backup network. Adding extra wires may complicate the network and ad- versely affects the vehicle energy efficacy due to their weight. Also, in sce- narios where cabling space or cost is limited, the PLC network can replace the primary network. Aftermarket devices, for example, may be easier to install if no extra wires are required for communication. PLC is capable for low or high data rate applications. We expect that high latency control applications and high date rate infotainment data can immediately benefit from PLC. However, low latency may be more chal- lenging for PLC. The powerline is a harsh environment not designed for communication. The challenges of PLC include a varying impedance, a time-varying channel impulse response, colored noise and impulse noise. Powerline networks are usually made of a variety of conductor types and loads with a varying impedance. Over such channels, the frequency response may vary widely with frequency. Also, the channel may change over time as switching on or off devices changes the network topology. In cars, for example, the channel of a stationary car can be very different than that of a moving car. Noise in powerline is also a significant problem. We classify here two major noise types.

• Background Noise: This noise distribution may be stationary or time- varying. The sum of low power noise sources is included in this

4 Chapter 1. Introduction

noise. Interference from wireless broadcast stations also contributes to this noise as a narrowband background source.

• Impulse Noise: This type of noise is an abrupt noise with a large am- plitude. It can be repetitive and synchronized to some source but can also be isolated. One characteristic of impulse noise is the inter-arrival time — the time between successive noise pulses. This property, for example, is different between in-home powerlines and in-car power- line as an impulse inter-arrival time in a car can be hundreds of times shorter than in a [12].

A more thorough review of the PLC characteristics and challenges can be found in [13, 14, 15]. Due to the vehicular powerline characteristics, an in-vehicle PLC re- search can greatly benefit from full access to a PLC protocol operating on actual powerlines. This can be accomplished through a use of an SDR. The communication protocol utilized by the SDR system can be based on an available standardized PLC protocol. This enables us to reuse parts that have already been proven to work efficiently in similar circumstances.

1.2.1 Powerline Communication Standards

There are no vehicle-specific powerline communication standards. Yamar has developed a proprietary PLC technology for communication over Di- rect Current (DC) powerline [16]. There are, however, numerous powerline standards for narrowband and applications for in-home or in- dustrial use. Similarly to Ethernet, broadband standards have the ability to serve a broad range of in-car applications. Therefore, we will focus here solely on the PLC broadband standards. The most widely deployed power- line networking standards are from the HomePlug Powerline Alliance [14]. Also worth mentioning is the High-Definition Powerline Communication (HD-PLC) standard. A brief description of these standards physical layer is given below (a more thorough overview can be found in [15]). HomePlug 1.0 [17]: The standard was released in 2000. HomePlug 1.0 uses Orthogonal Frequency-Division Multiplexing (OFDM) symbols

5 Chapter 1. Introduction with 84 carriers in the frequency band between 4.5 to 21 MHz. It uses differential Binary Phase-Shift Keying (BPSK) and differential Quater- nary Phase-Shift Keying (QPSK) modulation, a Reed-Solomon Forward Error Correction (FEC) with a code rate between 1/2 and 3/4. A Robust OFDM (ROBO) mode is defined for transmitting important management information. ROBO mode is achieved by using a strong code, lower rates and a diversity copier of the data. The nominal maximum PHY rate is 13.78 Mbps. HomePlug AV [18]: This standard was released in 2005. HomePlug AV uses a windowed Discrete Fourier Transform (DFT)-based OFDM symbols with 917 carriers in the frequency range of 2 to 30 MHz. It uses modu- lations from BPSK up to 1024-Quadrature Amplitude Modulation (QAM) independently applied to each carrier (bit-loaded modulation). HomePlug AV also uses powerful turbo convolutional code with rate 1/2 and 16/21. Three ROBO modes are defined (see IEEE 1910 highlights in next chapter for more information). HomePlug AV can share the medium with Home- Plug 1.0 devices. The maximum date rate supported is 200 Mbps. HomePlug Green PHY [19]: This is essentially a subset of HomePlug AV as it uses only the ROBO modes. It targets smart energy and home ap- plications. HomePlug Green PHY aims to provide a significantly reduced power consumption, maintain high reliability and be cost effective. The maximum date rate supported is 10 Mbps. HomePlug AV2 [20]: This standard was built on top of HomePlug AV. It extends the band to 2 to 86 MHz. It also adds 4096-QAM, a 8/9 code rate, smaller guard intervals, and MIMO capabilities. The maximum date rate supported is 1.5 Gbps. HD-PLC: The standard uses -transform based OFDM symbols with 512 carriers in the frequency range of 2 to 28 MHz. HD-PLC carri- ers are modulated with pulse amplitude modulation, and it uses convolu- tional Reed-Solomon code for the FEC. The maximum date rate supported is 210 Mbps.

6 Chapter 1. Introduction

IEEE 1901

The HomePlug AV and HD-PLC were adopted by the IEEE 1901 group as the baseline technology for their IEEE Std 1901-2010 standard [21] (called IEEE 1901 in this thesis). We have chosen to use IEEE 1901 as the basis for our in-vehicle PLC research as it is based on the most widely used standard for in-home PLC. IEEE 1901 also indirectly includes HomePlug Green PHY, which has been adopted for communication between charging stations and plug-in electric cars [1,2,3]. The IEEE 1901 has two optional physical layers: the FFT-PHY adopted from HomePlug AV and the Wavelet-PHY adopted from HD-PLC speci- fication [22]. The standard provides a way for the two physical layers to coexist, but there is no requirement for interoperability. In our work, we focus solely on the FFT-PHY. The IEEE 1901 FFT-PHY extends the HomePlug AV PHY in several ways, including a higher bandwidth, a higher maximum modulation, and an increased maximum code rate. The maximum data rate supported is 400 Mbps. More details are given is Section 2.1.

1.3 Software-Defined Radio-Based Implementation

As the powerline channel is unpredictable, simulating the real-life perfor- mance of a PLC network is a difficult task. Testing on an actual chan- nel is desired and can significantly reduce the research and development turnaround time. However, full access to an operating PLC protocol is somewhat limited. One approach is to experiment with commercial off- the-shelf devices as it was done in [23, 24, 25]. However, this limits the scope of the research as only a few PHY attributes are controllable or ob- servable by the user. Another approach is to build a custom hardware prototypes, usually based on Field-Programmable Gate Array (FPGA) boards. A hardware based implementation gives a good performance but the overhead of

7 Chapter 1. Introduction building such prototypes is high, and it is a relatively complicated process. Therefore it focuses on only parts of the transmission and reception chain. Furthermore, reproducing the results by other researchers is difficult as the physical hardware is not accessible to all. An SDR-based implementation combines the advantages of using a software simulation environment (like MATLAB) and conducting a real- life experiment. The SDR consists of a Personal Computer (PC) connected to a radio peripheral hosting an Analog to Digital Converter (ADC), a Digital to Analog Converter (DAC) and a Radio Frequency (RF) front-end. The DAC is responsible for taking the signal generated on the PC and feed it to the RF front-end for transmission. The ADC is in charge to sample signals received by the front-end and pass it to the PC software for signal processing. Most of the signal processing is conducted on the PC rather than on dedicated hardware. This enables a quick development of prototypes in software and testing them in a real environment, rather than designing a special-purpose hardware. However, the main drawback of this approach is the lower data processing speed compared to the use of dedicated hardware. When performing the signal processing using the software, we can ei- ther do it in real-time and get instantaneous results or do it off-line by cap- turing the signals and carry out the processing later on. Why would we want a real-time signal processing? One reason is to emulate real-life sce- narios that are difficult to reproduce offline, such as a car powerline chan- nel. Real-time processing enables longer testing as it does not require sav- ing large volumes of data. For example, the Ettus Universal Software Radio Peripheral (USRP) N210 SDR front-end can sample at 25 MHz where each sample takes 64 bits in memory. This means 200 MB/s of incoming data. This is a serious challenge, concerning the throughput of a typical mechan- ical hard drive nowadays, not to mention the amount of storage it may require. Another reason for a real time signal processing is interaction with other systems that require an immediate feedback. In this work, we develop a software-based implementation of the IEEE 1901 protocol for use in an SDR that operates in real time. We then utilize

8 Chapter 1. Introduction the system to perform experiments on a real powerline.

1.4 Related Works

Several other related works involving SDR-based experimentation with or without PLC are described below. The authors of [26] implemented an OFDM receiver supporting the IEEE 802.11a/g/p (WiFi) standards in GNU Radio. In this work, they use the USRP N210 as the front-end. Their source code is publicly available, and some software design concepts related to integration with GNU Ra- dio framework were taken from this project. We also use a similar state machine-based implementation of the PHY receiver. The authors of [27] investigated PLC using an SDR-based implementa- tion. They used GNU Radio for a PLC noise analysis. They also used an IEEE 1901 FFT-PHY-based implementation on MATLAB for experiment- ing with a dynamic spectrum access algorithm. However, this work only demonstrated a proof of concept where only small parts of the transmit and receive chain were implemented. In [28] the authors use an SDR-based implementation to experiment with PLC. The signals were generated in MATLAB and passed to GNU Ra- dio for testings. They experimented with an OFDM signal over 12 V DC and in-home powerlines. This was done mainly for demonstrating the po- tential of the SDR platform. In [29] the same researchers used the same system along with a simple MAC layer and were able to demonstrate a video streaming over PLC using USRP. They experimented with optimiza- tion of several parameters such as the cyclic prefix and the OFDM symbol length. In [23] the authors use commercial and compare the through- put of HomePlug AV and HD-PLC in a vehicular powerline network. The measurements were performed at different locations in the car and in vari- ous scenarios including a stationary car and a moving car. The authors of [30] experimented with a single carrier PLC system us- ing an SDR-based implementation in GNU Radio. They use differential

9 Chapter 1. Introduction

BPSK modulation, an interleaver and a convolutional code with rate 1/2. They used the implementation to analyze the channel Signal to Noise Ratio (SNR) and to calculate the Bit Error Rate (BER).

1.5 Contribution

In this thesis, we address two areas. The first one is the need for an SDR implementation of a PLC protocol. The second one is a reliable PLC in a vehicular powerline network, where we test aforementioned SDR-based system on an in-vehicle powerline. Software-Defined Radio PLC System: We developed an SDR of an end-to- end PLC system. It is capable of streaming data in real-time. The system is based on IEEE 1901, with some modifications. It includes an IEEE 1901- based PHY as well as a simple MAC layer. We derived a blind channel amplitude estimation method for IEEE 1901 aimed for the vehicular time- varying channel. We use a noise Power Spectral Density (PSD) estimator along with an adaptive bit loading algorithm to cope with the vehicular channel noise. The system can be used both for simulation and for actual transmission and reception of data over powerlines. We make all software components available as an open source project to facilitate further devel- opment by the broader research community. Reliable In-Vehicle PLC Feasibility: We show experimental results ob- tained with the SDR-based system. The system was tested on a vehicle harness and a real vehicle powerline network under different network settings. We present our analysis of the IEEE 1901-based protocol behavior in a vehicular powerline.

1.6 Organization

The remainder of this thesis is organized as follows. In Chapter2 we describe the theory and derive the formulas utilized in the actual implementation of the SDR system. In Chapter3 we discuss the implementation details. In Chapter4 we presents the experiments results

10 Chapter 1. Introduction performed on a car harness and an actual car powerline network. Finally, in Chapter5 we draw conclusion and suggest future research direction.

11 Chapter 2

Powerline Communication System Description

In this chapter, we present the background information about the PLC sys- tem implemented in this thesis. The frame generation process performed by the transmitter is described in Section 2.1. The frame receiving process performed by the receiver is de- scribed in Section 2.2. The channel estimation, noise PSD estimation and adaptive bit rate algorithm performed by the receiver are described in Sec- tions 2.3, 2.4 and 2.5 respectively. A description of the MAC layer is given in Section 2.6. The impulse noise model used for the impulse noise emula- tion is described in Section 2.7.

2.1 PHY Transmitter

In this section, we describe the frame generation process performed by the transmitter PHY. The frame specification described in this section is based on IEEE 1901 FFT-PHY.

2.1.1 Overview

Highlights of IEEE 1901 FFT-PHY are given below.

• DFT-based OFDM symbols:

12 Chapter 2. Powerline Communication System Description

– 1974 OFDM carriers from 1.8 to 50 MHz. The actual available carriers are defined in the tone mask. The default tone mask for north America consists of 917 OFDM carriers from 1.8 to 30 MHz. – 40.96 µs OFDM symbol length. – Guard intervals of 5.56 µs or 7.56 µs for the payload symbols and 18.32 µs for the frame control.

• Bit-loaded modulation with constellations from BPSK, QPSK, 8- QAM, 16-QAM, 64-QAM, 256-QAM, 1024-QAM and 4096-QAM.

• A turbo convolutional code FEC for the frame control and payloads with code rates of 1/2, 16/21 and 16/18.

• A channel interleaver for interleaving the turbo convolutional code FEC block to overcome powerline noise.

• A diversity copier for a more reliable frame control.

• ROBO modes for a more reliable payload. The ROBO modes use QPSK modulation, a code rate of 1/2 and a diversity copier where each bit is replicated 2,4 or 5 times.

In IEEE 1901, the physical frame that is transmitted over the power- line is referred as PHY Protocol Data Unit (PPDU). The PPDU consists of a preamble, a frame control OFDM symbol and optional several payload OFDM symbols. A PPDU with two payload symbols is depicted in Figure 2.1.

Preamble Frame Control Payload Payload

FIGURE 2.1: PPDU Structure with Two Payload Symbols

The frame control and the payload OFDM symbols consist of 4096 real samples or 2048 complex samples in baseband representation. The pream- ble consists of 10 smaller symbols, each with 512 real samples or 256 com- plex samples in baseband representation. Note that since we perform the

13 Chapter 2. Powerline Communication System Description symbol generation in the baseband, for the rest of this chapter the symbols lengths refer to the baseband representation. The spectral mask is determined by a tone mask which defines the masked carriers. The tone mask is an extension of the default tone mask which is predetermined by the manufacturer. For simplicity, in our implementation, the user is restricted to the default tone mask. As our implementation goal was to provide an IEEE 1901-like com- munication between two stations, almost all the PHY specifications were adopted from IEEE 1901. Aspects that deviate include the following:

• The TIA-1113 (or 1901 FFT hybrid) mode for compatibility with pre- vious protocol version is not supported.

• The guard interval length is fixed for all payload symbols.

• The turbo convolutional code is different than what is defined in IEEE 1901 (see Section 2.1.3).

• The preamble is a concatenation of the SYNCP and SYNCM symbols (see description at Section 2.1.2) multiplied by a window. Therefore it might not meet the spectral requirement due to the SYNCP/SYNCM transition.

• Priority Resolution Symbol (PRS) is not supported, as our MAC layer does not use it.

• Amplitude map control is not supported. This means that all carriers have the same gain.

2.1.2 Preamble Generation

The first part of the PPDU is the preamble. The preamble in the time do- main consists of a repeating pattern of 7.5 SYNCP symbols followed by 2.5 SYNCM symbols, where SYNCM is simply the SYNCP multiplied by −1. The SYNCP/SYNCM are OFDM symbols of length M = 256. The symbols

14 Chapter 2. Powerline Communication System Description are frequency sweeps spanning the used bandwidth except for masked car- riers as derived from the default tone mask. All non-masked carriers have the same magnitude, and their phase is given in Table 13-27 from [21]. The SYNCP/SYNCM symbols are generated using a 256-point Inverse Discrete Fourier Transform (IDFT) and are then concatenated. The pream- ble is multiplied by a window to create a roll-off at both ends according to the instructions in Section 13.9.1 of [21]. The final preamble is depicted in Figure 2.2. The number of samples in the roll-off interval is LRI = 248. Therefore there are approximately only 6.5 and 1.5 effective SYNCP and SYNCM symbols respectively. Additional filtering is required to meet the spectral mask requirements due to SYNCP/SYNCM transition, but this step is not performed in our implementation.

SYNCP SYNCM SYNCM

FIGURE 2.2: Preamble Structure

2.1.3 Encoder

The encoder is the first step in the frame control and payload symbol gen- eration. We use different encoders for the frame control and payload bits, although some of the encoder elements are shared.

Frame Control Encoder

The frame control pre-encoded data is a structure of 128 bits. The structure contains information about the PPDU length, PPDU type, and the payload bit loading configuration. These fields are mostly filled by the upper MAC layer. The PPDU length field, however, depends on the number of payload symbols in the PPDU, which is more difficult for the MAC layer to calcu- late. Therefore it is filled by the PHY layer. The PHY then also fill the Cyclic Redundancy Check (CRC) field, measured on the entire frame control, as defined in Section 6.4.1.1.6 of [21].

15 Chapter 2. Powerline Communication System Description

The frame control 128 bits are passed through the frame control encoder blocks as depicted in Figure 2.3. Description of the encoder blocks is given below.

Frame Control Encoder

Frame Turbo Cyclic Prefix, Channel Diversity To control bits Convolutional Mapper IDFT Window and Interleaver Copier powerline (128) Encoder Overlap

Payload Encoder

Turbo Payload Channel ROBO Insert Scrambler Convolutional bits Interleaver Interleaver Preamble Encoder

FIGURE 2.3: PPDU Generation

Turbo Convolutional Encoder: The raw bits enter the turbo convolutional encoder. The turbo convolutional encoder in our PHY is different than what is defined in IEEE 1901. The output is 256 bits consists of the 128 systematic bits and the 128 parity bits. Channel Interleaver: The 256 bits are shuffled according to the IEEE 1901 channel interleaver specification given in Section 13.7.3 of [21]. Diversity Copier: The 256 shuffled bits are then replicated several times to fill the entire OFDM symbol. The diversity copier follows the IEEE 1901 specification as defined in Section 13.6.4 of [21]. For a typical case of North Americas tone mask with 917 QPSK carriers, each bit is copied at least seven times. The redundant information is used by the receiver improve the data detection.

Payload Encoder

The payload length should be a multiple of 520 bytes or a total of 136 bytes as defined in IEEE 1901. Therefore the payload is first sliced into 520-byte blocks or remains one 136-byte block. Each block is then passed through the payload encoder as depicted in Figure 2.3. Description of the encoder blocks is given below.

16 Chapter 2. Powerline Communication System Description

Scrambler: The bits are first scrambled by XORing them with a pseudo noise sequence to produce a uniform bits distribution. This is done with the IEEE 1901 pseudo noise generator given in Section 13.7.1 of [21]. Turbo Convolutional Encoder: The raw bits enter the turbo convolutional encoder. The turbo convolutional encoder in our PHY is different than what is defined in IEEE 1901. This step doubles the number of bits. Channel Interleaver: The bits are shuffled according to the IEEE 1901 channel interleaver specification given in Section 13.7.3 of [21]. ROBO Interleaver: This is an optional step. When in ROBO mode, each bit is copied 2, 4 or 5 times. This block replicates and interleaves the bits according to the IEEE 1901 specification given in Section 13.7.4.1 of [21]. The redundancy improves data detection at the receiver.

Turbo Convolutional Encoder

A special section is dedicated for the turbo convolutional encoder as it was modified from the IEEE 1901 specification. The IEEE 1901 turbo convolutional encoder consists of two identical rate 2/3 recursive systematic convolutional constituent encoders and one interleaver. The encoder output is optionally punctured to produce a fi- nal code rate of 1/2, 16/21 or 16/18. The IEEE 1901 constituent encoder is depicted in Figure 2.4. u1 and u2 are the turbo convolutional encoder in- put even bits and odd bits respectively. The generator matrix of IEEE 1901 constituent encoder is

D3+D+1 ! D3+D2+1 G(D) = D3+D2+D+1 . D3+D2+1

Due to time constraints, we have used the IT++ library [31] in our im- plementation of the turbo convolutional encoder and decoder. However, the library does not support a two-input constituent encoder as in IEEE

17 Chapter 2. Powerline Communication System Description

 2  1

 + + + + 0

FIGURE 2.4: IEEE 1901 Constituent Encoder

1901. Therefore we use a rate 1/2 recursive systematic convolutional con- stituent encoder with one input. The generator matrix of the modified con- stituent encoder is  D3 + D + 1  G(D) = . D3 + D2 + 1 The encoder is depicted in Figure 2.5, where u is the turbo convolutional encoder input. The modified version has eight states, as in the IEEE 1901 encoder. The same constituent encoder is used in UMTS (third generation cellular network) [32]. The turbo interleaver (not described here) follows the IEEE 1901 specification given in Section 13.7.2.4 of [21]. The parity bits are then punctured such that the final code rate is 1/2 as in IEEE 1901. Code rate of 1/2 is the only rate supported in our encoding chain. If desired, the original IEEE 1901 encoder and decoder can be integrated instead, while keeping the rest of implementation intact. 

 + + + + 0

FIGURE 2.5: Modified Constituent Encoder

2.1.4 Symbol Generation

The encoded frame control and payload bits are modulated to form the OFDM symbols. The process for frame control and payload symbols is

18 Chapter 2. Powerline Communication System Description

TABLE 2.1: Modulation Types in IEEE 1901. Mi is the num- ber of constellation points, Bi is the number of bits carried, and Ei is the energy per symbol

i Name Mi Bi Ei 1 BPSK 2 1 1 √1 2 QPSK 4 2 2 √ 1 3 8-QAM 8 3 5+1.292 √1 4 16-QAM 16 4 10 √1 5 64-QAM 64 6 42 √1 6 256-QAM 256 8 170 √1 7 1024-QAM 1024 10 682 √ 1 8 4096-QAM 4096 12 2730

similar, and it is depicted in the common part in Figure 2.3. The number of frame control encoded bits fit exactly one OFDM sym- bol due to the diversity copier. Payload bits, however, may take several OFDM symbols. Therefore, the payload bit stream is first sliced, where each slice fills one OFDM symbol. The number of bits that fit in one sym- bol is known in advance and depends on the bit loading, the tone mask, and ROBO mode. E.g., for 917 carriers with 8-QAM modulation on all car- riers and no ROBO mode, each symbol carries 917 × 3 = 2751 bits. The symbol generation process includes the following steps. Mapper: The mapper takes the encoded bits and maps them to constella- tion symbols according to the bit loading configuration. The frame control OFDM symbol is QPSK only, while the payload OFDM symbols can have any configuration of bit loading (see Section 2.5). In ROBO mode, however, all payload OFDM symbols are QPSK only. The mapping is performed ac- cording to IEEE 1901 specification given in Section 13.8 of [21]. The mapper uses gray coding and modulation types as shown in Table 2.1. The output of this step is N = 2048 complex numbers (one number for each carrier). IDFT: The N complex numbers are passed through N-point IDFT to produce a time domain OFDM symbol of length N according to IEEE 1901

19 Chapter 2. Powerline Communication System Description specification given in Section 13.9.3 and 13.9.4 of [21]. The IDFT of X[k] is defined as N−1 X j2πnk x[n] = X[k]e N 0 ≤ n ≤ N − 1. k=0 Note that this produces a baseband signal since that is what the SDR hard- ware expects. At a later stage, the SDR front-end performs the conversion to a real-valued signal as defined in IEEE 1901. The conversion performed by the hardware is described in Section 3.2. Cyclic Prefix, Window, and Overlapping: A cyclic prefix is added to the OFDM symbol in the time domain. It is then multiplied by a window to create a roll-off at the beginning and the end of the symbol. All symbols are then concatenated with an overlap during the roll-off interval. All the steps are in agreement with the IEEE 1901 specification given in Section 13.9.3 and 13.9.4 of [21] except that the payload symbol guard interval is fixed at 756 samples regardless of ROBO mode or other configurations. Output: The preamble is inserted to form the final PPDU signal as illus- trated in Figure 2.1. The PPDU is ready for transmission over the power- line.

2.2 PHY Receiver

In this section, we describe the frame reception process performed by the PHY receiver. Note that IEEE 1901 specifies the frames format but does not specify how to receive them, except an outline of the transceiver building blocks. Therefore, an actual receiver is implementation dependent.

2.2.1 Overview

The receiver continuously listens to the powerline channel and searches for a PPDU frame. Once a PPDU is detected, it is processed as depicted in Fig- ure 2.6. The receiver components are discussed in the following sections.

20 Chapter 2. Powerline Communication System Description

From powerline

Frame Detection

Frame Control Decoder

Alignment & Turbo Remove Combine Channel Phase DFT Demodulator Convolutional Output Cyclic Prefix Copies Deinterleaver Correction Decoder

Payload Decoder

Turbo ROBO Channel Convolutional Descrambler Output Deinterleaver Deinterleaver Decoder

FIGURE 2.6: PPDU Receive Path

2.2.2 Frame Detection

The first task of the receiver is to detect the PPDU. Each PPDU starts with a preamble which consists of a periodic signal of length 7.5 × M − LRI , followed by another periodic signal of length 2.5 × M − LRI where M is the SYNCP/SYNCM length, and LRI is the roll-off interval as described in Section 2.1.2. Let s(t) be the transmitted signal. Assuming an additive noise channel, the received signal r(t) is

r(t) = (h ∗ s)(t) + w(t), where w(t) is an additive noise, and ∗ stands for the convolution operator: R ∞ (f ∗ g)(t) = −∞ f(u)g(t − u)du. The sampled received signal is

r[n] = (h ∗ s)(nT ) + w[n], where T is the sampling interval, and w[n] is the sampled noise. In order to detect the preamble we exploit its cyclic property. Consider

21 Chapter 2. Powerline Communication System Description the following normalized autocorrelation with lag M of the incoming sig- nal samples over a window of length M:

PM−1 ∗  Re k=0 r[n + k]r [n + k + M] ρ[n] = q . (2.1) PM−1 2 PM−1 2 k=0 |r[n + k]| k=0 |r[n + k + M]|

Due to the preamble structure and its cyclic property, this autocorrela- tion is high at the start of the preamble, and remains high for 5.5×M −LRI samples. Therefore, the frame is detected once ρ[n] is above a threshold td for consecutive 5.5 × M − LRI samples. We mark this sample as nd, thus

nˆd = min{n|ρ[m] > td, ∀m ∈ [n − (5.5M − LRI ) + 1, n]}. (2.2)

Choosing td depends mostly on the channel noise and the channel im- pulse response length. For example, an abrupt noise during the preamble can pull ρ[n] down. An actual measurement of ρ[n] from a car powerline is illustrated in Figure 2.7. The graph shows the duration which ρ[n] re- mains high. In this graph, for example, a threshold of td = 0.9 would not detect the preamble, where td = 0.8 would detect it. We experimented with different threshold values and found that td = 0.75 works well. Similar correlation-based detection scheme for 802.11a/g/p standard was done in [26].

2.2.3 Symbol Alignment

The symbol alignment is the process which attempts to locate the first sam- ple of the preamble. We perform the alignment by exploiting the inversion between the SYNCP and the SYNCM symbols. Similar inversion technique was discussed in [33]. We use the same correlation ρ[n] and look for its minimum value during the 2 × M + LRI samples following nˆd. The minimum value is attained when the signal is anti-correlated with its lag, i.e, when SYNCP overlaps SYNCM in ρ[n]. As this can happen at only one location in a preamble (see the preamble structure at Figure 2.2), we use this point as an anchor. We

22 Chapter 2. Powerline Communication System Description

1

0.8

0.6

0.4

0.2 ] n

[ 0 ρ −0.2

−0.4

−0.6

−0.8

−1 0 500 1,000 1,500 2,000 2,500 3,000 n

FIGURE 2.7: Preamble Correlation subtract 6.5M from the anchor point in order to estimate the first sample of the preamble na. Therefore

nˆa = arg min (ρ[n]) − 6.5M. (2.3) n∈[ˆnd+1,nˆd+2M+LRI ]

2.2.4 Phase Estimation

As the symbol alignment is not perfect, as the sampling times of the sender and the receiver are not synchronized, and as the channel might distort the phase, a phase offset is introduced. The phase offset may vary with frequency. It can be estimated in the frequency domain by subtracting the known sent phase from the received phase.

23 Chapter 2. Powerline Communication System Description

The following approach of combining the channel phase estimation with the channel delay is based on [34, Algorithm B]. Estimation of the amplitude HA[k] is performed at a later stage as also suggested in [34, Algorithm B] and discussed in Section 2.3. Let r[n] be the aligned received signal such that r[0] is the beginning of the preamble as estimated by Equation 2.3. Thus the received signal is

r[n] = (h ∗ s)(nT − d) + w[n], where s(t) is the aligned PPDU such that s(0) is the beginning of the pream- ble, and d is an offset caused by an alignment estimation error or sampling offset between the transmitter and the receiver. Note that |d| < 1 if the symbol alignment was precise, else |d| ≥ 1. In this analysis we assume h(t) with a support within [0, 3.5MT − LRI T − d]. This length corresponds to the cyclic prefix in r[n] as described below.

Note that s(t) is periodic for LRI T ≤ t ≤ 7.5MT with a period of M. We can utilize the cyclic property of s(t) to reduce the noise variance and to allow the linear convolution with the unknown channel to be modeled as a circular convolution. To reduce the variance we average three copies of the SYNCP symbol as follows:

1 r¯[n] = (r[n + 3.5M] + r[n + 4.5M] + r[n + 5.5M]) 3 = (h ∗ s˜)(nT − d) +w ˜[n] 0 ≤ n ≤ M − 1, where s˜(t) is a repeated SYNCP symbol, and w˜[n] is the additive noise. The shift of r[n] by 3.5M is for removing the cyclic prefix as we assumed h(t) support is within [0, 3.5MT − LRI T − d]. Let H[k] be the Fourier Transform H(ξ) = F(h(t)) at ξ = 2πk/T M. We now take an M-point DFT of r¯[n], therefore,

R[k] = H˜ [k]S[k] + W [k] 0 ≤ k ≤ M − 1,

24 Chapter 2. Powerline Communication System Description

−j 2πd where H˜ [k] = H[k]e M , and S[k] and W [k] are the DFT of the SYNCP symbol and w˜[n] respectively. jH [k] Denote H˜ [k] = HA[k]e P where HA[k] and HP [k] are the amplitude and the phase component of H˜ [k]. The phase estimation is performed by comparing the phase of R[k] with the known phase of S[k] as follows:

R[k] φ[k] = arg = H [k] + δ [k] mod 2π, S[k] P W where δW [k] is the phase shift introduced by W [k]. M˜ ˜ Let {ki}i=1 be the non-masked SYNCP carriers where M is the number of non-masked SYNCP carriers. Denote ∆i = φ[ki] − φ[ki−1]. As we expect that |HP [ki] − HP [ki−1]| < π, a phase wrapping is assumed when |∆i| > π. The estimated phase for the first non-masked is

HˆP [k1] = φ[k1], and the estimated phase for the other non-masked carriers is calculated recursively by unwrapping φ[ki] as follows:

 ˆ   HP [ki−1] + ∆i − 2π ∆i > π  ˆ   ˜ HP [ki] = HˆP [ki−1] + ∆i + 2π ∆i < π 2 ≤ i ≤ M.    HˆP [ki−1] + ∆i else 

ˆ 1 The phase estimation HP (ξ) for an arbitrary 0 ≤ ξ < T is performed by an interpolation of HˆP [k] at k = T Mξ. As the N OFDM carriers are at 0 0 ˆ 0 M ξ = k /T N, 0 ≤ k ≤ N − 1, the discrete HP [k] is interpolated at k = k N .

2.2.5 Symbol Demodulation

The preamble is followed by a frame control OFDM symbol and then op- tionally several payload symbols. The payload symbols are different from the frame control. Payload carriers may use a non-QPSK modulation, pay- load bits may not have several copies, and the payload guard interval is

25 Chapter 2. Powerline Communication System Description shorter than frame control guard interval. Therefore payload and frame control symbols are processed differently. The frame control carries information about the length, type, and bit loading configuration of the following payload symbols, if any. Therefore payload symbols only start processing after the frame control is fully de- coded. The first sample of the frame control OFDM symbol is derived from the symbol alignment process. The frame control is then extracted, demodu- lated and decoded. Similarly, the payload symbols are then also extracted, demodulated and decoded. The demodulation process performed on each symbol is depicted in Figure 2.6 and described below. Remove Cyclic Prefix: The cyclic prefix is removed according to the sym- bol type (frame control or payload). DFT: The remaining symbol r[n], 0 ≤ n ≤ N − 1 goes through DFT:

N−1 X −j2πkn R[k] = r[n]e N 0 ≤ k ≤ N − 1. n=0

Therefore R[k] = H˜ [k]S[k] + W [k] 0 ≤ k ≤ N − 1.

−j 2πd where H˜ [k] = H[k]e N similarly to what described in Section 2.2.4. Demodulation: Let B[m] be the m-th uncoded bit in an incoming bit stream. A soft bit b[m] is defined as follows

p(B[m] = 0|R) p(R|B[m] = 0) b[m] = log = log . p(B[m] = 1|R) p(R|B[m] = 1)

Assume that B[m] is replicated in L different carriers k1, . . . , kL. Let Bk[q] be the q-th bit in carrier k, so Bk1 [q1] = ... = BkL [qL] are the actual copies of B[m] where q1, . . . , qL are the corresponded bit positions. Also assume that the added noise W [k] is Gaussian and for any two carriers k 6= k0, W [k] and W [k0] are independent. Under these assumptions the soft bit expression is

26 Chapter 2. Powerline Communication System Description simplified as follows:

p(R|B[m] = 0) p(R[k ],...,R[k ]|B[m] = 0) b[m] = log = log 1 L p(R|B[m] = 1) p(R[k1],...,R[kL]|B[m] = 1) p(R[k1]|Bk [q1] = 0) p(R[kL]|Bk [qL] = 0) = log 1 + ··· + log L . (2.4) p(R[k1]|Bk1 [q1] = 1) p(R[kL]|BkL [qL] = 1)

p(R[k]|Bk[q]=0) Denote bk[q] = log , thus p(R[k]|Bk[q]=1)

L X b[m] = bki [qi]. (2.5) i=1

It can be shown that bk[q] is approximately

1 2 2 b [q] ≈ Y [k] − x(1)[q] − Y [k] − x(0)[q] k 2 k k , (2.6) σW [k]

σ2 [k] k Y [k] = R[k] x(0)[q] where W is the noise variance in carrier , H˜ [k] , and k , (1) xk [q] are the closest constellation symbols to Y [k] which their q-th bit is zero or one respectively. Demodulation thus is the calculation of the values ˜ 2 bk[q] for all bits in all non-masked carriers. Estimations for H[k] and σW [k] are discussed in Sections 2.2.4, 2.3 and 2.4. When the estimation for H˜ [k] amplitude HA[k] has not been obtained yet it is assumed HˆA[k] = 1. This should not affect the BPSK or QPSK carriers demodulation (hence frame control symbol demodulation). However, a full channel estimation must be performed before payload symbols with QAM carriers can be received.

2.2.6 Decoder

Frame Control Decoder

The input to the frame control decoder are the values bk[q] calculated in the demodulation step. The frame control decoder blocks are depicted in Figure 2.6 and described below. Decopier: For each bit, all copies are located by reversing the diversity copier. Let bit B[m], 0 ≤ m ≤ 128×2−1 have L copies at carriers k1, . . . , kL

27 Chapter 2. Powerline Communication System Description

with the corresponded bit location q1, . . . , qL. The soft bit b[m] of B[m] is the sum as shown in Equation 2.5. Therefore, for each bit B[m] we calculate the soft bit b[m] as follows: L X b[m] = bki [qi]. i=1 Channel Deinterleaver: The channel interleaving process is reversed here so the correct order of soft bits b[m] is sent to the turbo decoder. Turbo Convolutional Decoder: The IT++ library [31] is utilized for decod- ing the soft bits information. The Maximum A Posteriori (MAP) probability is used to determine the 128 hard bits output. Output: The bits are checked for CRC. If the CRC passes, the data is parsed to determine the frame type, frame length, ROBO mode, bit loading and other information. The decoded bits are passed to the MAC layer as well.

Payload Decoder

(l) The input to the payload control decoder are the values bk [q] calculated in the demodulation step, where (l) indicates the symbol number in the sequence. The stream is first sliced into groups of 520 × L × 2 bytes or one slice of 136 × L × 2 bytes where L is the number of times the bits are copies, and the factor of 2 is for the code rate of 1/2. If in ROBO mode then L can be 2, 4 or 5, otherwise L = 1. The decoding process performed on each slice is depicted in Figure 2.6 and described below. ROBO Deinterleaver: This part is executed only if in ROBO mode. In ROBO mode each bit is copied 2, 4 or 5 times. For each bit, all copies are located by reversing the ROBO interleaver process. Let bit B[m], 0 ≤ m ≤

136×8×2−1 or 0 ≤ m ≤ 520×8×2−1 have L copies at carriers k1, . . . , kL with the corresponded bit location q1, . . . , qL in the corresponding symbol number l1, . . . , lL. The soft bit b[m] of B[m] is the sum as shown in Equation

28 Chapter 2. Powerline Communication System Description

2.5. Therefore, for each bit B[m] we calculate the soft bit b[m] as follows:

L X (l ) b[m] = b i [q ] ki i . i=1

Channel Deinterleaver: The channel interleaving process is reversed here so the correct order of soft bits b[m] is sent to the turbo decoder. Turbo Decoder: The IT++ library [31] is utilized for decoding the soft bits information. The MAP probability is used to determine the 520×8 or 136×8 hard bits output. Descrambling: The final step in the decoding process is descrambling. The reverse process is identical to the forward process where each bit is XORed by the pseudo-random noise sequence. Output: The bits are passed to the MAC layer for CRC and parsing.

2.3 Channel Estimation

As the channel phase is estimated using the preamble (see Section 2.2.4), we now present three channel amplitude estimation techniques. The first method is using a sound frame where a station receives a predetermined frame it can utilize to estimate the channel. The estimation is stored and used in subsequent frames demodulations. The second and third meth- ods exploit selected carriers with a known amplitude and interpolates in- between carriers to estimate the entire channel amplitude. This allows im- mediate demodulation of QAM payload data symbols on a time-varying channel without waiting for a sound frame.

2.3.1 Sounding Method

In the sounding method, the channel estimation is performed by the re- ceiver PHY after receiving a sound PPDU. A sound PPDU consists of an all- zeros 512-byte payload which typically spans several OFDM symbols. The modulation type is QPSK for all carriers. The receiver identifies a sound

29 Chapter 2. Powerline Communication System Description frame by a field in the frame control thus it knows to use the payload for channel estimation only. The sounding method presented here is based on the least-squares- based algorithm described in [34, Algorithm B]. Let L be the number of payload OFDM symbols in the PPDU, let R(i)[k], 0 ≤ k ≤ N − 1 be the N-point DFT of the i-th received OFDM symbol where 1 ≤ i ≤ L and let H[k] be the unknown Fourier Transform H(ξ) = F(h(t)) at ξ = 2πk/T N, 0 ≤ k ≤ N − 1. Assuming no inter-symbol interference is present due to the guard interval, the value of R(i)[k] is

R(i)[k] = H˜ [k]S(i)[k] + W (i)[k], (2.7)

−j 2πd where H˜ [k] = H[k]e N , d is an offset caused by an alignment estimation error or sampling offset between the transmitter and the receiver, S(i)[k] is the N-point DFT of the i-th sent symbol s(i)[n], and W (i)[k] is an additive noise. Note that S(i)[k] is known by the receiver. The receiver constructs S(i)[k] using the prior information that it should be an all-zeros payload. The construction is done by passing all-zeros bits through the transmission path as in Figure 2.3 until the IDFT block. The estimation for H˜ [k] is performed using a linear least-squares er- ror regression. This is equivalent to a maximum likelihood estimation [35] (i) 2 when W [k] is i.i.d. following the distribution CN (0, σW [k]) [36]. The least-squares error estimation is given by:

PL S(i)∗[k]R(i)[k] Hˆ [k] = i=1 . PL (i) 2 i=1 S [k]

The estimation of the channel amplitude HA[k] = |H[k]| is performed by taking the absolute value of Hˆ [k] as follows:

L 1 X R(i)[k] Hˆ [k] = Hˆ [k] = , (2.8) A L S(i)[k] i=1

30 Chapter 2. Powerline Communication System Description

where we used the fact that the amplitude S(i)[k] = A is constant for all carriers in all payload symbols. (i) Hˆ [k] = H˜ [k] + 1 PL W [k] S(i)[k] Note that A L i=1 S(i)∗[k] . Since amplitude (i) A PL W [k] ∼ is and the phase is independent of the noise, the term i=1 S(i)∗[k] σ [k] CN (0, σ2 [k]/A2) Hˆ [k] ∼ Rice (|H[k]|, σ ) σ = √W W . Thus A H [37] where H 2AL . The expected value of the Rician HˆA[k] for |H[k]|/σH  1 is approxi- mately [37] h i σ2 E Hˆ [k] ≈ H + |H[k]|. A |H[k]| The expected value shows that the estimator is biased. The reason is the absolute value operation done in Equation 2.8 on the unbiased Hˆ [k]. The bias term however decreases with increasing number of payloads symbols L, carrier amplitude A or channel amplitude |H[k]|.

The mean square error of HˆA[k] is

 2  ˆ  h ˆ 2 i h ˆ i 2 E HA[k] − |H[k]| = E HA[k] − 2|H[k]|E HA[k] + |H[k]|  σ2  ≈ 2σ2 + |H[k]|2 − 2|H[k]| H + |H[k]| + |H[k]|2 = 0. H |H[k]|

2.3.2 Payload Method

A sound PPDU-based estimation becomes invalid once the channel has changed. This makes the sounding method inefficient in a repeatedly changing channel as it requires a high rate of sound frames. An alternative way to estimate the channel amplitude is to use the non-masked preamble and the frame control carriers. In-between carriers can be interpolated similarly to the phase estimation process discussed in Section 2.2.4, or, a more sophisticated fitting techniques can be used as in [38]. However, this may not perform well on a noisy channel as there are very few usable SYNCP symbols and only one frame control symbol. What we require is a blind channel amplitude estimation method suitable for IEEE 1901. There are several literature discussions regarding blind channel estima- tion for PLC systems. A subspace-based channel estimation for HomePlug

31 Chapter 2. Powerline Communication System Description is described in [39]. However, it is not practical for a time-variant channel. A pilot based channel estimation techniques are described in [40, 41, 42] but IEEE 1901 FFT-PHY does not facilitate pilot carriers. There are other blind channel estimation methods, not designed specif- ically for PLC. In [43, 44] they present a blind channel estimation for chan- nels that changes slowly in the frequency domain. The method exploits phase-shift keying carriers properties. This process is too complicated for our system and was tested only in wireless channels models. Therefore it may also not be efficient in powerlines. In [45] they present a method that exploits the finite alphabet property of the transmitted symbols, but it suffers from high complexity and an irreducible error floor [39]. We now present a novel scheme which exploits the preamble, frame control, and the payload symbols to blindly estimate the channel ampli- tude. This method requires that selected payload carriers be forced to use QPSK modulation. The channel is then estimated for these carriers, and the rest are linearly interpolated. The payload symbols can greatly improve the channel amplitude estimation as the number of payload symbols in a PPDU frame can reach ≈ 50 (or even ≈ 100 when two stations negotiate a longer maximum frame length). For a comparison, only 3 SYNCP symbols participate in the channel phase estimation described in Section 2.2.4. The main difference between this method and the sounding method is that for a payload carrier modulated with QPSK, we do not have infor- mation about the transmitted S(i)[k] phase, just the amplitude. Therefore, we take the absolute value of the normalized Equation 2.7 to eliminate the phase part from the signal statistics. Let k be a QPSK modulated payload carrier with amplitude A, thus

R(i)[k] H˜ [k]S(i)[k] W (i)[k] (i) Y [k] = = + . A A A

S(i)[k] ± √A ±j √A is a random variable with equal probability for 2 2 . Therefore  σ [k]  Y (i)[k] ∼ Rice |H[k]|, √W 2A . Similarly can be done for the frame control symbol. Let SF [k] and RF [k]

32 Chapter 2. Powerline Communication System Description be the N-point DFT of the sent and the received frame control symbol re- spectively. Then

R [k] H˜ [k]S [k] W [k] F F F YF [k] = = + , AF AF AF where AF is the amplitude of SF [k]. Similarly to the payload symbols  σW [k]  YF [k] ∼ Rice |H[k]|, √ . 2AF We can also use the known preamble symbols and get more samples (i) (i) for the channel estimation. Let SP [k] and RP [k] be the N-point DFT of the sent and the received i-th SYNCP symbols respectively. Similarly to what we showed in the sounding method for a known sent symbol (as in Equation 2.8), we have

(i) 1 X R [k] Y [k] = P P (i) , LP i SP [k] where LP is the number of participating SYNCP symbols. Again, YP [k] ∼  σW [k]  (i) Rice |H[k]|, √ where AP is the amplitude of S [k]. 2AP LP P (i) We now use the Rician samples Y [k], YF [k] and YP [k] to estimate the channel amplitude at carrier k. See Appendix A.1 for a Rice parameter estimation using samples with a varying variance. The estimator HˆA[k] using Equation A.1 is given by

HˆA[k] = v 2 uP (i) 2 2 P (i) (i) 2 u R [k] + |RF [k]| + AP R [k]/S [k] − (L + 2)ˆσ [k] t i i P P W 2 2 2 2 , (2.9) A L + AF + AP LP

2 where k is both a QPSK payload carrier and a SYNCP carrier, and σˆW [k] is 2 ˆ an estimate for σW [k]. The value of HA[k] for other k is linearly interpolated using the nearest estimated neighbours. When the expression inside the square root is negative, we discard it and interpolate the point instead.

33 Chapter 2. Powerline Communication System Description

2.3.3 Preamble Method

The preamble method is similar to the payload method but without incor- porating the payload symbols. Therefore only the preamble and the frame control participate in the estimation. This method does not restrict the pay- load carriers modulation thus the data rate is inherently higher. Similarly to Equation 2.9 we have

v 2 u 2 P (i) (i) 2 u|RF [k]| + AP R [k]/S [k] − 2ˆσ [k] ˆ t i P P W HA[k] = 2 2 2 . (2.10) AF + AP LP

2.4 Noise Power Spectral Density Estimation

The noise DFT samples W [k] used by several equations in this chapter are 2 2 assumed to be i.i.d. CN (0, σW [k]). The variance σW [k] is used by the re- ceiver when calculating the soft bit information in Equation 2.6, during the channel estimation in Equation 2.9 and Equation 2.10 and during the adap- tive bit rate algorithm in Equation 2.13. 2 σW [k] estimation can be performed when no data is transmitted over the channel. The IEEE 1901 dictates a default inter-frame space of 140 µs between PPDU frames, which corresponds to 7000 complex noise samples (for a 100 MHz sampling rate). As this may be an insufficient number of samples, several or other silence periods can be utilized as well. Similar to what has done in [46], the method for a spectral analysis is based on periodogram averaging. Unlike [46] we do not use any window function for the periodogram as we would like to incorporate the spectral leakage into the estimation as well.

Let NT be the number of samples during a silence period, and let r[n] be the received signal during that period where 0 ≤ n ≤ NT − 1. The signal r[n] is divided into segments of length N as follows:

0 ≤ n ≤ N − 1 r(i)[n] = r[n + iN] , 0 ≤ i ≤ L − 1

34 Chapter 2. Powerline Communication System Description

NT where L = b N c. The periodograms are then computed according to

N−1 2 (i) X (i) −j 2π kn N P [k] = r [n]e 0 ≤ k ≤ N − 1, n=0

2 An estimate for σW [k] can be obtained by averaging the periodograms as follows [47]: L−1 1 X σˆ2 [k] = P (i)[k]. (2.11) W L i=0 2 The estimator for σW [k] presented above is identical to a noise PSD es- timation technique shown in [47], except a factor of 1/N when calculating the periodograms. Therefore we refer to Equation 2.11 as a noise PSD esti- mator for the rest of the thesis.

2.5 Adaptive Bit Loading

As the IEEE 1901 is a multi-carrier system, we need a method to assign a modulation type for each carrier. The technique for assigning different modulation types is referred here as bit loading, while the actual assignment is referred as tone map. We first introduce the carrier BER equations, and then present the in- cremental algorithm [48] which performs the bit loading based on these equations and a target total BER.

A constellation symbol Sl,m transmitted in a carrier with modulation type i (see Table 2.1) is of the form

p Sl,m = N Ei (Xl + jYm) , where

p p Xl = 2l − Mi + 1 l = 0, 1,..., Mi − 1 p p Ym = 2m − Mi + 1 m = 0, 1,..., Mi − 1

35 Chapter 2. Powerline Communication System Description

and Mi is number of constellation points. Exceptions are BPSK (i = 1) where Ym = 0, and 8-QAM (i = 3) where

Xl = 2l − 3 l = 0, 1, 2, 3 ( ) −1.29 m = 0 Ym = . 1.29 m = 1

2 Ei is chosen such that the average power of Sl,m is N ,

Mi Ei = P 2 . l,m |Xl + jYm|

Let H[k] be the Fourier Transform H(ξ) = F(h(t)) at ξ = 2πk/T N, and let S[k] = Sl[k],m[k] be the transmitted symbol in carrier k. The received symbol is then

R[k] = H˜ [k]S[k] + W [k] 0 ≤ k ≤ N − 1,

−j 2πd where H˜ [k] = H[k]e N , d is an offset caused by an alignment estima- tion error or sampling offset between the transmitter and the receiver, and 2 W [k] ∼ CN (0, σW [k]). The maximum likelihood estimate for l[k], m[k] is calculated by finding the closest point Sl,m to the normalized R[k] as follows [49]:

R[k] (ˆl[k], mˆ [k]) = arg min − S ˜ ˜l,m˜ . (2.12) ˜l,m˜ H[k]

√ N|H˜ [k]| Let γi[k] = Ei . Similar to what was shown in [50], the symbol σW [k] estimation error probability for carrier k with modulation type i is given by:   1 (γ [k]) i = 1  2 erfc 1    1  h 1  1  i  C˜i[k] = 2 1 − √ erfc (γi[k]) 1 − 1 − √ erfc (γi[k]) i = 2, 4, 5, 6, 7, 8 , Mi 2 Mi  3 1   4 erfc (γ3[k]) (1 − erfc (1.29γ3[k]) + 2 erfc (1.29γ3[k])) i = 3  (2.13)

36 Chapter 2. Powerline Communication System Description

∞ 2 √2 R −u where erfc(x) = π x e du. The bit error probability is obtained using the approximation

Ci[k] ≈ C˜i[k]/Bi, (2.14) where Bi is the number of bits in modulation type i. The reasoning behind this approximation is that a symbol error corresponds to one bit error, as the constellation points are arranged such that the hamming distance between two adjacent points is one.

2.5.1 Incremental Algorithm

We will now describe an algorithm for performing a bit loading given a total BER limit PT . It is based on the algorithm in [48] but customized for IEEE 1901 modulation types and with an ability to force carriers to QPSK for supporting the channel estimation method described in Section 2.3.2. Let t[k] be the modulation type for carrier k, let q[k] be the number of bits for the modulation (q[k] = Bt[k], see Table 2.1), let c[k] be the carrier BER

(c[k] = Ct[k][k]) and let PT be the target error rate. Assigning modulations type for all carriers (i.e. performing the bit loading) is formulated in the following optimization problem:

N−1 PN−1 X k=0 q[k]c[k] max q[k] subject to P¯ = ≤ PT . q PN−1 k=0 k=0 q[k]

Based on [48], the incremental algorithm described below gives an ap- proximate solution to the optimization problem above. 1. Initialization: set the modulation type of carriers k = 0, 1,...,N − 1 to the maximum allowed.   0 k is masked   t[k] = 2 k is forced to QPSK .    8 else 

2. Determine q[k] = Bt[k] and c[k] = Ct[k][k] for k = 0, 1,...,N − 1 given

the γt[k][k] values using Equation 2.14.

37 Chapter 2. Powerline Communication System Description

3. Compare P¯ with PT . If P¯ is less than PT , the current tone map is kept and the algorithm ends.

4. Search for the carrier k, that is not forced to QPSK or with t[k] = 0, with the worst c[k] and reduce its constellation size, i.e., t[k] ← t[k]−1.

5. Recompute q[k] and c[k] of all carriers with changed allocations and return to Step 3.

The adaptive bit loading process is performed by the receiver. Once the receiver obtained the desired tone map, it transmits it to the sender using IEEE 1901 management message. The transmitter may then use the customized tone maps for subsequent frames payload modulation.

2.6 MAC Layer

A minimal MAC layer is required in order to manage the resources, send data through the PHY, and accept data arriving from the PHY. In this sec- tion, we describe the MAC frame, the MAC Protocol Data Unit (MPDU) and our channel access model.

2.6.1 MAC Frame

An IEEE 1901 MAC frame is a structure that includes fields for the source station address, the destination station address, a MAC frame payload, and a CRC value computed over the entire MAC frame. The MAC frame payload is the data required to transfer by the upper layer or a management message from one MAC entity to its peer. The full structure of a MAC frame or a management message is beyond the scope of this work and is available in Sections 6.1 and 6.5 of [21] respectively. When the MAC layer receives data to transfer or when it is required to transfer a management message, it constructs a MAC frame according to IEEE 1901 specification mentioned above. As in IEEE 1901, all available MAC frames are concatenated to form a MAC frame stream. The MAC frame stream is then fragmented into 512-byte segments or one 128-byte segment

38 Chapter 2. Powerline Communication System Description if the stream is less than 128 bytes. A header of 8 bytes is added to each segment to form a 520-byte or 136-byte PHY block. The header contains information such as a segment sequence number and a segment valid flag. The PHY blocks are concatenated and become the payload of the MPDU (described below) which is passed to the PHY for transmission. Alternatively, the MAC layer may also construct a MAC frame contain- ing a management message. The only management message required by our communication system is for passing a tone map data between two stations. This refers to IEEE 1901 CM CHAN EST.indication management message described in Section 6.5.1.5.10 of [21].

2.6.2 MAC Protocol Data Unit (MPDU)

MPDU is the unit of data exchanged between two peer MACs over the PHY. The MPDU consists of a 128-bit frame control and an optional 136- byte or multiple of 520-byte payload. These two parts become the frame control and payload of the PPDU (as in Figure 2.1). Our MAC layer supports the following MPDU types: Start-of-Frame (SOF), Sound and Selective Acknowledgment (SACK). An SOF MPDU consists of a frame control and a payload. SOF MPDUs are used for transmission of data or management messages. A Sound MPDU consists of a frame control and an optional 136-byte or 520-byte payload. The payload is predetermined to be zeros and used for negotiating a tone map and channel estimation between two stations. An SACK MPDU consists of only a frame control. SACK MPDUs are used by a station to acknowledge the reception of an SOF MPDU. Other MPDU types not supported by our MAC layer are Request to Send/Clear to Send (RTS/CTS), Beacon, and Reverse SOF. The full specifi- cation of the MPDU is given in Section 6.4.1 of [21].

2.6.3 Channel Access

Our MAC layer performs a master-slave channel access described as follows. We have two stations, where one is defined as a master and the other as a

39 Chapter 2. Powerline Communication System Description slave. The communication begins when the master initiates a sounding pro- cess. When the sounding process is complete, the master transmits an SOF MPDU with data to the slave. Upon reception, the slave responds with an SACK MPDU. The master then transmits another SOF MPDU, and the process repeats. This channel access is depicted in Figure 2.8. When a mas- ter does not receive an SACK MPDU after some time interval, it assumes the slave did not receive the last SOF MPDU, and it transmits another SOF MPDU. The process is periodically interrupted for a sounding process.

Sounding Process

A sounding process in our system begins with a transmission of a Sound MPDU by the master. The slave then performs the sounding method chan- nel estimation as described in Section 2.3.1 and calculates a bit loading as described in Section 2.5. Upon completion, the slave responds with an SACK MPDU and a management SOF MPDU containing the new tone map. The master initiates a sounding process when the tone map ”expires”. The expiration is determined by a timer in the MAC layer. The process is depicted in Figure 2.8: it begins with a sounding process, followed by several SOF MPDU transmissions and a new sounding process after the tone map expires. The channel estimation performed may be kept for demodulation of subsequent SOF MPDUs or discarded if using the other estimation method as discussed in Section 2.3.

2.7 Impulse Noise Model

Impulse noise is considered as a major difficulty for a vehicular PLC system [12]. It is generated by the various connected electronic devices. In order to test the system performance in a controlled noise environment, we need to generate the noise in software. In this section, we describe the impulse

40 Chapter 2. Powerline Communication System Description

Master Slave

Sound MPDU Initiate sounding Channel SACK MPDU estimation, bit loading calculation SOF management MPDU (contains new custom tone map)

SOF MPDU (modulated with the new tone map)

SACK MPDU

SOF MPDU

SACK MPDU

Sound MPDU Tone map expired, Channel initiate SACK MPDU estimation, sounding bit loading calculation SOF management MPDU

FIGURE 2.8: Master-Slave Channel Access

41 Chapter 2. Powerline Communication System Description noise model and its characteristics. This model is then used to create the actual impulse noise in Chapter4. A typical impulse noise pulse shape is similar to a damped sine wave [12, 46, 51]. In Section F.3.5.2 of [21], they model it as a damped sine wave or a double-side damped sine wave. Another model for the impulse noise suggested in [21] is a product of a periodic rectangular wave and colored noise. Here we chose to model it as a damped sine wave as we found it represents better the vehicular impulse noise shape as observed in [12, 46].

2.7.1 Damped Sine Wave

A damped sine wave signal d(t) is of the form

d(t) = Ae−λt cos(2πft + φ)u(t), (2.15) where A is the amplitude, λ is the decay, f is the frequency, φ is the phase, and u(t) is the unit-step function. As we feed the transmitter with the im- pulse noise in the baseband, an approximation for the complex baseband representation is given by:

−λt+j2π(f−fc)t+jφ dB(t) = Ae u(t), (2.16) where fc is the translation frequency. We refer to dB(t) as the baseband representation since   j2πfct d(t) = Re dB(t)e .

However, we refer to it as an approximation since DB(ξ) = F(dB(t)) is only approximately equal to D+(ξ + fc), where D+(ξ) = F(d(t))u(t). Similar approximation was also done in Section F.3.5.2.1 of [21]. λ is set according to the required impulse duration U. We require that the temporal power is reduced by at least 99 % till the end of the duration, ln 100 thus λ = 2U . A damped sine wave with a slow decay (small λ) and with a faster decay (bigger λ) is depicted in Figure 2.9.

42 Chapter 2. Powerline Communication System Description

1 ln 100 A = 1, f = 10M, λ = 2µ ,U = 2µ, φ = −π/2 0.5

0

Slow Decay −0.5

−1

0.6 5 ln 100 A = 1, f = 10M, λ = µ ,U = 0.1µ, φ = −π/2 0.4

0.2

Fast Decay 0

−0.2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3 Time (µs)

FIGURE 2.9: Damped Sine Wave

Fourier Analysis

The impulse noise analysis in the frequency domain is performed in this section. This analysis will help us explain the experimental results in Chap- ter4.

The Fourier Transform DB(ξ) = F (dB(t)) is given by:

Aejφ DB(ξ) = . λ + j2π(ξ − f + fc)

The magnitude of DB(ξ) is then

A |DB(ξ)| = , p 2 2 2 λ + 4π (ξ − f + fc) and ˆ ξ = arg max |DB(ξ)| = ±(f − fc).

43 Chapter 2. Powerline Communication System Description

The Fourier Transform magnitude |D(ξ)| of a slow decay (small λ) damped sine wave is illustrated in Figure 2.10. The graph shows a narrow band signal with a sharp peak around the sine frequency f − fc = 10 MHz. However, a fast decay (bigger λ) damped sine wave, as depicted in the same figure has a wider band. A faster decay damped sine wave be- haves more like a Dirac delta function, which means a wider band in the frequency domain.

ln 100 A = 1, f − fc = 10M, λ = 2µ 5 ln 100 A = 1, f − fc = 10M, λ = µ

−7

| 10 ) ξ ( B D | log

10−8

0 5 10 15 20 25 30 ξ (MHz)

FIGURE 2.10: Damped Sine Wave Fourier Transform

The energy of dB(t) is given by:

Z ∞ 2 2 A |dB(t)| dt = . (2.17) −∞ 2λ

44 Chapter 2. Powerline Communication System Description

2.7.2 Periodic Impulse Noise

We generate the impulse noise in order to verify the correctness of our im- plementation in Chapter4. Therefore, the impulse noise parameters are de- terministic. For the same reason, we are emulating only periodic impulse noise as an aperiodic impulse noise has little value for us. Similar to the periodic impulse noise model in Section F.3.5.2.2 of [21], we define the periodic impulse noise I(t) as follows:

∞ X I(t) = dB(t + Ln + l), n=−∞ where L ≥ U is the inter-arrival time, and l is the offset parameter. For several impulse noise sources the cumulative noise w(t) is

X w(t) = Ii(t), (2.18) i where Ii(t) is the i-th impulse noise with its own parameters Ai, fi, λi, φi,Li and li. A typical OFDM symbol in IEEE 1901 is of length 40.96 µs. As we set the impulse duration U = 2 µs (as in [46]), several impulses can interfere with one OFDM symbol but not vise versa (an impulse cannot span several

OFDM symbols). The inter-arrival time parameter Li dictates how many impulses from noise source i will interfere with an OFDM symbol. Small

Li means more impulses per OFDM symbol window. The Fourier analysis performed in Section 2.7.1 is also valid during a window that contains several impulses. Assuming the inter-arrival time Li divides the OFDM symbol length, then the Fourier Transform shape of the repetitive impulse is similar to what previously discussed, but the mag- nitude is proportional to the number of impulses fit the OFDM window.

When the inter-arrival time Li does not divide the OFDM length, we will see a deviation from that analysis due to spectral leakage. Also, if the im- pulse frequency f is greater than the Nyquist frequency, it will alias to other carriers.

45 Chapter 3

Implementation Details

In this chapter, we describe the implementation of the IEEE 1901-based transceiver described in Chapter2. The source code for the IEEE-1901- based transceiver is readily available at [52]. The code is open source to allow reproduction of our results and to facilitate further development by the broader research community.

3.1 Overview

3.1.1 Development Platform

The hardware front-end used in our work is Ettus USRP N210. The USRP N210 is supported on several platforms such as MATLAB, GNU Radio, LabVIEW and more, each with its limitations and advantages. We chose to use GNU Radio software, a well-accepted open source platform in the SDR community. The main reasons are portability, multi-platform support, native C/C++ support for time-sensitive code, scripting (Python) for fast prototypes, successfully used in similar projects [26, 53], open source, and free. As C/C++ is so ubiquitous, the core code can be ported to other plat- forms if desired. The popular MATLAB platform was rejected due to poor signal processing speed which limits a real-time operation with the USRP. MATLAB also suffers from poor code portability due to a closed program- ming language and propitiatory software. LabVIEW was rejected for simi- lar reasons.

46 Chapter 3. Implementation Details

3.1.2 Structure

The core of our software implementation lies in a C++ library that we call lightplc. The library performs signal processing routines required by the PHY. A complementary code is implemented in several new GNU Radio blocks. The important implemented GNU Radio blocks are the PHY block and the MAC block. The PHY block, representing the physical layer, uti- lizes lightplc for most of the signal processing and performs the rest of the processing within the block. The PHY block is the only component that interacts with lightplc. The PHY block also communicates with the MAC block and the USRP block. The MAC block, representing the MAC layer, manages the resources and controls the PHY block. The USRP block (included in GNU Radio software) is the front-end which transmits and receives samples from the physical USRP hardware. Other implemented blocks are the APP Out block which provides the input to the MAC, the APP In block which accepts the MAC block output, and the Impulse Source block for emulating a periodic impulse noise. An abstract diagram of the basic architecture is depicted in Figure 3.1.

Lightplc

Front Powerline APP MAC PHY end

FIGURE 3.1: Implementation Block Diagram

Most of the signal processing is performed in the external library light- plc rather than within a GNU Radio module. This approach reduces the overhead of creating a dedicated block for each step in the signal process- ing chain (if a block does not exist in GNU Radio). Too many blocks would also over complicate the potential transceiver flow graph. We believe that

47 Chapter 3. Implementation Details modifications are easier with this approach. Some of the disadvantages in- clude not utilizing GNU Radio scheduling capabilities and its built-in Sin- gle Instruction Multiple Data (SIMD) which may improve the performance.

3.2 Ettus USRP N210

The implemented transmitter and receiver described in this chapter uses the Ettus USRP N210 for the SDR front-end. The host PC connects to the USRP using a port. The USRP N210 includes a Xilinx Spartan 3A-DSP 3400 FPGA, a 100 MS/s ADC and a 100 MS/s DAC. For the RF front-end, we have daughterboards that perform the actual trans- mission and reception. The daughterboards used in this work are LFRX for the receiver and LFTX for the transmitter. They operate in the frequency range 0 to 30 MHz. The transmission path is described as follows. The signal from the host PC arrives through the Ethernet port to the FPGA. Each sample is 32-bit wide which consists of I and Q numbers, 16 bits each. The FPGA first in- terpolates the signal to reach the DAC sampling rate of 100 MS/s. As we use Gigabit Ethernet, the maximum sampling rate of a 32 bits number is 1G 32 = 31.25 MS/s. However, the FPGA cannot interpolate such a rate into 100 MS/s since it requires the interpolation factor to be an integer. The clos- est rate that satisfies the condition is a sampling rate of 25 MS/s, which is, therefore, the maximum achievable rate from the host to the USRP. This corresponds to a bandwidth of 25 MHz. Note however that the IEEE 1901 bandwidth is 50 MHz. Hence, we cannot reach the full IEEE 1901 spectrum using the USRP N210. Other SDR devices from the same company allow communication with the PC host using or dual Gigabit Ethernet, which enable a wider bandwidth. After the interpolation, the USRP performs Digital-Up-Conversion (DUC) to change the center frequency of the signal, if required. The I and Q samples from the FPGA arrives the DAC, which performs a conversion to analog and passes the signal to the daughterboard. The daughterboard filters the signal using a Low Pass Filter (LPF) and may further change the

48 Chapter 3. Implementation Details center frequency if it includes an oscillator (the LFRX/LFTX used here do not include an oscillator). The daughterboard then transmits the signal. The process is depicted in Figure 3.2.

cos()

LPF DAC DUC

-sin()

LPF DAC DUC

cos() Ethernet Powerline LPF ADC DDC

-sin()

LPF ADC DDC

FIGURE 3.2: USRP N210 Architecture

The receiving direction is similar but reversed. The signal arrives the daughterboard which may bring it to an intermediate frequency range (if it includes an oscillator) and filters it using the LPF. The signal is sampled by the ADC and passed to the FPGA for decimation and changing of center frequency using the Digital-Down-Conversion (DDC). Lastly, it arrives the PC host through the Ethernet connection.

3.3 Lightplc

The lightplc library performs signal processing tasks requested by the PHY. As it needs to be fast, it was written in C++. Lightplc consists of a single class called phy service. Its objectives are:

49 Chapter 3. Implementation Details

• Generate IEEE 1901-like PPDUs which includes encoding and gener- ating the preamble, frame control, and payloads symbols.

• Process incoming preamble, frame control, and payload symbols. This includes demodulation, decoding, and parsing of the data.

• Perform channel estimation.

• Calculate the noise PSD from incoming noise samples.

• Perform bit loading.

Typically, a user instantiates a phy service object and access the fol- lowing services routines: create ppdu: The function performs the encoding and the generation of frame control and payload symbols. It also inserts the preamble and produces a complete PPDU ready for transmission as described in Section 2.1. process ppdu preamble: The function processes a PPDU preamble and computes the phase offset as described in Section 2.2.4. process ppdu frame control: The function processes a PPDU frame control symbol. It demodulates the OFDM symbol as described in Section 2.2.5, and decodes the received bits as described in Section 2.2.6. process ppdu payload: The function processes PPDU payload sym- bols. It demodulates the OFDM symbols as described in Section 2.2.5 and decodes the received bits as described in Section 2.2.6. It may also perform channel estimation if using the payload method or the preamble methods as described in Section 2.3. post process ppdu: The function takes the last processed payload symbols and performs BER calculation. It may also perform channel esti- mation if the last frame was sound as described in Section 2.3. process noise: The function processes the noise samples and esti- mates the noise PSD as described in Section 2.4. calculate tone map: The function performs bit loading calculation using the incremental algorithm as described in Section 2.5.

50 Chapter 3. Implementation Details

3.4 GNU Radio Blocks

In the following sections, we describe the implemented GNU Radio blocks and how they connect to each other to form a complete PLC transceiver. All new GNU blocks are encapsulated in an out-of-tree module we called gr-plc.

3.4.1 PHY Hierarchical Block

The PHY block is a hierarchical block. A hierarchical block is an abstrac- tion of several connected GNU Radio blocks. The PHY hierarchical block designed in GNU Radio Companion tool is depicted in Figure 3.3. The im- portant blocks are PHY Rx, which is in charge of the reception, and PHY Tx, which is in charge of the transmission. These blocks are described in the following subsections. The output of PHY Tx is scaled by a constant. We refer to this as the con- trollable gain AG (see AG’s contribution to signal energy in Appendix A.2). The controllable gain can be used for any purpose, but the main purpose is to keep the PHY block output samples between −1 and 1 as required by the USRP block. The PHY Rx has a sensitivity parameter which corresponds to the preamble detection threshold td from Equation 2.2. The log parameter determines the amount and type of information to print (for debugging and analysis of the PHY operation). In the figure, the ’mac in’ and ’mac out’ blocks correspond to messages arriving from the MAC or going to the MAC. The ’samp out’ and ’samp in’ correspond to the signal samples arriving at the PHY block or going from the PHY block. Solid lines correspond to a continuous stream of samples between two blocks. Dashed lines correspond to an asynchronous message passing between two blocks.

51 Chapter 3. Implementation Details

FIGURE 3.3: PHY Hierarchical Block

3.4.2 PHY Rx Block

The PHY Rx block is the physical layer receiver. It is written in C++ as it communicates with the lightplc library and performs time-sensitive signal processing. For the most time critical operations we use SIMD to allow a real-time signal processing. The block has two inputs: one input is for incoming samples (originated from the USRP), and the other input is for messages arriving from the MAC block. It has one output that goes to the MAC block. The PHY Rx block instantiates a phy service object to perform some of the signal processing (see below). In general, the frame detection and alignment is performed by the PHY Rx block and the rest of the signal processing is performed by the phy service class. Processing an incoming PPDU consists of multiple steps where for each step we assigned a state in a state machine. Here we will describe the state machine states. Variables outside the state machine required for the block seamless operation and interaction with GNU Radio are beyond the scope of this thesis.

52 Chapter 3. Implementation Details

State Machine

The block operates a state machine as depicted in Figure 3.4. The states are described as follows.

Found preamble Search

Reset Sync

CRC failed

Copy Copy Payload Preamble

Copy Frame CRC passed Control

FIGURE 3.4: PHY Rx State Machine

Reset: This is the initial state. It initializes the internal counters and then goes to the next state. Search: When in this state, it performs an autocorrelation of the incom- ing samples and searches for a preamble as described in Section 2.2.2. Once a preamble is detected, the machine goes to the next state. Sync: When in this state, it performs the symbol alignment as described in Section 2.2.3. Once a synchronization has been established, the machine goes to the next state.

53 Chapter 3. Implementation Details

Copy Preamble: When in this state, it copies the incoming PPDU preamble samples and performs phase offset correction by calling process ppdu preamble. Also, it passes the noise samples collected before the preamble, during the inter-frame space, to process noise for a noise PSD estimation. It then goes to the next state. Copy Frame Control: When in this state, it copies the PPDU frame con- trol samples and passes them to process ppdu frame control. If the decoded frame control passes the CRC, it determines the length of the up- coming payload. It then goes to the next state. If the CRC fails, the machine goes to Reset. Copy Payload: When in this state, it copies the PPDU payload samples and passes them to process ppdu payload for decoding. The decoded bits are sent to the MAC block via an outgoing message. The machine then goes to Reset.

Incoming Messages

The PHY Rx performs other tasks triggered by messages from the MAC block. The messages are described as follows. PHY-RXINIT: This message commands to put the state machine in the Reset state. This message also configures the default tone mask and other PHY parameters. The message is sent by the MAC only on system start-up. PHY-RXPOSTPROCESS: This message commands to perform post- processing on last received PPDU. This is triggered by the MAC block once the received payload passes the CRC. The actual utilization is carried out by post process ppdu which performs channel estimation and BER calculation. PHY-RXCALCTONEMAP.request: This message is a request arriving from the MAC block to perform bit loading. The actual calculation is per- formed by calculate tone map.

54 Chapter 3. Implementation Details

3.4.3 PHY Tx Block

The PHY Tx block is the physical layer transmitter. It is written in C++ as it communicates with the lightplc library and performs time-sensitive opera- tions. The block has one input for incoming messages from the MAC block. It has two outputs. One output is for outgoing samples (which goes to the USRP block), and the other output is for messages to the MAC block. The block instantiates a phy service class to perform the signal processing. Transmitting a PPDU consists of multiple steps where for each step we assigned a state in a state machine. Here we will describe the state machine states. Variables outside the state machine required for the block seamless operation and interaction with GNU Radio are beyond the scope of this thesis.

State Machine

The block operates a state machine as depicted in Figure 3.5. The states are described as follows.

Ready

PHY-TXSTART

Tx Preparing

PPDU ready

FIGURE 3.5: PHY Tx State Machine

55 Chapter 3. Implementation Details

Ready: When in this state, the block is ready for transmission and waits for an incoming message from the MAC block. It produces an output of zeros. Preparing: We enter this state after receiving a PHY-TXSTART message from the MAC block (see below). When in this state, we are waiting for the PPDU frame to be ready. The block still produces samples of zeros. Tx: We enter this state after the PPDU frame is ready. When in this state, the block outputs the PPDU frame samples. Once the transmission of the PPDU is done, the machine goes to the Ready state.

Incoming Messages

The PHY Tx is controlled by messages arriving from the MAC block. The messages are described below. PHY-TXINIT: This message commands to put the state machine in the Reset state. This message also configures the default tone mask and other PHY parameters. The message is sent by the MAC only on system start-up. PHY-TXSTART: This message commands to transmit a frame. The mes- sage contains a MAC Protocol Data Unit (MPDU). If the state machine is in Ready, the MPDU is passed to create ppdu, and the state machine goes to Preparing. If the state machine is not in Ready the MPDU is dropped. PHY-TXCONFIG: This message sets the tone map for future transmis- sions using the set tone map routine.

3.4.4 MAC Block

The MAC block implements the MAC layer as described in Section 2.6. As the MAC layer does not perform signal processing but mainly manages resources and copies data, high performance is not required. Therefore it was written in Python which simplifies the implementation and allows easier modifications if required. The implemented MAC block constructs MAC frames where the pay- load data arrived from the APP Out block. Each MAC frame is fragmented

56 Chapter 3. Implementation Details into three 520-byte PHY blocks. The payload of successfully received MAC frames is passed to the APP In block.

State Machine

The MAC block operates a state machine. The master state machine is illustrated in Figure 3.6 and the slave state machine is illustrated in Figure 3.7. The labels on the transitions arrows are in the form of EVENT/CONDITIONS/ACTION. For example, from the ’Waiting for APP’ state: if the event ’frame arrived’ occurred and the condition ’tone map is valid’ is satisfied, then ’transmit SOF’ action is taken, and we transit to the state ’Transmitting SOF’. The state machine transitions are triggered by messages arriving from the PHY block, the APP In block.

Incoming Messages

The MAC block communicates with the PHY block through messages. The outgoing messages of the MAC block, PHY-RXINIT, PHY-RXPOSTPROCESS, PHY-RXCALCTONEMAP.request, PHY-TXINIT, PHY-TXSTART, and PHY-TXCONFIG are described in the PHY Rx and PHY Tx blocks descrip- tion in Section 3.4.2 and Section 3.4.3. The incoming messages are described as follows. PHY-RXSTART: This message is sent by the PHY Rx to indicate that a new PPDU was detected and that the receiving process has begun. The message includes the received MPDU frame control and the MPDU pay- load. The MAC layer parses the MPDU frame control to determine the MPDU type. PHY-RXEND: This message is sent by the PHY Rx to indicate that the PPDU frame reception process has ended. PHY-RXCALCTONEMAP.response: This message is sent by the PHY Rx in response to PHY-RXCALCTONEMAP.request. The message includes a new tone map. The MAC then send the tone map to the other station via a management MPDU.

57 Chapter 3. Implementation Details

SACK received or timeout / Frame available, tone map valid / Transmit SOF

Transmission is done Transmitting Waiting SOF For SACK SACK received or timeout / No frame available SACK received or timeout / Frame arrived / Frame available, Tone map valid / tone map expired / Transmit SOF Transmit Sound Waiting For APP Frame arrived / Tone map expired / SOF received // Transmit Sound Transmit SOF Timeout

Waiting for Waiting Transmitting Management For SACK Sound SOF

SACK received Transmission is done

FIGURE 3.6: MAC Master State Machine

58 Chapter 3. Implementation Details

Transmitting Transmission SACK is done

SOF received // Transmit SACK

Waiting for a Frame Sound arrived // Transmit SACK Transmission is done

Transmitting Transmitting Management SACK SOF

Transmission is done // Transmit management SOF

FIGURE 3.7: MAC Slave State Machine

59 Chapter 3. Implementation Details

PHY-TXEND: This message is sent by the PHY Tx to indicate that the PPDU transmission is complete. MAC-TXMSDU: This message is sent by the APP Out block to a master MAC block. The message contains data required to transmit to the slave station.

User Parameters

Several parameters in the MAC block are easily configurable. Some of the parameters used internally by the MAC block and some are passed to the PHY via messages. The parameters are described as follows. Role: The parameter sets whether a block is a master or a slave. Address: The parameter sets the station address. This value is used when the MAC frame is constructed. Dest Address: The parameter sets the destination station address. This value is used when the MAC frame is formed. Tone Mode: The parameter sets the tone mode for the station: Standard ROBO, High-Speed ROBO, Mini ROBO or no ROBO mode which uses the negotiated tone map. Broadcast Mask: The parameter is a mask of 2048 bits which sets the default tone mask. Sync Mask: The parameter is a mask of 256 bits which sets the tone mask for the preamble SYNCP and SYNCM symbols. QPSK Mask: The parameter is a mask of 2048 bits which determines which carriers should be forced to QPSK modulation during the bit loading calculation. Target BER: The parameter sets the target BER for the bit loading calcu- lation. Channel Estimation: The parameter sets the channel estimation method used by the station. Inter-frame Space: The parameter sets the minimum space between two adjacent transmitted frames.

60 Chapter 3. Implementation Details

Log: The parameter sets the amount and type of information to print when running. Used for debugging and analysis of the MAC block opera- tion.

3.4.5 APP Layer Blocks

The APP Out block and APP In block represent the APP layer. The purpose of the APP Out block is to pass to the MAC block data re- quired for transmission. The APP Out block input may be any bit stream source such as a file and a sound wave. The block first fragments the in- coming bit stream and then passes the fragments to the MAC block via the MAC-TXMSDU outgoing message. The MAC block responds with the mes- sage MAC-READY when it is ready to receive more data. The purpose of APP In block is to collect data arriving from the MAC block. The APP In block receives data from the MAC block via the MAC-RXMSDU incoming message and streams it through its output port.

3.4.6 Impulse Source Block

The Impulse Source block generates a repetitive impulse noise as defined in Equation 2.18. The block can generate several repetitive impulse noise sources each with its own Ai, fi, λi,Li and li parameters.

3.4.7 Transceiver

A complete two-transceiver flow graph created in GNU Radio Companion is depicted in Figure 3.8. The top part is the master station transceiver, and the bottom part is the slave station transceiver. Note that the PHY blocks in the figure are the hierarchical block that is shown in Figure 3.3. The master station includes a file source that feeds the APP Out block with a continuous bit stream. The data is processed through the MAC and PHY blocks and then goes to the USRP block. The USRP block sends the signal to an actual USRP hardware through the Ethernet port. The USRP hardware is connected to the powerline.

61 Chapter 3. Implementation Details

FIGURE 3.8: Two-Transceiver Flow Graph

The powerline is also connected to another USRP hardware, represent- ing the slave station. The USRP sends the data through the same Ethernet port to the slave station USRP block shown in the bottom part of Figure 3.8. Samples from the USRP block are processed through the PHY and MAC blocks and eventually saved to a file through the APP In block. The two USRP physical devices are paired using a special MIMO cable. This connection synchronizes the two USPRs internal oscillators to avoid a carrier frequency offset. The return path, from the slave to the master, is not going through the USRP blocks. Instead, the slave PHY block output is fed directly to the

62 Chapter 3. Implementation Details master station PHY block. In our channel access scheme described in Sec- tion 2.6.3, the return path is less important as it is used solely for acknowl- edging received frames and for sending management messages containing tone maps. Therefore we have decided to utilize a real powerline only in the forward path. In order to utilize the USRPs in the return path as well, two more daugh- terboards are required. However, connecting two more daughterboards will adversely affect the system bandwidth as we double the data passed through the Ethernet port. It will also put more strain on the PC, and the system might fail. Therefore, for using a two-way USRPs connection, we advise using two PCs. Each PC should run an instance of GNU Radio and connect to a USRP with a receiver and transmitter daughterboards.

3.5 Known Limitations

The following are known limitations that apply to our communication sys- tem, and how to mitigate them. • The library used for the turbo convolutional decoder is IT++ [31]. We expect that implementing a custom-made decoder will greatly im- prove the PHY receiver throughput. It would also allow compatibil- ity with the original IEEE 1901 turbo convolutional code rather than using the modified version as discussed in Section 2.1.3.

• Lightplc supports only one tone map. This means that setting a new tone map overrides the previous one. In the current master-slave channel access this is not a problem. However, there may be a prob- lem when more than two stations are communicating or when more than one tone map is required.

• The communication system does not correct a carrier frequency off- set, as it relies on the USRPs’ ability to synchronize their internal os- cillators using a MIMO cable. For non-synchronized oscillators, a car- rier frequency offset may appear, and a correction mechanism should be added to the system.

63 Chapter 3. Implementation Details

• As the maximum Ethernet data rate is 25 MS/s (complex number samples), the maximum bandwidth when using USRP N210 is 25 MHz (see description in Section 3.2). For a higher bandwidth, the user can use other SDR devices which can utilize a 10 Gigabit Ethernet or dual Gigabit Ethernet.

• A known limitation of the USRP N210 is an aliasing effect caused by an upsampling and a non-ideal LPF in the transmitter. This process creates unwelcome images near the bandwidth edges. Therefore, it is best to avoid using carriers near the bandwidth edges. This makes the actual bandwidth available less than 25 MHz. In the experiments performed in Chapter4 we use only the central 12.5 MHz out of the 25 MHz to avoid this interference.

64 Chapter 4

Experimental Results

In this chapter, we present the results of experiments conducted with our communication system. In Section 4.1 we describe the system setup used throughout the exper- iments. In Section 4.2 we perform experiments on an actual car harness (disconnected from a car) where a white Gaussian noise is generated in software. In Section 4.3 we use the same setting but with an addition of an impulse noise. Lastly, in Section 4.4 we perform measurements on an actual vehicle. The purpose of the car harness experiments is to verify the correctness of the implementation, to compare between the different channel estima- tion methods and to measure the system performance. The purpose of the last part is to investigate the feasibility of a reliable IEEE 1901 communica- tion in a vehicular powerline.

4.1 System Setup

All experiments were performed with the implemented system described in Chapter3. The specific PHY and MAC layer parameters are described below.

65 Chapter 4. Experimental Results

4.1.1 PHY Parameters

In IEEE 1901 the sampling frequency is 100 MHz where the OFDM symbol consists of N = 2048 carriers (4096 samples). The positive frequency of car- 50 rier k is thus equals to k 2048 MHz, where 0 ≤ k ≤ 2047 and the bandwidth is 50 MHz. Due to USRP N210 sampling rate limitation as described in Section 3.2, the effective sampling rate is 50 MHz. This corresponds to carriers at 25 k 2048 MHz, where the bandwidth is 25 MHz. To keep the same carrier spac- ing as in IEEE 1901, we use a tone mask where we unmasked one of every 2048 two carriers. We are then left with 2 = 1024 carriers. Due to aliasing effect at the band edges, as described in Section 3.5, we will use only the center N˜ = 512 carriers. The same logic is applied to the preamble SYNC symbols, where one of every two carriers is masked to keep the same car- rier spacing as in IEEE 1901, and only the central M˜ = 64 carriers are used. As the implemented PHY uses baseband modulation and as the USRP sampling frequency of complex numbers is 25 MHz, the input to the USRP is a signal between −12.5 to 12.5 MHz. Therefore the central frequency pa- rameter in the USRPs is set to fc = 12.5 MHz, which shifts the band to 0 to 25 MHz. The effective band used in our modified IEEE 1901 is illustrated in Figure 4.1. The minimum inter-frame spacing, which is exploited for noise PSD estimation, has been tripled to improve estimation accuracy. In an actual IEEE 1901 system, several or other silence periods can be utilized for this purpose. However, to keep the system simple, we have decided to extend the inter-frame spacing. Note that as the effective sample rate is two times slower than IEEE 1901 (50 MHz vs. 100 MHz), the frame is two times longer than in IEEE 1901. A comparison between IEEE 1901 and our system is summarized in Table 4.1. Other implementation-specific parameters are the sensitivity for pream- ble detection (see Section 3.4.1), the target BER for the incremental algo- rithm (from Section 2.5.1) and the controllable gain (from Section 3.4.1). The values are summarized in Table 4.2. Note that the controllable gain is

66 Chapter 4. Experimental Results

Active IEEE 1901

Masked

Active

Modified IEEE 1901 Masked 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 Frequency (MHz)

FIGURE 4.1: IEEE 1901 Spectrum Mask. The original spec- ification spectrum mask (top) and the modified spectrum mask (bottom) reduced when we add an external amplifier in Section 4.4. When not us- ing an external amplifier the purpose of the controllable gain is to keep the PHY output between −1 and 1 as described in Section 3.4.1. When using the external amplifier, the controllable gain is reduced to keep the amplifier output below the maximum power limit as described in Section 4.1.3. For both cases, the controllable gain value was determined empirically.

4.1.2 MAC Layer Parameters

The channel access mode we use is the master-slave channel access as de- scribed in 2.6.3. The master takes data from a file (a compressed video stream) and transmits MPDUs where each MPDU consists of three 520-byte PHY blocks, i.e. 520 × 3 = 1560 bytes in each MPDU payload. The transceiver used is similar to the one describe in Section 3.4.7 but with an addition of emulated noise if required. As outlined in Section 3.4.7,

67 Chapter 4. Experimental Results

TABLE 4.1: Modified IEEE 1901 Properties

IEEE 1901 Modified IEEE 1901 Sampling rate 100 MHz 50 MHz Number of carriers 2048 2048 Non-masked carriers 917 512 Band 2 to 28 MHz 6.25 to 18.75 MHz Carrier spacing 24.41 kHz 24.41 kHz Number of SYNC carriers 256 256 Non-masked SYNC carriers 113 64 SYNC carrier spacing 195.28 kHz 195.28 kHz Preamble length 51.20 µs 102.4 µs OFDM symbol length 40.96 µs 81.92 µs Frame control guard interval 18.32 µs 36.64 µs Payload guard interval 7.56 µs 15.12 µs Roll-off interval 4.96 µs 9.92 µs Minimum inter-frame spacing 140 µs 840 µs

TABLE 4.2: Implementation-Specific Parameters

Sensitivity 0.75 Target BER 0.01 Controllable gain 0.3 or 0.066

68 Chapter 4. Experimental Results only the forward path goes through the SDRs (master to slave). The re- turn path (slave to master) is done internally on the PC. The return path is less important as it is used solely for acknowledgment of frames reception (SACK MPDU) and management messages.

4.1.3 Power Spectral Density

We first show the PSD of the SDR output. The IEEE 1901 requires a PSD lower than −55 dBm/Hz between 1 to 30 MHz for a 100 Ω termination impedance. We performed measurements by continuously transmitting the same frame control OFDM symbol (which has slightly more power than a payload symbol). The controllable gain parameter for this mea- surement was set to 0.3. The PSD as measured by the spectrum analyzer VNA Master 2304A from Antrisu is depicted in Figure 4.2. The resolution bandwidth used is 10 kHz and the detection scheme was set to peak. The spectrum analyzer input impedance is 50 Ω. We assume that the USRP output impedance is small. Therefore the results for 100 Ω termination should be similar. As shown in the figure, the PSD is a pulse shape around the OFDM band (6.25 to 18.75 MHz) where the height is approximately −80 dBm/Hz, which is much below the maximum allowed by IEEE 1901. We believe that the slight declining in the PSD shape in the figure is due to the cable connecting the USRP to the spectrum analyzer or due to the USRP internal hardware. For the car experiment in Section 4.4 we add an amplifier to increase signal power. This is due to increased noise and an increased signal attenu- ation. When using the amplifier, the controllable gain parameter is reduced to 0.066 to keep the output signal below the maximum output power limit of the amplifier. The PSD measurement by the spectrum analyzer in this configuration is −67 dBm/Hz. Reaching the limits set by IEEE 1901 is possible by adding an appropri- ate amplifier. However, we did not have one available at the time of the experiments.

69 Chapter 4. Experimental Results

−70

−80

−90 ) Hz

/ −100 dBm −110 PSD (

−120

−130

−140 0 2 4 6 8 10 12 14 16 18 20 22 24 Frequency (MHz)

FIGURE 4.2: OFDM Power Spectral Density

4.2 Car Cable Harness (White Noise)

In this part, we test our system over a car cable harness, as shown in Figure 4.3. The cable harness was built by Azure Dynamics and was taken from a hybrid Ford truck. Its layout is depicted in Figure 4.4. The numbers in the figure identify the connectors and the devices used to connect to it. In our experiments, the two SDRs communicate between connector C347S and C346S, which corresponds to the powertrain and the electri- cal power assisted steering system. The path length is 4.25 m and has 8 branches [54]. No electrical devices except the SDRs are connected to the cable. In this part, we present a comparison between the channel estimation

70 Chapter 4. Experimental Results

FIGURE 4.3: Car Cable Harness

71 Chapter 4. Experimental Results

C309S C355S C308S C310S RT091 C082P C346S C354S C053S C142S C056S C174S C060S C020P C261S C347S RT002 RT003 RT092 C321S C252S C253S C074P RT001 C251S C335P RT090

C312S

C155S C154S C153S

FIGURE 4.4: Car Cable Harness Diagram methods, results of the adaptive bit rate algorithm and general perfor- mance of the system. In each test the master station transmits a total of 1000 MPDUs to the slave station.

4.2.1 Channel Estimation

The channel amplitude estimation is performed by the slave using one of the estimation methods as described in Section 2.3. A channel estimation using the sounding method (as outlined in section 2.3.1) in a noiseless set- ting obtained by the slave is shown in Figure 4.5. For a reference, we used a Vector Network Analyzer (VNA) to perform an independent channel es- timation. The device used is VNA Master 2304A by Antrisu. The reference channel estimation is also shown in Figure 4.5. The two shapes of the esti- mated channel amplitude are similar. The main difference is a vertical shift which is resulting from some scaling done by the SDR front-end and by the transmitting PHY block (such as the controllable gain in Section 3.4.1). These scalings are considered by the slave as a part of the channel ampli- tude. The other minor distortions (for frequencies above 9 MHz), we believe are attributed to the USRP internals.

72 Chapter 4. Experimental Results

Channel Amplitude (dB)

−30

−32

−34

Our System −36

−38

−2

−4

−6 VNA −8

−10

7 8 9 10 11 12 13 14 15 16 17 18 Frequency (MHz)

FIGURE 4.5: Car Cable Harness Channel Estimation

Comparison of Channel Estimation Methods

We now perform a comparison between the three channel amplitude es- timation methods presented in Section 2.3: sounding channel estimation method (Sounding-CE), payload channel estimation method (Payload-CE) and preamble channel estimation method (Preamble-CE). For the Payload- CE we force a QPSK carrier in one of every eight non-masked carriers, so it matches the SYNC carriers frequency. 2 The added noise follows the distribution CN (0, σW ). The noise is added to the signal going from the USRP block to the PHY block in the slave sta- tion (see transceiver diagram in Figure 3.8). The SNR is calculated as follows:

PR SNR = 2 2 , σW +σ ˜W

73 Chapter 4. Experimental Results

where PR is the average power of a received noise-free payload OFDM 2 symbol as described in Appendix A.2, and σ˜W is the external non-emulated noise variance. This non-emulated noise is assumed to be a Gaussian white noise. 2 The emulated noise variance σW is therefore   2 1 1 σW = PR − , SNR SNR˜

˜ PR ˜ where SNR = 2 . In this setup our measurements showed that SNR = σ˜W 27 dB. The baseline for the comparison is the noiseless Sounding-CE measure- ment described before and shown in Figure 4.5. The average Normalized Mean Square Error (NMSE) for each method in different SNR settings is shown in Figure 4.6. The graphs indicate that Sounding-CE performs the best, as expected, as it is inherently more accu- rate than the other two methods. It also shows that as the SNR decreases the gap between Preamble-CE and Sounding-CE increases. This is also expected as there are very few symbols participating in the Preamble-CE. However, the difference between Payload-CE and Sounding-CE increases only slightly. Reasons for the difference between Sounding-CE and Payload-CE are a noise PSD estimation error and a linear interpolation inaccuracy which may adversely affect Payload-CE but do not affect Sounding-CE. However, Payload-CE uses more symbols than Preamble- CE to estimate the channel. Therefore it is more accurate. The number of symbols is also increasing as we lower the SNR since as data rate decreases the number of OFDM symbols per frame increases. The average number of payload OFDM symbols against the SNR in Payload-CE is depicted in Figure 4.7.

4.2.2 Bit Loading

The bit loading calculation is performed by the slave using the incremental algorithm according to the estimated channel amplitude and the noise PSD

74 Chapter 4. Experimental Results

·10−3 9 Sounding-CE 8 Payload-CE Preamble-CE 7

6

5

NMSE 4

3

2

1

0 6 8 10 12 14 16 18 20 22 24 SNR (dB)

FIGURE 4.6: Channel Estimation Methods Comparison as described in Section 2.5. We define PHY rate as the number of bits in a payload OFDM symbol divided by the symbol duration. The maximum PHY rate is attained when all 512 carriers are assigned 4096-QAM, i.e., 512 × 12 = 6144 bit/symbol. The number of decoded bits are half of this number as the code rate is 1/2. 6144 The maximum PHY rate is then 2×(81.92µ+15.12µ) = 31.65 Mbps. Note the PHY rate only measures the capacity according to the tone map, regardless if the actual bits were received correctly or not. As the Payload-CE forces carriers to QPSK, the PHY rate is degraded. For the Payload-CE the maximum number of uncoded bits is 64×2+448× 12 = 5504 bit/symbol. This corresponds to a PHY rate of 28.35 Mbps, which is around 90 % of a non Payload-CE PHY rate.

75 Chapter 4. Experimental Results

24 22 20 18 16 14 12 10 8

Payload OFDM Symbols 6 4 2 0 6 8 10 12 14 16 18 20 22 24 SNR (dB)

FIGURE 4.7: Number of Payload OFDM Symbols per Frame in Payload-CE

Figure 4.8 shows the average normalized PHY rate (i.e. divided by 31.65 Mbps) as calculated by the incremental algorithm. The graphs show that for the measured SNRs range the Payload-CE reaches around 90 % PHY rate of the other methods.

Bit Error Rate

The BER calculated for each method is depicted in Figure 4.9. We remind that the target BER used is 0.01. The BER measured is the uncoded BER. It is calculated based on the received bits before passed to the turbo convo- lutional decoder. A bit error is assumed when the sent bit is different from

76 Chapter 4. Experimental Results

1 Without Payload-CE 0.9 With Payload-CE 0.8

0.7

0.6

0.5

0.4

0.3

Average Normalized PHY Rate 0.2

0.1

0 6 8 10 12 14 16 18 20 22 24 SNR (dB)

FIGURE 4.8: Channel Estimation Methods PHY Rate the maximum likelihood estimation as described in Section 2.5 and calcu- lated by Equation 2.12. The BER measures the quality of the received soft bits. The actual BER is different from the target BER as it is affected by the channel and noise PSD estimation accuracy (the incremental algorithm as- sumes a perfect knowledge of both). The graphs show that the BER is de- creasing as the SNR increases. As the SNR decreases the BER is increas- ing due to poor channel estimation, especially the channel phase which is based solely on the preamble in all methods. The slight BER increase in Preamble-CE and Payload-CE at high SNR is due to a high modulation type assigned by the incremental algorithm (due to the high SNR) which does not take the channel estimation statistics into account.

77 Chapter 4. Experimental Results

·10−2 3.2 Sounding-CE Payload-CE 3 Preamble-CE

2.8

2.6

2.4 BER

2.2

2

1.8

1.6 6 8 10 12 14 16 18 20 22 24 SNR (dB)

FIGURE 4.9: Channel Estimation Methods BER

4.2.3 Summary

In this section, we demonstrated the system behavior in a Gaussian white noise environment. We first performed a channel estimation without noise emulation and compared it to an independent channel estimation performed by a VNA device. We then drew a comparison between the NMSE of the three channel estimation methods for different SNR levels. We showed that Sounding-CE performed the best, as expected, and that Payload-CE performed much better than the simpler Preamble-CE, espe- cially in low SNR. We also showed how the number of OFDM symbols increases as the noise level is increasing. This inherent feature improves the Payload-CE accuracy at low SNR. We then compared the PHY rate of Payload-CE to the other methods and showed it reaches roughly 90 %

78 Chapter 4. Experimental Results of the data rate, as expected. Lastly, we presented the BER for the three methods and showed that the BER increases while the SNR is decreasing. This is expected since a channel estimation error or a noise PSD estimation error adversely affects the adaptive bit rate algorithm accuracy.

4.3 Car Cable Harness (Impulse Noise)

As an impulse noise is a significant part of a vehicular powerline noise [12], we now demonstrate the system behavior in an impulsive noise en- vironment. In this part, we focus on the noise PSD estimation and the bit loading calculation which are directly affected by periodic impulse noise. We first describe the noise parameters and then we show how it affects the system operation. As in previous part, the noise is generated in software and added to the signal going from the USRP block to the PHY block in the slave station (see transceiver diagram in Figure 3.8). The channel estima- tion method used throughout this section is the Sounding-CE.

4.3.1 Noise Generation

We generate two types of noise: a periodic impulse noise and a white Gaus- sian noise. The impulse noise is generated using the impulse noise generator as de- scribed in Section 3.4.6. The impulse noise parameters are described below. 2 The emulated background noise follows the distribution CN (0, σW ). Based on [46] we have five repetitive impulse noise sources. All sources produce impulses with the same energy. The duration of an impulse is ln(100) 2 µs [46], thus λ = 4µ . The frequencies fi, 1 ≥ i ≥ 5 are distributed over the OFDM band as shown in Table 4.3. The offset parameter of each source is chosen such that the combined impulses from all sources are spaced equally. The inter-arrival time L for each source is chosen such

79 Chapter 4. Experimental Results

TABLE 4.3: Impulse Noise Parameters

Parameter Value λ - Decay 1.1513 MHz L - Inter-arrival time 87.12 µs

i fi - Frequency li - Offset 1 1 8 3 MHz 0 5 2 10 12 MHz L/5 1 3 12 2 MHz 2L/5 7 4 14 12 MHz 3L/5 2 5 16 3 MHz 4L/5 that each OFDM symbol will be hit by approximately one impulse. There- fore we choose L = 485.2 µs. The impulse noise parameters are summa- rized in Table 4.3. Note that the space between two successive impulses is L/5 = 97.04 µs which is the same order of magnitude discussed in [46, 12].

Since we have two noise types, we define two SNRs. Let SNRW be the ratio between the average power of a received noise-free payload OFDM symbol and the background white noise variance. Then, similarly to the SNR in the previous section:

PR SNRW = 2 2 , σW +σ ˜W where PR is the average power of a received noise-free payload OFDM 2 symbol as described in Appendix A.2, and σ˜W is the external non-emulated noise variance. This non-emulated noise is assumed to be a Gaussian white noise. 2 The emulated noise variance σW is therefore   2 1 1 σW = PR − , SNRW SNR˜

˜ PR ˜ where SNR = 2 . In this setup our measurements showed that SNR = σ˜W 27 dB.

80 Chapter 4. Experimental Results

Let SNRI be the ratio between the average power of a received noise- free payload OFDM symbols and the average power of the impulse noise

PI : PR SNRI = . PI Using Equation 2.17 for impulse noise energy, the average power of an im- 5A2 pulse is given by PI = 2λL . The amplitude is then determined by: s 2 PRλL A = . 5 SNRI

4.3.2 Noise PSD

The noise PSD is estimated by the slave during the inter-frame space, as described in Section 2.4. Since the impulse noise inter-arrival time (for each impulse noise source) is less than the inter-frame space, we expect peaks at the noise frequencies as discussed in Section 2.7.

A noise PSD measurement from the slave station for SNRW = 15 dB and SNRI = 10 dB is shown in Figure 4.10. The peaks for the impulse noise frequencies in Table 4.3 are shown clearly in the noise PSD graph. Note that the peaks height vary due to PSD estimation spectral leakage.

4.3.3 Bit Loading

The bit loading calculation is performed by the slave using the incremental algorithm according to the estimated channel amplitude and the noise PSD as described in Section 2.5. As we have a colored noise, we expect it to be reflected in the calculated tone map. The adaptive bit loading algorithm utilizes the average carrier SNR es- timation performed by the slave. The carrier SNR estimation for carrier k 2 |NHˆ [k]|2 with modulation type i is γi [k] = 2 as described in Section 2.5.A σˆW [k] carrier SNR estimation for SNRW = 15 dB and SNRI = 10 dB calculated by the slave is depicted in Figure 4.11. The graph shows local minima at the impulse noise frequencies. Note that above 15 MHz the SNR is low due to low channel amplitude (see Figure 4.5).

81 Chapter 4. Experimental Results

−106

−108

−110

−112

−114

−116

−118

Noise PSD (dB/Hz) −120

−122

−124

−126 8 10 12 14 16 18 Frequency (MHz)

FIGURE 4.10: Car Cable Harness Noise PSD Estimation

A tone map from the master station for SNRW = 15 dB and SNRI = 10 dB is depicted in Figure 4.12. In this figure, each carrier has a cor- responded dot in the graph according to its modulation type. The five impulse noise frequencies cause a reduction in the modulation type around their carrier frequency. The low modulation types assignments at frequency 15 MHz and above are due to low carrier SNR as shown in Figure 4.11.

4.3.4 Performance

We have performed tests with SNRI between 0 to 25 dB and SNRW = 25, 20 and 15. In each test the master station transmits ≈ 350 MPDUs to the slave station. For each test, we measure the BER, average PHY rate, block error

82 Chapter 4. Experimental Results

25

20

15

10

5 SNR Estimation (dB) 0

−5

−10 8 10 12 14 16 18 Frequency (MHz)

FIGURE 4.11: Car Cable Harness SNR Estimation rate and sync error rate. The BER and the PHY rate were defined in the pre- vious section. A block error corresponds to a PHY block CRC failure. This occurs when the turbo decoder cannot recover all erroneous bits. A sync error corresponds to a PPDU frame not detected correctly by the receiver.

Bit Error Rate

The BER graphs are depicted in Figure 4.13. The three lines represent the three SNRW levels. We remind that the target BER for the incremental al- gorithm is set to 0.01. The graphs show that the white noise has very little impact on the BER, when comparing to the impulse noise impact. Increas- ing the impulse noise power (i.e. decreasing SNRI) increases the BER more significantly. This behavior is expected since the adaptive bit rate algorithm

83 Chapter 4. Experimental Results

4096-QAM

1024-QAM

256-QAM

64-QAM

16-QAM

8-QAM Modulation Type QPSK

BPSK

Nulled 8 10 12 14 16 18 Frequency (MHz)

FIGURE 4.12: Car Cable Harness Tone Map assumes the noise is purely Gaussian. Other factors that may increase the BER above the target BER are channel and noise PSD estimation inaccuracy. Note that the BER is calculated only for successfully transmitted frames. Frames with synchronization error are obviously not included in the calcu- lation since the frame is not decoded. Frames with block error are also not included in the BER calculation since the reference frame cannot be con- structed.

PHY Rate

The normalized PHY rate graphs are depicted in Figure 4.14. The graphs show, as expected, that the PHY rate increases when SNRW or SNRI are increasing. Note that the PHY rate is not the actual data rate but rather the potential transfer speed based on the tone map. Data transfer error is not reflected in the PHY rate.

84 Chapter 4. Experimental Results

0.1 SNRW = 25 dB −2 9 · 10 SNRW = 20 dB SNRW = 15 dB 8 · 10−2

7 · 10−2

6 · 10−2

5 · 10−2 BER 4 · 10−2

3 · 10−2

2 · 10−2

1 · 10−2

0 0 2 4 6 8 10 12 14 16 18 20 22 24

SNRI (dB)

FIGURE 4.13: Car Cable Harness Bit Error

Sync Error

The sync error rate graphs are depicted in Figure 4.15. The graph resem- bles a step like function where the cutoff is at SNRI = 10 dB. As illustrated in the graphs, no sync error occurs above SNRI = 10 dB, and a sharp in- crease occurs at SNRI = 10 dB. When going below 10 dB, the sync error rate slowly increases. Note that the background Gaussian noise has little to no effect on the sync error rate. Since the inter-arrival time between two impulse noises is L/5 = 97.04 µs, and the preamble length is 102.4 µs, we have roughly one im- pulse in a preamble window. The detection success depends on where an impulse impacts the preamble. We expect that increasing the impulse inter-arrival time will decrease the sync error rate. The cutoff SNRI will be

85 Chapter 4. Experimental Results

1 SNRW = 25 dB 0.9 SNRW = 20 dB SNRW = 15 dB 0.8

0.7

0.6

0.5

0.4

Normalized PHY Rate 0.3

0.2

0.1

0 0 2 4 6 8 10 12 14 16 18 20 22 24

SNRI (dB)

FIGURE 4.14: Car Cable Harness PHY Rate higher since the impulse noise average power is reduced.

Block Error

The block error rate graphs are depicted in Figure 4.16. The graphs show small blocks error rate (less than 2.5 %) and only at very low SNRI. This result means that the impulses almost do not affect the OFDM symbol de- coding results. That is due to IEEE 1901 encoding schemes and the adaptive bit rate algorithm.

4.3.5 Summary

In this section, we demonstrated the system behavior in a repetitive im- pulse noise environment. We first showed a noise PSD estimation and a

86 Chapter 4. Experimental Results

1 SNRW = 25 dB 0.9 SNRW = 20 dB SNRW = 15 dB 0.8

0.7

0.6

0.5

0.4 Sync Error Rate 0.3

0.2

0.1

0 0 2 4 6 8 10 12 14 16 18 20 22 24

SNRI (dB)

FIGURE 4.15: Car Cable Harness Synchronization Error bit loading calculation performed by the slave station in a presence of a repetitive impulse noise and a background white Gaussian noise. We then conducted several tests with different levels of impulse and background noise and measured the BER, PHY rate, sync error rate and block error rate. The BER increases while the impulse noise level is increas- ing. This behavior is expected since the incremental algorithm assumed a pure Gaussian noise. Sync errors occur when an impulse noise energy goes beyond some threshold. However, the impulse noise almost does not af- fect the OFDM payload symbols decoding. This suggests that the OFDM symbols along with the adaptive bit rate algorithm are more robust to the repetitive impulse noise than the preamble detection process.

87 Chapter 4. Experimental Results

0.1 SNRW = 25 dB −2 9 · 10 SNRW = 20 dB SNRW = 15 dB 8 · 10−2

7 · 10−2

6 · 10−2

5 · 10−2

4 · 10−2 Block Error Rate 3 · 10−2

2 · 10−2

1 · 10−2

0 0 2 4 6 8 10 12 14 16 18 20 22 24

SNRI (dB)

FIGURE 4.16: Car Cable Harness Block Error

4.4 Real Car

In this section, we present the results of experiments executed on a real car. The tests were performed on a 2006 Pontiac Solstice. In this experiment, the master station USRP was connected to the car lighter, and the slave station USRP was connected to the left front light. Two bias tees were used to block the DC component. Since the USRP output PSD of −80 dBm/Hz is too low for this setup, we add an amplifier which brings the master station output PSD to around −67 dBm/Hz as described in Section 4.1.3. The connection diagram is illustrated in Figure 4.17. The system was tested in five scenarios: the engine is off (Car-Off), the engine is off and the turn signal is on, (Turn-Signal-On), the engine is off while toggling the front lights switch (Lights-Toggle), the engine is off and

88 Chapter 4. Experimental Results

USRP

USRP

FIGURE 4.17: Car Experiment Diagram the wipers are on (Wipers-On), and the engine is on (Engine-On). All sce- narios were tested with the three channel estimation methods: Sounding- CE, Payload-CE, and Preamble-CE. The sound frame spacing is set to two seconds in all cases. For each test, we measure the BER, average PHY rate, block error rate and sync error rate.

4.4.1 Results

Car-Off

We first demonstrate the performance of the system in Car-Off, which is the most static and least noisy setting. In this scenario, the master station transmits a total of 10 000 MPDUs. The results are shown in Table 4.4. Reasons for deviation from the target BER can be errors in channel or noise PSD estimation, a non-linear operation of the amplifier and non-Gaussian noise components. The Sounding-CE yields the best BER since the channel is the most accurate, next is Payload-CE and last is Preamble-CE. No block error or sync error occurred in this setting. The results show that the IEEE 1901-like system works correctly and can recover all transmitted frames in a real car when the car is off. As

89 Chapter 4. Experimental Results

TABLE 4.4: Car Car-Off Results

Block Error Sync Error PHY Rate BER (Out of (Out of (Mbps) 30000) 10000) Sounding-CE 0.0209 0 0 24.27 Payload-CE 0.0242 0 0 21.94 Preamble-CE 0.0254 0 0 24.12 there are no block errors in all channel estimation methods, the Preamble- CE is preferred in this case as it has the advantage of a dynamic channel estimation without reducing the data rate.

Turn-Signal-On

In scenario Turn-Signal-On the master station continuously transmits MP- DUs, where at some point we switch on the turn signal for around 40 s. The purpose of this test is to check the influence of different units on the communication channel. The results of this test are very similar to the re- sults in Car-Off at Table 4.4. Therefore the results are omitted here. We also did not observe any changes in the channel impulse response in this case. Therefore, we can conclude that the turn signal has little to no effect on this communication path.

Lights-Toggle

In scenario Lights-Toggle the master station continuously transmits MP- DUs where at some point we manually toggle the front lights switch every 2 s for a total of 40 s. As the slave station is connected to the left front light, we expect the toggling to heavily influence the communication channel. The two channel states measured in Lights-Toggle are depicted in Fig- ure 4.19. The estimation method used in the Figure is Sounding-CE. The graphs show a significant difference between the two states. The short-term block error rate for the three estimation methods is il- lustrated in Figure 4.19. In Sounding-CE all PHY blocks are lost after every

90 Chapter 4. Experimental Results

−30 Lights off Light on −32

−34

−36

−38

Channel Amplitude (dB) −40

−42

8 10 12 14 16 18 Frequency (MHz)

FIGURE 4.18: Car Channel in Lights-Toggle toggling (error rate is one). The system recovers immediately following a sounding process, and the error rate goes to zero until the next toggle. The toggling however has little to no effect on the Payload-CE. In Preamble-CE we see sporadic spikes in the Preamble-CE error rate due to the toggling. The results are summarized in Table 4.5. Note that only successful PHY blocks are included in the BER calculation since the reference PHY block cannot be recovered. This explains why the BER of Sounding-CE seems lower than the other methods despite its poor performance.

Wipers-On

In scenario Wipers-On the master station is continuously transmitting MPDU, where at some point in time we switch on the wipers for around 40 s. The purpose of this test, similarly to Turn-Signal-On, is to check the

91 Chapter 4. Experimental Results

Block Error Rate 1 0.8 0.6 0.4 0.2

Sounding-CE 0

1 0.8 0.6 0.4 0.2 Payload-CE 0

1 0.8 0.6 0.4 0.2

Preamble-CE 0 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Time (Second)

FIGURE 4.19: Car PHY Block Error Rate in Lights-Toggle influence of other units on the communication path between the front lights and the lighter. A high amplitude impulsive noise, reaching 10 times the preamble max- imum height, was observed when the wipers were switched on. This phe- nomenon caused sync error at around 15 % of the attempted MPDUs trans- mission. Figure 4.20 illustrates the cumulative PHY block success and the cumulative sync error in Sounding-CE (Payload-CE and Preamble-CE be- have the same as the sync error is not related to the channel estimation method). The wipers are switched on at around 10 s and switched off just before 50 s. The graphs show how the block success rate drops as the sync error rate rises. All other results are summarized in Table 4.6. Notice that the impulse noise very little effect on the block error, i.e. the encoding schemes and the

92 Chapter 4. Experimental Results

TABLE 4.5: Car Lights-Toggle Results

Block Error Sync Error PHY Rate BER (Out of (Out of (Mbps) ≈ 3000) ≈ 1000) Sounding-CE 0.0286 1693 1 25.86 Payload-CE 0.0332 0 0 23.30 Preamble-CE 0.0345 10 0 25.68

TABLE 4.6: Car Wipers-On Results

Block Error Sync Error PHY Rate BER (Out of (Out of (Mbps) ≈ 900) ≈ 300) Sounding-CE 0.0241 23 48 23.37 Payload-CE 0.0214 3 48 21.03 Preamble-CE 0.0266 2 49 23.64 adaptive bit rate algorithm are able to accommodate the high amplitude noise. We believe the sync errors can be alleviated by increasing the PSD (of the entire signal or just the preamble) which is still much below the maxi- mum allowed in IEEE 1901. Another possible solution is to clip high am- plitude samples only for preamble detection purposes. Note that changing the sensitivity parameter of the PHY had little to no effect on the sync error rate in this case.

Engine-On

Lastly, we measure the system performance when the car is started. In sce- nario Engine-On, we turn on the engine and similarly to Car-Off the master station transmits a total of 10 000 MPDUs. The car remains in neutral gear, and no other device is switched on. The results are summarized in Table 4.7. Despite the increase of noise when the engine is on, the number of PHY block errors and sync errors is

93 Chapter 4. Experimental Results

2,000 50 Total block success 1,800 Total sync error 1,600 40

1,400

1,200 30

1,000

800 20

600 Cumulative Sync Error Cumulative Block Success 400 10

200

0 0 0 10 20 30 40 50 Time (Second)

FIGURE 4.20: Car Block Success and Sync Error in Wipers- On insignificant. The decreased SNR causes a 5 % decrease in the established PHY rate. The results show that the IEEE 1901-like system works correctly and can recover transmitted frames in a car when the engine is turned on, but no other device is switched on. It also shows that Payload-CE performed slightly better than Sounding-CE. This might suggest that the channel is not entirely static when the engine is on, even when no other device is operating.

4.4.2 Summary

In this section, we presented the results of our IEEE 1901-like communi- cation system experiments executed on a real car. As our system includes all components of the IEEE 1901 physical layer (with some modifications),

94 Chapter 4. Experimental Results

TABLE 4.7: Car Engine-On Results

Block Error Sync Error PHY Rate BER (Out of (Out of (Mbps) 30000) 10000) Sounding-CE 0.0239 39 33 23.20 Payload-CE 0.0229 6 46 20.84 Preamble-CE 0.0245 5 36 23.04 we expect that an actual IEEE 1901 system will perform similarly or better. The major differences between the system tested and the IEEE 1901 speci- fications are a doubled guard interval for the frame control and a different . A compliant guard interval, we believe, will not affect the over- all performance as the tested payload symbols had a much shorter guard interval and did not show signs of error resulting from a short guard inter- val. The turbo code of IEEE 1901 we believe will perform at least as good as this one as it was designed for powerline networks (we used a turbo code designed for UMTS). Also note that our system PSD is −67 dBm/Hz and can perform better if operated at −55 dBm/Hz as allowed by IEEE 1901 (see Section 4.1.3). Although IEEE 1901 is not targeted for vehicular powerline networks, we showed that it is capable of working efficiently in the scenarios tested. When the car was off, no sync errors or block errors were observed, and all data was decoded correctly. When we switched on the turn signal, it did not affect the communication path whatsoever. When we toggled the front light, it directly influenced the channel impulse response, and the Payload- CE showed the best resilient. When we switched on the wipers, it did not change the channel impulse response but merely introduced high ampli- tude impulse noise. This phenomenon caused around 15 % lost frames due to sync errors. However, the impulse noise almost did not affect the pay- load decoding performance, which suggests that the noise is band limited and manageable. When we turned on the engine, we saw a slight degra- dation in the established PHY rate due to the increased noise. The system however still performed well with an insignificant number of sync errors

95 Chapter 4. Experimental Results or block errors. In [23] they showed that for HomePlug AV over vehicular powerlines, an operation of other devices such as the wipers, adversely affect the chan- nel throughput up to 15 %. This was performed in a different car, and the particular communication path and the devices used were not provided in the article. However, we observed in our experiments the same order of magnitude of throughput reduction. In [12] it was suggested that the impulse noise is one of the biggest problems for vehicular PLC. We can add that in the scenarios tested the impulse noise mainly affects frame synchronization. The channel estimation methods comparison shows that in very dy- namic scenarios (as in Lights-Toggle) the Payload-CE performs better than the others. Preamble-CE also performs well as it shows only a few num- ber of errors. Sounding-CE, as expected, is not suitable for such cases. For static scenarios, Sounding-CE is supposed to give the best results, however, in all tests except Car-Off the BER of the Payload-CE is better than the other two methods. This may suggest that even in Car-On scenario the channel is somewhat time-variant.

96 Chapter 5

Conclusions

To conclude this thesis, in the following sections we summarize our main contribution, draw conclusions and suggest directions for future work.

5.1 Conclusions

We first presented an IEEE 1901-like communication system. The system consists of an IEEE 1901-based PHY and a minimal IEEE 1901 MAC layer. It is the first SDR of an end-to-end PLC system, capable of streaming data in real-time. The code is publicly available to allow reproduction of the result and further study by fellow researchers. As the system developed for SDR, it can be used both for simulation and for actual transmission and reception of data over powerlines. To deal with the vehicular powerline challenges we presented methods to cope with a time-varying channel impulse response and a periodic im- pulse noise. For the time-varying channel, we derived a blind channel am- plitude estimation method that does not require a training frame. For the periodic impulse noise, we gather statistics about the noise spectrum dur- ing the silence periods and use that information for performing bit loading calculation using the incremental algorithm. We demonstrated the system behavior on a car harness with an emu- lated noise. We compared the different channel estimation methods and showed that the Payload-CE is more robust to noise than the Preamble- CE, as expected. We demonstrated the correctness of the implementation

97 Chapter 5. Conclusions by comparing to a reference channel measurements performed by a VNA. Next, we showed how repetitive impulse noise is correctly reflected in the noise PSD estimation and bit loading calculation. We also presented the system performance by measuring the BER, PHY rate, sync error rate and block error rate under different impulse and background noise levels. We then performed tests on an actual car in various scenarios. The results show that an IEEE 1901-like communication system is capable of working efficiently in the scenarios studied. In our experience, the large amplitude impulse noise occurs due to other devices operation such as the wipers. We showed that such noise mainly affects frame synchronization. Therefore, the system throughput is degraded in the presence of such noise. Previous attempts to tests similar standards using commercial modems (as in [23]) showed a similar performance degradation. However, they could not show exactly why it happens and how to mitigate it. Such analysis was accomplished by our system as it allows full access all physical layer components. A comparison between the channel amplitude estimation methods on an actual car shows that the Sounding-CE channel estimation may not be suitable for a car powerline. Our experiments show that even when only the engine is on, the channel is not entirely static. The simpler Preamble-CE or the more robust Payload-CE perform similarly to Sounding-CE in static scenarios but also able to cope with a dynamic channel impulse response.

5.2 Future Work

Regarding the implementation, an IEEE 1910 turbo convolutional encoder and decoder would be highly beneficial to this project. It will be both com- patible with the standard and would improve the decoding speed which is now hindered by the external decoding library. As the impulsive noise is known to be the main drawback of vehicular PLC, we have identified that it mainly affects the frame detection. More work should be done to adapt the detection process to an impulse noise environment. As suggested in the thesis, one immediate possible solution

98 Chapter 5. Conclusions would be to amplify the output signal, or just the preamble, to meet the maximum PSD allowed in IEEE 1901. Another possible quick solution is to clip high amplitude samples during the detection process. As the system was tested only on a standing car, more testing should be performed in other scenarios. We believe that running tests on a moving car might be more challenging but may bring new insights regarding the feasibility of a reliable in-vehicle PLC.

99 Bibliography

[1] ISO/IEC. ISO/IEC DIS 15118-3: Road vehicles - Vehicle to grid communi- cation interface – Part 3: Physical and data link layer requirements. 2012. URL: http://www.iso.org/iso/home/store/catalogue_ ics / catalogue _ detail _ ics . htm ? ics1 = 43 & ics2 = 120 & ics3=&csnumber=59675. [2] SAE International. Broadband PLC Communication for Plug-in Electric Vehicles. 2014. URL: http://standards.sae.org/j2931/4_ 201410/. [3] Jason D Harper. Development and Implementation of SAE DC Charging Digital Communication for Plug-in Electric Vehicle DC Charging. Tech. rep. SAE Technical Paper, 2013. [4] M. Rahmani et al. “A Novel Network Architecture for In-Vehicle Au- dio and Video Communication”. In: Broadband Convergence Networks, 2007. BcN ’07. 2nd IEEE/IFIP International Workshop on. May 2007, pp. 1–12. DOI: 10.1109/BCN.2007.372741. [5] S. Tuohy et al. “Intra-Vehicle Networks: A Review”. In: Intelligent Transportation Systems, IEEE Transactions on 16.2 (Apr. 2015), pp. 534– 545. ISSN: 1524-9050. DOI: 10.1109/TITS.2014.2320605. [6] CAN Specification. Version 2.0. Robert Bosch GmbH. 1991. [7] MOST Specification. Rev 2.4. MOST Cooperation. 2005. [8] Rainer Makowitz. “Flexray-a communication network for automo- tive control systems”. In: [9] LIN Specification Package. Revision 2.2A. LIN Consortium. 2010. [10] An Overview of LVDS Technology. Revision 2.2A. National Semicon- ductor. 1994.

100 BIBLIOGRAPHY

[11] Peter Hank, Thomas Suermann, and Steffen Muller.¨ “Automotive Ethernet, a Holistic Approach for a Next Generation In-Vehicle Net- working Standard”. English. In: Advanced Microsystems for Automotive Applications 2012. Ed. by Gereon Meyer. Springer Berlin Heidelberg, 2012, pp. 79–89. ISBN: 978-3-642-29672-7. DOI: 10.1007/978- 3- 642-29673-4_8. URL: http://dx.doi.org/10.1007/978-3- 642-29673-4_8. [12] V. Degardin et al. “Impulsive Noise Characterization of In-Vehicle Power Line”. In: Electromagnetic Compatibility, IEEE Transactions on 50.4 (Sept. 2008), pp. 861–868. ISSN: 0018-9375. DOI: 10.1109/TEMC. 2008.2006851. [13] M. S. Yousuf and M. El-Shafei. “Power Line Communications: An Overview - Part I”. In: Innovations in Information Technology, 2007. IIT ’07. 4th International Conference on. Nov. 2007, pp. 218–222. DOI: 10. 1109/IIT.2007.4430363. [14] M.S. Yousuf, S.Z. Rizvi, and M. El-Shafei. “Power Line Communi- cations: An Overview - Part II”. In: Information and Communication Technologies: From Theory to Applications, 2008. ICTTA 2008. 3rd Inter- national Conference on. Apr. 2008, pp. 1–6. DOI: 10.1109/ICTTA. 2008.4530268. [15] H.C. Ferreira et al. Power Line Communications: Theory and Applications for Narrowband and Broadband Communications over Power Lines. Wiley, 2010. ISBN: 9780470740309. URL: https://books.google.ca/ books?id=GdTbkwEACAAJ. [16] Yamar Website. http://yamar.com/. [accessed 25-Jan-2016]. [17] HomePlug 1.0 Technical White Paper. HomePlug Powerline Alliance. Sept. 2005. [18] HomePlug AV White Paper. Version HPAVWP-050818. HomePlug Powerline Alliance. 2005. [19] HomePlug Green PHY Specification. Release Version 1.1.1. HomePlug Powerline Alliance. July 2013.

101 BIBLIOGRAPHY

[20] HomePlug AV2 Technology. HomePlug Powerline Alliance. 2013. [21] “IEEE Standard for Broadband over Power Line Networks: and Physical Layer Specifications”. In: IEEE Std 1901-2010 (Dec. 2010), pp. 1–1586. DOI: 10.1109/IEEESTD.2010. 5678772. [22] Haniph A. Latchman et al. Homeplug AV and IEEE 1901: A Hand- book for PLC Designers and Users. 1st. Wiley-IEEE Press, 2013. ISBN: 0470410736, 9780470410738. [23] P. Tanguy, F. Nouvel, and P. Maziero. “Power Line Communication standards for in-vehicule networks”. In: Intelligent Transport Systems Telecommunications,(ITST),2009 9th International Conference on. Oct. 2009, pp. 533–537. DOI: 10.1109/ITST.2009.5399296. [24] W. Gouret, F. Nouvel, and G. El-Zein. “High Data Rate Network Us- ing Automotive Powerline Communication”. In: Telecommunications, 2007. ITST ’07. 7th International Conference on ITS. July 2007, pp. 1–4. DOI: 10.1109/ITST.2007.4295835. [25] W. Gouret, F. Nouvel, and G. El-Zein. “Powerline Communica- tion on Automotive Network”. In: Vehicular Technology Conference, 2007. VTC2007-Spring. IEEE 65th. Apr. 2007, pp. 2545–2549. DOI: 10.1109/VETECS.2007.524. [26] Bastian Bloessl et al. “An IEEE 802.11a/g/p OFDM Receiver for GNU Radio”. In: ACM SIGCOMM 2013, 2nd ACM SIGCOMM Workshop of Software Radio Implementation Forum (SRIF 2013). Hong Kong, China: ACM, Aug. 2013, pp. 9–16. DOI: 10.1145/2491246.2491248. [27] Nico Otterbach et al. “Software-Defined Radio for Power Line Communication Research and Development”. In: Proceedings of the 2015 Workshop on Software Radio Implementation Forum. SRIF ’15. Paris, France: ACM, 2015, pp. 37–42. ISBN: 978-1-4503-3532-4. DOI: 10.1145/2801676.2801690. URL: http://doi.acm.org/10. 1145/2801676.2801690.

102 BIBLIOGRAPHY

[28] P. Tanguy and F. Nouvel. “Vehicle Power Line Communication (VPLC) using SDR demonstrator”. In: 2012. [29] Fabienne Nouvel and Philippe TANGUY. “In Vehicle Commu- nication Networks : A Power Line Communication Study and Demonstrator for Infotainment Applications”. In: Best Award Paper. IARIA. NICE, France, Oct. 2014. URL: https://hal.archives- ouvertes.fr/hal-01153533. [30] A. Pinomaa et al. “Utilization of Software-Defined Radio in power line communication between motor and frequency converter”. In: Power Line Communications and Its Applications (ISPLC), 2010 IEEE In- ternational Symposium on. Mar. 2010, pp. 172–177. DOI: 10 . 1109 / ISPLC.2010.5479887.

[31] Inc Free Software Foundation. IT++. Version 4.3.1. July 6, 2013. URL: http://itpp.sourceforge.net. [32] Matthew C Valenti and Jian Sun. “The UMTS turbo code and an effi- cient decoder implementation suitable for software-defined radios”. In: International journal of wireless information networks 8.4 (2001), pp. 203–215. [33] H. Minn, M. Zeng, and V. K. Bhargava. “On timing offset estimation for OFDM systems”. In: IEEE Communications Letters 4.7 (July 2000), pp. 242–244. ISSN: 1089-7798. DOI: 10.1109/4234.852929. [34] R. Riva et al. “Improved HomePlug AV channel estimation exploiting sounding procedure”. In: Power Line Communications and Its Applica- tions, 2009. ISPLC 2009. IEEE International Symposium on. Mar. 2009, pp. 296–300. DOI: 10.1109/ISPLC.2009.4913446. [35] Abraham Charnes, EL Frome, and Po-Lung Yu. “The equivalence of generalized least squares and maximum likelihood estimates in the exponential family”. In: Journal of the American Statistical Association 71.353 (1976), pp. 169–171. [36] Robert G Gallager. “Circularly-symmetric Gaussian random vec- tors”. In: (2008).

103 BIBLIOGRAPHY

[37] H. Kobayashi, B.L. Mark, and W. Turin. Probability, Random Processes, and Statistical Analysis: Applications to Communications, Signal Process- ing, Queueing Theory and Mathematical Finance. Cambridge University Press, 2011. ISBN: 9781139502610. URL: https://books.google. ca/books?id=DQCMdT-3qbQC. [38] D. Altolini et al. “Preamble-based channel estimation in HomePlug AV systems”. In: Power Line Communications and Its Applications (IS- PLC), 2012 16th IEEE International Symposium on. Mar. 2012, pp. 176– 181. DOI: 10.1109/ISPLC.2012.6201326. [39] X. Ding, J. Meng, and B. R. Petersen. “Blind Channel Estimation for HomePlug Power-Line Communications: A Feasibility?” In: IEEE Transactions on Power Delivery 26.2 (Apr. 2011), pp. 754–763. ISSN: 0885-8977. DOI: 10.1109/TPWRD.2009.2038477. [40] J. A. Cortes, A. M. Tonello, and L. Diez. “Comparative Analysis of Pilot-based Channel Estimators for DMT Systems Over Indoor Power-line Channels”. In: 2007 IEEE International Symposium on Power Line Communications and Its Applications. Mar. 2007, pp. 372– 377. DOI: 10.1109/ISPLC.2007.371153. [41] P. Corlay et al. “Improving Channel Estimation in Power Line Com- munications by using Linear Interpolation Revitalized”. In: 2007 IEEE International Symposium on Power Line Communications and Its Applications. Mar. 2007, pp. 471–475. DOI: 10.1109/ISPLC.2007. 371170. [42] V. Degardin, M. Lienard, and P. Degauque. “Optimisation of equal- isation algorithm for power line communication channel”. In: Elec- tronics Letters 39.5 (Mar. 2003), pp. 483–485. ISSN: 0013-5194. DOI: 10. 1049/el:20030286. [43] Marc C Necker and Gordon L Stuber. “Totally blind channel estima- tion for OFDM over fast varying mobile channels”. In: Communica- tions, 2002. ICC 2002. IEEE International Conference on. Vol. 1. IEEE. 2002, pp. 421–425.

104 BIBLIOGRAPHY

[44] M. C. Necker and F. Sanzi. “Generalized 8-PSK for totally blind chan- nel estimation in OFDM”. In: Vehicular Technology Conference, 2004. VTC 2004-Spring. 2004 IEEE 59th. Vol. 2. May 2004, 924–928 Vol.2. DOI: 10.1109/VETECS.2004.1388965. [45] Shengli Zhou and G. B. Giannakis. “Finite-alphabet based channel es- timation for OFDM and related multicarrier systems”. In: IEEE Trans- actions on Communications 49.8 (Aug. 2001), pp. 1402–1414. ISSN: 0090- 6778. DOI: 10.1109/26.939873. [46] J.A. Cortes et al. “Analysis of the periodic noise on in-vehicle broad- band power line channels”. In: Power Line Communications and Its Ap- plications (ISPLC), 2012 16th IEEE International Symposium on. Mar. 2012, pp. 334–339. DOI: 10.1109/ISPLC.2012.6201305. [47] Alan V. Oppenheim, Ronald W. Schafer, and John R. Buck. Discrete- time Signal Processing (2Nd Ed.) Upper Saddle River, NJ, USA: Prentice-Hall, Inc., 1999. ISBN: 0-13-754920-2. [48] Alexander M. Wyglinski, F. Labeau, and P. Kabal. “Bit loading with BER-constraint for multicarrier systems”. In: Wireless Communi- cations, IEEE Transactions on 4.4 (July 2005), pp. 1383–1387. ISSN: 1536-1276. DOI: 10.1109/TWC.2005.850313. [49] Andreas Molisch. Wireless Communications. Wiley-IEEE Press, 2005. ISBN: 047084888X. [50] J.G. Proakis. Digital Communications. Electrical engineering series. McGraw-Hill, 2001. ISBN: 9780072321111. URL: https://books. google.ca/books?id=sbr8QwAACAAJ. [51] M. Zimmermann and K. Dostert. “Analysis and modeling of impul- sive noise in broad-band powerline communications”. In: IEEE Trans- actions on Electromagnetic Compatibility 44.1 (Feb. 2002), pp. 249–258. ISSN: 0018-9375. DOI: 10.1109/15.990732.

[52] Roee Bar. gr-plc. URL: https://github.com/roeebar/gr-plc.

105 BIBLIOGRAPHY

[53] Johannes Demel, Sebastian Koslowski, and Friedrich K. Jondral. “A LTE Receiver Framework Using GNU Radio”. In: J. Signal Process. Syst. 78.3 (Mar. 2015), pp. 313–320. ISSN: 1939-8018. DOI: 10.1007/ s11265-014-0959-z. URL: http://dx.doi.org/10.1007/ s11265-014-0959-z. [54] Florian Gruber. “MIMO PLC Channel Emulation with Application to Vehicular PLC”. MA thesis. Lehrstuhl fur¨ Informationsubertragung¨ Friedrich-Alexander-Universitat¨ Erlangen-Nurnberg,¨ 2014. [55] J. Sijbers et al. “Maximum-likelihood estimation of Rician distribu- tion parameters”. In: IEEE Transactions on Medical Imaging 17.3 (June 1998), pp. 357–361. ISSN: 0278-0062. DOI: 10.1109/42.712125.

106 Appendix A

Derivations

A.1 Rice Parameter Estimation

L Let {Yi}i=1 be L independent random variables following the distribution Rice(µ, σ/αi) [37]. The second moment of Yi is given by:

 2 2 2 2 E Yi = µ + 2σ /αi .

Let σˆ2 be an estimate for σ2. An estimate for µ2 is then

PL α2Y 2 − 2Lσˆ2 µˆ2 = i=1 i i . (A.1) PL 2 i=1 αi

This formula is based on an estimator shown in [55] except that each Rician 2 2 sample is weighted proportionally to its σ /αi parameter. Note that the expected value is

2L(σ2 − σˆ2) E µˆ2|σˆ2 = µ2 + . PL 2 i=1 αi

This expected value shows that the estimate is biased. The equation also shows that adding samples with low αi increases the bias term. However, the variance of of the estimate is ! 4σ2 Lσ2 Var µˆ2 = + µ2 PL 2 PL 2 i=1 αi i=1 αi

107 Appendix A. Derivations

It can be shown that adding samples even with low αi can reduce the esti- mator variance. p 2 We estimate µ by µˆ = µˆ . For the simple case of αi = 1, ∀i and where µ σ  1 (high SNR), we have the following expected value of µˆ [55]:

σ2 E [ˆµ] ≈ µ − . 2Lµ

A.2 OFDM Symbol Energy

A.2.1 Generated Symbol

The average energy of an IEEE 1901 OFDM symbol is given by:

2 AR ˜ 2 1 1 2 ES = × NN × × × AG 2N N Fs

Each term in the formula is described below.

• √AR As defined in IEEE 1901, each OFDM symbol is multiplied by 2N , 2.2/20 where AR = 10 is the relative power boost of 2.2 dB for payload 3/20 symbols. For the preamble and frame control AR = 10 .

• We have N˜ active carriers where each carrier has an average ampli- tude of N in the DFT domain (thus unit amplitude in the time do- main). This corresponds to the NN˜ 2 factor.

1 • The term N is the Parseval’s theorem factor for energy in the DFT domain.

• 1 We then multiply by the sampling interval Fs for a continuous time total energy.

• The factor AG is the gain. The gain is determined by the user. Usually it is chosen empirically so the real and the imaginary part of the signal will not exceed 1 or −1 as this is the input range for the USRPs.

108 Appendix A. Derivations

Simplifying the formula gives

2 ˜ 2 ARNAG ES = . 2Fs

The average power is given by:

2 2 ESFs A NA˜ P = = R G . S N 2N

6 For N˜ = 512, Fs = 25 × 10 and AG = 0.3, we have

102.2/10 × 512 × 0.32 E = = 1.5295 × 10−6, and S 2 × 25 × 106

102.2/10 × 512 × 0.32 P = = 0.0186. S 2 × 2048

A.2.2 Received Symbol

The average energy of a received noise-free IEEE 1901 OFDM symbol r(t) is given by:

Z NT  2 N X 2 ER = E |r(t)| dt ≈ |H[k]| , (A.2) Fs 0 k where the summation is over all non masked carriers k. The derivation is described below.

• Note that

N−1 N−1 Z NT X 1 X |r(t)|2dt ≈ |r[n]|2 T = |R[k]|2 T . (A.3) N 0 k=0 k=0

• Since |R[k]|2 = |H[k]S[k]|2, then h i E |R[k]|2 = |H[k]|2 × N 2,

109 Appendix A. Derivations

h i where we assumed E |S[k]|2 = N 2. Substituting it in Equation A.3 T = 1 gives Equation A.2, where Fs .

The average power PR = ER/NT is given by:

X 2 PR ≈ |H[k]| . k

Note that since the true H[k] is unknown we use Hˆ [k] instead.

110