OFDM/FM FOR MOBILE DATA COMMUNICATION By Eduardo F. Casas B. A. Sc., The University of Ottawa, 1981 M. Eng., McMaster University, 1983

A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF

THE REQUIREMENTS FOR THE DEGREE OF

DOCTOR OF PHILOSOPHY

in

THE FACULTY OF GRADUATE STUDIES

DEPARTMENT OF ELECTRICAL ENGINEERING

We accept this thesis as conforming to the required standard

THE UNIVERSITY OF BRITISH COLUMBIA September 1989 © Eduardo F. Casas, 1989 In presenting this thesis in partial fulfilment of the requirements for an advanced degree at the University of British Columbia, I agree that the Library shall make it freely available for reference and study. I further agree that permission for extensive copying of this thesis for scholarly purposes may be granted by the head of my department or by his or her representatives. It is understood that copying or publication of this thesis for financial gain shall not be allowed without my written permission.

Department of c TVC3-/ £<\a\^e* y

The University of British Columbia Vancouver, Canada

DE-6 (2/88) Abstract

The use of Orthogonal Frequency Division Multiplexing (OFDM) for digital communica• tions over Rayleigh- channels was proposed by Cimini [1]. OFDM transmits blocks of bits in parallel and reduces the bit error rate (BER) by averaging the effects of fading over the bits in the block. This thesis studies the performance of OFDM/FM, a new technique in which the OFDM baseband signal is used to modulate an FM transmitter. OFDM/FM can be implemented simply and inexpensively by retrofitting existing FM communication systems.

Expressions are derived for the BER and word error rate (WER) within a block when each subchannel is QAM-modulated. Several numerical methods are developed to eval• uate the overall BER and WER. An experimental OFDM/FM system was implemented using unmodified VHF FM radio equipment and a fading channel simulator. The BER and WER results obtained from the hardware measurements agree closely with the nu• merical results. The effects of forward error correction (FEC), switching diversity, automatic gain con• trol (AGO, and were tested. A new technique, decision feedback correction (DFC), was developed to reduce the crosstalk interference between the OFDM subchannels. This method significantly improves the BER performance of OFDM/FM.

At BERs below 10~2 the experimental OFDM/FM system has better power efficiency than the serial modulation techniques conventionally used for mobile radio (NCFSK,

3 GTFM, or GMSK). At a BER of IO" and a normalized block duration (Tfd) of 2.6, the experimental OFDM/FM system is 5 dB more power efficient than serial techniques. The use of DFC can significantly increase this advantage. However, current GTFM and GMSK systems have better spectral efficiency than the OFDM/FM prototype.

ii Table of Contents

Abstract ii

List of Tables xi

List of Figures xii

Acknowledgement xv

1 Introduction 1

1.1 Mobile Data Communication 1 1.2 OFDM/FM for Mobile Radio Data Communication 2 1.3 Scope of the Thesis 3 1.4 Organization of the Thesis 4

2 Review of Previous Work 6 2.1 The Mobile Radio Channel 6 2.1.1 Frequency-Selective Fading 8 2.1.2 Log-Normal Fading 9 2.1.3 Noise 9 2.2 Digital Modulation for Mobile Radio 9 2.2.1 Performance Criteria 9 2.2.2 Modulation Suitable for Non-Coherent Receivers 10 2.2.3 Modulation Suitable for Coherent Receivers 10 2.2.4 Spread Spectrum Modulation 10 2.3 Orthogonal Frequency Division Multiplexing 11

iii 2.3.1 Description 11 2.3.2 Implementation of OFDM/FM 12 2.3.3 Advantages of OFDM 13 2.3.4 Disadvantages of OFDM 14 2.3.5 Previous Applications of OFDM 14 2.4 The FM Channel 15 2.4.1 The FM Transmitter 15

2.4.2 The FM Receiver 16 2.4.3 Discriminator Output Noise Spectrum and Probability Distribution . 17 2.4.4 Receiver SN Curves 18 2.4.5 Random FM 20 2.4.6 Capture Effect . 20 2.4.7 Preemphasis and Deemphasis 20

3 Modelling and Error Rate Analysis 22 3.1 Introduction 22 3.2 The Equivalent Baseband Channel Model 22 3.3 BER Analysis 24 3.3.1 Mean and Variance of the Received Value 24 3.3.2 Bit Error Rate Within a Block 24 3.3.3 Evaluating the BER 25 3.4 Modelling the OFDM/FM Channel 25 3.4.1 Baseband Noise Distribution 25 3.4.2 Baseband Noise Spectrum 25 3.4.3 Random FM Noise 26 3.4.4 Clipping Noise 26 3.4.5 Squelch 26 3.4.6 FM Receiver SN Curves 27

iv 3.5 Modelling the OFDM/SSB Channel 28 3.5.1 Frequency and Phase Synchronization 28 3.5.2 AGC 28 3.5.3 Example of SSB Receiver SN Curves 29 3.6 Word Error Rate Analysis 29

4 Numerical Evaluation of Bit and Word Error Rates 31 4.1 Introduction 31 4.2 BER Bounds for Large and Small Blocks 31 4.3 Monte-Carlo Integration of the Block BER Equations 32 4.4 Simulation of the Equivalent Baseband Channel . 33 4.5 Description of Software 34 4.5.1 Fading Waveform Generator 35 4.5.2 Data Generator 35 4.5.3 Noise Generators 36 4.5.4 Bit and Word Error Rate Measurement 36 4.5.5 FEC 37 4.5.6 QAM Encoding/Decoding 37 4.5.7 OFDM Modulation/ 38 4.5.8 IF SNR to Baseband Signal and Noise Power Conversion 38 4.5.9 Simulated Fading Channel 38

5 Experimental Measurements 39 5.1 Introduction 39 5.2 Experimental Hardware 39 5.2.1 Transmitter 40 5.2.2 Fading Channel Simulator 41

5.2.3 Receiver 43

v 5.2.4 DSP Equipment 44 5.3 Experimental Software 46 5.4 Measuring the Baseband SN Characteristics 46 5.4.1 The Modulating Signal Level 48 5.4.2 The Baseband Frequency Range 48 5.4.3 Software Preemphasis 49 5.4.4 Bit Rate 50 5.4.5 Measuring the IF SNR 50

5.4.6 Converting from IF SNR to E6/N0 51 5.4.7 SN Curve Measurement Method 51 5.4.8 SN Curve Results 53 5.5 BER and WER Measurements 54 5.5.1 BER Results 54 5.5.2 Bound Results 55

5.5.3 Effect of Block Duration and Doppler Rate (T/d) 56 5.5.4 WER Results 57 5.6 Random FM 60 5.7 Probability Distribution of the Baseband Noise 61 5.8 Example of Received Signal Values 62 5.9 Conclusions 62

6 Improving Performance 65 6.1 Introduction 65 6.2 Switching Diversity . 66 6.3 Forward Error Correction Coding 68 6.3.1 Testing the Independent Error Assumption 69 6.3.2 BER Performance of Block Codes 70 6.4 Automatic Gain Control 73

vi 6.5 Squelch 74 6.6 Decision Feedback Correction 76 6.6.1 Description of the Method 76 6.6.2 Simulation Results 80

7 System Design 83 7.1 Introduction 83 7.2 Block Size 83 7.3 Reducing Dependence on Vehicle Speed 84 7.4 Timing, Synchronization and Equalization 84 7.4.1 Sampling Timing 85 7.4.2 Phase Synchronization 86

7.4.3 Equalization 87 7.4.4 Differential Coding 88 7.5 Hardware Cost and Complexity 89 7.6 A/D and D/A Quantization 90 7.7 Sampling Frequency Error and Jitter 91

8 Comparisons With Other Modulation Methods 92 8.1 Introduction 92 8.1.1 Description of Other Modulation Techniques 92 8.2 Power Efficiency 93 8.2.1 GTFM 93 8.2.2 GMSK 93 8.2.3 OFDM/SSB 95 8.2.4 OFDM/FM 95 8.3 Bandwidth Efficiency 95 8.3.1 GTFM/GMSK 95

vii 8.3.2 OFDM/SSB 96 8.3.3 OFDM/FM 96 8.4 Delay 97 8.5 Implementation Considerations 97 8.5.1 OFDM/SSB 98 8.5.2 OFDM/FM 99 8.5.3 GMSK/GTFM 99 8.6 Conclusions 99

9 Conclusions 101 9.1 Conclusions 101

9.2 Topics for Further Study 103

Bibliography 105

Appendices

A Conditional Mean and Variance of the Error 115 A.l Notation 115 A.2 Assumptions 115 A.2.1 Data 116 A. 2.2 Noise 116 A.3 Conditional Mean 117 A. 4 The Conditional Variance 118

B The Fading Simulator 121 B. l Introduction 121 B.2 Control Section 122 B. 2.1 Software Description 122 B.2.2 Hardware Description 125

viii B.3 The RF Quadrature Modulator 130

B.3.1 Mixers 130

B.3.2 IF Port Network 132

B.3.3 Splitters 132

B.3.4 Delay Line 132

B.3.5 Construction 132

B. 4 Performance Measurements I33

B.4.1 CPDF 134

B. 4.2 Level Crossing Rate 135

C The Analog/Digital Interface 136

Cl Introduction 136

C. 2 Circuit Description i3^

C. 2.1 Timer Circuit 136

C.2.2 A/D I37

C.2.3 A/D Status I37 C.2.4 Address Decoding and D/A 138 C.2.5 A/D and D/A Analog Interface 139

C.3 Software 140

C.4 Testing 141

C.4.1 Noise 141

C.4.2 Distortion I42

C.4.3 Linearity and Accuracy . I42

C.4.4 Jitter 143

C.4.5 Clock Accuracy I43

C.4.6 Overrun Indicator I43

D RF SNR Measurement I44

ix D.l RF SNR Measurement 144 D.2 Accuracy 145 D.3 Noise Power Measurement 146 D.4 Noise Bandwidth Measurements 147 D.4.1 Spectrum Analyzer IF Filter 148 D.4.2 Receiver IF Filter 149

E Program Listings 151 List of Tables

5.1 Summary of parameter values used in experimental measurements 54

8.1 Performance summary for various modulation techniques 100

E.l Types of listings and compilers used 151 E.2 Routines used for BER evaluations 152

xi List of Figures

1.1 A mobile data terminal (MDT) system 1 1.2 A sample plot of the received signal level 2

2.1 Nomograph showing the relationship between fd,v, and fc 7 2.2 An implementation of an OFDM system 13 2.3 Block diagram of an FM transmitter 16 2.4 Block diagram of an FM receiver 16 2.5 Baseband noise spectra for different IF SNRs 18 2.6 The SN curves of a narrowband FM receiver 19 2.7 Preemphasis filter specification 21

3.1 The equivalent baseband channel model 23 3.2 Example of an FM SN curve 27 3.3 Example of SSB receiver SN curves 29

4.1 The numerical integration method 33 4.2 Simulation using the equivalent baseband channel 34 4.3 QAM Encoding 37

5.1 Block diagram of experimental setup 39 5.2 Experimental transmitter 40 5.3 Fading channel simulator 41 5.4 Experimental receiver 43 5.5 Schematic of audio attenuator for transmitter 45 5.6 Signal processing for experimental measurements 47

xii 5.7 Measured IF filter response 52 5.8 Theoretical and measured SN curves 53

5.9 BER results for fd = 20Hz . 55 5.10 Bounds on the BER 56

5.11 Measured BER for two values of Tfd 57 5.12 Measured and computed WER 58 5.13 Random FM noise power versus Doppler rate 60 5.14 Example of probability density of the noise in the frequency domain 62 5.15 Example of received data values 64

6.1 Switching diversity receiver 66 6.2 BER performance with switching diversity 68 6.3 WER as function of corrected errors for block size of 256 samples 70 6.4 WER as function of corrected errors for block size of 1024 samples 71 6.5 WER as function of corrected errors for block size of 4096 samples 72 6.6 BER performance with FEC coding 73 6.7 BER bounds as a function of AGC threshold 75 6.8 BER performance with AGC 76 6.9 BER bounds as a function of squelch threshold 77 6.10 BER performance with squelch 78 6.11 Flowchart for DFC processing 79 6.12 Sample signals during DFC processing 80 6.13 BER performance with DFC 81 6.14 Distribution of the number of DFC iterations 82

7.1 OFDM block transmission timing 85 7.2 Measured baseband channel transfer function 88 7.3 Effect of quantization on BER 90

xiii 8.1 Efc/N0 performance of various modulation methods 94

B.l Method of generating 121 B.2 Use of the simulator for mobile radio channel simulation 122

B.3 Generation of the pseudo-random control signals 123 B.4 Switch register bits 124

B.5 CPU schematic 126 B.6 Address decoding schematic 127 B.7 Memory schematic. 128 B.8 D/A and parallel I/O schematic 129 B.9 Analog interface schematic 130 B.l0 Diagram of the RF quadrature modulator 131 B.ll Fading simulator performance measurement 133 B.l 2 Comparison of measured and Rayleigh CPDFs 134 B. l 3 Comparison of theoretical and measured LCRs 135

C. l Timing circuit schematic 137 C.2 A/D and sample-and-hold schematic 138 C.3 A/D status circuit schematic 139 C.4 Address decoding and D/A schematic 140 C.5 D/A analog interface schematic 141 C. 6 A/D analog interface 142

D. l Measurement of RF SNR 144 D.2 Measurement of spectrum analyzer noise bandwidth 148 D.3 Frequency response of spectrum analyzer 30 kHz filter 149 D.4 Measurement of receiver noise bandwidth 150

xiv Acknowledgement

I would like to thank the many people who have helped with this work. My supervisor, Dr. Cyril Leung, was a constant source of encouragement and helpful advice. The past and present members of my supervisory committee, Dr. Hyong Lee, Dr. Sam Chan• son, and Dr. Victor Leung provided periodic reviews and guidance. Ron Jeffery helped greatly in the design and construction of the fading simulator and with numerous other tasks. The staff of MDFs Technology Assessment Group assisted in making various RF measurements. Fred Siu of the B.C. Telephone company arranged for a loan of mea• surement equipment. Peter Schumacher and Lisa Kan of UBC's Statistical Consulting and Research Laboratory provided advice on statistical tests. Finally, I would like to acknowledge the financial assistance provided by NSERC in the form of a Post-Graduate Scholarship and funds from operating grant A-1731, by UBC as a University Graduate Fellowship, and by Mobile Data International Inc. as an MDI Communications Fellow• ship.

xv Chapter 1

Introduction

1.1 Mobile Data Communication

Mobile data communication has become increasingly popular over the past ten years [2]. For example, many police departments now use mobile data terminals (MDTs) to access vehicle and criminal databases. MDTs are also used by taxi companies to dispatch cabs and by courier companies to track deliveries. MDTs can support more users per channel, offer increased accuracy and security, and allow the transmission of information in new forms such as graphics. Figure 1.1 shows the main components of a mobile data communication system.

operator networks

Figure 1.1: A mobile data terminal (MDT) system.

Data transmission over the mobile radio channel presents a challenging problem [3]. Radio signals propagate over these channels by reflecting and scattering from buildings

1 Chapter 1. Introduction 2

and other objects. The interference between signal components propagating along differ• ent paths forms a pattern of varying field strength. The received signal level fluctuates as a vehicle moves through this pattern. Figure 1.2 shows the deep fades that are char• acteristic of the received signal. The challenge is to provide efficient and reliable data communication through this channel.

Distance (m) 0 1 2 3 4 5 6

.|> ; Carrier frequency = 900 MHz : Vehicle speed = 24 km/h : ; Doppler rate = 20 Hz ; - Sampling rate = 2 kHz :

_40 nii11(111111111111111n1111111111n111111111ni(11111111(i(11111111n 11111111111111111111111111111r 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Time (s)

Figure 1.2: A sample plot of the received signal level.

1.2 OFDM/FM for Mobile Radio Data Communication

Orthogonal Frequency Division Multiplexing (OFDM) modulation has been proposed as an approach to the problem of fading [1]. OFDM is a modulation method that uses frequency division multiplexing to reduce the baud rate. A single serial data stream is Chapter 1. Introduction 3

split up into many QAM1 -modulated [4]. OFDM thus transmits blocks of data in parallel instead of serially. The symbol duration is typically increased by a factor of hundreds or thousands. The increased duration of each symbol creates a time-diversity effect by making it less likely that the complete symbol will be severely faded. However, fading distorts the subcarriers and reduces their orthogonality2. This results in crosstalk between the subchannels that degrades performance. The OFDM signal must be modulated onto an RF () carrier. One ap• proach is to translate the baseband OFDM signal up to the desired RF frequency by using single side-band (SSB) modulation (OFDM/SSB, or simply OFDM). The performance of a cellular telephone system using OFDM/SSB was studied in [1]. FM (frequency modula• tion) can also be used (OFDM/FM) [5]. OFDM/SSB systems require new and complex SSB receivers and transmitters while OFDM/FM systems can use existing FM radio equipment. For this reason OFDM/FM would be less expensive to implement than OFDM/SSB. However, the OFDM/SSB system proposed in [1] is more spectrally efficient and more power efficient than the OFDM/FM system described in this thesis.

1.3 Scope of the Thesis

This thesis presents the results of research into the performance of OFDM/FM for mobile radio data communication. Flat (non-frequency-selective) fading will be assumed because propagation surveys [6, 7,8,9] have shown that this is a good assumption for narrow-band (under 20kHz) signals. The radio system design is assumed to be a conventional non-cellular design that provides enough protection from cochannel interference to make additive Gaussian noise the major

1 Quadrature , see Section 4.5.6. 2The functions a(t) and b(t) are said to be orthogonal if a(t)b(i)dt = 0 where T is the period oi duration of the signal. When a(t) and b(t) are distorted the magnitude of the integral increases and in this sense the orthogonality is "reduced". Chapter!. Introduction 4

source of noise. The main contributions of the research include:

• several methods to predict the bit error rate (BER) performance of OFDM/FM sys• tems,

• a method to reduce the crosstalk caused by fading,

• measurements on a prototype OFDM/FM system to verify the performance analysis and to demonstrate the feasibility of OFDM/FM, and

• investigation of the performance of OFDM/FM systems using forward error correc• tion (FEC) and switching diversity.

1.4 Organization of the Thesis

Chapter 2 provides background information on mobile radio propagation, other digital modulation methods for mobile radio, the characteristics of FM channels, and previous applications of OFDM. Chapter 3 describes the model used to analyze the BER performance of OFDM/FM. The model converts the fading of the RF signal into equivalent effects on the baseband signal. The model can include receiver functions such as automatic gain control (AGC) and squelch. The model also applies to OFDM/SSB in the case of perfect carrier synchro• nization. An expression for the BER of OFDM is obtained as a function of three statistics of the received signal level.

Three methods that were developed to evaluate the BER performance of OFDM are described in Chapter 4. First, bounds on the BER can be obtained for block durations much shorter or much longer than the average fade duration. Second, the BER expres• sions derived in Chapter 3 can be evaluated with a Monte Carlo numerical integration method. Finally, a signal-processing simulation can be used to study OFDM in more detail. Chapter 1. Introduction 5

Chapter 5 describes the measurements on a prototype OFDM/FM system. These measurements include the BER and some FM receiver and transmitter characteristics. The measurements verify the assumptions in the model and the numerical results. Chapter 6 explains some ways to improve the BER performance of OFDM/FM. A method to reduce the crosstalk caused by fading is described. This method, decision feedback correction (DFC), uses the received data to recreate the parts of the signal lost in fades. Switching diversity and forward error correction (FEC) coding are also briefly examined.

Chapter 8 compares OFDM/FM with OFDM/SSB and with more conventional serial modulation techniques. Chapter 7 covers various topics on the implementation of OFDM/FM systems. The complexity of the digital signal processing (DSP) hardware required and the problem of synchronization are briefly considered. Chapter 9 summarizes the contributions of the thesis and suggests some topics for further research. Chapter 2

Review of Previous Work

This chapter reviews several topics that are relevant to the work described in subsequent chapters. The sections briefly describe the mobile radio channel, other digital modulation techniques, OFDM, and FM transmitters and receivers. )

2.1 The Mobile Radio Channel

Propagation at VHF and UHF frequencies is mostly by reflection, diffraction and scatter• ing from buildings and other objects. As the receiver moves in the interference pattern created by the different propagation paths, the received signal strength varies. Clarke's simple model [10] assumes many scatterers uniformly distributed in a cir• cle around the moving receiver. The signal components received from the scatterers are assumed to have equal amplitudes and independent, uniformly-distributed phases. If each of the received components is expressed in complex notation, the central limit theorem [11] implies that the probability distributions of the real (in-phase) and imag• inary (quadrature) components are Gaussian. The probability density function (pdf) of the envelope (magnitude of the complex sum) can then be shown to be Rayleigh [11],

(2.1) and the cumulative distribution function (CDF) is

0 if r < 0 P(r) = < (2.2) 1 - e,-r »/26 if r > o where r is the level of the envelope and the mean is y/irb/2.

6 Chapter 2. Review of Previous Work 7

Each of the received components will have a different Doppler shift. The shift will depend on the relative velocity between the scatterer and the vehicle. The maximum

Doppler shift (fd) is given by fcV fd = (2.3)

where fc is the carrier frequency, v is the vehicle speed, and c the velocity of propagation. The nomograph in Figure 2.1 shows this relationship.

vehicle speed Doppler rate carrier frequency

1000 -> 10000

Hz MHz mi/h 1000 km/h

-100

100- 100 1000

10

•10

10- 100

0.1

0.01 10 Figure 2.1: Nomograph showing the relationship between maximum Doppler rate (fd), vehicle speed(t>), and carrier frequency (/c). Draw a straight line intersecting the appro• priate axes at the two known quantities. The unknown is read at the intersection of the line with the axis of the unknown variable.

The distribution of the Doppler shifts and the response of the antenna to the different components define the power spectrum of the combined in-phase and quadrature compo• nents [10]. The spectrum of the envelope can then be computed. Some useful statistics Chapter 2. Review of Previous Work 8

of the received signal envelope can be derived from this power spectrum. Two of these are the level crossing rate (LCR) and the average fade duration (r) [3]. The level crossing rate is the average rate of envelope crossings up through a threshold level. The level crossing rate (LCR) (for a vertical monopole antenna) is [3]:

p2 LCR = V2^fdpe- (2.4) where p is the level above the mean and fd is the maximum Doppler rate.

The average fade duration is the average time that the envelope stays below a thresh• old level. The average fade duration f is given by [3]:

ep2 - 1 T=1T7= (2-5) where p and fd are as above.

2.1.1 Frequency-Selective Fading

A more complex propagation model includes many discrete scatterers. Each propagation path can have a different amplitude, propagation delay, and Doppler shift. The distribu• tion of these three variables is called the delay-Doppler profile [12] and defines the way the received signal will be distorted.

When components are received with different delays, the phase differences between them will be a function of the signal frequency. The times or the positions of the fades will depend on the frequency. This is known as frequency-selective fading. Field measurements [6,7,8,13,14] have shown that the distribution of the propagation delay is different in urban and rural areas but that the rms delay spread1 is seldom more than 10 us.

The frequency range over which the correlation of fading signals exceeds 0.9 is defined as the coherence bandwidth [3]. In general, however, the channel will severely distort a signal whose bandwidth significantly exceeds the coherence bandwidth. The coherence

1The rms delay spread is the root of the second central moment of the delay distribution [3]. Chapter 2. Review of Previous Work 9 bandwidth is typically greater than 40 kHz in urban areas and more for suburban areas [15]. Frequency-selective fading is therefore not a significant effect for narrowband (15 to 25 kHz) FM signals [3].

2.1.2 Log-Normal Fading

The mean signal level also changes as the mean path length changes and as the types of scatterers change. The distribution of the mean signal level is often approximated as log-normal. This log-normal fading is slower and affects the modulation much less than the Rayleigh fading.

2.1.3 Noise

Field measurements have been made of typical noise levels in urban areas. The man- made noise at 100 MHz is 20 to 40 dB above the thermal noise limit. At 1 GHz the man-made noise is 0 to 20 dB above the thermal noise limit. Car ignitions, electric motors, fluorescent lighting, and computers are some sources of RF noise [3].

2.2 Digital Modulation for Mobile Radio

2.2.1 Performance Criteria

Three important measures of the performance of a modulation scheme are spectral ef• ficiency, power efficiency, and delay. Spectral efficiency measures how many bits per second can be transmitted in a given bandwidth. For example, a state-of-the-art serial modulation technique, GTFM (Gaussian Tamed FM), can transmit about 16 kbps on a 25 kHz channel [16]. Power efficiency measures the energy required per bit for a given BER. Delay is important in interactive systems. The acceptable delay depends on the application. Chapter 2. Review of Previous Work 10

2.2.2 Modulation Suitable for Non-Coherent Receivers

Frequency shift keying (FSK) is a common digital modulation technique for mobile radio channels. The carrier is modulated by changing the carrier frequency. FSK can be demodulated non-coherently. FSK is less sensitive to fading than modulation techniques that use amplitude or phase modulation. The spectral efficiency of FSK can be improved by selecting the amount of frequency shift and by filtering the modulating waveform. [Gaussian-filtered] minimum-shift keying ([G]MSK), and [Generalized] Tamed FM ([G]TFM) are variations of FSK with better spectral efficiency [16,17,18].

2.2.3 Modulation Suitable for Coherent Receivers

Coherent modulation methods such as phase shift keying (PSK) tend to be more power efficient than non-coherent modulation methods. However, demodulation of PSK requires carrier phase synchronization. Estimating the carrier phase is difficult on fading channels because the received phase is constantly changing. One popular approach is to transmit a pilot carrier with the data and recover the pilot carrier at the receiver [19,20,21,22,23, 24,25,26,27,28,29,30,31].

Many modulation techniques such as GTFM and GMSK can be demodulated coher• ently or non-coherently. Coherent demodulation can result in better power efficiency at the cost of increased receiver complexity.

2.2.4 Spread Spectrum Modulation

Spread spectrum modulation methods spread the transmitted signal over a bandwidth many times the bit rate, typically several MHz [32,33]. One spreading method is to multi• ply the data with a pseudo-random signal (Direct Sequence modulation). Another method is to shift the carrier frequency many times during each bit period (Frequency Hopping). If the signal bandwidth is much greater than the coherence bandwidth the resulting Chapter 2. Review of Previous Work 11

frequency diversity reduces fading. Spread spectrum systems also degrade gracefully as the number of users increases and are less sensitive to jamming. However, spread spectrum systems are not widely used except in military applications due to challenging synchronization problems that increase their complexity and expense.

2.3 Orthogonal Frequency Division Multiplexing

2.3.1 Description

OFDM is a modulation method that uses frequency division multiplexing with frequencies spaced at the symbol (baud) rate. This frequency spacing makes the carriers orthogonal over one symbol interval [4,34,35,36,37]. This allows efficient modulation and demodulation by using discrete Fourier transforms (DFTs) [36].

Modulation is done by using several bits (typically two to five) to set the amplitude and phase of each OFDM carrier. The modulator is an inverse DFT that converts the complex phase/amplitude data for each subchannel into samples of an OFDM signal. The demodulator is a DFT that extracts the phase and amplitude of each carrier from the sampled OFDM signal. Because OFDM can be used to efficiently multiplex many bits into one block (symbol), the baud (symbol) rate can be greatly reduced compared to conventional serial modulation methods. The symbol rate is typically reduced by hundreds or thousands of times. The sampling rate must be greater than twice the bandwidth of the baseband OFDM signal. The number of samples per block, N, is the product of the sampling rate and the block duration. The DFT extracts the phase and amplitude information for N/2 (complex) subchannels from the N (real) samples in the block. The number of bits in a block is determined by the number of subchannels used and the number of bits transmitted on each subchannel. Some subchannels may not be usable because some subchannel frequencies may be too noisy, or may be reserved for synchronization information. The bit rate of the system is the number of bits transmitted per block divided by the block Chapter 2. Review of Previous Work 12

duration. Consider the prototype system transmitting blocks of N — 4096 as an example. The sampling rate was 8 kHz since the audio channel bandwidth was less than 4 kHz. For a block size of 4096 samples, the block duration is 512 ms. A DFT on the 4096 real samples produces 2048 (complex) subchannels. Pairs of bits are encoded into complex values (± 1 ± j) and used to set the amplitude and phase of the subchannels using the 4-QAM constellation shown in figure 4.3. Although up to 4096 bits could be transmitted with each block, only half of the subchannels are used (those between 1 kHz and 3 kHz) resulting in only 2048 bits being transmitted per block. Since the duration of the block is 512 ms, the overall bit rate is 4000 bps. This bit rate stays constant as the block duration decreases because the number of subchannels also decreases by the same factor. The OFDM generates a signal with carrier frequencies between DC and one- half of the sampling rate. Any analog modulation method, for example FM or SSB, can be used to transmit the OFDM signal over the channel. OFDM/SSB has better energy and spectral efficiency. OFDM/FM has the advantage of being compatible with existing mobile radio equipment.

2.3.2 Implementation of OFDM7FM

Figure 2.2 is a block diagram of an OFDM implementation. The OFDM modulator and demodulator are implemented with digital signal processors. The modulator collects a block of bits from the data source, encodes them into complex (QAM) data values, and converts the data to signal samples using an inverse FFT. The digital to analog (D/A) converter then produces the baseband OFDM signal. This baseband signal modulates a transmitter. The modulated signal is transmitted over the fading channel. A receiver recovers the baseband signal which may have been corrupted by fading and additive noise.

The demodulator does the inverse. An analog to digital converter (A/D) samples and Chapter 2. Review of Previous Work 13

OFDM Modulator

serial serial N parallel QAM data to inverse to D/A encoder in parallel FFT serial converter

Receiver channel Transmitter

serial N parallel A/D QAM serial to FFT to converter decoder data parallel serial out

OFDM Demodulator Figure 2.2: An implementation of an OFDM system. quantizes the signal. The demodulator collects a block of samples from the A/D, converts the samples to complex data values using an FFT, and decodes the complex data values back into bits.

2.3.3 Advantages of OFDM

OFDM is less sensitive to the distribution of the additive noise than serial modulation techniques [38]. The averaging of the signal noise over the symbol period gives a Gaussian distribution to the noise on the demodulated data values. This usually results in a lower error rate. Conventional high-speed need equalizers to undo the frequency-dependent effects of the channel. Since the bandwidth of each OFDM subchannel is much narrower, the phase and amplitude response is approximately constant over each subchannel and equalization is not required. OFDM can also be made resistant to narrowband interference by not transmitting data on the affected subchannels. Chapter 2. Review of Previous Work 14

2.3.4 Disadvantages of OFDM

OFDM is sensitive to any distortion that disturbs the orthogonality of the carriers. Any such distortion causes crosstalk interference between the subchannels. An important cause of such distortion is amplitude modulation caused by fading. Another cause is frequency offsets due to synchronization errors. The effects of phase and amplitude jitter and the effects of a single phase or gain change during a symbol were studied in [38]. It was found that the crosstalk noise produced by small amounts of amplitude jitter or gain hits (typically up to 15% or 2 dB) could be reduced about 10 dB by using an adaptive equalizer consisting of a seven-tap transversal filter operating in the frequency domain.

2.3.5 Previous Applications of OFDM

OFDM modems are currently being used for data transmission over telephone channels. OFDM-like multi-carrier modems have also been used for HF (3 to 30 MHz) radio chan• nels.

Telephone Channel Modems

OFDM modems are used on telephone lines because the subchannels do not need to be equalized and because OFDM is less sensitive to impulse noise. The Gandalf Supermodem is a 9600 bps OFDM modem developed in the late 70's [39,40]. It was intended for operation over switched telephone lines. The modem encoded 5 bits on each of 52 carriers at 37 baud. The signal processing was done by a custom MSI TTL processor and the modem sold for several thousand dollars. NEC manufactures a 19.2 kbps voice-bandwidth modem for use over conditioned tele• phone lines that uses a type of modulation (Orthogonal QAM, see Chapter 6) that is similar to OFDM [37]. Chapter 2. Review of Previous Work 15

OFDM modems can adapt to channel conditions by sending fewer bits on subchan• nels with high error rates [41,42]. The Telebit company manufactures one such modem, the TrailBlazer. Telebit's modulation technique, DAMQAM (Dynamically Adaptive Mul- ticarrier QAM), sets the number of bits transmitted on each subchannel according to the quality of that subchannel [42].

HF Modems

The fading on HF channels differs from the fading on mobile radio channels. The nar• rowband mobile radio channel fades quickly but is not frequency selective while the HF channel fades slowly and is frequency selective [43]. The coherence bandwidth of an HF channel can be less than a few hundred Hertz.

Many narrow channels, each less than 100 Hz, can be used to avoid the distortion that would result from a single wide-bandwidth signal. Such modems have been used on HF channels since the early 1950s [43,44,45,46]. Multi-carrier systems can also be used for channel quality measurements [47].

2.4 The FM Channel

An OFDM/FM system could use the same narrowband FM that are currently in use by almost all land mobile radio systems. This section describes the performance characteristics of narrowband FM transmitters and receivers.

2.4.1 The FM Transmitter

Figure 2.3 shows a block diagram of an FM transmitter. After the baseband modulating signal is amplified, it is put through a preemphasis filter. The purpose of this filter will be explained in Section 2.4.7. The signal's RF bandwidth must be restricted to avoid interference with adjacent channels. A clipper limits the peak value of the modulating signal and thus limits the Chapter 2. Review of Previous Work 16

Baseband Amplifier Pre-Emphasis Clipping Input

Low-Pass FM RF Amplifier RF FM Signal Filter Modulator

Figure 2.3: Block diagram of an FM transmitter. peak frequency deviation. Increasing the level of the modulating signal increases the amount of clipping and the resulting distortion. Reducing the modulating signal level reduces clipping distortion but also reduces the received signal-to-noise ratio (SNR). Thus the clipping level is a compromise between distortion and receiver power output. The ratio of peak power to rms power is set to about 10 dB for speech signals [3].

A low-pass filter removes harmonics produced by the clipping and the resulting signal is used to vary the frequency of an RF oscillator. This oscillator's output is amplified and transmitted over the channel.

2.4.2 The FM Receiver

RF Input RF Mixer IF Filter Limiter Amplifier Oscillator

De-Emphasis Squelch and Baseband Discriminator Filter Audio Amplifier " Output

Figure 2.4: Block diagram of an FM receiver. Chapter 2. Review of Previous Work 17

Figure 2.4 is a block diagram of an FM receiver. The received RF signal is amplified and converted down to IF (Intermediate Frequency). The IF filter has a noise bandwidth, B, which is about 15 kHz for narrowband FM systems. The limiter removes amplitude variations. The discriminator demodulates the FM signal to produce the baseband sig• nal. The baseband signal is then passed through a -20 dB/decade deemphasis filter (see

Section 2.4.7). The noise bandwidth2 of this filter, W, is about 3 kHz. A squelch circuit shuts off the output when the signal level drops below some threshold.

2.4.3 Discriminator Output Noise Spectrum and Probability Distribution

The IF SNR affects the spectrum and the probability distribution of the baseband noise. When the IF signal level is much higher than the noise level, the noise added to the FM signal causes small phase changes. The discriminator, a differentiator, acts as a high-pass filter. In this case the baseband noise has a Gaussian probability distribution and a power spectrum that increases 6 dB per octave. When the IF signal level is comparable to the noise level or lower than it, the noise will often be large enough to cause extra zero crossings of the limited signal. These appear as sudden changes of frequency and are demodulated as noise impulses. In this case the baseband click noise has a more impulsive distribution and a flat (white) noise spectrum. The power spectrum of the noise can be approximated by [3,48]:

(2.6) Bp ^20 + 2.35) where p is the IF SNR and B is the IF filter noise bandwidth. The first term increases as f2 and dominates at high SNR. The second term is independent of / and dominates at low SNR. Figure 2.5 shows how the noise spectrum changes with IF SNR.

2Noise bandwidth is defined in Appendix D. Chapter 2. Review of Previous Wort 18

~i r~ -i r r IFSNR = -20dB IF SNR = OdB

m -10 -10 "O IF SNR = 5dB c CD -20 Q -20

0) a. co -30 -30 k_ a> o

DL -40 -40 > a> cr -50 -50

-60 -60 0.02 0.04 0.06 0.08 0.1 0.2 0.4 Frequency (fraction of IF Bandwidth)

Figure 2.5: Baseband noise spectra for different IF SNRs.

2.4.4 Receiver SN Curves

The baseband noise spectrum can be integrated over the baseband filter bandwidth to obtain the total baseband noise power [3].

The resulting FM baseband noise power level is:

„, , o(l - e~P) ZirBWe-P (2.7) V2(p + 2.35) where

4it2w3 g (-Try fwyn (2.8) and W is the baseband filter noise bandwidth.

The FM baseband signal level is:

2 S0(p) = ^(B - 2W) (1 - e-?)\ (2.9) Chapter 2. Review of Previous Work 19 where c is the peak to rms voltage ratio of the modulating signal. Figure 2.6 shows this theoretical baseband output signal power (5) and noise power (n) as a function of IF SNR for a discriminator-type FM demodulator without deemphasis. This type of curve will be referred to as a receiver SN curve.

-i—1 1 1 1 1 1 10 - —1— — —1— —1— —1—1— —1—;

Noise (N) g O Signal (S) CL

O 2

c10 w -o B = 14900 Hz c « W = 3290 Hz 0> peak/rms = 3.16 (tn0 m

20 30 IF SNR (dB)

Figure 2.6: The theoretical SN curves of a narrowband FM receiver: receiver output signal power (s) and noise power (n) as function of IF SNR (p).

Above a threshold value of IF SNR the output level is constant and the noise power decreases. Below this threshold the output signal level drops and the noise output level becomes constant. The ratio of the IF bandwidth to the baseband bandwidth affects the location of the threshold and the shape of the SN curves. The values used in Figure 2.6 (B =14.9 kHz, W =3.3 kHz) are those of the narrowband receiver described in Chapter 5. For a larger ratio of B/W there is more SNR improvement above threshold but the threshold occurs Chapter 2. Review of Previous Work 20

at a higher IF SNR. For example, broadcast FM receivers use B of about 180 kHz and W about 15 kHz to improve the baseband SNR [49]. The type of FM demodulator also affects the receiver SN curves. Discriminators and Phase Locked Loops (PLLs) are the two common types of FM demodulators. PLL demodulators have lower thresholds than discriminators [49]. There are also different types of discriminators (quadrature, filter, and pulse-counting) [50,51].

2.4.5 Random FM

Multi-path propagation and the vehicle's motion result in random variations of the re• ceived signal phase. These phase changes are detected by the discriminator and cause random FM noise. The power of the random FM noise is independent of the received signal level and thus random FM sets a limit on the achievable baseband SNR [48].

2.4.6 Capture Effect

The FM demodulator tends to demodulate only to the strongest signal in the IF passband [3]. This is known as the capture effect.

2.4.7 Preemphasis and Deemphasis

The use of preemphasis and deemphasis filtering affects the baseband noise spectrum and the baseband noise power [3,49]. At high IF SNR the noise has a parabolic (/2) noise spectrum so that there is more noise at higher frequencies.

A preemphasis filter with an f2 response (+20 dB per decade) is used at the trans• mitter to increase the power of the components. Figure 2.7 shows the specifications for the f2 response of the preemphasis filter [52]. A deemphasis filter (-20 dB/decade) is used at the receiver to remove the effect of preemphasis on the baseband signal. Chapter 2. Review of Previous Work 21

10 (from DOC RSS-119) N y / / / / / / / s CD / / > / / CD / / / / / / / / / / CD / / CO / / CD i CU OC -10 // CD / / / COL co CD OC -20 1 2 3 4567891 2 3 456789 100 1000 10000 Frequency (Hz) Figure 2.7: Preemphasis filter specification. From [52].

Unlike the signal, the noise is only affected by the deemphasis filter. If the noise has a parabolic spectrum (such as at a high IF SNR), then deemphasis can reduce the total baseband noise power and can flatten the noise spectrum. When the IF SNR is low and the discriminator output noise has a flat noise spectrum, deemphasis concentrates the noise at low frequencies and makes the click noise distribution less impulsive. Chapter 3

Modelling and Error Rate Analysis

3.1 Introduction

This chapter proposes a simple model for the mobile radio channel, the equivalent base• band channel (EBC) model, and uses it to obtain an expression for the BER of OFDM. The model is shown to apply to the OFDM/FM channel and to the OFDM/SSB channel with perfect carrier synchronization. The independent error assumption is used to predict the word error rate.

3.2 The Equivalent Baseband Channel Model

The model used to analyze the effects of fading on the OFDM signal and to predict the performance of OFDM over mobile radio channels must include all significant effects and yet be kept simple enough for analysis and efficient numerical work. To do this, the EBC model converts the effects of fading at IF (or RF) into equivalent effects at baseband. Two effects are considered: time-varying channel gain (fading), and additive noise.

The notation a is used to indicate a vector {aQ, a\,..., ajv-i} and (a) is used to denote

the time average of the variable a over N samples ((a) = ^(a0 + ai + ... + ow-i)). The word sample will be used for quantities in the time domain, while the term value will be used for quantities in the frequency domain. x Figure 3.1 is a diagram of the equivalent baseband channel model. The received samples, y, are the sum of received data and noise samples. The re• ceived data samples are the transmitted data samples scaled by the channel gain, s. The received noise samples are zero-mean Gaussian random variables scaled by the channel

22 Chapter 3. Modelling and Error Rate Analysis 23

IDFT Transmitted Data snr —• signal

f8(r)

IF SNR DFT

Received snr —• noise Data

n Gaussian w Noise

Figure 3.1: The equivalent baseband channel model. noise gain n. Both s and n are functions of r, the IF SNR. Since the IF noise level is assumed fixed, 7* is proportional to the IF signal level. The functions s = /s(f) and n = fn(r), define the SN curves of the receiver. Different modulation methods can be modelled by changing these functions. Theoretical or measured SN curves can be used. This model assumes that the receiver SN curves are memoryless. This allows the average signal and noise powers to be obtained by averaging the instantaneous signal and noise powers. This quasi-static approximation is valid when the Doppler rate is less than the baseband bandwidth [48,53], as is the case with land mobile radio applications. However, the quasi-static model cannot include time-dependent effects such as a delay in the response of an AGC amplifier. Chapter 3. Modelling and Error Rate Analysis 24

3.3 BER Analysis

An expression for the BER of a single OFDM block transmitted over the equivalent baseband channel is obtained in this section.

3.3.1 Mean and Variance of the Received Value

In Appendix A the ensemble average of the m'th received data value Ym over the set of all possible data vectors with the m'th data value fixed at Xm = D (D — ±l±j) and over all possible noise vectors w is found conditioned on a given fixed signal level r (and the corresponding s and n) as:

E[Ym\Xm = D,X.m = D*,r]mD(s). (3.1)

The conditional variance (given the same conditions as for the mean) of a received data value Ym, is found to be:

2 2 2 var( Ym\Xm = D,X-m = D\r)*2 ((S ) - (s) + (n )) . (3.2)

3.3.2 Bit Error Rate Within a Block

Since the interference between the subchannels is caused by a large number of inde• pendent subchannels, the Central Limit Theorem implies that the distribution of this interference is approximately Gaussian. This is confirmed by measurements of the inter• ference distribution (Chapter 5). Since the effect of the channel noise is also Gaussian (because of the linearity of the DFT) and independent of the interchannel interference (because r is a constant), the sum of the noise and interference will also be Gaussian and their powers will add.

Using signal-space arguments [11] it is then possible to obtain the BER within a block: Chapter 3. Modelling and Error Rate Analysis 25

where a = (s), 8 = (s2), and 7 = (n2). This result applies for the Gray-coded signalling constellation shown in figure 4.3.

3.3.3 Evaluating the BER

The resulting overall BER can be obtained by using the joint distribution of a, 8, and 7,

To obtain estimates of the overall BER, the joint distribution of a, 8, and 7 is required. Unfortunately, no closed form expression is available for this joint distribution, p(a, 8,7). In Chapter 4 a Monte-Carlo numerical integration procedure is described that can be used to evaluate this expression.

3.4 Modelling the OFDM/FM Channel

The following sections explain how the OFDM/FM channel is modelled.

3.4.1 Baseband Noise Distribution

Although the probability distribution of the noise depends on the SNR, the noise after the DFT can be assumed to be Gaussian because the DFT in the OFDM demodulation process converts any noise distribution to a distribution that is approximately Gaussian.

3.4.2 Baseband Noise Spectrum

As described in Chapter 2, the spectrum of the discriminator noise output depends on the SNR. The noise distribution among the subchannels thus depends on the IF SNR. Fading causes different subchannels to receive different average noise powers from block to block. It was assumed that differences in the spectral distribution of the noise power from block to block would be small and that any overall long-term uneven spectral distribution of Chapter 3. Modelling and Error Rate Analysis 26

the noise could be corrected by changing the transmitted power spectrum. The noise spectrum was therefore assumed to be independent of the IF SNR. Experimental measurements showed that subchannels at lower frequencies had more noise. This caused subchannels at lower frequencies to have higher error rates. This effect was corrected by transmitting more power in the noisier subchannels. Measure• ments of the error rates in the different subchannels showed that the error rates could be made approximately equal by using a -10 dB per decade preemphasis at the transmitter in addition to the standard +20 dB per decade.

3.4.3 Random FM Noise

The spectrum of the random FM is independent of the SNR and decreases as (1//) for frequencies above the Doppler rate [48]. Random FM could have been included in the model by adding noise whose level was a function of the Doppler rate. However, this was not necessary since the level of the random FM noise was not significant at any of the Doppler rates measured.

3.4.4 Clipping Noise

Clipping at the transmitter (section 2.4.1) was modelled as an additional source of additive white Gaussian noise. Although the clipping is not independent of the signal, it forms a relatively small portion of the total noise power. The modulating signal level will normally be set so that clipping distortion does not have a measurable effect on the BER. This was the case during the experimental measurements.

3.4.5 Squelch

Squelch can be incorporated into the SN curves by making the values of s and n equal to zero when the IF SNR level is below the squelch threshold. Chapter 3. Modelling and Error Rate Analysis 27

The model assumes an ideal squelch circuit that is not affected by noise and has no hysteresis or delay.

3.4.6 FM Receiver SN Curves

Figure 3.2 is an example of an FM SN curve to demonstrate the above effects. This exam• ple shows the theoretical non-linear SN curves of an FM discriminator with a threshold at an IF SNR of approximately 10 dB. The effect of baseband SNR limiting due to random FM or clipping noise has been added so that the maximum baseband SNR is 18 dB. This example also shows the effect of squelch with threshold at -10 dB IF SNR.

-30 -20 -10 0 10 20 30 IF SNR (r) (dB)

Figure 3.2: Example of an FM SN curve. Chapter 3. Modelling and Error Rate Analysis 28

3.5 Modelling the OFDM/SSB Channel

SSB transmission is equivalent to translating the OFDM signal spectrum from baseband to the RF frequency. If carrier phase and carrier frequency synchronization are perfect, the effect of fading on the baseband signal is the same as the effect on the RF signal. In this case the analysis of the SSB channel is simplified because the SN curves are linear and the baseband noise has the same spectrum and distribution as the RF noise.

3.5.1 Frequency and Phase Synchronization

Coherent demodulation of the SSB signal requires the use of a pilot carrier. Multipath fading makes accurate carrier phase and frequency synchronization difficult because the signal undergoes rapid phase and amplitude changes. The demodulator must contin• uously track the phase of the . The effect of constant frequency and phase offsets on an OFDM modem for telephone channels was analyzed in [38]. The OFDM/SSB system studied in [1] uses two pilot carriers to reduce the effects of frequency-selective fading on carrier synchronization. Perfect frequency and phase recovery must be assumed when using the equivalent baseband model for OFDM/SSB because the model does not include frequency or phase shifts.

3.5.2 AGC

SSB receivers use automatic gain control (AGC) circuits to maintain a constant output level as the received signal fades. A limit must be set on the maximum gain of the AGC to avoid excessively large noise outputs during fades. The effect of such an AGC can be incorporated into the SN curves. To simulate the changing gain of the AGC, the signal level curve is kept constant above the AGC limit and the noise level curve is set to the amount required to achieve the correct SNR. The model assumes an ideal AGC circuit that is not affected by noise and has no delay. Chapter 3. Modelling and Error Rate Analysis 29

3.5.3 Example of SSB Receiver SN Curves

Figure 3.3 is an example of an SSB receiver SN curve. It shows the linear SN curves and the effect of AGC.

3.6 Word Error Rate Analysis

In many data communications systems, any error within a related group of bits (a word) invalidates all of the bits. In such systems the performance measure of interest is the word error rate, WER. If bit errors occur randomly with a probability p, the probability of i errors in N bits is:

l^pXl-pf-'. (3.5) Chapter 3. Modelling and Error Rate Analysis 30

The assumption of random errors would simplify the prediction of the error rate of words contained within an OFDM block. Experimental results (see Chapter 5) showed that the independent error assumption is a good approximation for the system that was studied. The prediction of the error rate for words spanning more than one block cannot be done using this method because BERbiock changes from block to block. Chapter 4

Numerical Evaluation of Bit and Word Error Rates

4.1 Introduction

This chapter describes three numerical methods that were developed to evaluate the BER and WER performance of OFDM. The first three sections describe the three numerical methods: a bound computation for very short and very long block lengths, a Monte-Carlo integration, and a baseband signal processing simulation. The final section describes the software routines used.

A comparison of results obtained with the three methods can be used as a check of the analysis and also as a check of the software. The results obtained with these numerical methods are presented along with the experimental results in Chapter 5.

4.2 BER Bounds for Large and Small Blocks

This section gives bounds on the BER of OFDM using blocks that are very short or very long relative to the average fade duration. This is the fastest method but only provides bounds on the BER performance. When the block is very short, the signal level will be constant during the block. Thus

2 2 2 2 (s) — s, (s ) — s , and (n ) = n . The bit error rate for each block, BERbiock> as a function of the IF SNR can be averaged over the Rayleigh signal level distribution (equation 2.1) to find the average overall BER. That is,

(4.1)

31 Chapter 4. Numerical Evaluation of Bit and Word Error Rates 32

Since the signal level is constant over the block (s)2 = (s2) and equation 3.3 simplifies to

BERblock(a,/?,7) = Q^^. (4.2)

When the block is very long, each block will have the same statistics and therefore each block will have the same BER. The overall BER will be the block BER for the average block statistics. That is, if

/•oo poo poo a = s(r)p(r)dr, 0 = s2(r)p(r)dr, and 7 = / n2(r)p(r)dr, (4.3) Jo Jo Jo then

BERlong biock = BERbiock(a, 0,l)- (4.4)

The values of s(r) and n(r) were taken from the measured SN curves (see Chapter 5). The SN values were interpolated from the measured values over the range of -60 to +50 dB in 0.1 dB steps. A listing of the program that computes the bounds is given in Appendix E.

4.3 Monte-Carlo Integration of the Block BER Equations

The second numerical method uses a Monte-Carlo numerical integration technique to evaluate the integral obtained from the BER analysis in the previous chapter (equation 3.4). The method involves generating random fading waveforms and using the a, 0 and 7 statistics to compute the expected overall BER. Figure 4.1 shows the steps in this procedure. A Monte-Carlo procedure is used in which signal level vectors r are chosen at random from a sequence which is Rayleigh distributed with the appropriate Doppler rate and block duration. From each r the values of a, 0 and 7 and the resulting BERbiock are calculated. These BERbiock values are then averaged to obtain the overall BER of the system. This is an efficient way to evaluate the BER for any channel that can be accurately modelled by the equivalent baseband channel model. The word error rate can also be Chapter 4. Numerical Evaluation of Bit and Word Error Rates 33

SN s compute BER Rayleigh r table block erfc and Fading n lookup statistics WER

Figure 4.1: The numerical integration method. computed using equation 3.5. It is more efficient than the more detailed simulations described in the following section because it does not involve generating random data or noise or computing DFTs. A listing of this program is given in Appendix E.

4.4 Simulation of the Equivalent Baseband Channel

The OFDM system can be studied in more detail by generating a sampled baseband OFDM waveform and passing it through the equivalent baseband channel. This involves performing most of the baseband signal processing for an OFDM system. This method allows testing of signal processing procedures that cannot be included in the equivalent baseband channel model or whose effect is too complex to analyze (see Chapter 6). This approach is considerably slower1 since it involves generating pseudo-random data and noise as well as computing the FFTs required for OFDM modulation and demodulation.

Figure 4.2 shows the steps involved in the baseband simulation. A block of bits from a pseudo-random bit sequence (PRBS) generator is QAM-encoded into a block of complex values. The inverse FFT generates the baseband OFDM signal. The Rayleigh fading generator produces the signal envelope. The SN lookup table and the channel simulator implement the equivalent baseband channel (shown in Figure 3.1) and combine the baseband signal and Gaussian noise. The FFT demodulates the OFDM signal and the QAM decoder recovers the binary data. Optional forward error correction (FEC)

1A typical simulation (about 3 million samples for each of four SNRs and three block sizes) required about 8.5 hours CPU ("user") time on a Sun 3/50 compared to about 1.5 hours for the numerical integration procedure. Chapter 4. Numerical Evaluation of Bit and Word Error Rates 34

processing simulates the effect of FEC coding. The final step in the simulation is to compare the transmitted and received bit sequences and to compute the BER and WER.

Gaussian RNG I

PRBS QAM inverse channel data encoder FFT simulator generator S 1 N SN Rayleigh lookup Fading tables

bit and QAM FFT FEC word error decoder counter BER and WER

Figure 4.2: Simulation using the equivalent baseband channel.

A more detailed simulation that included the IF signal processing stages could have studied other effects but would have required much more computation. A listing of the simulation program is given in Appendix E.

4.5 Description of Software

The computer programs were written in FORTRAN 77 because it was the only compiler on the computers available at the start of the research project and efficient FORTRAN FFT routines were available [54]. The sed stream editor was used to generate different versions to run on an IBM PC/AT (MS-DOS) and a Sun 3/50 (BSD 4.2 UNIX). The programs re-used the same fading, noise, and data waveforms when computing the BER statistics for different block sizes. This reduces the computation time by a factor of about 2 and reduces the uncertainty in the measurement of the effect of the block size. Chapter 4. Numerical Evaluation of Bit and Word Error Rates 35

The durations of the baseband simulation and Monte-Carlo integration computations were made as long as practical to reduce the statistical uncertainty of the results. The 0.95 confidence intervals for the desired values were computed to estimate this uncer• tainty. The overall simulation was divided into a number of separate trials (usually twelve). The variance of the results (the BERs or WERs) in the different trials was used to compute the confidence intervals [55]. The following sections describe the various software routines and how they were tested. Testing can help find errors although it does not guarantee correctness. The tests were done on both the Sun 3/50 and the IBM PC/AT.

4.5.1 Fading Waveform Generator

The Rayleigh fading envelope of the received signal is generated using the method de• scribed in [3,56] and in Appendix B. The routine can also simulate switched diversity between independently-fading input signals. The diversity routines simulate the phase transients produced by switching between antennas by setting a number of samples to zero at each switching time (see section 6.2). The fading generator was tested by measuring the level crossing rate (LCR) and the cumulative probability distribution function (CPDF) of the generated waveform.

4.5.2 Data Generator

The transmitted data bits were generated with a pseudo-random bit sequence (PRBS) generator implemented as a shift register with feedback. The generator polynomial is taken from [57] and generates a maximal length sequence of period 223 — 1. The period was measured and found to be correct. Chapter 4. Numerical Evaluation of Bit and Word Error Rates 36

4.5.3 Noise Generators

Two random number generators (RNGs) are used to generate the noise. The Gaussian generator converts two uniformly distributed random variables into two normally dis• tributed ones [54]. The uniform RNG is a linear modulo-congruential type with the multiplier, increment and modulus taken from [58] and agreeing with the criteria in [59]. The recursion equation for this generator is

= axi + c mod m (4-5) where a = 8 x 8385161 + 5 = 67081293, c = 2 x 7090885 + 1 = 14181771, and m = 226 = 67108864. The period of this generator is m. The RNG was implemented using double precision floating point numbers to ensure that full integer precision was maintained [60].

The modulo congruential uniform random number generator was tested by starting at a seed of zero and measuring the period before the state returned to zero. The period was found to be 67108864. The generator was also tested by comparing the sequence generated using the floating point numbers against a sequence computed with infinite- precision arithmetic. A simple impulsive noise generator was also implemented. Each sample had the same probability of containing an impulse and all noise impulses had the same amplitude.

4.5.4 Bit and Word Error Rate Measurement

This routine compares the transmitted data and the received data and computes bit and word error rates. The bit and word error measurement routines were tested by generating known error patterns and checking the resulting bit and word error counts. Routines are also provided to compute the 95 percent confidence interval statistics for the means [55]. Chapter 4. Numerical Evaluation of Bit and Word Error Rates 37

4.5.5 FEC

An FEC routine was used to test the effect of various FEC codes. The codes are idealized block codes that can correct up to m errors in n bits. They are idealized codes because an actual code may attempt error correction in some words with more than m errors. This attempt may succeed or may introduce additional errors. However, steps can be taken to ensure that these events do not affect the results (see Section 6.3.2). The FEC routines were tested by generating bit sequences with a known error pattern and measuring the number of errors after FEC processing.

4.5.6 QAM Encoding/Decoding

A QAM data encoder/decoder and an OFDM modulator/demodulator are required for the baseband simulation. The QAM data encoding is done by using two bits per subchannel - one bit for the imaginary (quadrature) component and one bit for the real (in-phase) component. A 0-bit is converted to a value of -1, and a 1-bit to +1. Unused subchannels are set to zero. The decoding is done by comparing the received values to a threshold of zero. Figure 4.3 shows the QAM encoding constellation and the decision thresholds used for decoding.

quadrature (imaginary)

• +1 +i

in-phase (real)

-1 -j • • +1 -j

Figure 4.3: QAM Encoding. The real and imaginary axes are the decision region bound• aries. Chapter 4. Numerical Evaluation of Bit and Word Error Rates 38

4.5.7 OFDM Modulation/Demodulation

A fast (radix 8/4/2) FFT from the IEEE DSP subroutine library [54] is used to modulate the data values into signal samples. The inverse FFT converts each block of N/2 complex values into N samples. Since

each block can transmit N bits and the duration of the block is N/fs where fs is the

sampling rate, the nominal bit rate is fs. However, if the channel is bandlimited, not all of the subchannels may be usable and this will reduce the bit rate. Any guard times left between blocks to avoid interference between blocks (see Chapter 6) will further reduce the overall bit rate.

4.5.8 IF SNR to Baseband Signal and Noise Power Conversion

The conversion from IF SNR (r) to baseband signal power (s) and noise power (n) is done with look-up tables. The tables contains values for IF SNRs from -50 to +60 dB in 0.1 dB (2.3 percent) increments. The tables can contain theoretical values (for example, equation 2.9) or measured values. Linear interpolation is done between measured points.

The conversion routines were tested by converting a range of IF SNRs and plotting the results to obtain the SN curves.

4.5.9 Simulated Fading Channel

The channel simulator simply scales the inverse FFT output sample and the Gaussian RNG output sample by the s and n values in conversion table and then sums the two scaled samples. The appropriate s and n values are selected by the fading signal level (r). Chapter 5

Experimental Measurements

5.1 Introduction

This chapter describes measurements on an experimental OFDM/FM system. Sections 5.2 and 5.3 describe the experimental hardware and software. Section 5.4 describes how the SN curves of the FM channel were measured and compares the results to those of a theoretical FM channel. The next section describes how the experimental system's BER and WER performances were measured and compares the results with those obtained using the numerical techniques described in Chapter 4. The final section describes mea• surements to determine the effect of random FM.

5.2 Experimental Hardware

This section describes the equipment used in the measurements: the FM transmitter, the fading channel simulator, the FM receiver, and the digital signal processing equipment. Figure 5.1 shows a block diagram of the overall experimental setup.

FM Fading Channel FM Transmitter Simulator Receiver

low-pass low-pass D/A Computer A/D filter filter

Figure 5.1: Block diagram of experimental setup.

39 Chapter 5. Experimental Measurements 40

5.2.1 Transmitter

The transmitter was an Icom model IC-2AT narrow-band FM transceiver designed for operation in the 144 to 148 MHz amateur band. Its specifications are similar to those of commercial land mobile radio equipment [52]. The audio processing circuitry contains a +20 dB per decade preemphasis network, a limiter (peak clipping) circuit and a low-pass filter. The maximum peak deviation was measured to be 5 kHz. The carrier frequency was set to 144.150 MHz. The frequency stability is specified as ±1.5 kHz. The transmitter was placed in a cast aluminum box and the power leads were passed through an EMI filter to provide RF shielding. A voltage regulator held the transmitter supply voltage at 10 volts DC. An 11 dB 50 ohm attenuator was mounted inside the shield• ing box to reduce the RF output level to 12.5 dBm1. Figure 5.2 shows the components associated with the transmitter.

Cast Aluminum Box

j RF Ant. 11 dB Attenuator Zrv^ Output CORCOM 10EK1 IC2AT (12.5 dBm) EMI Filter FM Transmitter Power 144.15 MHz Imput (low power mode) (13 VDC) 10V Pwr. Mic. 10 Regulator VDC

Audio Input (6 mV rms)

Audio , Audio Input (2.5 V peak) Attenuator

Figure 5.2: Experimental transmitter.

^dBm = lmW. Chapter 5. Experimental Measurements 41

5.2.2 Fading Channel Simulator

Figure 5.3 shows the components of the fading channel simulator. The simulator consists of a Rayleigh fading simulator, an RF attenuator, a noise source, and a combiner/splitter.

Rayleigh fading Kay Elemetrics simulator model 437 RF power from re• RF attenuator combiner/splitter transmitter to modulator receiver

Q

controller Mini-Circuits ZHL-2-8 HP 8558B RF amplifier (noise source) spectrum analyzer

Figure 5.3: Fading channel simulator.

Fading Simulator

A fading simulator was built for these measurements. The fading simulator modulates the RF signal to give it a Rayleigh-distributed envelope and a uniformly-distributed phase. The fading simulator is described in Appendix B and [56].

Noise Source

The signal and noise levels were measured at RF because it was not possible to make accurate measurements at the receiver's IF stage. To ensure that the IF SNR and the RF SNR were equal, the receiver's internal noise was masked by adding a large amount of noise to the RF signal. The additional RF noise resulted in an increase in the IF noise level of at least 11 dB. This level of noise ensured that the noise added by the receiver had a small (< 0.5 dB) effect on the IF SNR.

A Mini-Circuits model ZHL-2-8 RF amplifier with its input terminated was used as Chapter 5. Experimental Measurements 42 the RF noise source. The noise output is the internal device noise of the amplifier. This amplifier has a specified frequency range of 10 to 1000 MHz, gain of 27 ± lOdB, and noise figure of 10 dB. The spectrum of the noise was measured with a spectrum analyzer set at 1 kHz resolution bandwidth and was found to be constant to within 0.2 dB over the receiver's IF bandwidth. Although the probability distribution of the IF noise was not measured, it should have been Gaussian because the broadband (approximately 1 GHz) noise was passed through an IF filter with a much narrower bandwidth (approximately 15 kHz) [11, section 3.2].

Step RF Attenuator

The RF SNR was set by keeping the noise power fixed and varying the RF signal level. A KAY Elemetrics model 437 step attenuator with a range of 0 to 101.5 dB in 0.5 dB steps was used to vary the RF signal level.

Combiner/Splitter

A Mini-Circuits PSC-2-1 RF power combiner/splitter was used to sum the signal and noise. A second combiner/splitter was used to provide two outputs. One went to the receiver and the other went to the spectrum analyzer. The difference in the levels of the two splitter outputs was measured to be less than 0.2 dB.

Spectrum Analyzer

An HP model 8558B spectrum analyzer was used to measure the relative levels of the signal and the noise. Although the signal power can be measured directly, measurement of the noise power requires several auxiliary measurements and corrections that are described in Appendix D. When the spectrum analyzer was not available it was replaced with a 50 ohm termination to ensure proper matching of the splitter ports. Since the spectrum analyzer was not accurately calibrated, the SNR measurements used only the Chapter 5. Experimental Measurements 43

differences between the signal and noise levels.

5.2.3 Receiver

The FM receiver was another Icom model IC-2AT transceiver. The receiver IF filter bandwidth specification is ± 7.5 kHz at -6 dB and ± 15 kHz at -60 dB. The receiver uses a Motorola MC3357 "Low Power Narrow-Band FM IF" IC for most of the IF and AF signal processing functions. The FM detector is a quadrature-type discriminator [50,51]. The receiver frequency was set to 144.150 MHz. The squelch level was set to minimum so that the receiver audio output was always on.

The receiver was placed in a cast aluminum box. A connection was provided to the output of the receiver's IF filter (ICI, pin 5) so that the IF signal level could be measured. The transmitter was disabled to prevent accidental damage to the fading simulator. An EMI power line filter was used on the power supply leads. Figure 5.4 shows the compo• nents associated with the receiver. Cast Aluminum Box

IC2AT 9VDC CDE1021L FM Receiver EMI Filter (144.15 MHz) Battery Pwr. 10VDC

Power Supply

IF Output (high impedance)

Figure 5.4: Experimental receiver. Chapter 5. Experimental Measurements 44

5.2.4 DSP Equipment

Computer

An IBM PC/AT-compatible computer was used for all of the digital signal processing as well as test data generation and BER and WER rate measurement. All of the signal processing computations used IEEE-standard 32-bit floating point.

A/D and D/A Board

The analog interface circuit was designed and built for this project. It contains a 10-bit analog-to-digital converter (A/D), a 12-bit digital-to-analog converter (D/A), a sample-and- hold amplifier, buffer amplifiers, and a timing circuit. It was built on a prototyping board that was plugged into the computer's bus. The circuit is described in Appendix C and the interface software is listed in Appendix E.

Reconstruction and Anti-Aliasing Filters

A Krohn-Hite model 3342 filter was used to reconstruct the analog waveform from the D/A output samples. The reconstruction filter used one eighth-order Butterworth low- pass section with a -3 dB frequency of 4 kHz and one eighth-order Butterworth high-pass section with a -3 dB frequency of 100 Hz. The high-pass section was used to provide AC coupling to the transmitter. The received signal was passed through a second Krohn-Hite model 3342 low-pass filter to avoid aliasing. This anti-aliasing filter used two eighth-order Butterworth low- pass sections with -3 dB frequencies of 4 kHz. The filters have a 1 M ohm input impedance, and a 50 ohm output impedance. The quality of the analog interface was tested by measuring the distortion of a 0.5 to 3.5 kHz OFDM signal sent through the D/A, the filters and the A/D. The SN curve measurement procedure (section 5.4) was used to measure the signal power and the Chapter 5. Experimental Measurements 45 distortion-plus-noise power. The distortion-plus-noise power was 40 dB less than the signal power. Other tests are described in Appendix C.

Audio Attenuator

An audio attenuator was used to reduce the D/A output (approximately 140 millivolts rms) to a level suitable for modulating the transmitter (approximately 6 millivolts rms). The attenuator circuit includes a low-pass filter to reduce RF leakage and a switch to turn the transmitter on and off. The attenuator circuit is shown in Figure 5.5.

transmitter 1uH * off 50k

to -AMr transmitter from D/A 1nF 50k 50 and filter

Figure 5.5: Schematic of audio attenuator for transmitter.

Shielding

Shielding is an important consideration because the transmitter output power is much (over 100 dB) greater than the minimum signal power that can be detected by the receiver. Any signal leaking into the receiver directly from the transmitter would alter the level of the received signal level and affect the results. Cast aluminum boxes were used to shield both the transmitter and receiver, and EMI filters were used on power supply leads to avoid RF leakage. Aluminum foil was used as a material gasket to seal the seams around the lids of the aluminum boxes. A tone was transmitted with no added RF noise and the simulator set for maximum attenuation to test for signal leakage around the channel simulator. The RF attenuator was set to 101.5 dB and the fading simulator set to the -20 dB test level. The received signal was not audible and its level was too low to measure above the noise. Chapter 5. Experimental Measurements 46

5.3 Experimental Software

The simulation program described in Chapter 4 was modified to make the BER and WER measurements over the experimental channel. Instead of using a subroutine that simulates the channel, the OFDM signal samples are written to the D/A and read from the A/D. Two additional processing steps were added for use on the hardware channel:

• periodic extension to provide guard times around each block, and

• correction for phase and amplitude (linear) channel distortion.

These procedures are described in Chapter 7. Figure 5.6 shows the signal processing steps for the experimental measurements. A block of pseudo-random bits is QPSK-encoded2 and modulated into a block of OFDM samples. The block of samples is extended to add guard times before and after the block. The samples are sent to the D/A and the resulting analog audio signal modulates the FM transmitter. The recovered baseband (audio) output of the FM receiver is sampled and A/D converted. The received samples are demodulated and the complex data values corrected for the linear distortion effects of the channel. The received complex data values are then decoded into bits and compared to the transmitted data to compute the BER and WER. The program can also compare the transmitted and received data values on each subchannel to measure the signal and noise powers. This was used to measure the SN curves (section 5.4.7).

5.4 Measuring the Baseband SN Characteristics

The numerical methods used to predict the performance of OFDM over a fading channel require that the channel's SN curves be known. Measurements of the experimental channel's SN curves showed that theoretical models for an FM discriminator [3] do not

2QPSK is the same as 4-QAM. Chapter 5. Experimental Measurements 47

audio output PRBS QPSK periodic inverse D/A generator encoder DFT extension

S,N computation S,N

bit error counter BER, audio WER input correction for QPSK A/D DFT linear distortion decoder

Figure 5.6: Signal processing for experimental measurements. accurately predict the performance of a real FM receiver and therefore these models cannot be used to accurately predict the performance of OFDM/FM. Some of the effects that the theoretical discriminator model does not take into account are:

• the distortion due to clipping,

• the effect of preemphasis and deemphasis on the noise and signal powers, and

• receiver dynamic range limitations.

The effects on the signal and noise due to preemphasis, deemphasis and clipping, are described in Chapter 2. In addition to these effects, at low IF SNR the receiver's noise output is theoretically much (over 10 dB) higher than the maximum signal output. Receiver dynamic range limitations can prevent the output noise power from reaching its theoretical value. For these reasons it was necessary to use measured SN curves instead of the theoretical SN curves to predict OFDM BER and WER performance. The following three sub-sections describe how the modulating signal level, the base• band frequency range, and the amount of software preemphasis were chosen. Subsequent sub-sections describe how the bit rate, the IF SNR and Efe/N0, were computed. The final Chapter 5. Experimental Measurements 48

two sub-sections describe how the baseband signal and noise powers were measured and present the SN curves of the experimental channel.

5.4.1 The Modulating Signal Level

As described in Chapter 2, the FM transmitter clips the peaks of the modulating signal to limit the peak deviation and avoid interference with adjacent channels. The effect of clipping on the OFDM signal was included in the SN curves by considering clipping to be equivalent to an additive noise source. It is difficult to measure the amount of clipping of the modulating waveform because:

• preemphasis occurs before clipping and this makes the amount of clipping depend on the frequency content of the signal, and

• the low-pass filter following the clipper smooths out the signal and distorts the effects of clipping.

However, the additive noise effect due to clipping can be measured (see Section 5.4.7). Clipping, in the absence of other impairments, sets an upper limit on the baseband SNR, the limiting baseband SNR. The modulating signal level should be set so that the Umiting baseband SNR does not prevent the system from achieving its BER performance objectives. The modulating signal level was set to give a limiting baseband SNR of

17.5 dB, a level for which the BER was very small3 (<10-6).

5.4.2 The Baseband Frequency Range

The transmitter's clipping circuits limit the total transmitted baseband power and it is necessary to allocate this power among the subchannels. This allocation involves a compromise between concentrating the power in fewer subchannels to reduce the BER or using more subchannels (to increase the bit rate) and increasing the BER.

3The effect of clipping varies from block to block since the modulating signal is different for each block. Chapter 5. Experimental Measurements 49

The allocation of power must also take into account the frequency responses of the transmitter's post-clipping low-pass filter and the receiver's audio circuits. These filters are not flat and therefore some subchannels are attenuated more than others. Those subchannels with higher attenuation have lower SNRs and thus higher BERs. Since the total transmitted baseband power is fixed by clipping and then passes through the transmitter's low-pass filter, the use of subchannels with higher attenuation also reduces the total received power.

Brief measurements of Eb/N0 performance using various frequency ranges showed that a good compromise was to use frequencies between 1 and 3 kHz and to transmit the same power on each subchannel. Another approach that was not tested but is widely used [37,41,42,61] is to encode more bits on subchannels with higher SNRs.

5.4.3 Software Preemphasis

As described in Chapter 2, the spectrum of the discriminator output noise depends on the IF SNR. Above the FM threshold, the noise has a parabolic spectrum while below the FM threshold the noise spectrum is flat. The relative amounts of noise falling in the different subchannels will therefore depend on the IF SNR.

The use of standard +20 dB per decade preemphasis and -20 dB per decade deem• phasis produces a flat noise spectrum when the IF SNR is above threshold. This is appropriate for a non-fading channel that normally operates above threshold. However, the discriminator output noise will have more power at lower frequencies when the IF SNR fades below threshold. The effect of -20 dB per decade deemphasis in this case is to produce a noise spectrum with relatively more noise power at low frequencies. Fading therefore causes low-frequency subchannels to have more noise and these subchannels will have a higher BER.

To equalize the SNRs of the received subchannels, the powers transmitted on the Chapter 5. Experimental Measurements 50

subchannels can be scaled. This software preemphasis has the effect of increasing the received signal power in the low-frequency subchannels. The amount of software preemphasis was chosen experimentally. A value of -10 dB per decade was chosen because it tended to produce bit errors that were equally dis• tributed among the subchannels. This software preemphasis was applied prior to the transmitter's +20 dB/decade. This same value was used when measuring the SN curves.

5.4.4 Bit Rate

All of the results in this thesis use QPSK (4-QAM) encoding on each subchannel. The phase of each subchannel can be represented as a complex quantity (±l±j). An inverse DFT modulates a block of N bits (N/2 complex values) into an OFDM signal, producing N real samples. These N samples (or bits) are transmitted over the channel in a block of duration N/fs where f3 is the sampling rate. The nominal bit rate is thus fs bps and

the nominal bandwidth is fs/2. However, the channel is bandlimited and not all of the subchannels can be used. This reduces the data rate. The sampling rate (fs) was 8 kHz and, as explained in Section 5.4.2, only subchannels between 1 and 3 kHz were used. The overall data rate was therefore 4 kbps.

5.4.5 Measuring the IF SNR

The RF (and thus IF) SNR was measured with an HP 8558B spectrum analyzer. The noise power measurement involves measuring the noise bandwidths of the spectrum analyzer and receiver IF filters as well as making corrections for the effect of the noise distribution on the spectrum analyzer's envelope detector and logarithmic display, and the effect of the spectrum analyzer noise floor. The details of the RF SNR measurement are presented in Appendix D. Chapter 5. Experimental Measurements 51

5.4.6 Converting from IF SNR to Eb/N0

There are two common ways to specify the quality of the IF signal. The first method is the ratio of the average signal power to the average noise power - the signal-to-noise ratio (SNR). This is the traditional method used for analog communication systems. The second method is the ratio of bit energy to noise power spectral density (E^/No). E&/Nn is often used to compare the energy efficiency of digital communication systems. Both measurements are used in this thesis.

The FM baseband channel is defined by the baseband SN curves as a function of IF

SNR. However, results are given as a function of Eb/N0 when comparing OFDM with other digital modulation schemes.

To convert from SNR to Efc/N0, the ratio of bit rate (R) to IF bandwidth (B) must be

known. The bit energy, Eb (Joules, or Watts/Hz), can be computed as Eb= S/R, where S is the received signal power (Watts) and R is the data rate (bits/second). The noise power spectral density, N0 (Watts/Hz), can be computed as N0= N/B, where N is the power output (Watts) of a filter of noise bandwidth B (Hz). Thus Eb/N0 = SNR x B/R. SNR and E6/N0 are both unitless quantities.

5.4.7 SN Curve Measurement Method

The SN curves were measured by transmitting a broad-bandwidth baseband signal over the channel and measuring the received baseband signal and noise powers. A broadband signal was required for several reasons. First, as shown in Figure 5.7 the IF filter does not have constant gain across its passband4. The power at the input of the discriminator will thus depend on the IF spectrum of the FM signal. Therefore, to make SN curve measurements that will apply to OFDM modulation, a signal with same IF spectrum as an OFDM signal is required. Second, the effect of the transmitter's preemphasis filter and the receiver's deemphasis

4Measurement details are given in Appendix D. Chapter 5. Experimental Measurements 52

Offset from center frequency (kHz)

Figure 5.7: Measured IF filter response. filter will depend on the baseband spectrum of the modulating signal. Third, the effect of the clipping at the transmitter will depend on the probability distribution of the modulating signal. The signal used to measure the SN curves must have the same probability distribution as the OFDM signal in order to properly measure the amount of distortion due to clipping. For these reasons it was necessary to use a signal with the same power spectrum and probability distribution as the OFDM signal. Since the OFDM signal itself has the appropriate spectrum and probability distribution, an OFDM signal was used as the test signal. If there is no fading, there will be no crosstalk between subchannels due to fading and the noise received on each subchannel will be due solely to additive noise and distortion effects such as clipping. The simulation program was modified to make SN curve measurements. The signal Chapter 5. Experimental Measurements 53

power (S) was computed as the square of the mean of the received data values. The noise power was computed as the variance (second central moment) of the received data values. The signal and noise powers were measured over the subchannels that were used (1 to 3 kHz). The program could also display signal and noise power in certain frequency bands so that the distribution in frequency of the signal and noise powers could be measured.

5.4.8 SN Curve Results

The measured SN curves are given in Figure 5.8 along with those of an ideal discrimi• nator. 1 r 10 n 1 1 r T ~\ 1 1 r B = 14900 Hz W = 3290 Hz

O—E3—EJ—B—-B peak/rms (for theoretical) = 3.16 -e—e—e—e—©—e—e—e—e—e—e-

-10 13<~. noise limit due to clipping

c Q — B— B~G—•—• cn in -20

theoretical signal (S) theoretical noise (N) -30 measured signal (S) measured noise (N) —B

-40 -20 -10 —1 1 L- 10 20 30 IF SNR (dB)

Figure 5.8: Theoretical and measured SN curves.

Each point is an average of 64 1024-sample measurements. The measurements are normalized to give a maximum signal (S) level of 0 dB. Chapter 5. Experimental Measurements 54

Doppler rate 20 Hz corresponding vehicle speed 25 km/h at 850 MHz sampling frequency 8 kHz baseband frequencies used 1 kHz to 3 kHz bit rate (during block) (R) 4000 bps samples per block 256, 1024, 4096 samples/block block duration 32,128, 512 ms bits per block 128, 512, 2048 bits/block IF SNR 10,15, 20, 25 dB IF noise bandwidth (W) 14.9 kHz Efc/No 16, 21,26, 31 dB

Table 5.1: Summary of parameter values used in experimental measurements.

5.5 BER and WER Measurements

The purpose of these measurements was to measure the BER and WER of an OFDM/FM system over the non-frequency-selective Rayleigh fading channel. The results are then compared against results obtained using the numerical techniques with the measured SN curves.

5.5.1 BER Results

Table 5.1 summarizes the values of some of the experimental parameters. Figure 5.9 compares the BER results obtained using three methods: Monte-Carlo in• tegration (section 4.3), baseband signal processing simulation (section 4.4), and measure• ments using the experimental channel. The Monte-Carlo integration and the baseband signal processing simulations used the measured SN curves shown in Figure 5.8. The measurements were organized as 12 trials of 60 blocks per trial with 4096 samples per block. For the simulations and the experimental BER measurements, this represents about 1.5 million bits. For the Monte-Carlo integration this represents a fading waveform duration of about 6 minutes. As shown by the 95 percent confidence interval error bars [55,62], there are large uncertainties at low BERs. The three different BER evaluation Chapter 5. Experimental Measurements 55

I.F. SNR (dB)

Figure 5.9: BER Results for fd = 20Hz. The error bars show the 95 percent confidence intervals. The error bars offset to the right are for the Monte Carlo (M.C.) integration results, those to the left are for the simulation results, and those that are centered are for the measured results. methods give results that are within about 1 dB.

5.5.2 Bound Results

Figure 5.10 shows the large- and small-block bounds (section 4.2) on the BER obtained using the parameter values given above. As expected, the results obtained in the previous section lie within the bounds. Chapter 5. Experimental Measurements 56

10

10

10

N=256 I 10

N=1024 o 10 LU m 10

Bound for small N N=4096 Bound for large N 10 M.C. Integration &

10

10 10 15 20 25 I.F. SNR (dB)

Figure 5.10: Bounds on the BER.

5.5.3 Effect of Block Duration and Doppler Rate (Tfd)

The BER performance of OFDM is determined by the time averages of three variables during a block. If the duration of the block is made longer and time scale of the fading is increased by the same amount (the Doppler rate decreased), the time statistics of the av• erages will not change. It would therefore be expected that the OFDM BER performance

is determined by the product, Tfd, of the block duration T and the Doppler rate, fd. This relationship should hold until the Doppler rate is high enough to produce a significant amount of random FM noise (section 5.6).

Figure 5.11 shows the measured and computed BER performance for Doppler rates of 20 and 80 Hz (100 km/h at 850 MHz) and block sizes of 256,1024 and 4096 samples. As expected, the BER performance remains the same if either the block size or the Doppler Chapter 5. Experimental Measurements 57

rate is changed by the same amount.

10

10

10

CD oc o io" LU . 'iF... 55 Tfd=2.6

10

fd=80Hz, N=1024 A--— fd=80Hz, N= 256 & Tfd=10.2 fd=20Hz, N=4096 & — 10 fd=20Hz, N=1024 A-— \

10 10 15 20 _i i i_ 25 LF. SNR (dB)

Figure 5.11: Measured BER for two values of Tfd- Lower limits on error bars are not shown if lower limit is off the graph.

5.5.4 WER Results

Figure 5.12 compares the experimental WER measurements and the WER predicted with the Monte-Carlo integration program and the assumption that the errors occur indepen• dently (see Chapter 3). The two curves agree to within about 1 dB. This indicates that the independent error assumption can be useful in predicting the WER. The WER is always quoted for a word size of 128 bits.

Consider two channels that have the same BER but the errors on one channel tend to occur in bursts while the errors on the other channel occur at random. The channel with Chapter 5. Experimental Measurements 58

o

•| o I I i i i ' I i i i i 1 i i i i L 10 15 20 25 I.F. SNR (dB)

Figure 5.12: Measured and computed WER. bursty errors will have a lower WER than the random error channel because the errors will tend to be concentrated into fewer words. By making blocks longer and thus putting

more words into each block there is less variation in the BERbiock from word to word and the channel errors appear to be more random. Increasing the block length thus increases the WER because the bit errors are more random. However, increasing the block length

also reduces the BER and this will reduce the WER.

At low SNRs the different block sizes have approximately the same BER as shown in

Section 5.5.1. Thus at low SNRs using shorter blocks will produce more bursty errors and

a lower WER than longer blocks. At high SNRs the longer blocks have much lower BERs

than the shorter blocks and this leads to lower WERs for longer blocks. This explains

why the WER curves intersect in Figure 5.12. Chapter 5. Experimental Measurements 59

Test for Independence

The assumption that errors occur independently of each other is often used when evalu• ating the effectiveness of various error correction methods. A Wald-Wolfowitz statistical test for the independence of errors was performed on the bit error pattern to test the independence of errors [62,63,64,65]. This test is based on the expected number of runs

(continuous sequences of bits with or without errors) for a given bit error rate. For a large number of runs the distribution of the number of runs (R) tends to a Gaussian with mean given by [63]:

E[R] = 1+*™ (5.1) n and a variance given by

2 2n1n2(2n1n2 - n) . . ffR = n\n - 1) (5-2) where nx is the number of bits with errors, n2 is the number of bits without errors and n is the total number of bits. The test for independence on the OFDM bit error patterns was done by normalizing the number of runs in each OFDM block by using the above expression for the mean and variance and the measured values of n\ and n2 for each block. This normalized count of the number of runs was averaged over several hundred blocks and was repeated for several block sizes and SNRs. Only blocks with 10 or more runs were considered so that the number of runs would be approximately normally distributed. This average normalized number of runs was significantly (at the 0.95 confidence level) negative (less than zero) except for the two tests for SNRs of 25 dB for block sizes of 1024 and 4096 samples (the Doppler rate was 20 Hz). These results indicate that there were fewer runs than would have been expected if the errors had occurred independently. Chapter 5. Experimental Measurements 60

5.6 Random FM

Random FM adds a noise component that increases with the Doppler rate and is indepen• dent of the IF SNR. At high Doppler rates the random FM noise power might limit the achievable baseband SNR. Available theoretical analyses of the baseband noise produced by random FM [3,48] cannot be used since they do not take into account the effect of deemphasis. The baseband SNR at a high (nominally 75 dB) IF SNR was measured while the carrier was fading to see if random FM had a significant effect. The level of the modulating signal was reduced so that the noise due to random FM could be measured above the noise due to clipping. The modulating signal level was reduced by 3.5 dB so that the limiting baseband SNR increased to 24.2 dB. Figure 5.13 shows the measured random FM noise power as a function of Doppler rate. -16 i i i i i i i i

CD 8. noise level due to clipping at normal modulation level -18 'in o v— -20 £ CQ V CD o CL "o

E o •o noise level due to clipping at reduced modulation level c

-26 20 40 60 80 100 120 Doppler frequency (Hz)

Figure 5.13: Random FM noise power versus Doppler rate.

At a Doppler rate of 120 Hz (over 140 km/h at 900 MHz) the random FM noise reduced Chapter 5. Experimental Measurements 61

the baseband SNR to about 20.5 dB. Since the limiting baseband SNR due to clipping during the BER measurements was 17.5 dB, random FM noise should not be a significant problem for OFDM/FM with QPSK (4-QAM) subchannel modulation.

5.7 Probability Distribution of the Baseband Noise

An assumption made in Chapter 3 is that the crosstalk interference between subchan• nels due to fading is normally distributed. The distribution of this crosstalk noise was measured to confirm this assumption. A simulation was performed in which a block of 4096 samples was sent over the fading channel but no noise was added. The probability distribution (a histogram) of the noise due to the crosstalk interference was measured and normalized by dividing the measured noise values by the standard deviation. This normalized distribution is plotted in Figure 5.14. This figure also shows the normal probability distribution (unit variance and zero mean). The measured distribution ap• proximates the normal distribution.

As described in 2, the probability distribution of the baseband noise output of an FM discriminator is not Gaussian. However, the averaging done by the DFT in the OFDM demodulation process produces noise in the frequency domain whose distribution is approximately normal. A second measurement of the probability distribution of the noise after the OFDM demodulation was made to confirm this assumption. A second simulation was done in which there was no fading but impulse noise was added to the OFDM signal. The impulse noise used was composed of noise samples of the same level with an equal probability (0.05) of occurrence at each sample (see Section 4.5.3). This impulse noise waveform is not meant to simulate a realistic source of impulse noise, but only to verify that the averaging of the baseband noise by the OFDM demodulation process produces noise with a distribution that is approximately Gaussian. The measured distribution was normalized as before and is also shown in Figure 5.14. Again, the measured distribution approximates the Gaussian distribution and confirms the Gaussian Chapter 5. Experimental Measurements 62

assumption.

Figure 5.14: Example of probability density of the noise in the frequency domain.

5.8 Example of Received Signal Values

Figure 5.15 shows plots of the received complex data values for four IF SNRs. The plots show the effect of the additive and crosstalk noise. The noise distribution is circularly symmetric as would be expected from two independent and equal-power components.

5.9 Conclusions

The measurements described in this chapter were designed to measure the SN curves of a typical NBFM radio channel, to verify experimentally the BER and WER results ob• tained through numerical methods, and to check for possible unforeseen implementation problems. Chapter 5. Experimental Measurements 63

Equipment and techniques were developed to measure the SN curves, and the BER and WER performance of OFDM/FM over a non-frequency-selective Rayleigh-fading chan• nel. The experimental work demonstrated the need to consider the practical limitations of FM transmitters such as clipping, bandwidth restrictions, preemphasis/deemphasis, and the baseband noise spectrum. Although bit errors are not independent, it was shown that use of the independent error assumption gives a good approximation to the measured WER. It was also shown that random FM should not be a significant problem.

Performance measurements were made only on one transmitter and receiver combi• nation. Other units or models may have different performance. NBFM equipment that has been modified or designed for digital transmission by modifying the audio processing stages should have better performance. Thus, although the experimental measurements do not show the range of performance that can be achieved with OFDM/FM, the experi• mental results help to verify the analysis and demonstrate the feasibility of OFDM/FM. Chapter 5. Experimental Measurements 64

Figure 5.15: Example of received data values. Chapter 6

Improving Performance

6.1 Introduction

This chapter examines four methods that might be used to improve the performance of OFDM/FM. The first method is switching diversity, a type of space diversity. Switching diversity is widely used but it works especially well with OFDM because OFDM is resistant to the transients caused by switching between antennas. The second method, forward error correction (FEC) coding, is also widely used. It is shown that the distribution of the number of errors in an FEC code word can be predicted by assuming that bit errors occur independently within each OFDM block. The BER performance of two BCH and Reed-Solomon rate | codes are also given. Squelch and AGC were described in Chapter 3. In this chapter the BER bound com• putations are used to find the optimum squelch and AGC thresholds for large block sizes. It is shown in this chapter that neither technique significantly improves the performance of the OFDM/FM system studied. The final section describes a novel signal processing technique, decision feedback cor• rection (DFC), that reduces the crosstalk between the OFDM subchannels caused by fading. DFC greatly improves the performance of OFDM/FM when large block sizes are used.

65 Chapter 6. Improving Performance 66

6.2 Switching Diversity

Space diversity is used on many fading channels to reduce the depth and duration of fades. Space diversity involves using two or more antennas spaced far enough apart (more than about one-half wavelength for mobile receivers) so that the fading at the antennas is not highly correlated. When one antenna is in a fade another one may still be receiving a strong signal. The severity of the fading can be reduced by adding the signals from the different antennas or by switching between them. Time diversity and frequency diversity are also common, but space diversity has the advantages of being insensitive to the fading rate and of not requiring extra bandwidth.

There are several methods of combining the signals from the different antennas [3]. A common and inexpensive type of space diversity is switching diversity. Switching diversity involves switching between antennas whenever the received signal level on the antenna in use drops below a specified threshold. Switching diversity is less expensive to implement than other types of space diversity because only one receiver is required. Figure 6.1 shows a block diagram of a switching diversity receiver.

antenna received select baseband signal signal Data strength Switching Recovery Receiver Decision Circuit Circuit

Figure 6.1: Switching diversity receiver.

When the receiver switches between antennas the received signal undergoes a phase shift due to the difference in propagation delay between the two antennas. This phase Chapter 6. Improving Performance 67

discontinuity creates a noise impulse in the recovered baseband signal of an FM receiver. Switching diversity is well suited to a mobile radio system using OFDM since OFDM can average out this impulsive noise. The effect of using switching diversity on the BER performance of OFDM/FM was examined by simulating a switching diversity receiver. Two uncorrelated fading waveforms were generated and the receiver switched between the signals when the signal level on the current antenna dropped below a threshold. The effect of switching between antennas was simulated by blanking out one sample each time the antenna was switched. This is reasonable because a receiver could be designed to blank (set to zero) the audio output during antenna switching. Therefore zero is the worst-case amplitude of the noise impulse. Since solid-state switches can switch between antennas in a fraction of a microsecond [66], the RF switching time can be made negligible. As a result, the duration of the phase discontinuity (and thus of the noise impulse) after the IF filter will be determined by the IF bandwidth, typically 15 kHz. A single sample (125 us) is thus likely to be the worst-case duration for the switching discontinuity. The level of the switching threshold is a compromise between the degradation caused by excessive switching if the threshold is too high and the degradation caused by a low signal level if the threshold is too low. In general, the optimum switching threshold is a function of the IF SNR and the number of diversity branches. For FSK and two- branch diversity a threshold of between 18 dB (13 dB IF SNR), and 20 dB (20 dB IF SNR) below the mean signal power was found to give best performance [67]. However, since OFDM/FM is more tolerant of antenna switching, the optimum threshold might be expected to be somewhat higher. A threshold set at 10 dB below the mean was used. The switch stays on each antenna for a minimum of four samples, before switching. This is done to avoid continuous switching when both signals are below threshold. Figure 6.2 shows the BER performance without diversity and with switching diversity for the case of two antennas. Chapter 6. Improving Performance 68

-1

10 E 1 -I 1 1 1 1 1 -1 1 1 1 r

1 •j o ' I i i i I ' i i i I L i i i L_ 10 15 20 25 I.F. SNR (dB)

Figure 6.2: BER performance with and without switching diversity, fd = 20 Hz.

Switching diversity also improves the BER performance of FSK systems but the phase transient due to switching "causes a high error probability for a bit received during a switch" [67]. As shown by the results in Figure 6.2, OFDM/FM does not suffer from this problem. For a 20 Hz Doppler rate and a switching threshold of 10 dB below the mean, equation 2.4 gives a level crossing rate of about 14 Hz which corresponds to one switch every 280 bits at the 4000 bps bit rate. A high bit error probability at each switch would have resulted in a much higher BER for the OFDM/FM system.

6.3 Forward Error Correction Coding

Forward error correction (FEC) coding is used in many digital communication systems. FEC coding adds parity bits to the data to allow the receiver to correct certain error Chapter 6. Improving Performance 69

patterns introduced by the channel. FEC has been used for mobile radio data communi• cation because the probability that errors will occur in a long data transmission is quite high [68].

6.3.1 Testing the Independent Error Assumption

To predict the performance of an FEC block code it is helpful to know the distribution of the number of bit errors per code word. In Chapter 5 it was shown that the independent error assumption could be used to predict the WER for OFDM/FM. In this section it is shown that the independent error assumption can be used to predict the distribution of the number of errors per word and thus the performance of an FEC block code. If bit errors in a code word of k bits occur independently with probability p, the probability of e errors, Pfc(e), is binomially distributed:

(6.1)

It is necessary to average over the block BERs to predict the average distribution because the BER (p) will be different for each block. This was done by averaging Pfc(e) using p's generated with the Monte-Carlo integration program. A simulation was then run and the actual distribution of the number of errors per word was measured to verify the results obtained with the binomial distribution prediction. The simulation program generated a file of error-free run lengths and a second program then computed the distribution of the number of errors in each word. Figures 6.3, 6.4 and 6.5 compare the measured and computed distributions. These graphs shows the results for block sizes of 256, 1024, and 4096 samples (normalized durations, Tfj, of 0.64, 2.56 and 10.24). In each case the bits in the block were split into four words. The simulation length was 1,474,560 bits for each OFDM block size. The distributions obtained from the simulations are very close to those obtained by assuming independent errors within a block. Chapter 6. Improving Performance 70

Number of Bits Corrected ° 0 5 10 15 20 25

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Fraction of Bits in Word Corrected

Figure 6.3: WER as function of corrected errors for block size of 256 samples.

6.3.2 BER Performance of Block Codes

Among the most popular FEC block codes are the binary Bose-Chaudhuri-Hocquenghem (BCH) and Reed-Solomon (RS) codes [69]. A binary BCH block code uses codewords of

2m - 1 bits. To allow correction of up to t errors, at most mt of these bits are used for parity and the remainder can be used for data. A Reed-Solomon (RS) code uses codewords of 2m - 1 m-bit digits. To allow correction of up to t digits, 2t of the digits are used for parity. RS codes are often used for burst error channels because they can correct any number of bit errors in each digit. The effect of using FEC on OFDM was tested using the equivalent baseband channel simulation. For simplicity, the received data bits were corrected by comparing them to the transmitted data instead of implementing the actual coders and decoders. This approach assumes that when an uncorrectable error is detected no error correction is attempted Chapter 6. Improving Performance 71

Number of Bits Corrected 10 20 30 40 50 60 70 i i 11 i 11 1111111 i 111111 i i i i i 1111iii 11 i 111 i 11 i 111111ii111 11 111 i i II i i i1111i111 i 11 | 10

MC Integration 10 Simulation

N=1024 (Tfd=2.56) CD Word Size: 128 bits <5 DC -2 10 2 k_ LU "5 o 10

10 ••noaaooD •••13 ••••••••

10 ' i i i i i i i i t i i i 0.1 0.2 0.3 0.4 0.5 Fraction of Bits in Word Corrected

Figure 6.4: WER as function of corrected errors for block size of 1024 samples. and the decoder outputs the bits as they were received. Figure 6.6 shows the effect on the BER performance of using rate | RS (burst-error)

and BCH (random-error) codes with OFDM block sizes of 1024 samples (Tfd= 2.56, 512

bits) and 4096 samples (Tfd= 10.24, 2048 bits). For a block size of 4096 the BCH code has a word size of 2047 bits and uses 1023 parity bits to correct up to 93 bit errors1. The RS code has a word size of 255 (8-bit) bytes (2040 bits) and uses 128 parity bytes to correct up to 64 bytes containing errors. Both codes give approximately the same performance. They reduce the required SNR by about

2 3 -4 2 dB at a BER of IO" , 3 dB at IO" , and 4 dB at 10 . The improvement in E6/N0 (the coding gain) is 3 dB worse than these values because the coding approximately doubles the energy per information bit.

1The actual BCH code that corrects up to 93 errors probably requires fewer parity bits. Chapter 6. Improving Performance 72

Number of Bits Corrected 0 20 40 60 80 100 120 140

p

0 0.1 0.2 Fraction of Bits in Word Corrected

Figure 6.5: WER as function of corrected errors for block size of 4096 samples.

For a block size of 1024 the BCH code has a word size of 511 bits and uses 252 parity bits to correct up to 28 bit errors2. The RS code has a word size of 63 6-bit digits (378 bits) and uses 32 parity digits to correct up to 16 digits containing errors. Again, both codes give approximately the same performance. They reduce the required SNR by about

2 dB at a BER of 10~2, 2.5 dB at IO"3, and 3 dB at IO"4. As before, the coding gain is about 3 dB less. Block interleaving is a method used on burst-error channels to produce a more even distribution of errors within a block. The block is logically divided into a number of sub-blocks. Instead of transmitting the bits in the block sequentially, the first bit of each of sub-block is transmitted, followed by the second bit of each sub-block, and so on. This procedure helps to spread error bursts among the sub-blocks. Figure 6.6 shows

2The actual BCH code that corrects 31 errors requires slightly fewer (234) parity bits. Chapter 6. Improving Performance 73 that block interleaving increases the corrected bit error rate of the RS code by a very small amount. This is what would be expected if the errors were already approximately randomly distributed within the OFDM block. The sub-block length was chosen to be the smallest integer greater than the square root of the number of bits in the code word.

10 i—1—1—1—1—r

No FEC B— 10 BCH A- RS e- RS with interleaving O-

10 CD IS or -4 o 10 LU m s>. N=1024 10

-6 10 N=4096 E

10 10 15 20 25 I.F. SNR (dB)

Figure 6.6: BER performance with FEC coding.

6.4 Automatic Gain Control

The purpose of an automatic gain control (AGC) circuit is to increase the receiver's gain during fades in order to keep the receiver output level constant. AGC is implemented as an amplifier whose gain is controlled by the received signal level. AGC is not normally required by FM receivers because, as shown by the SN curves (Figure 5.8, p. 53), the output signal level is constant when the IF SNR is above threshold. However, AGC is required for SSB reception of fading signals to reduce the distortion of the baseband Chapter 6. Improving Performance 74

signal [21,27]. As described in Chapter 3, amplitude variations in the received baseband OFDM signal cause crosstalk between the subchannels. The use of AGC might reduce this crosstalk. A problem with using AGC on a fading channel is that the receiver's output noise level increases as the AGC amplifier gain increases to compensate for fading. OFDM averages the noise power received during the block and thus even a short increase in noise power can result in a significant contribution to the average noise power. The gain of the AGC amplifier must therefore be limited to prevent large noise contributions when the received signal undergoes deep fades. This gain limit reduces the baseband noise output during deep fades but increases the interference between subchannels because of limited correction of the fading. This topic has been studied for the OFDM/SSB channel [1]. The AGC threshold is the SNR below which the AGC gain is fixed. The bounds for large and small block sizes (see Chapter 4) were computed for various AGC thresholds to investigate the effect of the threshold on the BER. The results, shown in Figure 6.7, indicate that AGC would not significantly improve the BER performance of this system. The BER performance of the OFDM/FM system with AGC was evaluated with simu• lations. AGC thresholds of 0 dB SNR and 11 dB SNR were tested. The results, shown in Figure 6.8, show a degradation of several dB with an AGC threshold at 0 dB SNR and negligible improvement with a threshold at 11 dB SNR.

6.5 Squelch

The receiver's squelch circuit is designed to shut off the audio output when no signal is being received. Squelch is normally used as a convenience for the user and to reduce power consumption. Squelch reduces the average noise power output of the receiver because it removes Chapter 6. Improving Performance 75

- I I I 1 I I I I | I 1 I I I I I I | I I I I I I I I I | I I I i i i i i i 1 i i - -1 - - 10 — 10 dB \ ^ " — 10dB - -2 15 dB .

10 - 20 dB

-3 25 dB 10 - " \^ ^ — 15dB _

-4 10 -

-5 10 — —

-6 20 dB - 10 -

-7 10 - \ Small N Bound — \ Large N Bound -8 10

-9 10 25 dB

i i i l i i i i i i i , i l i i i Ill -40 -30 -20 -10 0 AGC Threshold Relative to Mean Signal Level (dB)

Figure 6.7: BER bounds as a function of AGC threshold. those portions of the output that are most noisy. Unfortunately, the additional distortion due to eliminating the signal also increases the crosstalk interference between subchan• nels. Squelch could improve the performance of OFDM if the reduction in noise power could offset the increase in crosstalk interference. The squelch threshold is the IF SNR below which the receiver output is set to zero. The bounds for large and small block sizes were evaluated for various squelch thresholds to investigate the effect of the threshold on the BER. The results, shown in Figure 6.9, indicate that squelch with a threshold of about 0 dB IF SNR might produce a small improvement in BER performance. Figure 6.10 shows the BER results of a simulation using a squelch threshold at 0 dB SNR. As predicted by the bounds on the BER for large block sizes, the use of squelch at 0 dB SNR provides a small improvement. Chapter 6. Improving Performance 76

10 15 20' 25 I.F. SNR (dB)

Figure 6.8: BER performance with AGC.

6.6 Decision Feedback Correction

As explained in Chapter 3, fading causes interference between the OFDM subchannels. A new method has been developed to reduce this interference. The method uses a correction signal that is generated from the received data - a process similar to decision feedback equalization - and is therefore called decision feedback correction (DFC).

6.6.1 Description of the Method

Figure 6.11 shows a flowchart of the signal processing steps while Figure 6.12 gives an example of the waveforms at the different steps of the DFC processing. The OFDM modulator converts the original data (1, Figure 6.12) into an OFDM signal (2). The envelope of the received signal (3) fades and occasionally falls below a DFC threshold. The first step in the DFC process is to make an initial estimate of the transmitted data Chapter 6. Improving Performance 77

Squelch Threshold Relative to Mean Signal Level (dB)

Figure 6.9: BER bounds as a function of squelch threshold.

(5) using the faded received signal (4). This estimate of the transmitted data may contain errors due to the additive noise and the fading-induced crosstalk interference between the subchannels. An OFDM modulator (inverse DFT) can then be used to produce an estimate of the transmitted signal (6) from the initial data estimate (5). Portions of this estimate of the transmitted signal (7) can then be substituted into the faded portions of the received signal to form a composite signal (8). The new composite signal can be used to make another estimate of the data. Since the composite signal has fewer fades, there should be less crosstalk interference and this should result in a second data estimate with fewer errors.

If this second data estimate has fewer errors, then a more accurate estimate of the lost (faded) signal samples can be made. The preceding steps are then repeated until

• there are no more errors (determined by an error detecting code embedded within Chapter 6. Improving Performance 78

-1

I.F. SNR (dB)

Figure 6.10: BER performance with squelch.

the block); or

• until there are no changes in the data estimate between iterations, indicating that the method has converged to an incorrect solution; or

• until a limit on the number of iterations is reached.

Unfortunately, this method does not always converge to the correct solution. The reason is that errors in the estimates of the data tend to be self-reinforcing. Errors in the data estimate produce a substitution signal that tends to produce that same erroneous estimate when demodulated. The errors corrected at each iteration must produce a new substitution signal that results in a different data estimate on the next iteration or the data estimate has converged. Chapter 6. Improving Performance 79

make data estimate (demodulate)

check for errors

^no errors or iteration^- true < limit exceeded

make signal estimate end (modulate) 1 substitute new signal estimate into faded portion of received signal i make data estimate (demodulate) I check for errors

Figure 6.11: Flowchart for DFC processing.

Measuring the IF SNR

DFC, squelch, and AGC require that the received signal level or the IF SNR be known. There are several ways of measuring the signal level or measuring the IF SNR. Typical squelch circuits measure the IF SNR indirectly by measuring the decrease in baseband noise power above audio frequencies as the IF SNR increases (see Chapter 2). Cellular radio systems use the envelope of received signal to measure the received signal strength [70]. Systems that use SSB modulation [1,24] use a pilot carrier to estimate the signal magnitude and phase.

A measurement of the signal level is not required for DFC, simply a "fade/no-fade" indication. Therefore DFC should be insensitive to small errors in the estimate of the Chapter 6. Improving Performance 80

1 5

Figure 6.12: Sample signals during DFC processing. received signal level. Also, DFC does not involve increasing the receiver gain (as does AGC) and so avoids the problems associated with amplifying noise.

6.6.2 Simulation Results

Figure 6.13 shows simulation BER results with and without DFC. In these simulations a maximum of eleven iterations were allowed and the DFC threshold was 4 dB SNR. These results show that DFC can significantly improve the performance of OFDM over a fading channel. At a BER of 10-2 the improvement due to using this method is 2 to 3 dB. At a

BER of 10-3, the improvement is between 3 and 5 dB. The performance improvement is greater for longer blocks. These results also show that error propagation due to DFC is not a significant effect. Complete results are not given for the longer blocks because the error rates were too small to be measured. The number of iterations required for the method to converge to a solution was also measured. Figure 6.14 shows the distribution of the number of iterations. These results Chapter 6. Improving Performance 81

10

10

10

CD N=256

to 10 O k_ N=256 LU N=1024 CO 10

with DFC 10 no DFC B N=4096

-7 10 10 15 20 ' ' u 25 I.F. SNR (dB)

Figure 6.13: BER performance with DFC. show that there is little to be gained by allowing more than about fiveiterations . Exam• ination of the number of errors remaining after each iteration showed that the number of errors corrected per iteration decreases very quickly. Chapter 6. Improving Performance

N=256 N=1024 N=4096 ' I ' i I i 1 1 1 I I ' I < 1 1 1 1 1 ' 1 I 1 O o 25 dB o A A 20 dB A 0.9 15dB o 10dB • 0.8 -O

0.7 O in •og 0.6 m "5 0.5 -• <= o • t5 0.4 CB 1i1— • 0.3 D

0.2 O • 0.1 - 8 o • O A O n 0

I.I.I, ,1,1, 1 i I i I , I , I 1 , 0 2 4 6 8 10 12 0 2 4 6 8 10 12 0 2 4 6 8 10 12 Number of Iterations

Figure 6.14: Distribution of the number of DFC iterations. Based on simulations of 2.9 million samples for each block size. Chapter 7

System Design

7.1 Introduction

The purpose of this research was to examine the performance of OFDM over mobile radio FM channels rather than to design an OFDM/FM system. However, this chapter briefly examines some possible implementation problems and how they might be solved. Many implementation decisions will involve cost/performance trade-offs that will depend on the application.

The first section deals with the choice of block size. This will be affected by the traffic statistics and system delay specifications. Other sections deal with sampling timing, phase synchronization, and equalization. As in serial modulation techniques, differential coding can be used to simplify synchronization requirements. The final sections deal with hardware requirements. These are comparable to those of other high-speed baseband modems.

7.2 Block Size

Longer OFDM blocks give better performance because more fades are averaged. However, long OFDM blocks introduce correspondingly long delays and may be inefficient if there is little information to be transmitted per block. The block size (or sizes) must therefore be tailored to the traffic statistics and transmission delay requirements. Continuous broadcast (e.g. base-to-mobile) systems can combine messages for several receivers into one OFDM block. In this case the block size can be made as large as delay specifications will allow. In the mobile-to-base direction the OFDM block typically has

83 Chapter 7. System Design 84

only one message and it may be inefficient to make the OFDM block size much larger than the average message size. However, typical packet sizes require reasonably long OFDM block durations. For example, a popular mobile radio data communication system uses packets of between 294 and 3388 bits with a typical message of 735 bits [68]. A 735-bit packet would require an OFDM block length of over 1470 samples for the experimental 4000 bps system described in Chapter 5. An OFDM system could use a number of different block sizes with the block size being determined from the signal duration as measured at the receiver. Although FFT computations are most efficient for block sizes of 2", fast algorithms are available for other block sizes. A DFT can be computed for any block size but it may not be practical for long block sizes because it requires N multiplication and addition operations per sample.

7.3 Reducing Dependence on Vehicle Speed

The Doppler rate and the performance of OFDM decrease as the vehicle slows down. This is also a problem for any time- whose performance depends on the fading rate. One proposal is to artificially increase the fading rate by continuously switching between several antennas (spaced sufficiently far apart) whenever the vehicle speed falls below a certain speed [71]. This can be considered a simple form of switched diversity in which the antennas are switched at random. At UHF frequencies it is practical to mount several antennas around a cylinder with a diameter of a half-wavelength [71].

7.4 Timing, Synchronization and Equalization

Data recovery from the baseband OFDM/FM signal requires three types of synchroniza• tion:

• sampling timing to select a block of N samples to demodulate, Chapter 7. System Design 85

• phase synchronization to estimate the delay between the transmitter and receiver

sampling clocks,

• and equalization to compensate for the frequency-dependent linear distortion (phase and amplitude changes) of the receiver and transmitter circuits.

7.4.1 Sampling Timing

Figure 7.1 shows the three parts of the OFDM block transmission.

( timing OFDM guard error block time margin (N samples)

time

Figure 7.1: OFDM block transmission timing.

The first part, the guard time, allows transients to settle before sampling begins. Since the signal is periodic with a period of N samples, the samples in the guard time are copied from the trailing portion of the block. Shaping of the transmitted signal with a window function (e.g. a Hamming window) during the guard time allows transients to settle more quickly and can reduce the required guard time [1], Although the guard time reduces the system throughput, the effect of guard time on system throughput is small for the expected block lengths. For example, the Gandalf mo• dem uses a 4 ms guard time for the telephone channel of approximately 3 kHz bandwidth [39]. Since the duration of the OFDM block will typically be more than 100 milliseconds, only a few percent of the channel time will be lost to the guard time.

The receiver must detect the start of block and then take N samples immediately after the guard time. However, if the receiver cannot accurately determine the start Chapter 7. System Design 86

of the transmission it may start sampling late. The second part of the OFDM block transmission is an un-windowed extension of the guard time that allows for delays in timing the start of the sampling. Longer allowances for timing errors means that the receiver need not be as accurate in detecting the start of the block. Shorter extensions give higher system throughput. Since the FFT is periodic, any N contiguous samples may be used to demodulate the data. The effect of a delay at the start of the sampling is a phase shift at each subchannel proportional to the frequency and the delay. The phase shifts can be estimated and subtracted (see Section 7.4.2). Transmitting blocks within "slots" reduces the timing problem since the receiver can start sampling at the start of every slot and can ignore the block of samples if no signal is detected during the slot. The program used to make the experimental measurements (Chapter 5) allows a variable amount of extension before and after the OFDM block samples. This extension can be up to 32k samples (4 seconds). These long extensions allowed the average signal levels to be measured on meters. In the experimental BER measurements guard times of 2000 samples were used to eliminate any possible effect on the performance. The guard time samples were not windowed.

7.4.2 Phase Synchronization

A delay between transmitter and receiver will result in a phase shift at each subchannel proportional to the delay and the subchannel's frequency. This delay must be estimated and used to correct the phase of each subchannel. The delay can be estimated from the phase errors of the demodulated data values since the phase errors should all increase in proportion to the subchannel frequency. In the experimental work, the delay between the D/A and A/D sampling instants was exactly the same for each block. Correction for this fixed delay was included as part of Chapter 7. System Design 87

equalization, described in the following section.

7.4.3 Equalization

The various circuits (amplifiers, filters, modulators, etc.) that process the baseband signal at the transmitter and receiver will introduce some linear distortion. The amplitude and phase changes at each subchannel (the baseband channel's transfer function) must be estimated and corrected to allow accurate data recovery.

In some systems this linear distortion can be measured and the measurement can then be used to correct it. For example, dial-up telephone modems use a training sequence at the start of each call to measure the channel characteristics.

The typical mobile radio system involves one that communicates with many mobile stations. Each mobile receiver and transmitter may have a different transfer function. This makes equalization difficult. Each receiver could do its own training in the base-to-mobile direction but the base station might need to store one set of correction characteristics for each mobile unit. An alternative would be differential coding, described in section 7.4.4. In the experimental measurements the phase and amplitude changes on each sub• channel were measured and used to correct the received data values. A training sequence of pseudo-random data was used to measure the channel phase and amplitude character• istics. This measurement was done at high RF SNR and without fading to increase the accuracy of the measurement. The measured phase shifts and gains at each subchannel were used to correct all subsequent received values as follows: if the transmitted value at one frequency was X and the received value at that frequency is Y, each value received subsequently at that frequency was multiplied by the (complex) value X/Y to undo the channel's phase and amplitude changes.

Figure 7.2 shows the measured phase and amplitude characteristics for the hardware prototype described in Chapter 5. Chapter 7. System Design 88

0 1000 2000 3000 4000 Frequency (Hz)

Figure 7.2: Measured baseband channel transfer function.

7.4.4 Differential Coding

Differential coding for OFDM was first proposed as a way to avoid equalization [36]. If the phase shift between adjacent subchannels is small, the data can be coded as the dif• ference in phase between the subchannel carriers instead of their absolute phase. For example, the lowest subchannel is taken to be a fixed reference and the data on the other subchannels are encoded differentially from the next lower subchannel. The measure• ments in Figure 7.2 show that after phase synchronization the assumption of small phase differences between adjacent subchannels is quite good. Differential coding simplifies re• ceiver design by eliminating the need for equalization but degrades performance due to error propagation. Chapter 7. System Design 89

7.5 Hardware Cost and Complexity

Inexpensive OFDM modems can be built with DSP microprocessors. This section gives examples of the complexity and cost of the DSP hardware required to implement a base• band OFDM modem.

The first commercial OFDM modem was the Gandalf SuperModem [38,40]. This 9600 bps telephone modem used OFDM modulation with 52 subchannels. The signal process• ing was performed by a custom processor built with medium scale integration transistor- transistor logic (TTL) circuits [39]. This modem was sold in the late 1970's and early 1980's for about $4000 [40].

A more recent example is the Telebit Trailblazer [42]. This modem uses DAMQAM (Dynamically Adaptive Multicarrier Quadrature Amplitude Modulation). DAMQAM is OFDM with up to 511 subchannels and using 2, 4, or 6 bits per subchannel depending on the subchannel quality. The aggregate bit rate is between 10 and 17 kbps. The hardware includes a Motorola 68000 microprocessor and a Texas Instruments TMS32010 DSP microprocessor. The retail price in 1988 was $1400; approximately the same as CCITT V.32 (QAM) 9600 bps modems [72]. The DSP hardware is a small fraction of the cost of an OFDM modem. For example, the quantity price of a TMS320C10 is under $181. Hirosaki has compared the complexity (in terms of multiplications per sample) of

OQAM2 and conventional serial QAM with equalization [73]. OQAM was found to be less complex for systems requiring spectral efficiencies greater than about 1.9 bits/s/Hz. These comparisons show that the cost and complexity of the signal processing hard• ware required for OFDM is comparable to that required for conventional high speed serial transmission over bandlimited channels.

"^Price quote for 1000's quantities from Future Electronics, April 1989. 2OQAM is OFDM combined with frequency-domain equalization that allows OFDM blocks to be transmitted without guard time delays between blocks. Chapter 7. System Design 90

7.6 A/D and D/A Quantization

Figure 7.3 shows the BER performance results from a simulation of the OFDM/FM system described in Chapter 5 using 16, 8, 4, and 2 bits of D/A (transmitter) and A/D (receiver) quantization with a quantization range of 20 times the rms value. The theoretically achievable SNR for Gaussian-distributed signals with a quantization range of four times the rms value is given by 66 - 1.24 dB where b is the number of bits of quantization [74]. Because the baseband SNR is limited to less than 18 dB, even inexpensive 8-bit D/As and A/Ds are sufficient for this system. The effect of quantization on OFDM systems (not including clipping or fading) has been studied by Ingram [75].

-1 10 F

N=4096

-7 10 10 15 20 25 I.F. SNR (dB)

Figure 7.3: Effect of quantization on BER. Chapter 7. System Design 91

7.7 Sampling Frequency Error and Jitter

An error in the sampling frequency shifts the effective frequencies of the subchannels. The frequencies of the subchannels are no longer orthogonal and this results in crosstalk interference between the subchannels. Jitter in the sampling clock varies the position of the sampling instant and this causes an effect similar to additive noise. Neither of these effects is likely to be a significant problem because inexpensive, accurate, and stable crystal-controlled sampling clocks are available. Chapter 8

Comparisons With Other Modulation Methods

8.1 Introduction

This chapter describes alternative modulation techniques for data transmission over mo• bile radio and compares them with OFDM/FM. OFDM/FM is compared with OFDM/SSB and also with two bandwidth-efficient serial modulation techniques: GMSK (Gaussian- filtered Minimum-Shift Keying) and GTFM (Generalized Tamed FM). After a brief de• scription of the other modulation techniques, their performances are compared on the basis of:

• power efficiency (BER versus Eb/N0),

• bandwidth efficiency (bps/Hz),

• delay, and

• implementation complexity.

8.1.1 Description of Other Modulation Techniques

GTFM and GMSK

There are a large number of possible digital modulation techniques available for mo• bile radio data transmission [76,77]. GTFM and GMSK are two of the most promising bandwidth-efficient modulation techniques [17,18]. Both GMSK and GTFM are forms of MSK (FSK with a modulation index of 0.5) in which the modulating signal is shaped by filtering to reduce the RF bandwidth. GMSK uses a Gaussian filter[16]. GTFM uses

92 Chapter 8. Comparisons With Other Modulation Methods 93

a 3-bit-period transversal filter followed by a raised-cosine low-pass filter[18]. GMSK and GTFM signals have a constant envelope and can be demodulated with coherent, differential, or discriminator detectors[76].

OFDM/SSB

The notation OFDM/SSB is used in this thesis for the transmission of the OFDM signal by directly translating the baseband OFDM signal to the carrier frequency as described in [1].

8.2 Power Efficiency

8.2.1 GTFM

The Eb/N0 performance of one GTFM implementation is shown in Figure 8.1 [18, Figure 18]. This system used GTFM parameters B=0.62 (transversal filter's center tap coeffi• cient) and r=0.36 (raised-cosine low-pass filter roll-off). The receiver used a discriminator followed by a maximum-likelihood sequence estimator (MLSE) to decode the three-level signal produced by filtering. The bit rate is 16 kbps and the -3 dB filter bandwidth is about 16 kHz (noise bandwidth not given). Since B/R « 1, the SNR is numerically equal to E6/N0. The results shown in Figure 8.1 are from simulations of operation over a Rayleigh fading channel1. Experimental results in the non-fading case are about 2 dB worse than the (non-fading) simulation results.

8.2.2 GMSK

Figure 8.1 also shows the experimental Eb/N0 performance for a 16 kbps GMSK system given in [16] with B^T (product of filter -3 dB bandwidth and bit period) of 0.25. An

'Random FM produces an error floor at a BER of approximately 2xl0-5 for a Doppler rate of 25 Hz, about lxlO-4 for a Doppler rate of 50 Hz, and about 3xl0-4 for 100 Hz. Chapter 8. Comparisons With Other Modulation Methods 94

-i 1 1 r "T 1 1 r

OFDM/SSB, Tfd= 2.6 10 OFDM/FM, Tfd=10.2 A OFDM/FM, Tfd=2.6 — GTFM — GMSK —

10

(5 tr o LU m 10

-4 10

10 10 15 20 25 30 35 Eb/No (dB)

Figure 8.1: Eb/N0 performance of various modulation methods.

IF filter with a 16 kHz noise bandwidth is assumed. The demodulator was a (two bit) differential detector.

In [17] another GMSK system with BbT =0.25 is described. This system uses a coherent receiver and the experimental results are about 2 to 3 dB better than those in [16]. These serial transmission methods when used with non-coherent demodulation, all have approximately the same BER performance as non-coherent FSK. Their BER perfor• mance in Rayleigh fading can be approximated by

1 BER = (8.1) 2 + E6/N0- Chapter 8. Comparisons With Other Modulation Methods 95

8.2.3 OFDM/SSB

In [1] the performance of OFDM over mobile radio channels was studied for the case of a single fading cochannel interferer rather than additive white noise. Therefore it may not be valid to compare the OFDM/SSB system's SIR (Signal-to-Interference) performance to other systems' SNR performance.

Figure 8.1 shows software simulation BER versus Eb/N0 results from [1, Figure 5] assuming that the effect of the fading interferer is equivalent to that of a fixed white noise source. The Doppler rate was 38 Hz and the block duration was 68 ms2 giving Tfd of about 2.6.

8.2.4 OFDM/FM

3 The experimental results for OFDM/FM without DFC for T/d=2.6 and T/d=10.2 (section 5.5.1) are also shown in Figure 8.1.

8.3 Bandwidth Efficiency

Bandwidth efficiency is the number of bits per second that can be transmitted per unit (Hz) of channel bandwidth. The bandwidth efficiency will be computed as the data rate on each channel divided by the channel frequency spacing. For example, a system that transmits 15 kbps on each channel and uses channels spaced every 30 kHz would have a spectral efficiency of 0.5 bps/Hz.

8.3.1 GTFM/GMSK

The proposed GTFM and GMSK systems operate at 16 kbps with IF bandwidths of about 16 kHz. However, to provide protection against adjacent channel interference the chan• nels are spaced 25 or 30 kHz apart. Thus their spectral efficiency varies between 0.64

2Note that in [l] the variable TV is the number of subchannels instead of the number of samples in a block. 3The performance of OFDM/SSB would also improve with a larger Tfd- Chapter 8. Comparisons With Other Modulation Methods 96

and 0.53 bps/Hz.

8.3.2 OFDM/SSB

The design of the OFDM/SSB system in [1] transmits 8.6 kbps with 7.5 kHz channel spacing. The nominal spectral efficiency is thus 1.15 bps/Hz. However, the design only allows for guard bands of 500 Hz between channels. This guard band must account for the following frequency errors:

• differences in Doppler shifts (±100 Hz at 80 mph),

• transmitter and receiver frequency errors, (quartz frequency standards age about

5xl0~~10 per day (150 Hz per year)), and

• IF filter roll-off (typically 200-600 Hz between channels for crystal filters).

Channel spacing of 7.5 kHz would require much more sophisticated technology than is currently used. If we assume a more realistic guard band of 3 kHz between channels, the channel spacing becomes 10 kHz and the spectral efficiency drops to 0.86 bps/Hz.

8.3.3 OFDM/FM

The experimental OFDM/FM system described in Chapter 5 transmits at 4 kbps over channels with 25 kHz spacing giving a spectral efficiency of 0.16 bps/Hz. However, by reducing the modulating level it should be possible to use 8-QAM or 16- QAM modulation thus increasing the bit rate to 6 or 8 kbps and the spectral efficiency to 0.24 or 0.32 bps/Hz. Modifications to transmitter and receiver audio processing circuits and transmitting a variable number of bits per subchannel should allow bit rates of 12 kbps (without increasing the peak deviation or RF bandwidth), giving spectral efficiencies of about 0.48 bps/Hz. However, the reduction in modulation level to increase the spectral efficiency would reduce the power efficiency somewhat. Chapter 8. Comparisons With Other Modulation Methods 97

8.4 Delay

OFDM systems introduce a transmission delay of at least the duration of the OFDM block. In addition, gaps must be left between blocks, there are delays in computing the forward and inverse DFTs, and there may be delays in transferring data between the terminal and the modem. These additional delays will depend on the implementation (see Chapter 6).

The permissible delay depends on the application. In [1] the interval between blocks for the proposed OFDM/SSB cellular telephone system was restricted to 20 ms to re• duce delays. Longer delays (several hundred milliseconds) would be acceptable for many mobile data terminal applications.

The MLSE for the GTFM receiver described in [18] introduces a negligible decoding delay of up to several tens of bits.

8.5 Implementation Considerations

Performance results should not be the only basis of comparison between modulation tech• niques. There may be practical limits to a system's performance which do not show up in theoretical or simulation results. Experimental work can uncover some of these problems but experimental results only give a lower bound on performance - different implemen• tations may give better performance. Alternatively, systems that can be shown to work in the laboratory may not be successful commercially because of cost, manufacturing, regulatory, or market considerations. It is difficult to estimate the relative costs of im• plementing the different modulation techniques because new technology and techniques are constantly being developed. This section discusses some of the difficulties that might be faced in implementing the different modulation methods. Chapter 8. Comparisons With Other Modulation Methods 98

8.5.1 OFDM/SSB

Transmitters and receivers for SSB are more complex than those for FM. The two common methods of generating SSB signals require either a narrow IF filter to extract a single sideband or a method of generating two modulated signals in exact quadrature [49]. However, the increased spectral efficiency of SSB has led to the design of at least one experimental mobile radio SSB system [24]. Good results are reported for both voice and data transmission with an SSB system using an in-band pilot carrier.

Carrier Frequency Synchronization

Since OFDM/SSB is a coherent modulation technique, it is necessary to estimate the carrier phase and frequency in order to recover the transmitted data. The OFDM/SSB system proposed in [1] uses pilot carriers above and below the signal to provide carrier frequency synchronization. Filters with bandwidths of 100 Hz are used to extract the carriers. Some form of carrier frequency acquisition and tracking would be required because of Doppler shifts of ± 80 Hz at 60 mph (at 850 MHz), as well as transmitter and receiver frequency errors. The design of mobile radio systems that require high frequency stability would have to take into account poor environmental conditions that include vibration and large temperature and power supply variations.

RF Amplifier Efficiency

Amplification of OFDM/SSB signals generally requires linear (class A) power amplifiers to avoid distortion that could produce harmonics. The constant-amplitude OFDM/FM, GTFM, or GMSK signals can be amplified by more efficient non-linear (class C) power amplifiers. The power efficiency of OFDM/SSB relative to constant-amplitude modulation schemes is reduced by up to 3 dB if the efficiency of the RF amplifier is taken into account. Chapter 8. Comparisons With Other Modulation Methods 99

8.5.2 OFDM/FM

Transmitters and receivers for FM are much simpler than those for SSB. OFDM/FM receivers can use simple non-coherent discriminator detectors. Since almost all current mobile radio equipment uses FM modulation, OFDM/FM can be retrofitted as a voice- band modem operating over an un-modified FM radio.

8.5.3 GMSK/GTFM

The complexity of GMSK/GTFM systems is mainly in the signal processing required for generating the modulating signal and for demodulation. Simple receivers use discrim• inators [16] while more sophisticated ones are synchronous and require carrier phase recovery [17]. Some designs use DSP microprocessors for filtering and MLSE decoding.

8.6 Conclusions

OFDM/SSB and OFDM/FM systems have better power efficiency than serial modulation methods because of the long symbol period. OFDM/SSB has better power and spectral efficiency than OFDM/FM but would be more expensive to implement. OFDM/FM is simple to implement and can be used with existing radio equipment but needs further development to improve its spectral efficiency. The experimental OFDM/FM system was built to verify the analysis and simulation results and thus does not demonstrate the best achievable OFDM/FM performance. Several approaches to im• proving the performance of OFDM/FM are described in Chapter 6.

GMSK and GTFM are relatively simple to implement and have good spectral efficien• cies. Table 8.1 summarizes the differences among the modulation techniques considered in this chapter. Chapter 8. Comparisons With Other Modulation Methods 100

Performance Summary Table OFDM/SSB OFDM/FM GMSK/GTFM

2 a b c E6/N0 for BER=10- 13-15 15-21 18-22

3 d Eb/N0 for BER=10" 18-22 18-27 28-32 channel spacing 7.5-10 e 25 25-30 bit rate 8.6' 4-12 s 16 spectral efficiency (bps/Hz) 1.15-0.86 h 0.16-0.48 »' 0.53-0.64 J delay > ss 30 ms fc > « 30 ms1 < 1 ms m signal processing complexity high high low-medium RF complexity high low low cost high low-medium" low-medium uses existing radios no yes no

a[l], T/d=5 to T/d=0.63, no delay spread, assuming SIR = SNR

b T/d=10.2 with DFC to T/d=0.64 without DFC. c[16] and [17]. dEstimated from [1, Figure 5 and Figure 12]. e0.5 to 3 kHz guard bands.

"section 8.3.3. h8.6 kbps at 7.5 to 10 kHz. '4 kbps to 12 kbps at 25 kHz. J16 kbps at 25 kHz to 30 kHz. ^typical, N =512 at /, =15 kHz. 'typical, JV =256 at /, = 8 kHz. m16 bits at 16 kbps. "low cost if retrofitting existing equipment.

Table 8.1: Performance summary for various modulation techniques. Chapter 9

Conclusions

9.1 Conclusions

A novel modulation method, OFDM/FM, has been proposed for data communication over mobile radio channels. Orthogonal Frequency Division Multiplexing (OFDM) is an ef• ficient method of transmitting a block of bits in parallel and thus reducing the symbol rate. The use of OFDM averages the effects of fading over all of the bits in the block and this can result in better power efficiency than conventional serial modulation tech• niques. OFDM/FM is the transmission of a baseband OFDM signal over an FM channel. OFDM/FM systems can be implemented simply and inexpensively by retrofitting existing FM radio systems. A simple and versatile model for the mobile radio FM channel, the equivalent baseband channel (EBC) model, was developed to study the performance of OFDM/FM. This model is quite general and so allows various receiver effects to be be modelled. A simple expression was derived for the Bit Error Rate (BER) within a block when each channel is QAM-modulated. An expression was also obtained for the Word Error Rate (WER) by assuming that errors occur randomly within the block. Several numerical methods were developed to evaluate the overall BER and WER. An expression was obtained for the BER for the case where blocks are very short or very long relative to the average fade duration. An efficient Monte-Carlo numerical integration method was developed to evaluate the BER and WER for intermediate block lengths. A baseband signal-processing simulation that simulates the effects of fading on the baseband OFDM signal was written to evaluate various coding and signal processing

101 Chapter 9. Conclusions 102

techniques. An experimental OFDM/FM system was implemented using unmodified commercial VHF FM radio equipment and a fading channel simulator. The BER and WER results obtained from the hardware measurements agreed with the results obtained using the numerical methods. This agreement shows that the EBC model can be used to predict the performance of OFDM/FM systems. The experimental results also validate the analysis and demonstrate that it is feasible to implement an OFDM/FM system using conventional FM radio equipment. The experimental measurements also demonstrated the need to consider the limitations of practical FM channels such as clipping, bandwidth restrictions, preemphasis and deemphasis, and the baseband noise spectrum. Methods were developed to select the modulating signal level, the baseband frequency range, and the amount of "software preemphasis".

Several common techniques of improving the performance of communications sys• tems (forward error correction (FEC), space diversity, automatic gain control (AGC), and squelch) were tested. It was shown that the independent error assumption can be used to predict the distribution of the number of errors in a word. This result is useful in predicting the performance of FEC codes. The two rate-| random-error and burstjerror correcting FEC codes tested did not significantly improve the power efficiency (E&/N0 performance) of OFDM/FM. It was shown that OFDM/FM works well with switching diversity because OFDM can average out the effects of impulses created by switching. The optimum squelch and AGC thresholds for large blocks were found by evaluating the bounds on the BER for large blocks. The actual BER performance for blocks of vari• ous durations was obtained with baseband simulations. The use of squelch produced a small (about 1 dB) performance improvement and the use of AGC provided a negligible improvement.

A new technique to reduce the crosstalk interference between the OFDM subchan• nels was developed. This method, decision feedback correction (DFC), can significantly Chapter 9. Conclusions 103

improve the BER performance of OFDM/FM. At a BER of 10~3, the improvement due to this technique is between 3 and 5 dB. The improvement increases as the block size increases or the SNR increases. The OFDM/FM system studied in the thesis is not as power efficient or as spectrally efficient as a proposed OFDM/SSB system [1] but it is simpler and less expensive.

For BERs below 10-2, the experimental OFDM/FM system provides better power ef• ficiency than any of the serial digital modulation methods that are available for mobile radio data transmission (FSK, GTFM, or GMSK). At a BER of IO"3 the OFDM/FM system

with a block duration Tfd = 2.6 is about 5 dB more power efficient than GTFM or GMSK. The use of DFC can increase this advantage significantly. However, current GTFM and GMSK systems have better spectral efficiency than the experimental OFDM/FM system. The experimental system was designed for ease of implementation rather than to achieve optimum performance and better results would likely be obtained with further develop• ment.

The hardware requirements for OFDM/FM are comparable to those of other high• speed baseband modems and the cost of the required digital signal processing (DSP) hardware is relatively low.

9.2 Topics for Further Study

The spectral efficiency of OFDM can be increased by encoding more bits on each sub• channel. However, increasing the number of bits encoded per subchannel reduces the distance between data points in the signal space [11]. The experimental system's lim• iting baseband SNR would have to be increased to avoid introducing a BER floor. It is also possible to encode more bits on subchannels with high SNRs and fewer on sub• channels with lower SNRs. This method is used by many telephone OFDM modems [37,41,42,61,78]. The analysis in Chapter 3 can be extended to predict the BER for other encodings ("signalling constellations") by using the appropriate BER expression (see [79]). Chapter 9. Conclusions 104

Companding is a method used on various speech channels to reduce the peak value of the modulating signal without reducing its average power [49]. An amplifier with non-linear gain characteristics (the "compressor") is used at the transmitter to reduce the dynamic range of the modulating signal. An amplifier with the inverse characteristic is used at the receiver to "expand" the signal and recover the original waveform. Com• panding could be used to reduce the distortion due to clipping and improve the limiting baseband SNR. This would allow more bits to be encoded on each subchannel and would improve the spectral efficiency.

Various modifications to the DFC procedure might improve its performance. Instead of completely substituting the portions of the received signal that are below a fixed thresh• old, the amount of the regenerated signal that is added could be determined by a weight• ing function that is a function of the IF SNR. The weighting function could be changed as the correction procedure converges.

Practical methods of recovering timing and phase synchronization should be devel• oped. The timing system could be based on time slots or on detection of the presence of the IF or baseband signal. A prototype could be built and tested in the field along with a commercial mobile radio modem. OFDM is robust because it is insensitive to the distribution of the noise and because it can be adapted to compensate for non-ideal channel response characteris• tics such as narrow-band interference and attenuation notches in the spectrum. OFDM should therefore perform equally well outside the laboratory. Many telephone channel impairments such as frequency offset, jitter, or gain hits can be modelled as interference between the OFDM subchannels [38]. An adaptive equalizer operating on the recovered data values (i.e. across subchannels) was able to significantly reduce this interference [38]. This method was not implemented because the effects of Rayleigh fading were thought to be too severe for the proper operation of an adaptive equalizer. However, an investigation of this method may be worthwhile. Bibliography

[1] L. J. Cimini, "Analysis and simulation of a digital mobile channel using orthogonal frequency division multiplexing," IEEE Transactions on Communications, vol. COM- 33, pp. 665-675, July 1985.

[2] J. Morris, "MDTs give mobiles direct access to digital computer data bases," Mobile Radio Technology, vol. 1 issue 10, Dec. 1983.

[3] W. C. Jakes, ed., Microwave Mobile Communications. New York: Wiley and Sons, 1974.

[4] B. R. Saltzberg, "Performance of an efficient parallel data transmission system," IEEE Transactions on Commununications Technology, vol. COM-15, pp. 805-811, Dec. 1967.

[5] E. Casas and C. Leung, "Performance of an OFDM/FM scheme for data transmis• sion over fading mobile radio channels," in Proceedings of the 36th IEEE Vehicular Technology Conference, Dallas, Texas, May 20-22, 1986, pp. 103-108, May 1986.

[6] D. Cox and R. P. Leek, "Correlation bandwidth and delay spread multipath propa• gation statistics for 910 MHz urban radio channels," IEEE Transactions on Commu• nications, vol. COM-23, pp. 1271-1280, Nov. 1975.

[7] D. C. Cox and R. P. Leek, "Distributions of multipath delay spread and average excess delay for 910-MHz urban mobile radio paths," IEEE Transactions on Antennas and Propagation, vol. AP-23, pp. 206-213, March 1975.

[8] D. L. Nielson, "Microwave propagation measurements for mobile appli• cation," IEEE Transactions on Vehicular Technology, vol. VT-27, pp. 117-132, Aug.

105 Bibliography 106

1978.

[9] A. S. Bajwa, "UHF wideband statistical model and simulation of mobile radio mul-

tipath propagation effects," IEE Proceedings, Part F, vol. 132, pp. 327-333, Aug. 1985.

[10] R. H. Clarke, "A statistical theory of mobile radio reception," The Bell System Tech•

nical Journal, vol. 47, pp. 957-1000, July 1968.

[11] J. M. Wozencraft and I. M. Jacobs, Principles of Communication Engineering. New York, New York: John Wiley and Sons, 1965.

[12] R. S. Kennedy, Fading Dispersive Communications Channels. New York: Wiley- Interscience, 1969.

[13] G. L. Turin, F. D. Clap, T. L. Johnston, S. B. Fine, and D. Lavry, "A statistical

model of urban ," IEEE Transactions on Vehicular Technology, vol. VT-21, pp. 1-9, Feb. 1972.

[14] H. Hashemi, "Simulation of the urban radio propagation channel," IEEE Transac•

tions on Vehicular Technology, vol. VT-28, pp. 213-225, Aug. 1979.

[15] G. A. Arredondo and J. I. Smith, "Voice and data transmission in a mobile radio chan•

nel at 850 MHz," IEEE Transactions on Vehicular Technology, vol. VT-26, pp. 88-93, Feb. 1977.

[16] T. Miki and M. Hata, "Performance of 16 kbit/s GMSK transmission with postde-

tection selection diversity in land mobile radio," IEEE Journal on Selected Areas in

Communications, vol. SAC-2, pp. 512-517, July 1984.

[17] K. Murota and K. Hirade, "GMSK modulation for digital mobile radio telephony,"

IEEE Transactions on Communications, vol. COM-29, pp. 1044-1050, July 1981. Bibliography 107

[18] K. Chung, "Generalized tamed and its application for mo•

bile radio communications," IEEE Journal on Selected Areas in Communications, vol. SAC-2, pp. 487-497, July 1984.

[19] W. L. Aranguren and R. E. Langseth, "Baseband performance of a pilot diversity system with simulated Rayleigh fading signals and co-channel interference," Joint

IEEE Communications Society - Vehicular Technology Group Special Transactions

on Mobile Radio Communications, pp. 1248-1257, Nov. 1973.

[20] C. R. Stevenson, "An improved modulation format and signal processing scheme for

ACSB systems," in Proceedings of the 34th IEEE Vehicular Technology Conference, 1984, pp. 109-113,1984.

[21] K. W. Leland and N. R. Sollenberger, "Impairment mechanisms for SSB mobile communications at UHF with pilot-based doppler/fading correction," The Bell System

Technical Journal, vol. 59, pp. 1923-1943, Dec. 1980.

[22] S. H. Goode, "An evaluation of the tone calibrated technique for data transmission over land mobile radio channels," in Proceedings of the 35th IEEE Vehicular Tech•

nology Conference, 1985, pp. 140-145, 1985.

[23] A. J. Bateman and J. P. McGeehan, "Data transmission over UHF fading mobile radio channels," IEE Proceedings, Part F, vol. 131, pp. 364-374, July 1984.

[24] A. J. Bateman, G. L. Lightfoot, A. Lymer, and J. P. McGeehan, "Speech and data communications over 942 MHz TAB and TTIB single sideband mobile radio systems incorporating feed-forward signal regeneration," IEEE Transactions on Vehicular Technology, vol. VT-34, pp. 13-21, Feb. 1985.

[25] J. P. McGeehan and D. F. Burrows, "Performance limits of feedforward automatic gain control in mobile radio receivers," IEE Proceedings, Part F, vol. 128, pp. 385- 392, Nov. 1981. Bibliography 108

[26] J. P. McGeehan and A. J. Bateman, "Theoretical and experimental investigation of feedforward signal regeneration as a means of combatting multipath propagation effects in pilot-based SSB mobile radio systems," IEEE Transactions on Vehicular Technology, vol. VT-32, pp. 106-120, Feb. 1983.

[27] J. P. McGeehan and A. J. Bateman, "Phase-locked transparent tone-in-band (TTIB): a new spectrum configuration particularly suited to the transmission of data over SSB mobile radio networks," IEEE Transactions on Communications, vol. COM-32, pp. 81-87, Jan. 1984.

[28] J. P. McGeehan and A. J. Bateman, "Simple simultaneous carrier and bit syn• chronization system for narrowband data transmission," IEE Proceedings, Part F, vol. 132, pp. 69-72, Apr. 1985.

[29] J. P. McGeehan and J. P. H. Sladen, "The tracking performance of a narrowband phase-locked loop in the mobile multipath environment," IEE Proceedings, Part F, vol. 132, pp. 73-76, Apr. 1985.

[30] F. Davarian, "High performance digital communications in mobile channels," in Pro•

ceedings of the 34th IEEE Vehicular Technology Conference, 1984, ppt 114-117,1984.

[31] B. Lusignan, "Single-sideband transmission for land mobile radio," IEEE Spectrum, pp. 33-37, July 1978.

[32] G. R. Cooper and R. W. Nettleton, "A spread spectrum technique for high-capacity mobile communications," IEEE Transactions on Vehicular Technology, vol. VT-27, pp. 264-275, Nov. 1978.

[33] G. L. Turin, "Introduction to spread-spectrum antimultipath techniques and their application to urban digital radio," Proceedings of the IEEE, vol. 68, pp. 328-353, March 1980. Bibliography 109

[34] R. W. Chang, "Synthesis of band-limited orthogonal signals for multichannel data transmission," The Bell System TechnicalJournal, vol. 45, pp. 1775-1796, Dec. 1966.

[35] R. W. Chang and R. A. Gibby, "A theoretical study of performance of an orthogonal multiplexing data transmission scheme," IEEE Transactions on Commununications Technology, vol. COM-16, pp. 529-540, Aug. 1968.

[36] S. B. Weinstein and P. M. Ebert, "Data transmission by frequency division multiplex• ing using the discrete Fourier transform," IEEE Transactions on Communications, vol. COM-19, pp. 628-634, Oct. 1971.

[37] B. Hirosaki, "A 19.2 kbps voiceband data modem based on orthogonally multi• plexed QAM techniques," in IEEE International Conference on Communications, 1985 Chicago, III, June 23-26, 1985, pp. 21.1.1-21.1.5 or 661-665, June 1985.

[38] W. Keasler, Reliable Data Communication Over the Voice Bandwidth Telephone Channel Using Orthogonal Frequency Division Multiplexing. PhD thesis, Univer• sity of Illinois, 1982.

[39] S. P. Bernard, "A low baud rate 9600 bps voice band modem employing frequency division multiplexing," notes presented at a workshop on communications held in 1982 by the Communications Research Laboratory, McMaster University, Hamilton Ontario, 1982.

[40] T. Kelly, "Digital modem packs data onto 40 bauds for 9600 bps data comms over voice lines," Canadian Datasystems, vol. 11, pp. 64-65, 67, 69, Apr. 1979.

[41] A. Peled and A. Ruiz, "Frequency domain data transmission using reduced com• putational complexity algorithms," in Proceedings of the 1980 IEEE International Conference on Acoustics, Speech and Signal Processing, pp. 964-967,1980.

[42] M. Ballard, "A brief technical overview of the Telebit Trailblazer modem," article Bibliography 110

written in April 1988 and posted by Richard Siegel, (uunet!telebit!rls) on Usenet in September, 1988, Apr. 1988.

[43] A. L. Kirsch, P. R. Gray, and D. W. Hanna Jr., "Field-test results of the AN/GSC- 10 (KATHRYN) terminal," IEEE Transactions on Commununications Technology, vol. COM-17, pp. 118-128, Apr. 1969.

[44] P. A. Bello, "Selective fading limitations of the KATHRYN modem and some sys• tem design considerations," IEEE Transactions on Commununications Technology, vol. COM-13, pp. 320-333, Sep. 1965.

[45] R. R. Mosier and R. G. Clabaugh, "Kineplex, a bandwidth-efficient binary transmis• sion system," AIEE Trans., vol. 76, pp. 723-728, Jan. 1958.

[46] D. Kagan and J. M. Perl, "FFT based HF modems performance prediction," in Proceedings of IEEE MONTEC'86 (Conference on Antennas and Communications),

September 29 - October 1, 1986, Montreal, Quebec, pp. 86-89, Sep. 1986.

[47] J. M. Perl and D. Kagan, "Real-time HF channel parameter estimation," IEEE Trans• actions on Communications, vol. COM-34, pp. 54-58, Jan. 1986.

[48] B. R. Davis, "FM noise with fading channels and diversity," IEEE Transactions on Commununications Technology, vol. COM-19, pp. 1189-1200, Dec. 1971.

[49] H. Taub and D. L. Schilling, Principles of Communication Systems. McGrhw-Hill, 1971.

[50] R. Kellejian, Applied Electronic Communication. Science Research Associates, 1980.

[51] P. Horowitz and W. Hill, The Art of Electronics. Cambridge: Cambridge University Press, 1980.

[52] Radio Standards Specification - Land and Mobile Stations Primarily Voice and Data Modulated FM or PM Radiotelephone Transmitters and Receivers Operating in the Bibliography 111

Allocated VHF/ UHF Bands in the Frequency Range 27.41 to 866 MHz. Telecom• munication Regulatory Service, Department of Communications, Government of Canada, Aug. 1985. RSS 119, Issue 3.

[53] D. L. Schilling, E. A. Nelson, and K. K. Clarke, "Discriminator response to an FM signal in a fading channel," IEEE Transactions on Commununications Technology, vol. COM-15, pp. 252-263, Apr. 1967.

[54] Digital Signal Processing Committee, IEEE Acoustics, Speech and Signal Processing Society, ed., Programs for Digital Signal Processing. New York: IEEE Press, 1979.

[55] P. G. Moore and D. E. Edwards, Standard Statistical Calculations. New York: John Wiley and Sons, second ed., 1972.

[56] E. F. Casas and C. Leung, "A simple digital fading simulator for mobile radio," in Proceedings of the 38th IEEE Vehicular Technology Conference, Philadelphia, Penn• sylvania, June 15-17, 1988, pp. 212-217, June 1988.

[57] Orange Book, Volume VIII.l, Data Transmission Over the Telephone Network, Ap• pendix 1 to Recommendation V.29. International Telecommunications Union, Inter• national Telegraph and Telephone Consultative Committee (CCITT), 1977. from the Sixth Plenary Assembly Geneva 27 September — 8 October 1976.

[58] F. T. P. Staff, APMATH 82, Library Manual, Volume 2 of 4. Floating Point Systems, June 1982. item number 860-7288-008C.

[59] T. Nicol, "Random number generators," Tech. Rep., The University of British Columbia Computing Centre, May 1986.

[60] S. K. Park and K. W. Miller, "Random number generators: good ones are hard to find," Communications of the ACM, vol. 31, pp. 1192-1201, Oct. 1988. Bibliography 112

[61] I. Kalet, "The multitone channel," IEEE Transactions on Communications, vol. 37,

pp. 119-124, Feb. 1989.

[62] I. Miller and J. E. Freund, Probability and Statistics for Engineers. Englewood Cliffs,

New Jersey: Prentice-Hall, second ed., 1977.

[63] E. B. Manoukian, Mathematical Nonparametric Statistics. Gordon and Breach Sci•

ence Publishers, 1986.

[64] E. L. Lehman, Nonparametrics, Statistical Methods Based on Rank. San Francisco:

Holden-Day, 1975.

[65] A. Pierce, Fundamentals of Nonparametric Statistics. Belmont California: Dicken• son Publishing Company, 1970.

[66] RF I IF Signal Processing Handbook Volume 1 (Mixers) 1985186 and Volume 2 (Power Splitters I Combiners) 1987/1988. Mini-Circuits, P.O. Box 350166 Brooklyn, N.Y., 11235-0003.

[67] H. W. Arnold and W. F. Bodtmann, "Switched-diversity FSK in frequency-selective Rayleigh fading," IEEE Journal on Selected Areas in Communications, vol. SAC-2, pp. 540-547, July 1984.

[68] P. F. Driessen, "Maximizing the throughput of a mobile radio data system," in Proceedings of the 33rd IEEE Vehicular Technology Conference, Toronto, Ontario, Canada, May 25-27, 1983, pp. 414-418, May 1983.

[69] S. Lin and D. J. Costello Jr., Error Control Coding: Fundamentals and Applications. Englewood Cliffs, N.J.: Prentice-Hall, 1983.

[70] R. E. Fisher, "A subscriber set for the equipment test," The Bell System Technical

Journal, vol. 58, pp. 123-143, Jan. 1979. Bibliography 113

[71] W. C. Wong, R. Steele, B. Glance, and D. Horn, "Time diversity with adaptive error detection to combat Rayleigh fading in digital mobile radio," IEEE Transactions on Communications, vol. COM-31, pp. 378-387, March 1983.

[72] J. H. Humphrey and G. S. Smock, "High-speed modems," BYTE, vol. 13, pp. 102- 110,112-113, June 1988.

[73] B. Hirosaki, "An orthogonally multiplexed QAM system using the discrete Fourier transform," IEEE Transactions on Communications, vol. COM-29, pp. 982-989, July 1981.

[74] A. V. Oppenheim and R. W. Schafer, Digital Signal Processing. Englewood Cliffs, NJ: Prentice-Hall, 1975.

[75] D. W. Ingram and B. T. Tan, "Performance of a Fourier transform data transmission system," Electronics Letters, vol. 21, pp. 1014-1015, Oct. 1985.

[76] D. C. Cox, "Universal digital portable radio communications," Proceedings of the IEEE, vol. 75, pp. 436-^77, Apr. 1987.

[77] A. P. Clark, "Digital modems for land mobile radio," IEE Proceedings, Part F, vol. 132, pp. 348-362, Aug. 1985.

[78] A. Ruiz and J. M. Cioffi, "A frequency domain approach to combined spectral shap• ing and coding," in Proceedings of the International Conference on Communications, Seattle, Washington, June, 1987, pp. 49.3.1-49.3.5, June 1987.

[79] G. D. Forney, R. G. Gallager, G. R. Lang, F. M. Longstaff, and S. U. Qureshi, "Ef• ficient modulation for band-limited channels," IEEE Journal on Selected Areas in Communications, vol. SAC-2, pp. 632-647, Sep. 1984.

[80] I. S. Gradshteyn and I. M. Ryzhik, Table of Integrals, Series and Products. Academic Press, 1980. Bibliography 114

[81] International Business Machines Corporation, IBM Personal Computer Technical Reference Manual. Boca Raton, Florida: IBM, 1983.

[82] "Spectrum analysis ... noise measurements," Hewlett Packard Application Note 150- 4, Hewlett Packard, Apr. 1974.

[83] M. Engelson, "Noise measurements using the spectrum analyzer — part one: ran• dom noise," Tektronix Application Note AX-3260, Tektronix, Inc., Beaverton, Oregon, 1977.

[84] B. Benedict, "Fundamentals of spectrum analysis," Tektronix Application Note 26W- 5360-1, Tektronix, Inc., Beaverton, Oregon, 1984. Appendix A

Conditional Mean and Variance of the Error

A.1 Notation

The notation a is used to indicate a vector {a0, a1; • • •, a/v-i). The discrete Fourier transform (DFT) of a is defined as A = DFTja] where

N-l

n=0 and the inverse DFT (IDFT) of A is defined as a = IDFT[ A] where

m=0 and

W = e-j2^N. (A.3)

The notation (a) is used to denote the average of the vector a over N samples, that is, JV-l

N i=0 The notation is used for

0 if i#i (A.5) 1 if i = j

A.2 Assumptions

The received signal y (see Figure 3.1) is the sum of received data and noise samples. The received signal samples are the transmitted samples, x, scaled by the channel signal

115 Appendix A. Conditional Mean and Variance of the Error 116

gain, s. The received noise samples are Gaussian random variables, w, scaled by the channel noise gain n. Both s and n are functions of the RF signal level, r, which is Rayleigh distributed. The functions s = fs(r) and n = fn(r), depend on the type of modulation and the characteristics of the receiver used. Since the data, signal level, and noise (before fading) are generated by physically independent processes, x, w and r are assumed to be statistically independent. It will also be assumed that the spectrum of s is small above a certain frequency. Since the spectrum of r (equation B.l) lies below the Doppler rate, fry, the spectrum of s will also be concentrated below fo if the "S" portion of the SN curve is smooth so that there are few non-linearities in a to produce harmonics.

A.2.1 Data

The transmitted data vector, X, is a block of JV complex data values, each with energy o\. For example, for OFDM-QAM XM = ±1 ± j for all m so that o\ = 2. The JV real signal samples, x, which are transmitted over the channel are generated by an inverse

DFT (IDFT). For the JV samples to be real XM = X%_M (or equivalently XM = X*m). This means that only JV/2 of the complex data values are determined by the data and the remainder are their complex conjugates.

Most practical channels are bandpass channels so that frequencies at the low and high ends of the channel cannot be used. The data values for the unused channels are set to zero at the transmitter. In particular, it is assumed that XQ and XN/2 (both of which have only a real component) are set to zero.

A.2.2 Noise

The JV real, i.i.d. (white) noise samples, w, are taken from a zero-mean Gaussian distri• bution having a variance a2. Appendix A. Conditional Mean and Variance of the Error 117

A.3 Conditional Mean

The ensemble average of the m'th received data value, Ym> over the set of all possible

data vectors with the m'th data value fixed at Xm - D (D is complex) and over all possible noise vectors w is found conditioned on a given signal level vector r (and the corresponding s and n). For notational convenience the conditions will often be omitted from the expected value operators although they are implied. The received signal samples are

— 5na:n -j- nnwn. (A.6)

By using the definition of the DFT, the received value on the m'th data subchannel is

N-l

mn Ym=Yl + nnwn)W . (A.7)

n=0 The conditional mean of the received data values,

JV-l

mn E [ Ym | Xm = D, X-m = D\ v ] = £ (E [snxn] + E [nnwn))W . (A.8) n=0 Since r (and thus n) is fixed, and the noise w is zero-mean,

E[nnwn] = nnE[wn] = 0. (A.9)

Since s is fixed,

E [snXn] = SnE [Xn] . (A.10)

To evaluate E [xn] note that since the data values are zero-mean,

E [Xk] = DSkm + -D*<5fc(_m) (A.11) so that

r. N-i nk fc=0 Appendix A. Conditional Mean and Variance of the Error 118

Substituting (A.9) and (A.12) in (A.8),

JV-1 N-l D. nm—nm nia+nm 5 + E sn^-W E[Ym \Xm = D,X.m = D*,r] = E "^W- n=0 n=0 N-l JV-1

n=0 n=0

The term ^Zn^o1 SnW2""1 is the DFT of s evaluated at a frequency of twice the sub•

channel of interest (52m). If the spectrum of s is concentrated below m = 2L (Sm < So for |m| > 2L) then for m between L and y - £ the contribution of the second term will be small so that

E[YM\XM = D,X_M = D*, V]KD(S). (A.14)

A.4 The Conditional Variance

The conditional variance (given the same conditions as for the mean) of a received data value Ym, is:

2 var( Ym | Xm = D, X_m = D\ v) = E [Yro Y*] - |E [Ym] | (A.15)

Using the definition of the DFT, the first term can be re-written as:

N-lN-l E[YmY*] = E (A.16) mi mj E E (Wi + niWi)(sjXj + njWj)*W W- Using the linearity of the t=expectatio0 j=0 n operator, and since x, w, s and n are real (so that x* = Xi, w* = W{, etc.) this can be expanded as

N-l N-l

E[YmYn*] = 51 E (E[siXiSjXj] + E[siXinjWj) i=o j=o (A.17) + E [mwiSjXj] + E [riiWiTijWj]) Wm^-j\

Since a and n are constant because of the conditions, N-l N-l

E 5 5 E [^^1 = E E ( i J [xixj] + SiUjE [xiWj] m j 8=0 +j =niSjE0 [wiXj] + niiijE [wiWj]) W ^- \ (A.18) Appendix A. Conditional Mean and Variance of the Error 119

Since the noise is zero-mean (E [wi] — E [WJ] = 0), and w and x are independent,

E [XiWj] = E [wiXj] = 0 (A. 19) so that jV-i N-l 5 s E n E ro J E [YmYm] = Y, E ( «' i + »«i W- <*-'>. (A.20) i=o i=o Using the definition of the ID FT,

E M = iELE W-*W-*. (A.21) fc=0 /=o Using the conditions, and since the data symbols are zero-mean,

E[XkX,] = { DHkm + (D*)Hk{_m) for k = l (A.22)

0 otherwise so that

2 N-l 1 1

E= ]ya E W(i_i)fc + ^2^2W-'mI^-jm + ^(D*)2WimWjm fc=0

- ^i.^.. i J_ n2w->»(<+j) LD2wm(«'+j) j\r°«' + iV2^ N2

= + J_r;2 (V-m(.-+*) _ yr/m^+M (A_23) N N2 \ > since D2 = -(D*)2 for D = ±1 ± j.

Since io is real and i.i.d. with zero mean,

2 E[wiWj] = a w6ir (A.24)

Substituting (A.23) and (A.24) in (A.20),

2 2 E [YmYm] = £ (?fs + o-ln ^ W-('--> +

N-l N-l H

t'=0 i=0 j=0 j=0 Appendix A. Conditional Mean and Variance of the Error 120

The last term in equation A.25 can be simplified to

r,B, Bi JV>EEwi(2 '-^ ) 1=0 j=0 N / . JV-1 JV-1 . N-l N-l

\J vi=o j=o i=o j=o

, (N-l H JV-1 JV-1 H JV-1 2 2m = > E ^~ ^ E « - E ^2mi E -i \j=0 j'=0 i=0 j'=0

1 /JV-I JV-1 \

D2 S 5 w2mi (A 26) = IJ ( ) E *j^'2rai - E ' • - N \j=0 i=0 /

As in section A.3, the sums are the DFTs of s evaluated at ±2ra, S±2m- Under the same conditions as in section A.3 the sums (S±2m) can be assumed to be negligible compared to So = N (s), so that JV-1 JV-1

N(s)= E si > E SiW±2mi. (A.27) i=0 »'=0 Using Chebyshev's inequality [80], il>?><->2, (A.28)

2 2 and |Z>| = o x, we find 1 1 w 1 1 N <-< * " ~ 3 N »=o «=oN ±2mi ^ X>? > » \D?^{s) ^SlW . (A.29) Thus from A.25 W(*)

2 A 30 E[YmY*} » ^^E^ + ^^E^ ' < -> »=o t=0 and the conditional variance of the received data value is

2 2 2 2 2 2 var( Ym\Xm = D,X.m = D\r)*o x (s ) + No w (n ) - |2?| (s) . (A.31)

So that the ratio of s and n corresponds to the ratio of the baseband signal and noise, the noise power, o^, must be set equal to the baseband signal power a2. For the case of

2 2 D = ±l± j, al = 2/iV and a x = |£>| = 2 , we have

2 2 2 var( Ym\Xm = D,X.m = D\r)*2 {(s ) - (s) + (n )) . (A.32) Appendix B

The Fading Simulator

B.l Introduction

A fading simulator was built to carry out the measurements described in Chapter 5. This unit simulates the multipath fading present on narrowband VHF and UHF mobile radio channels. The simulator is also described in [56]. The effects of non-frequency-selective multipath fading on a mobile radio signal can be approximated by modulating the in-phase and quadrature components of the signal with independent low-pass Gaussian random signals as shown in Figure B.l. The fading simulator consists of a quadrature modulator and a control section that generates the two random signals.

Gaussian 'Q' RF signal Rayleigh input control signal power fading signal splitter Gaussian T control signal

Figure B.l: Rayleigh fading is produced by modulating the in-phase and quadrature components of the RF signal with independent Gaussian random signals.

The simulator implements the method developed by Jakes [3] but uses an Intel 8088

121 Appendix B. The Fading Simulator 122

microprocessor instead of analog components. Doppler rates between 2 and 126 Hz in steps of 2 Hz can be simulated. Figure B.2 shows how the simulator is used in a mobile radio channel simulation.

fading +11 dBm RF shield simulator i transmitter quadrature o •• modulator attenuator variable attenuator (30to130dB) (sets C/No) received simulator modulating baseband controller spectrum signal signal analyzer (measures C/No)

Figure B.2: Use of the simulator for mobile radio channel simulation.

The following sections describe the control section, the quadrature modulator, and how the simulator was tested.

B.2 Control Section

This section describes the unit that generates the in-phase (D and quadrature (Q) control signals. These are independent pseudo-random Gaussian signals with low-pass power spectra proportional to

[i-(f/fdY\ 2 f

o f>fd for a (maximum) Doppler rate fa and an omnidirectional vertical antenna[3].

B.2.1 Software Description

As shown in Figure B.3, the control signals are the weighted sums of the outputs of nine sinusoidal oscillators. The amplitudes and frequencies of the sinusoids are chosen to Appendix B. The Fading Simulator 123

give two uncorrelated signals with power spectra approximating S(f). The number of sinusoids is chosen to give a good approximation to the Gaussian amplitude distribution and the desired spectrum[3]. 0.983 f. 0.765 1.848

0.932 f 1.414 1.414

0.850 f 1.848 "0-d 0.765 0.739 fd 2.000 -©

0.603 fd 1.848 -0.765 E -©- 0.446 td 1.414 _©_ -1.414

0.274 f. 0.765 -1.848

0.092 U -2.000

1.000 t, 1.000 1.000

T" T Q control signal I control signal

Figure B.3: Generation of the pseudo-random control signals showing the frequencies and magnitudes of the sinusoids. The frequencies of the sinusoids are shown as a fraction of the Doppler rate, The quantities along the connecting lines are the amplitudes.

A listing of the 8088 assembly-language program that generates the control signals is given in Appendix E. The program runs continuously and generates one sample every 338/^s. An eight-bit switch register (see Figure B.4) is read before computing the value of each sample. If the least significant bit is one (switch on), the middle six bits of the switch register give the Doppler rate in binary between 2 and 126 Hz in increments of 2 Hz. If the least significant bit is zero (switch off), the RF level is held at a fixedvalue . Appendix B. The Fading Simulator 124

In this case the most significant bit selects a level of either 0 dB1 (switch off), or -20 dB

(switch on). The 0 dB level is used when measuring the mean signal level and the -20 dB level is used to check the calibration of the fading simulator attenuation. The control signal values that produce a 0 dB RF level are computed by summing the powers of the nine sinusoids.

M.S. bit selects level when stopped L.S. bit sets run/stop mode 0=0dB 0=stopped 1 = -20dB 1 =run

Figure B.4: Switch register bits.

The phase (0 to 2K) of each of the nine sinusoids is represented by a 32-bit integer.

Each sinusoid's phase is incremented once per sample by an amount proportional to its frequency. The phase increments are retrieved from a 2304-byte table (64 Doppler rates

x 9 sinusoids x 4 bytes). A listing of the FORTRAN program used to generate these tables is given in Appendix E. The phase counters and increments are scaled so that the least significant 12 bits of the most significant (16-bit) word of the phase count form a pointer into a scaled cosine table of 2048 (16-bit) words. The values looked up in these tables convert the phases to the oscillator outputs. The oscillator amplitudes are set by the scaling of the cosine tables. The values of the nine sinusoids obtained in this way are

added to form the I and Q signals. A listing of the program used to generate these tables is given in Appendix E. One table is required for each of the five oscillator amplitudes.

The five scaled cosine tables of 2048 16-bit values require 20k bytes.

The lowest Doppler rate that can be generated is determined by the length of the

cosine table and the bandwidth of the reconstruction filter. If a sinusoid's frequency is

so low that the same sample value is taken from the table k times, the effective sampling

rate at that frequency has been reduced by k. Since the effective sampling rate must

'All signal levels are relative to the mean signal level. Appendix B. The Fading Simulator 125 be more than twice the reconstruction filter bandwidth, a larger cosine table size allows lower Doppler rates to be generated for a given reconstruction filter bandwidth. Offsets are added to the 12 most significant bits of the I and Q control signal sums to convert from two's-complement to the offset-binary format required by the D/As. These offsets are the sample values that result in minimum RF output for a given mixer. These offsets do not necessarily produce a zero volt control signal. The offset values were measured by adjusting the D/A output to obtain minimum RF output. Finally, the two sample values are loaded into the D/As and output simultaneously. The fading waveform will eventually repeat because each phase counter can only take on a finite number of discrete phases. The state of each counter is defined by its least significant 28 bits since these are the only bits used to compute the phase. Each counter is initialized to zero. The period of the fading waveform is therefore the number of samples until all of the counters again have their least significant 28 bits equal to zero.

The least significant 28 bits of a counter will return to zero when the counter reaches a multiple of 228. If p is the period, m is the counter increment, and i is an integer, then

28 pm = i228 or p = i2^-. If m and 2 have no common factors (for example, m is odd) then the smallest i that will make p an integer is i = m, giving p = 228. If they do have a common factor, the period will be 228 divided by the largest common factor. Since each oscillator has a period that is a factor of 228, the period of the fading waveform will be that of the oscillator with the longest period. A period of 228 corresponds to about 25 hours at a 338 us sample period.

B.2.2 Hardware Description

Digital Section

Figure B.5 shows the schematic of the CPU section. The 8088 microprocessor was chosen primarily because a development system, an IBM PC, was readily available. The 8088 is also slightly faster than 8-bit microprocessors because it has more 16-bit registers. Appendix B. The Fading Simulator 126

. RESET

8088

35-38 RESET A16-A19 N.C. CLK A8-A15 8-2,39 _|». A8-A15 READY 74LS373 AD7 8D 8Q A7 AD6 10 7D 7Q A6 AD5 6D 6Q A5 AD4 12 5D 5Q A4 MN/MX* AD3 13 4D 4Q A3 AD2 14 3D 3Q A2 TEST- AD1 15 2D 2Q A1 ADO 16 1D 1Q AO HOLD CLK OE

INTR Al F 25 HOLDA 30 NMI D7 D6 D5 D4 RD' WR' IO/M* D3 32 29 28 D2 IO/M' D1 WR* DO RD*

Figure B.5: CPU schematic.

The number of ICs required is about the same as for a design with an 8-bit CPU. The 8088 is easier to interface than other 8-bit processors because of more relaxed bus timing specifications. This allows the relatively slow D/As to be connected directly to the CPU bus. The 8284 clock chip provides a 5 MHz clock for the 8088 microprocessor. The 74LS373 demultiplexes the 8088's address/data bus.

Figure B.6 shows the memory and I/O address decoding circuits. A 74LS139 dual two- to-four decoder selects either the RAM or the EPROM. A 74LS138 three-to-eight decoder selects one of the two D/As, the parallel interface chip, or a common output transfer signal for the D/As. Figure B.7 shows the two memory chips. A 32k static RAM (62256P-12) was used so that code could be downloaded to the control unit for testing. The 32k EPROM (27256-25) Appendix B. The Fading Simulator 127

74LS139 2 4 A15- AO YO* . RAMCS* 3 5 A1 Y1* . ROMCS*

1 IO/M* E*

74LS138 1 15 A5- AO YO* IO0CS* 2 14 A6- A1 Y1* I01CS* 3 13 A7- A2 Y2* I02CS* 12 Y3* I03CS*

6 IO/M*- E1 5 A8- E2* 4 A9- E3*

Figure B.6: Address decoding schematic. contains the program and about 22k bytes of look-up tables. Figure B.8 shows the D/A output circuit and the switch input circuit. One 8-bit port on the 8255A parallel interface chip reads the positions of the eight toggle switches. These switches set the simulator's run/stop status, the Doppler rate when the simulator is running, and the RF level when the simulator is stopped. The D/As are 12-bit National Semiconductor DAC1208LCD. Their double-buffered data registers allow values to be pre-loaded into each D/A and then output simultaneously using a common control signal.

Analog Section

The reconstruction filters create a continuous waveform from the discrete D/A output. A simple filter can be used because the sampling rate, approximately 3 kHz, is much higher than the maximum Doppler rate. Appendix B. The Fading Simulator 128

2764/27128/27256

A0-A14 A0-A14 EinoLLts D0-D7 D0-D7 Data Bus Address Bus RD* 22 DO 11 AO 10 OE' D1 12 A1 9 D2 13 A2 8 ROMCS* ' 20 CS' D3 15 A3 7 D4 16 A4 6 + 5 1 D5 17 A5 5 Vpp 06 18 A6 4 D7 19 A7 3 A8 25 A9 24 A10 21 A11 23 62256 A12 2 A13 26 A14 1 27 A0-A14 A0-A14 62256 D0-D7 2764/27128/27256 D0-D7

RD* 22 OE*

WR* 27 WE*

RAMCS* 20 csr

Figure B.7: Memory schematic.

The filter's cut-off frequency must be greater than the maximum Doppler rate while still providing enough filtering at the lowest effective sampling rate. The filter must also have a linear phase response up to the maximum Doppler frequency because a non• linear phase response would change the phase relationships between the control signal frequency components. Although a high-Q filter has a more linear phase over the pass- band it also has a poor transient response to step changes in D/A output. Finally, the gain of the filter must be high enough to let the D/A drive the mixers to minimum atten• uation. A filter output of about 2 volts provides enough current to drive the quadrature modulator to minimum attenuation when used with the mixer interface circuit described in the next section.

A second-order Butterworth filter was selected. The 3 dB frequency is 570 Hz, the Q is 0.7, and the gain is 0.8. The schematic is given in Figure B.9. Three of the amplifiers Appendix B. The Fading Simulator 129

DAC1208 D0-D7 DI4-DI11

D7-D4 DI0-DI3 ICCSO* CS*

IOCS2* 21 XFER* WR* WR1* 22 WR2* t-5V AO 23 BYTE1/BYTE2* 1k

DAC1208 8255A D0-D7 DI4-DI11 ^DO-07 D0-D7 PAD

D7-D4 AO 9 AO DI0-DI3

A1 8 A1 locsr CS* PBO-7 IOCS3* 6 CS* XFER* N.C.

WR* 36 WR* WR1*

RD* 5 PC0-7 22 WR2* RD' N.C.

23 RESET 35 RESET BYTE1/BYTE2*

Figure B.8: D/A and parallel I/O schematic. are used for the filter and one is used to convert the 0 to 5 volt D/A output to ± 2.5 volts. The major sources of noise on the control signals were digital signal noise coupling onto the analog circuitry and D/A switching transients. The digital and analog circuits used separate power and return lines to reduce the effect of the digital signal noise. A 47 nF capacitor (not shown on the schematics) was also connected from the power supply line to ground near each logic IC. Ringing at the D/A output transitions was reduced by using a low-impedance return (the chassis) for connections between the D/A and the analog circuit (on a separate board). In addition, the D/A output was bypassed to ground by small (1 nF) capacitors to filter out the highest frequency components. These steps reduced the output noise level to less than 2 mV.

The design could be improved by using a sample-and-hold on the output of the D/A to let the D/A switching transients die out before the sample is output. Appendix B. The Fading Simulator 130

+15V +15V -15V 3.3k 1ul V- 1/2 W it~* (Pin 4) 1uF_L- (pin11)

—AAAr 16.9k 10k 1uF 1uF output "AA/V 1 216 216 signal J (I orQ) WVTb 3 12 -b nF 22.7k 10k -Wv- each Op-Amp 1/4 TL084

Figure B.9: Analog interface schematic. One of two reconstruction filters is shown.

Construction

The prototype was built with 3M Scotchflex™ push-wire sockets. These sockets sped up the wiring but cost more than wire-wrap sockets. A ground plane was not used but it may have reduced the amount of digital noise.

B.3 The RF Quadrature Modulator

Figure B.10 shows the components in the quadrature modulator and the IF port matching network. The unit described here operates at 145 MHz although wideband units can also be built or bought.

B.3.1 Mixers

The RF drive level to the mixers is critical. The RF drive level to the Mini-Circuits SRA-1 double-balanced mixers must be sufficiently high (approximately +7 dBm) or the Appendix B. The Fading Simulator 131

Merrimac 113A splitter

ferrite

•\ S\ /K i i 3,4 LO mmum 1 control 50 > Mini-Circuits Mini-Circuits signal IF SRA-1 SRA-1 1nF 1nF ) DBM DBM ~r 5,6 RF

Merrimac RF 113A output combiner

Figure B.10: Diagram of the RF quadrature modulator with schematic of the IF port matching network. Only one of the two matching networks is shown.

RF output will not be a linear function of the control current. The input to the fading simulator should be approximately 11 dBm since the loss between the power splitter input and each output is about 3.8 dB. More information on mixer selection is available in [66]. Either the RF or LO port can be used as the RF input. The control signal must be applied at the DC-coupled IF port.

A lower RF drive level would be desirable to reduce the amount of RF leakage and the shielding requirements. A version of the control unit was built using a look-up table to make the mixer attenuation a linear function of control current at reduced RF drive levels. The fading had the right amplitude distribution but the wrong level crossing rate (see Section B.4). This is believed to result from control current effects on the mixer phase shifts. Appendix B. The Fading Simulator 132

B.3.2 IF Port Network

The mixers require 50 ohm terminations at all three ports. A 50 ohm resistor in series with a 1 nF DC-blocking capacitor provides the proper termination at the IF port. The 590 ohm current-limiting resistor converts the control signal voltage to a current for the (current-controlled) mixer. The ferrite bead and the 1 nF bypass capacitor help reduce RF leakage through the control unit. The bandwidth of this network is much greater than that of the control signal.

The rise time of the mixer output was measured with a spectrum analyzer used as an envelope detector (Section B.4).

B.3.3 Splitters

One of the two Merrimac 113A in-phase (0°) -3 dB power splitters is used as a power splitter, the other as a combiner (see Figure B.10). The amplitude imbalance between the branches was measured to be less than 0.1 dB and the phase imbalance less than 2°.

B.3.4 Delay Line

The 90° phase shift is produced by making one of the co-ax cable connections an electrical quarter-wavelength longer than the other. Performance should be equally good within a few percent of the center frequency even though the phase shift is exactly 90° at only one frequency. The design center frequency was 145.5 MHz.

B.3.5 Construction

The components were mounted on an insulating board and connected with short pieces of thin, well-shielded co-ax cable (RG-316/U). Good shielding is required to prevent sig• nal leaks from forming a path around the fading simulator. Such paths prevent deep fades and reduce the dynamic range of the simulator. A cast aluminum box with BNC Appendix B. The Fading Simulator 133 connectors was used. Aluminum foil was used as a gasket to seal the aluminum box. Connections to the signal source were made with well-shielded co-ax cable.

B.4 Performance Measurements

The simulator was tested by measuring the cumulative probability distribution function (CPDF) and the level crossing rate (LCR) (see Section 2.1). Figure B.ll shows how the measurements were made. detected video output +6 dBm fa5[.Ln9 s'™uia.!or (log scale) 145 MHz (0-800 mV) CW quadrature modulator 30 kHz RBW H: 0 kHz/div Marconi 2022 V:10dB/div signal generator Q simulator HP 8558B controller spectrum analyzer

CPDF 10 bit LCR « 8 KHz AD Computer

Figure B.ll: Fading simulator performance measurement setup. The detected video signal from the spectrum analyzer is proportional to the signal level in dB. This signal is digitized and the computer then calculates various statistics to confirm proper operation.

The Marconi 2022 signal generator produced a +6 dBm CW signal (the maximum generator output) at 145 MHz. An HP 8558B spectrum analyzer measured the level of the simulator output. The frequency sweep was set to zero so that the spectrum analyzer operated as a frequency-selective envelope detector. A 30 kHz resolution bandwidth (RBW) with no video filteringwa s used to avoid distorting the envelope waveform. The 8558B provides an analog voltage output proportional to the signal level in dB. This Appendix B. The Fading Simulator 134

signal was sampled with a 10-bit A/D converter (see Appendix C) at 8 kHz. The LCR and CPDF were computed from one million samples (approximately 2 minutes sampling time). Similar results were obtained using the IC2AT transmitter as the signal source.

B.4.1 CPDF

The CPDF measurements test the distribution of the envelope level and the simulator's dynamic range. Figure B.l2 compares the Rayleigh CPDF and the measured CPDFs for Doppler rates of 2, 20, and 120 Hz. The measured distributions are Rayleigh to within about 1 dB between -40 to +10 dB.

\ ' i i i i i i i i I i i i i i i i i |, I i i i Iii i i I i i i i I i i i i I i i i i f~ -50 -40 -30 -20 -10 0 10 Level above Mean (dB)

Figure B.l2: Comparison of measured and Rayleigh CPDFs (cumulative probability dis• tribution functions) for three Doppler rates. The CPDF is the probability that the signal will be below the indicated level. Appendix B. The Fading Simulator 135

B.4.2 Level Crossing Rate

The LCR measurements check time statistics. Figure B.l 3 compares the theoretical and measured LCRs for Doppler rates of 2, 20, and 120 Hz. The 2 Hz measurements were made on every tenth sample to reduce spurious level crossings caused by noise. The 2 Hz measurements are thus based on only 100,000 samples. The LCR measurements generally agree with the theoretical values for levels from -30 to +10 dB (±1 dB).

_——e- -o-e- -©-a. Q 100 120 Hz ^-xf^

-

N X

CD 10 20 Hz rr - o

cn 2 _ .- — A" -A- A" -a—£- ^ o -TJ > CD 2 Hz

0.1 1 1 I I 1 1 I 1 1 i i I , i I -30 -20 -10 0 Level above Mean (dB)

Figure B.l3: Comparison of theoretical and measured level crossing rates (LCRs) for three Doppler frequencies. The deviations from the theoretical at 120 Hz are due to limitations of the measurement method.

For some of the 120 Hz LCR measurements the sampling period is on the order of the average fade duration so many level crossings are not detected. The measurements are therefore lower than expected. For example, at a Doppler rate of 120 Hz the average fade duration at -30 dB is 105 /xs while the sampling period is 125 us. Appendix C

The Analog/Digital Interface

C.l Introduction

This appendix describes the analog interface board that was built to generate and sample the baseband OFDM signal. The interface features an 8 kHz sampling rate with simul• taneous input and output sampling, no sampling jitter, and a reliable error indication for any sampling overrun condition. The interface was also used to measure the statistics of the fading simulator described in Appendix B. The interface circuit was built on an IBM PC wire-wrap prototyping board [81].

C.2 Circuit Description

C.2.1 Timer Circuit

Figure C.l shows the schematic of the timing circuit. The hardware and software support a maximum sampling rate of 8 kHz. An 8 MHz crystal oscillator clock is divided by 4 to produce a 2 MHz timing clock. The 8253 timer generates the master timing signal labelled S/H (sample and hold). Two of the 8253's programmable timer sections are used. Section 0 of the timer divides the 2 MHz clock to generate an 8 kHz clock. Section 1 of the timer is a one-shot triggered from the 8 kHz clock and generates S/H, a 4^s-long pulse every 125 us.

136 Appendix C. The Analog/Digital Interface 137

8253 +5V 1 -8 11 DB0-DB7 + DB0-DB7 GATEO 22 10 RD* — RD* OUTO 21 14 CLKCS* — CS* GATE1 23 13 WR* — WR* OUT1 S*/H 20 16 A1 — A1 GATE2 N.C. 19 17 AO — AO OUT2 N.C.

CLK2 CLX1 24 Voc +5V CLKO 12 GND

2 MHz

N.C.

Figure C.l: Timing circuit schematic.

C.2.2 A/D

Figure C.2 shows the schematic of the A/D converter and the sample-and-hold circuits. The S/H signal controls the PMI SMP-11GY sample-and-hold. The NEC ^PD7004 A/D converter chip has a conversion time of 100 microseconds, 10 bit resolution and ± 1 bit linearity. The A/D's clock rate and input channel (0) are selected by writing to registers in the chip. Conversions are started under program control by writing to a register.

C.2.3 A/D Status

Figure C.3 shows the circuit that lets the CPU test the A/D status and check for overruns. The 8255 parallel interface chip reads the "sampling" and "overrun" status latches. The "sampling" signal indicates that the S/H is in sampling mode and thus that the previous conversion should have completed. When this signal goes high the CPU reads the A/D result and starts another conversion by writing to the A/D. The "overrun" status bit Appendix C. The Analog/Digital Interface 138

UPD7004C Vref 1-4, 26-28 23 V+ cm -CH7 . N C +5V 15 V+ SMP11GY 25 7 18 MC CHO OUT IN analog in IVI w 19 13 WR* WR* Vic Null N.C. 22 ADCCS* CS* Null N.C. 11 RD* 21 RD* Ch V- -12V 20 AO AO V + +12V 5nF - DBO- DB7 X S*/H N.C GND 14 24 1,6,8,10,12 GND 16 . EOC* CLK N.C. 17 S*/H 2 MHz

Figure C.2: A/D and sample-and-hold schematic.

indicates that an A/D overrun has occurred. This bit is set by latching the A/D's EOC (end of conversion) status signal into a second latch with the falling edge of the S/H control signal (start of sampling). This status signal is thus set if a conversion did not complete before the start of sampling for the next sample. Both status latches are cleared when the CPU starts a new conversion by writing to the A/D (indicated by ADCS and WR signals).

C.2.4 Address Decoding and D/A

Figure C.4 shows the address decoding circuitry that generates chip selects for the four I/O devices (NEC /iPD7400 A/D, National 1208 D/A, 8253 timer and 8255 parallel interface) and the D/A. The remainder of the address decoding circuit was built into the prototyping board [81] and is not shown here.

The D/A is a National 1208LCD with 12-bit resolution and is linear to ± 0.012 percent

of the full-scale output. The input registers are double buffered so that a value can be Appendix C. The Analog/Digital Interface 139

1/2 74

Q1 SVH PRE1* ADCS CLR1* WR 8255 1/4 '02 1/4 '02 13[ 1/2 74 ' CLR2* PAO (sampling) 12 37 EOC* Q2 PA7 (overrun) D2 27-36 PA1-PA6 10 11 34-27 CLK2 SVH DB0-DB7 DB0-DB7 1/4 '02 36 WR*- WR* PIACS*- CS* RD* - RD*

A1 - A1 A0- AO

35 RESET- RESET

Figure C.3: A/D status circuit schematic.

pre-loaded into the D/A without changing the current output value. The new input value is transferred to the output on the next falling edge of the (hardware-generated) S/H signal.

C.2.5 A/D and D/A Analog Interface

The D/A and A/D interfaces were designed to operate with signals between ± 2.5 volts. Shielded cable was used to reduce digital noise pickup and RF leakage. Ferrite beads were used to reduce RF output from the PC. The D/A interface, shown in Figure C.5, supplies a ± 2.5 volt signal from the D/A. The 100 pF compensating capacitor was required to avoid oscillation with some loads. The A/D analog interface, shown in Figure C.6, converts the input bipolar signal to a 0 to 5 volt signal. The input offset is adjustable. The A/D input is protected with diodes. Since neither interface circuit includes filtering, the analog input and output signals were filtered using external Krohn-Hite model 3342 filters. Appendix C. The Analog/Digital Interface 140

E14- AO DAC1208 E13- A1 „ 15-20,4-5^ D11-D4 Vref 10 U5-1 6- RD* 1 6-9. D3-D0 |out1 13 U5-18. WR* 2 14 WR*- WR1* |0ut2 E16- RESET 1 11 DACCS*- CS* Rfb B2- •N.C. E18 23 3 (RSTDRV) A0 BYTE1/BYTE2* AGND 21 12 S7H XFER* DGND E1,3,4,6 . + DB0-DB7 22 24 E7-10 + WR2* Vcc - H10V

'138 4 15 E11 G1A* YO* PIACS* (I/O DECODE*) 5 14 G2B* Y1* ADCCS* 1 13 E12(A2)- A Y2* DACCS* 2 12 E2 (A3). B Y3* 3 E5 (A4) • C 6 +5V- G1

Figure C.4: Address decoding and D/A schematic.

C.3 Software

Appendix E contains a listing of the 8088 assembly-language routine to read and write a block of samples to and from the analog interface board. The routine can be called from programs compiled with Microsoft FORTRAN version 3.3 or 4.0. The routine is passed an array of 16-bit numbers (declared with the LARGE attribute) and a 32-bit integer containing the number of samples to be read and written. The array may extend over multiple 64k segments. The routine sends the block of samples to the D/A and replaces these samples with the samples input from the A/D. The routine also converts the samples between two's-complement and the left-aligned unsigned format required by the hardware. The routines were only tested on an IBM PC AT although they were designed to work with an IBM PC as well. Appendix C. The Analog/Digital Interface 141

(B9) 7805 7905 +5V (B7) . in out out + 12 +10 -123 •10

1N4733A-JL -L 1N4733A.-U = 5.1V Y T 5.1V ¥ 1

2.5V

analog out

-b/"*7 ferrite bead

each Op-Amp 1/4 TL084 all resistors 1% TL084 power from +/-10V (pins 4,11)

Figure C.5: D/A analog interface schematic.

The I/O subroutine turns off all maskable interrupts during sampling to avoid over• runs that could occur while executing interrupt routines. This does not affect the DMA- based memory refresh.

C.4 Testing

C.4.1 Noise

Noise from the digital circuitry made the A/D reading fluctuate by about 1 sample value. One hundred thousand samples were taken with the A/D input disconnected (floating). About 0.1% were read as -1, about 0.2% were read as +1 and the rest were read as 0. The measurement was repeated with the D/A output connected to the A/D input to check the noise on the D/A output. One sample was read as 0, about 66% were read as 1 and about 34% were read as 2. Appendix C. The Analog/Digital Interface 142

19 +10 V out analog 24 -10 V out interface connector 21 (DB-25) NEC D7004C 9 • analog out ADC LM336 2.5V 10k 10pF 10 LM336 i 2.5V

13 . analog in HAAH SMP11GY 10k 12 13 10k 5.11k 14 2.5V- •%-vw 12

10k ferrite 2 analog bead 3 in each Op-Amp 1/4 TL084 196k all resistors 1 % TL084 power from +/-10V (pins 4,11)

Figure C.6: A/D analog interface.

C.4.2 Distortion

Harmonic distortion was measured by sampling a 500 Hz, ± 2 volt sine wave produced by a signal generator and computing the power spectrum. The harmonic distortion was computed as the ratio of the power in a 100 Hz bandwidth about the sine wave frequency to the power outside that range. The ratio was over 45 dB.

C.4.3 Linearity and Accuracy

The linearity and range were checked by comparing the A/D and D/A readings to a DMM. The protection diodes were removed and 100,000 samples of a 0.1 Hz ramp function were taken. The values read from the A/D were checked and all possible values were present. The diodes limited the voltage at the A/D input to between 5.6 volts and -0.6 volts and the A/D sample values were restricted to between 474 and -512. Appendix C. The Analog/Digital Interface 143

C.4.4 Jitter

The A/D sampling clock jitter was checked by looking at the sample and hold signal, S/H, with an oscilloscope. The delayed time base was set to display an edge of this signal at a sweep rate of 1 us per division after a delay of 45 ms from the same edge. The cumulative peak jitter after the 360 clock periods was less than 1 ^s, about 0.002 percent. Some or all of this may have been due to the oscilloscope's time base or noise on the triggering signal. The D/A sampling clock will have the same jitter because the D/A transfer signal is also controlled by the S/H clock.

C.4.5 Clock Accuracy

The sampling rate was checked with a frequency counter. It was 8000 ± 1 Hz.

C.4.6 Overrun Indicator

The overrun indication was tested by increasing the sampling rate until overrun errors were obtained. The minimum reliable sampling period was 112 us (8.9 kHz) on an 8 MHz IBM PC AT. Appendix D

RF SNR Measurement

D.1 RF SNR Measurement

As mentioned in Chapter 5, the RF SNR was measured instead of the IF SNR because the IF noise level could not be measured reliably. This appendix describes the RF SNR measurement.

variable RF IF attenuator SNR SNR receiver

transmitter l down- receiver 1 i discriminator converter IF filter noise >1 source J s.a. SNR spectrum analyzer

down- IF i envelope log converter —->filte r t detector display

Figure D.l: Measurement of RF SNR.

Figure D.l shows a block diagram of the equipment used. The signal and noise powers were measured with the spectrum analyzer. The RF signal power was measured after replacing the noise source with a 50 ohm termination. The noise power was measured after replacing the transmitter with a 50 ohm termination. The noise power measurement is described in detail in Section D.3. The 50 ohm terminations were used to maintain

144 Appendix D. RF SNR Measurement 145

the impedance match at the power combiner1. The measured signal and noise levels are given below. Since the noise is wide-band, the IF noise power measured by the spectrum analyzer will depend on the analyzer's IF filter bandwidth. Since the receiver has a narrower IF filter than the spectrum analyzer, the receiver's IF will receive less noise (relative to the signal) than the spectrum analyzer's IF. This effect can be corrected by scaling the noise power measurement by the ratio of the two IF filter noise bandwidths. Section D.4 describes the measurement of the noise bandwidths. The calculation of the IF SNR (with OdB signal attenuation) is as follows:

measurement value units

signal power -9.1 dBm

noise power -80.4 dBm noise bandwidth correction 3.6 dB computed IF SNR 74.9 dB

The attenuator can be used to reduce the RF signal level and thus reduce the SNR. For an SNR of X dB the attenuator is set to 75-X dB.

D.2 Accuracy

The accuracy of the SNR measurements is determined by the accuracy of the spectrum analyzer RF level measurements and the accuracy of the noise bandwidth measurements. The signal and noise level measurements were made by adjusting the spectrum analyzer's attenuators to bring the displayed level to a reference point. The accuracy specifications of the spectrum analyzer's step and vernier attenuators are ± 1 dB and ± 0.5 dB. The video filter was set to minimum bandwidth (about 1.5 Hz) to average the statistical fluctuations in the noise level. The vertical display was set to 1 dB/division. The measurements were

1 Turning the noise generator off changes its output impedance. Appendix D. RF SNR Measurement 146

repeated several times over a period of several months and the same results were obtained to within ±0.5 dB. Note that the absolute power levels read by spectrum analyzer need not be accurate (and they were not) because the final SNR result is the difference of two powers measured in dB. The different noise bandwidth measurements in Section D.4 gave results within a few kHz. The SNR measurement accuracy is therefore probably between ± 1 and ± 2 dB.

D.3 Noise Power Measurement

The procedure for measuring RF noise power with a spectrum analyzer is explained in [82,83,84]. The noise power measurement requires two corrections. The first correction is for the noise added by the spectrum analyzer's RF amplifier. The measured noise power is the sum of the spectrum analyzer's internally generated noise plus the noise of the device being measured. The first correction is therefore to subtract the noise power contribution of the spectrum analyzer from the measured noise power. The second correction is for the response of the spectrum analyzer's envelope detector and log amplifier to non-sinusoidal signals. The output of the detector and log amplifier depends on the probability distribution of the received signal. The spectrum analyzer's display is calibrated for sinusoidal signals rather than Gaussian noise. The spectrum analyzer's noise power reading must be increased by 2.5 dB to correct for the effect of the noise distribution [82].

The following table shows the noise power calculation. Appendix D. RF SNR Measurement 147

measurement value units

noise floor -85.5 dBm

measured noise level -81.0 dBm correction for noise floor -1.9 dB detector and log amplifier correction +2.5 dB

noise power -80.4 dBm

D.4 Noise Bandwidth Measurements

The noise bandwidth, BN, of a filter is defined as

1 f°° BN=- g(f)df go J-oo where g(f) is the power gain of the filter at frequency / and g0 is the gain at filter's center frequency [49]. The noise bandwidths of the IF filters were calculated from the measured filter gain measurements with the approximation

where the ^s are the filter gains measured at frequency intervals of A/ and g0 is the filter gain in the passband (see Section D.4.2). The noise bandwidth measurements of the spectrum analyzer and receiver IF filters are described in Sections D.4.1 and D.4.2 respectively. All of the SNR measurements were made using the spectrum analyzer's 30 kHz (resolution bandwidth) IF filter. The noise bandwidth of this filter was found to be 34.4 kHz. The noise bandwidth of the receiver's IF filter was found to be 14.9 kHz. The following table shows the correction required to compensate for the difference in IF noise bandwidths. Appendix D. RF SNR Measurement 148

measurement value units

s.a. noise bandwidth 34.4 kHz receiver noise bandwidth 14.9 kHz

noise bandwidth correction -3.6 dB

D.4.1 Spectrum Analyzer IF Filter

Figure D.2 shows how the measurement was made. The frequency response of the filter was measured by varying the frequency of the input signal and reading the signal level displayed by the spectrum analyzer. The frequency sweep was turned off (0 kHz/division) so that the analyzer remained tuned to one frequency. The gain of the spectrum analyzer's 30 kHz IF filter was measured over a 100 kHz range in steps of A/ = 5 kHz. The measurements are shown in Figure D.3. The noise bandwidth of the IF filter was found to be 34.4 kHz.

Marconi 2022 HP8558B Signal Generator Spectrum Analyzer

H: 0 kHz/div. RF output O V: 1 dB/div RF input

Figure D.2: Measurement of spectrum analyzer noise bandwidth.

The noise bandwidth of the IF filters used in HP spectrum analyzers is approximately 1.2 times the 3 dB bandwidth [82]. The nominal 3 dB bandwidth is the specified resolution bandwidth (30 kHz), giving a nominal noise bandwidth of about 36 kHz. The 3 dB bandwidth was measured to be 27 kHz, giving a noise bandwidth of about 32 kHz. Both estimates confirm the 34 kHz noise bandwidth measurement. Appendix D. RF SNR Measurement 149

100 110 120 130 140 150 160 170 180 190 200 210 Frequency (kHz)

Figure D.3: Frequency response of spectrum analyzer 30 kHz filter.

D.4.2 Receiver IF Filter

Figure D.4 shows how the noise bandwidth of the receiver's IF filter was measured. The signal generator's frequency was varied and the signal at the output of the IF filter was measured with an RMS voltmeter. The signal level was kept within the linear region of the receiver's RF and IF amplifiers (42 mV RMS maximum at IF). A constant wide-band noise of 0.85 mV RMS was subtracted from all of the readings. The gain was measured over a 26 kHz range in steps of Af — 1 kHz. The measurements are shown in Figure 5.7. Since the filter gain over the passband is not constant, the filter gain was calculated as the average gain over a 10 kHz range about the center frequency. The noise bandwidth was calculated to be 14.9 kHz. Appendix D. RF SNR Measurement 150

B&K 2426 Marconi 2022 RMS Voltmeter Signal Generator IC2AT pp Transceiver in \ O ant. o c RF output] IF output

Figure D.4: Measurement of receiver noise bandwidth. Appendix E

Program Listings

This appendix contains listings of the various programs mentioned in the thesis. Table E.l shows the types of listings and the compilers used (the Unix version was SunOS release 3.2).

suffix language compilers) used • f FORTRAN 77 Unix f 77, Microsoft FORTRAN 77 v.4.0.1 .for FORTRAN 77 Microsoft FORTRAN 77 v.4.0.1 . asm 8088 assembler Microsoft MASM assembler v.4.0 . c C Turbo C 2.0, gcc . csh csh shell Unix csh . awk awk Unix awk . sed sed Unix sed, GNU sed (for MS-DOS)

Table E.l: Types of listings and compilers used.

Table E.2 shows the major groups of routines that are used by the different BER evalu• ation procedures. The table shows that none of the routines are common to all of the BER evaluation methods. This independence helps to prevent errors in one software module from affecting all of the results and makes it less likely that errors will go undetected. The following list briefly describes the contents of the listings included in this ap• pendix:

• makefiles and sed customization scripts

makefile describes dependencies and how the various programs are com• piled (for MS-DOS)

151 Appendix E. Program Listings 152

Monte-Carlo Baseband Hardware Routine Integration Simulation Measurement data generator and bit/word error * • rate counters Rayleigh fading • • channel simulation using SN curve • • look-up tables baseband noise generator • QAM encoding/decoding and OFDM • • mo dulation/ demodulation pre-emphasis, phase synchroniza• • tion, A/D and D/A

Table E.2: Routines used for BER evaluations.

makeunix UNIX makefile

sim2ibm. sed sed script to convert programs to the MS-DOS FORTRAN com• piler

sim2unix.sed sed script to convert programs to the UNIX FORTRAN com• piler

• baseband simulation and experimental measurements

simrun.f the main program for baseband simulations and experimental measurements

simpdef .f declarations of variables that control the simulations

simpget.f input of variables described in simpdef .f

simfde.f Rayleigh fading generator

simdiv.f '

simgen.f Gaussian random number generator and pseudo-random bit sequence (PRBS) generator ndix E. Program Listings 153

simmod.f QAM encoding and decoding and OFDM modulation and de• modulation

simsnr. f theoretical SN curve computation for an FM receiver, SN curve lookup, and baseband channel simulator

simfec.f BER and WER evaluation and simple FEC

simut.f utility subroutines and functions

simhw.f hardware interface and software preemphasis

simdum.f dummy hardware routines to replace simhw.f when compiling under UNIX

sif f t. dif This file is the portion of the file FAST.FOR from [54] that fol• lows subroutine FFA (with minor changes). It includes the rou• tines FFA and FFS which use efficient (radix-8,4,2) FFT rou• tines and that were used to implement OFDM (de)modulation. Since this is a large file and is widely available, the listing con• tains only the differences from the original as reported by the UNIX dif f program.

Monte-Carlo integration and BER bounds (these use many of the routines in the files described above)

f dint. f Monte-Carlo integration

pint. f BER bound computation

analog interface routine

io.asm is the 8088 assembly-language subroutine that reads/writes samples from/to the analog hardware interface

fading simulator Appendix E. Program Listings 154

sim.asm the 8088 assembly-language program that controls the hard• ware fading simulator

ctabgen.for computes scaled cosine tables for sim.asm

ptabgen.for computes phase increment tables for sim.asm

• program to compute BER and WER with various FEC codes

ceval.c evaluates BER and WER performance of BCH or RS codes from the bit-error position information generated by simrun.f

• program to compute errors-per-word distribution

bkp. c computes the distribution of the number of errors in a word using the independent error assumption from block bit error

rates (BERbk)ck) generated by f dint. f

• examples of awk and csh scripts for manipulating simulation program output

out2bers.csh generates files containing block BERs for all SNR and block length combination by using the UNIX awk program.

out2bers. awk an awk "script" to extract the block BERs for one SNR and one block size from the combined results in the simulation output file

out2runs. awk an awk "script" to compute the distribution of the number of DFC passes from the simulation output file makefile $D\fdint.exe : fdint.obj simsnr.obj simfde.obj \ simdiv.obj simut.obj simgen.obj # makefile for OFDM software ${LINK} fdint.obj simsnr.obj simfde.obj \ # using Microsoft Fortran v. 4 0 compiler simdiv simut simgen ${LINKOPT} # Ed.Casas ${M0VE}

COMP = fl /Od /c /4Yd t disable optimize, compile only simrun.obj : simrun.f simpdef.f simpget.f # strict declarations ADD = /4Yb /Ge # /4Yb for runtime error trace. io.obj : \hw\pcio\io.asm # /Ge for stack check masm \hw\pcio\io.asm ; LINK = link # link command LINKOPT = /E ; # EXEPACK option $D\simrun.exe : simrun.obj simmod.obj simfec.obj \ D = ..\bin # binary destination directory simfde.obj simgen.obj sifft.obj simsnr.obj simut.obj \ MOVE. = ( copy $*.exe $D ; \ simhw.obj simdiv.obj io.obj del $*.exe ) # install in binary directory ${LINK} simrun.obj simmod.obj simfec.obj \ simfde.obj simgen.obj sifft.obj simsnr.obj simut.obj \ .SUFFIXES: .exe .obj .f .asm simhw.obj simdiv.obj io.obj ${LINK0PT} ${M0VE} .f.obj : ${COMP} ${ADD} /Tf $< $D\bkp.exe : bkp.c tc bkp.c .asm.obj : ${MOVE} masm $< ; $D\ceval.exe : ceval.c all : $D\fdint.exe $D\simrun.exe \ tc eval.c $D\pint.exe $D\bkp.exe $D\ceval.c ${M0VE} clean : del *.obj makefile (unix) del *.fX FC = f77 # select code for for little- or big-endian CPUs FFLAGS = -f68881 -c -u -C LD = f77 -f68881 simfde.obj : simfde.f LDOPT = -o $@ sed -f sim2ibm.sed simfde.fX CVT = sed -f sim2unix.sed ${COMP} ${ADD} /4Ns /Tf simfde.fX OBJ = fdint pint simrun bkp ceval BINDIR = ..\bin # IEEE DSP routines don't declare variables and subscripts are wrong all : ${0BJ} sifft.obj : sifft.f ${C0MP} ${ADD} /4Ns /4Nd /4Nb /Tf sifft.f install : mv ${0BJ} ../bin pint.obj : pint.f simpdef.f simpget.f sifft.o : sifft.f $D\pint.exe : pint.obj simut.obj simsnr.obj ${FC} -f68881 -c sifft.f ${LINK} pint simut simsnr $(LINKOPT} ${MOVE} simfdeX.f : simfde.f ${CVT} simfde.f >simfdeX.f fdint.obj : fdint.f simpdef.f simpget.f f diritx. f : fdint. f simpdef. f simpget. f ${CVT} faint.f >fdintx.f simrun.f fdint : fdintx.o simsnr.o simfdeX.o \ $LARGE

simdiv.o simut.o simgen.o c **************** ${LD} fdintx.o simsnr.o simfdeX.o \ c simrun.f - OFDM Simulation simdiv.o simut.o simgen.o ${LDOPT) c **************** c Ed.Casas pintX.f : pint.f simpdef.f simpget.f c ${CVT} pint.f >pintX.f c link with the following files : c pint : pintX.o simsnr.o simut.o c sifft.f - FFTs (adapted from IEEE DSP library) ${LD} pintX.o simsnr.o simut.o ${LDOPT) c simdiv.f - switching diversity c simdum.f - dummy hardware interface (non-IBM PC) simrunX.f : simrun.f simpdef.f simpget.f c simfde.f - fading envelope generation ${CVT} simrun.f >simrunX.f c simfec.f - FEC and bit/block error counting c simgen.f - noise and data generators simrun : simrunX.o simmod.o simfec.o \ c simhw.f - hardware interface (IBM PC) simfdeX.o simgen.o sifft.o simsnr.o simut.o \ c simmod.f - OFDM (de)modulation simdum.o simdiv.o c simsnr.f - IF to AF signal/noise level conversion ${LD} simrunX.o simmod.o simfec.o \ c simut.f - various utilities simfdeX.o simgen.o sifft.o simsnr.o simut.o \ c simdum.o simdiv.o ${LDOPT} c includes the following files: c pdf : pdf.o simut.o c simpdef.f - declarations of simulation parameters ${LD} pdf.o simut.o ${LD0PT} c simpget.f - input of simulation parameters c bkp : bkp.c c Major Revisions: gcc bkp.c -lm -o bkp c c 85- VAX/VMS FORTRAN and FPS AP-100 routines ceval : ceval.c C 86- VAX/VMS FORTRAN gcc ceval.c -lm -o ceval c 87-8 FORTRAN 77 (Microsoft v3.3 compiler subset) c sim2ibm.sed program simrun /AClBM/s/cIBM/ / c

sim2unix.sed $INCLUDE: 'simpdef.f

/A$LARGE/d c /A$INCLUDE: ' simpdef.f/r simpdef.f /A$INCLUDE: 'simpdef.f/d c local variables: /A$INCLUDE: 'simpget.f/r simpget.f /A$INCLUDE: ' simpget.f/d c i - trial counter /AcSUN/s/cSUN/ / c j - simulation block counter c k - signal block size counter c 1 - snr counter c n - signal block size cm - index of OFDM block in simulation block c sp - signal power (calculated by modu) runs - sums of number of runs statistics c oldsnr - fading waveform average snr ber2, bker2 - sums of squares of BERs and BkERs c ifl - Index into array corresponding to value of fl runs2 - sums of squares of number of runs statistics c if2 - Index into array corresponding to value of f2 nber, nbker - number of BER and BkER trials c nf - if2-ifl+l = number of frequencies between ifl and if2 nruns - number of runs statistics c nO, nl - number of non-error and errors (for runs test) nb, nw - number of bits/words per trial c nr - number of runs (for runs test) nbx, nwx - number of bits/words examined in a trial c r - normalized number of runs statistic (for runs test) integer nbel, nbe2, nwe2, npass integer i, j, k, 1, m, n integer nbx, nwx integer nO, nl, nr integer nbe (mxblk,mxsnr), nwe (mxblk,mxsnr) integer ifl, if2, nf integer nb (mxblk,mxsnr), nw (mxblk,mxsnr) real r real ber (mxblk,mxsnr), bker (mxblk,mxsnr) real oldsnr real runs (mxblk,mxsnr) real ber2(mxblk,mxsnr), bker2(mxblk,mxsnr) c statistics functions: mean, lower and upper .95 CI real runs2 (mxblk,mxsnr) integer nber(mxblk,mxsnr), nbker(mxblk,mxsnr) real stmn, stl95, stu95 integer nruns (mxblk,mxsnr) c convert power to dB c test dibits or bits for runs test

real dbp logical dibits parameter (dibits=.false.) c transmitted, received, and corrected bits and signal sample vectors:

logical txdata(ns), crdata(ns) c initialize BER, BkER, and runs statistics variables real txsig (ns), rxsig (ns), crsig (ns) data ber /mxblsn*0./, bker /mxblsn*0./, runs /mxblsn*0./ c the common block is a ns-real-long temporary work area data ber2/mxblsn*0./, bker2/mxblsn*0./, runs2/mxblsn*0./ c used by interleaving and diversity routines data nber/mxblsn*0 /, nbker/mxblsn*0 /, nruns/mxblsn*0 /

real wrk(4*ns) c *** program starts here **** common wrk write(*,*)'% OFDM Simulation - 88-6-4.' c noise and fading waveform sample vectors:

c real noise (ns), fade(ns) $INCLUDE: 'simpget.f c pre-emphasis and de-emphasis/channel-inversion vectors

c real prev(ns), dev(ns) if(fs.le.O)then c error measurement variables: write(*,*) ' simrun: bad fs ' stop c npass - count of dfb correction passes endif c nbel - bit error count on previous pass c nbe2 - bit error count on current pass if((2*ne+n)*2.gt.4*ns)then c nwe2 - word error count on current pass write(*,*) ' simrun: ne too large ' c nbe, nwe - bit and word errors (in one trial) stop c ber, bker - sums of BERs and BkERs endif in the data range. c if (noisng) then if (hw) then if (impnse)then call vimp(noise,ns,prbimp,nseed) c measure channel transfer function and generate pre/de-emphasis filter else c initialize for block of maximum lenght (ns), with sample work array call vgrand(noise, ns,nseed) c enough for 4 seconds (4*8000=32000). txsig is temporary work vector. endif call vsmul(noise,ns,sqrt( (fs/2.0)/(f2-f1) )) call hwinit(txdata,prev,dev,txsig,neqbl, else + wrk, ns,8*ns,fs,f1,f2, dbd,rms,peak,txemp,demp, call vfill(noise,ns,0.) + empscl,nempsc,empfr,empsc) endif

else if fading enabled, generate snr values with 0 dB mean c initialize snr-to-signal and snr-to-noise tables if (fading) then call genfdb(fd/fs,fseed,fade,ns, call s2init(b,w,rms,peak,fm,fd,rfm,agclim,sqlim, + ndbr,thr,ndw, nsw) + nints,intsr,intss, nintn,intnr,intnn, else + fading, noisng ) call vfill(fade,ns,0.) endif endif oldsnr=0. c do ntr trials endif

do 6 i=l,ntr do for all snrs c reset bit, word, bit error and word error counts for this trial do 3 l=l,nsnr

call vifill(nb ,mxblsn,0) set the fading waveform average snr call vifill(nw ,mxblsn,0) call vifill(nbe,mxblsn,0) if(.not.hw)then call vifill(nwe,mxblsn,0) call setsnr(fade,ns,oldsnr,snr(1)) endif c do "nblk" blocks per trial do for all data block sizes do 4 j=l,nblk do 3 k=l,nn c generate data bits set the block size if (npat.eq.O)then call prbs(txdata,ns,sr) n=na (k) else call dwg(txdata,ns,pat,npat) i f (n. le. 0. or. n. gt. ns) then endif write(*,*) ' simrun: bad N ' stop if (.not.hw)then endif c if noise enabled, generate a noise vector for proper noise density set lower/upper frequency limits and number of channels c scaling is because measured noise powers only include frequencies call setif(fs,n,fl,ifl,f2,if2) c continue correction passes until exceed iteration limit or no errors nf=if2-ifl+l i f (mxdf bp. gt. 0) then c do for all OFDM blocks in the ns-sample block call vcopy(crsig,rxsig,n) do 3 m=l,ns,n call modu (rxsig,n,nf, serial) c encode the data into complex data values npass=0 nbel=ns+l call encode(txdata(m),txsig,ifl,if2,n) 1 continue c do pre-emphasis if sending over HW channel if( (nbe2.eq.O) .or. (npass.gt.mxdfbp) (goto 2

if (hw) then c remodulate received data call emp(txsig,prev,fl,f2,fs,n,ns) endif call encode(crdata,crsig,if1,if2,n) call modu(crsig,n,nf,serial) c modulate the data into an ofdm signal (unit variance) c use original signal where received level > fade limit call modu (txsig, n,nf, serial) call vsel(crsig, rxsig, fade(m) ,fdlim(l) ,n) c send signal through noisy, fading channel c demodulate the composite signal call vquant (txsig,n,tmax,tquant) call demodu(crsig,n,nf,serial) if (hw)then call decode(crdata,crsig,ifl,if2,n) call hwch(txsig,crsig,wrk,n,n+2*ne,rms,peak) else npass=npass+l call ch(txsig, crsig,noise(m),fade(m),n,rms,peak) nbel=nbe2 endif c do [fee S] error checking call vquant(crsig,n,rmax,rquant) call fee(crdata,txdata(m),nf,intlv,ecn,ect, c demodulate + nbe2,nbx,nwe2,nwx)

call demodu(crsig,n,nf, serial) goto 1 2 continue c do de-emphasis if sent over HW channel if (dndfbp)then if (hw) then write(*,' (IX,A2,15,F4.0,13,15)') call emp (crsig,dev, f 1, f2, fs, n,ns) + '%D', n, snr(l), npass, nbe2 endif endif

call decode(crdata,crsig,ifl,if2,n) endif c do [fee &] error checking c if required, display signal and noise powers in this block

call fee(crdata, txdata(m),nf,intlv,ecn,ect. if(dsn)then + nbe2,nbx,nwe2,nwx) call dvsn(crsig(if1),txdata(m),nf, + fl, fs,n, snr (1) ,ndsn,wrk (1) ,wrk(ns+l)) endif do 5 k=l,nn do 5 l=l,nsnr if(dsnav)then n=na (k) call davsn(crsig(ifl) , txdata (m) ,nf, if (nb(k,l) .ne.O) + n,snr (1) ,wrk(l) ,wrk (ns+1)) + call stat (float (nbe (k,l))/nb(k,l), endif + ber (k,l),ber2 (k,l),nber (k,l)) if (nw(k,l) .ne.O) c if required, display transmitted and received signal values + call stat (float (nwe (k,l))/nw(k,l), + bker (k, 1), bker2 (k, 1),nbker (k, 1)) if(ddat)then 5 continue call vddat(crsig(if1), txdata(m),nf, + fl,f2,n,snr(l)) 6 continue endif c display results: runs tests c if required, display number of errors in each fee block if (rnstst)then if(dnerr)then do 7 k=l,nn call dne(crdata,txdata(m),nf,intlv,ecn,n,snr(l)) do 7 l=l,nsnr endif if (nruns (k,l) .ge.2)then write (*,' (4X, A, I6,F6.1,2 (1PE11.2))')'%' ,na (k), snr (1), c update bit/word add bit/word error counts + stl95(runs (k,l),runs2 (k,l),nruns (k,l)), + stu95(runs (k,l),runs2 (k,l),nruns (k,l)) nbe(k, 1)=nbe(k,1)+nbe2 else nb (k,l)=nb (k,l)+nbx write(*,' (4X,A,I6,F6.1,A)')'%',na(k),snr(l), Co nwe (k,l)=nwe (k,l) +nwe2 + ' : too few runs.' nw (k,l)=nw (k,l)+nwx endif g continue ^ c write(*,*) ' blk, BER = ', j, float(nbe2)/nbx endif c do runs test if required, only consider block with minrnst runs c display results: mean BERs and BkERs (with .95 CI)

if(rnstst)then write(*,*) '% bit error rates : ' if(dibits)then do 8 k=l,nn call vl2diff(crdata,txdata(m),nf,wrk,nf/2) do 8 l=l,nsnr call runcnt(wrk,nf/2,n0,nl,nr,r) if (nber(k,l) .ne.OJthen else write (*,' (IX, 16,F6.1,3 (1PE11.2))') na (k), snr (1), call vxor (crdata,txdata (m) ,wrk, nf) + stmn (ber (k,l),ber2 (k,l),nber (k,l)), call runcnt (wrk,nf,nO,nl,nr,r) + stl95(ber (k,l),ber2 (k,l),nber (k,l)), endif + stu95(ber (k,l),ber2 (k,l),nber (k,l)) if(nr.ge.minrns)then endif call stat (r, runs (k, 1), runs2 (k, 1), nruns (k, 1)) 8 continue endif endif write(*,*) '% FEC block error rates : ' do 9 k=l,nn 3 continue do 9 l=l,nsnr if (nbker (k,l) .ne.OJthen 4 continue write (*,' (IX, I6,F6.1,3 (1PE11.2))') na (k), snr (1), + stmn (bker (k, 1) ,bker2 (k, 1),nbker (k,l)), c update BER and BkER statistics + stl95(bker(k,1),bker2(k,1),nbker(k,1)), + stu95 (bker (k, 1), bker2 (k, 1),nbker (k, 1)) endif c fs - sample rate (bps) 9 continue c fseed - RNG seed to initialize fading generator (limits as above) c hw - true to send samples over A/D/A board (through hardware f.s.) end c impnse - true to use IMPulse (cf. gaussian) NoiSE c intlv - true to do interleaving before checking for word errors simpdef.f c intnn - "n" part of points to use to change r-n table c intnr - SNR part of points to use to change r-n table c ************************ c intsr - SNR part of points to use to change r-s table c simpdef.f - define simulation parameters c intss - "s" part of points to use to change r-s table c ************************ c minrns - minimum number of runs in block to use it for runs testing c mxdfbp - maximum number of dfb correction passes (0=no DFB) c c na - array of OFDM block sizes, each a power of 2 in [8,ns] c nblk - number of simulation blocks (ns samples) per trial c array sizes: c ndbr - Number of Diversity BRanches c ndsn - number of channels averaged when display signal/noise powers c ns - maximum number of samples in each "simulation block" c ndw - Number of samples to wait (DWell) after threshold crossed c mxpat - maximum number of elements in npat c ne - number of guard samples for hardware channel c mxblk - maximum number of elements in na c nempsc - number of values in empsc and empfr c mxsnr - maximum number of elements in snr c neqbl - number of blocks to average in measuring channel equalization c mxblsn - mxblk * mxsnr c nintn - number of elements in intnr and intnn c srlen - number of elements in sr (must be 23 for CCITT v.29) c nints - number of elements in intsr and intss c mxint - number of elements in intnr, intnn, intsr, intsn c nn - number of OFDM block sizes to be tested c mxthr - maximum number of elements in thrsh c noisng - true to add noise c npat - Number of elements in data PATtern (0 for random data) SG. integer ns, mxblk, mxsnr, mxblsn, mxpat, srlen, mxint, mxemp c nseed - RNG seed for noise generators (0 <= nseed < 67108864) 5 integer mxthr c nsnr - number of SNRs to test Q. parameter (ns=4096 ,mxblk=10, mxsnr=10, mxblsn=100, mxpat=20) c nsw - Number of samples to blank output while Switching branches 5, parameter (srlen=23, mxint=100, mxemp=50, mxthr=30) c nthrsh - number of squelch or age thresholds to test (pint only) ~* c ntr - number of trials done each time subroutine called c agclim - age gain limit (SNR dB) c pat - description of data PATtern c agevar - true to test effct of varying age threshold (pint only) c pfile - name of simulation parameter file c b - IF bandwidth (kHz) c rms - rms voltage of modulating signal c dbd - dB per decade of pre-emphasis c peak - peak voltage of modulating signal c demp - true to display equalization characteristics c prbimp - probability of a sample having an impulsive noise "hit" c dndfbp - true to display number of correction passes for each block c rfm - true to add Random FM c dnerr - true to display number of errors per fee work c rmax - Receiver A/D MAXimum (clipping) value c dsn - true to display received data value signal and noise power c rnstst - true to compute runs tests c dsnav - true to display average of received signal and noise powers c rquant - bits of Receiver A/D QUANTization (0=no quantization) c ddat - true to display transmitted and received data values c serial - true for "serial" (no OFDM) simulation c ecn - word size c snr - IF SNRs (dB) c ect - correctable bit errors per word (0=no FEC) c sqlim - squelch limit (SNR dB) c empfr - upper frequency limit to use for scaling values in empsc c sqval - true to test effect of varying squelch threshold (pint only) c empsc - scaling values (in dB) for scaling pre-emphasis vectors c sr - shift register logical values to generate PRBS data stream c empscl - true to do scaling of pre-emphasis vector c thr - switching threshold (dB rel. to mean) c fl - lowest frequency to use on channel (<= 0 -> use minimum) c thrsh - age or squelch thresholds to test c f2 - highest frequency to use on channel (>= fs/2 -> use maximum) c tmax - Transmitter D/A MAXimum (clipping) value c fading - true to apply fading c tquant - bits of Transmitter D/A QUANTization (0=no quantization) c fd - doppler rate (Hz) c txemp - true to amp./phase correction at transmitter (not receiver) c fdlim - "faded" decision levels for DFB correction (SNR dB), per SNR c vname - variable name i-» c fra - true for FM, false for SSB c w - baseband bandwidth (kHz) 2 if(nn.gt.mxblk)then integer na(mxblk), nn, ntr, nblk write(*,*) ' simpget : too many blocks sizes ' integer ecn, ect stop integer ndbr, npat, pat(mxpat), nsnr endif integer tquant, rquant write(*,*) '% na(i) =', (na(i) ,i=l,nn) integer nsw, ndw integer ne, mxdfbp, neqbl read(10,*) vname, ntr, nblk integer nintn, nints, minrns write(*,*) '% ntr, nblk =', ntr, nblk integer ndsn, nempsc, nthrsh real fs, fd, snr(mxsnr), fdlim(mxsnr) read(10,*) vname, fs, fd real agclim, sqlim, b, w, rms, peak write(*,*) '% fs, fd=\ fs, fd real prbimp real thr read(10,*) vname, nsnr, (snr (i) ,i=l,min (nsnr,mxsnr)) real fl, f2, tmax, rmax if(nsnr.gt.mxsnr)then real dbd write(*,*) ' simpget : too many SNRs ' real intnr(mxint), intnn(mxint), intsr(mxint), intss(mxint) stop real empsc(mxemp), empfr(mxemp) endif real thrsh(mxthr) write(*,*) '% snr(i) =', (snr(i),i=l,nsnr) double precision nseed, fseed logical fm, fading, noisng, rfm, intlv, impnse, hw, serial read(10,*) vname, serial logical dndfbp, dnerr, dsn, dsnav, demp, ddat, rnstst, txemp write(*,*) '% serial =', serial logical empscl, agcvar, sqvar logical sr(srlen) read(10,*) vname, fm, b, w, rms, peak character*70 vname, pfile write(*,*) '% fm, b, w, rms, peak =', fm, b, w, rms, peak c intrinsic functions read(10,*) vname, agclim, sqlim write(*,*) '% age, sqlim =', agclim, sqlim integer min read(10,*) vname, fading, noisng c '•— write)*,*) '% fading, noisng =', fading, noisng

read(10,*) vname, fseed, nseed simpget.f write(*,*) '% fseed, nseed =', fseed, nseed c ********************************* read(10,*) vname, rnstst, minrns c simpget.f - read simulation parameters write(*,*) '% rnstst, minrns =', rnstst, minrns c ********************************* read(10,*) vname, mxdfbp, (fdlim(i),i=l,nsnr) c write(*,*) '% mxdfbp, fdlim(i) =', mxdfbp, (fdlim(i) ,i=l,nsnr)

write(*,*) '% simulation parameter file ? ' read(10,*) vname, dndfbp, dnerr, demp, ddat read(*,' (A70)') pfile write(*,*) '% dndfbp, dnerr, demp, ddat =', write(*,*) '% ', pfile + dndfbp, dnerr, demp, ddat

open(10,file=pfile) read(10,*) vname, dsn, ndsn, dsnav write(*,*) '% dsn, ndsn, dsnav =', dsn, ndsn, dsnav read(10,*) vname write(*,*) '% ', vname read(10,*) vname, intlv write(*,*) '% intlv =', intlv read(10,*) vname, nn, (na(i) ,i=l,min (nn, mxblk)) read(10,*) vname, ecn, ect write(*,*) ' simpget : too many noise interpolation values ' write(*,*) '% ecn, ect =',ecn,ect stop endif read(10,*) vname, ndbr, thr, ndw, nsw write(*,' (a,1000 (/" %",2fl0.3))') write(*,*) '% ndbr, thr, ndw, nsw =', ndbr, thr, ndw, nsw + ' % intnr(i), intnn(i) =', + (intnr(i), intnn (i), i=l, nintn) read(10,*) vname, npat, (pat (i),i=l,min(npat,mxpat)) i f(npat.gt.mxpat)then read(10,*) vname, agcvar, sqvar, nthrsh, write(*,*) ' simpget : too many pattern elements ' + (thrsh(i), i=l,min(nthrsh,mxthr)) stop if(nthrsh. gt.mxthr)then endif write(*,*) ' simpget : too many agc/squelch test thresholds ' write(*,*) '% pat(i) =', (pat(i),i=l,npat) stop endif read(10,*) vname, (sr(i),i=l,srlen) write(*,*) '% agcvar, sqvar =', agcvar, sqvar write(*,*) '% sr(i) =', (sr (i) ,i=l,srlen) write (*,' (a, 1000 (/" %",f6.2))') + ' % thrsh(i) =', (thrsh(i), i=l,nthrsh) read(10,*) vname, rfm write(*,*) '% rfm =', rfm read(10,*) vname, empscl write(*,*) '% empscl =', empscl read(10,*) vname, irapnse, prbimp write(*,*) '% irapnse, prbimp =', impnse, prbimp read(10,*) vname, nempsc, + (empfr(i), empsc(i), i=l, min (nempsc,mxemp)) read(10,*) vname, hw, ne, dbd, negbl, txemp if(nempsc.gt.mxemp)then write(*,*) '% hw, ne, dbd, neqbl, txemp =', write(*,*) ' simpget : too many pre-emphasis scaling values ' + hw, ne, dbd, neqbl, txemp stop endif read(10,*) vname, fl, f2 write(*,' (a,1000 (/" %", 2fl0.3))') write(*,*) '% fl, f2 =', fl, f2 + ' % empfr(i), empsc(i) =', if(f2.1e.fl)then + (empfr(i), empsc(i), i=l, nempsc) write(*,*) ' simpget : f2 <= fl ' stop close (10) endif

read(10,*) vname, tquant, tmax, rquant, rmax write (*,*) '% tquant, tmax, rquant, rmax =', + tquant, tmax, rquant, rmax simfde.f

read(10,*) vname, nints, c ********************** + (intsr(i), intss(i), i=l,min (nints,mxint)) c simfde.f - fading envelope generator (Jake's method) if(nints.gt.mxint)then ********************** write(*,*) ' simpget : too many signal interpolation values c 87-7-9 stop endif write (*,' (a, 1000 (/"%", 2f 10.3))') + ' % intsr(i), intss (i) =', subroutine genfd(fdbyfs,seed,x,ns,b) + (intsr(i), intss (i), i=l,nints) c generate samples of the fading envelope read(10,*) vname, nintn, c method from W. C. Jakes, 1974, p. 65 + (intnr(i), intnn(i), i=l, min (nintn,mxint)) if(nintn.gt.mxint)then c output vector (x) is in dB c itl is the table length for each sine/cosine lookup table real fdbyfs c *** values of itl must match *** integer ns real x(ns) integer itl double precision seed parameter (itl=2048) logical init integer b, m c scaled sine and cosine lookup tables

c constant to scale envelope to unity rms integer*2 cl(itl), c2(itl), c3(itl), c4(itl), c5(itl), + c6(itl), c7(itl), c8(itl), c9(itl) real k integer*2 si (itl), s2(itl), s3(itl), s4(itl), s5(itl), c max number of diversity branches + s6(itl), s7(itl), s8(itl), s9(itl)

integer nb c I and Q sums parameter (nb=10) integer*2 sumi, sumq c storage for phase counters for diversity branches

integer*4 phs(9,nb) c phase increments per sample c word and full-word length phase counter integer*4 dpi, dp2, dp3, dp4, dp5, dp6, dp7, dp8, dp9

integer*4 pf(9) common /fdtabl/ cl, c2, c3, c4, c5, c6, c7, c8, c9, integer*4 pl, p2, p3, p4, p5, p6, p7, p8, p9 + si, s2, s3, s4, s5, s6, s7, s8, s9 integer*2 pw(18) common /fdtab2/ dpi, dp2, dp3, dp4, dp5, dp6, dp7, dp8, dp9 integer*2 il, i2, i3, i4, i5, i6, i7, i8, i9 real tpi, oldfds equivalence (pf,pw) integer i, j equivalence (pf(l), pl), (pf(2), p2), (pf(3), p3), + (pf(4), p4), (pf(5), p5), (pf(6), p6), real uni + (pf(7), p7), (pf(8), p8), (pf(9), p9) real float c only one of the following two tables can be used c using the wrong table will produce out-of-range subscripts data oldfds/0./, init/.false./ c this table for computers that store MS INTEGER*2 value first data tpi/6.28318/ c e.g. MOTOROLA 68000 (SUN) c compute look-up tables if have not been initialized cSUN equivalence (pw( 1), il), (pw( 3), i2), (pw( 5), i3), cSUN + (pw( 7), 14), (pw( 9), i5), (pw(ll), 16), if(.not.init)then cSUN + (pw(13), 17), (pw(15), 18), (pw(17), i9) call initos(k) init=.true. c this table for computers that store LS INTEGER*2 value first endif C e.g. INTEL 8088 (IBM PC), DEC VAX-11 c compute phase increments and initialize oscillator phases cIBM equivalence (pw( 2), il), (pw( 4), i2), (pw( 6), i3), c if doppler or sampling rate have changed cIBM + (pw( 8), i4), (pw(10), i5), (pw(12), i6), cIBM + (pw(14), 17), (pw(16), i8), (pw(18), i9) if(fdbyfs.ne.oldfds)then call initph(fdbyfs) if(i7.gt.itl)i7=i7-itl oldfds=fdbyfs if(i8.gt.itl)i8=i8-itl if(i9.gt.itl)i9=i9-itl c initialize phases using uniform RNG c add up two sets of scaled oscillator outputs and find mag. squared m=l do 1 1=1,nb sumi=cl (il) +c2 (i2) +c3 (i3) +c4 (i4) + do 1 j=l,9 1 c5 (i5) +c6 (i6) +c7 (i7) +c8 (i8) +c9 (i9) phs(j,i)=itl* 65536*uni(seed) 1 continue sumq=sl (il) +s2 (i2) +s3 (i3) +s4 (i4) + 1 s5(i5) +s6(i6) +s7(i7)+s8(18)+s9(i9) endif x(i) = k * ( float (sumi)**2 + float (sumq) **2 ) c range-check branch number 3 continue if((b.lt.l).or.(b.gt.nb))then write(*,*)'genfd:diversity branch out of range. c convert to dB (power) (x is magnitude squared of envelope) stop endif call vdbp(x,ns)

c copy branch phases to phase counters c copy phase counters back

do 2 i=l,9 do 4 i=l,9 pf (i)=phs(i,b) phs(i,b)=pf (i) 2 continue 4 continue c generate ns samples return end do 3 i=l,ns c increment oscillator phases ' subroutine initos(k) pl=pl+dpl p2=p2+dp2 c initialize oscillator lookup tables p3=p3+dp3 p4=p4+dp4 real pi, tpi, sqrt2 p5=p5+dp5 real N, NO p6=p6+dp6 real stk, ctk, k p7=p7+dp7 integer i, j p8=p8+dp8 real float, cos, sin p9=p9+dp9 c itl is the table length for each sine/cosine lookup table c keep phase modulo two pi c *** values of itl must match ***

if (il.gt.itl)il=il-itl integer itl if(i2.gt.itl)i2=i2-itl parameter (itl=2048) if(i3.gt.itl)i3=i3-itl if(i4.gt.itl)i4=i4-itl scaled sine and cosine lookup tables if(i5.gt.itl)i5=i5-itl if U6.gt.itl)i6=i6-itl integer*2 cw(itl,9), sw(itl,9) real rc(ltl) subroutine initph(fdbyfs)

common /fdtabl/ cw, sw c initialize phase increment table

data pi/3.14159/, tpi/6.28318/, sqrt2/l.414213/ real fdbyfs real tpi N0=8. real N, NO

N=4.*N0+2. integer i real cos, float c compute un-scaled oscillator (cosine) look-up table c itl is the table length for each sine/cosine lookup table do 1 j=l,itl c *** values of itl must match *** rc(j)=cos(float(j-1)/itl*tpi) integer itl 1 continue parameter (itl=2048) c generate scaled oscillator tables integer*4 dpf (9)

k=0. common /fdtab2/ dpf do 3 i=l,8 ctk=1750.*2.*cos(pi*float(i)/NO) data tpi/6.28318/ stk=1750.*2.*sin (pi*float(i)/NO) k=k+ctk**2+stk**2 if ((fdbyfs.It.0.).or.(fdbyfs.ge.0,5))then do 2 j=l,itl write(*,*)'genfd:doppler too high or negative.' cw(j,i)=rc(j)*ctk stop sw(j,i)=rc (j) *stk endif 2 continue 3 continue c compute phase increments c last oscillator has different amplitude N0=8. ctk=1750.*1. /sqrt2*2.*cos(pi/4.) stk=1750.*1./sqrt2*2.*sin(pi/4.) N=4.*N0+2. k=k+ctk**2+stk**2 do 4 j=l,itl do 1 i=l,8 cw(j,9)=rc(j)*ctk dpf(i)=cos(tpi*float(i)/N)*fdbyfs*itl*65536. sw(j,9)=rc(j)*stk 1 continue 4 continue dpf(9)= fdbyfs*itl*65536. write(*,*) '% phase increments (re)initialized ' c compute normalization constant write (*,*) '% fdbyfs = ', fdbyfs

k=2./k return end write(*,*)'% oscillator tables (re)initialized '

return end subroutine setsnr(fade,n, oldsnr,newsnr) c integer n real fade(n), oldsnr, newsnr c k - temporary variable for indexing real delta c nleft - Number of samples LEFT to generate c m - number of saMples to generate in one pass delta=newsnr-oldsnr c thr - switching THReshold (fraction of mean=l) c maxbuf - size of local buffer call vadd(fade,n, delta) oldsnr=newsnr integer i, j, k, nleft, m integer bufsiz, maxbuf return parameter (maxbuf=1000) end c buffer array (in common work area)

simdiv.f real buf (maxbuf) common buf c ********************** c simdiv.f - diversity c intrinsic functions c ********************** c 87-11-29 integer min, int c c range-check number of diversity branches

subroutine genfdb(fdbyfs, seed,x,ns, if(nb.lt.l)then + nb,thr,ndw,nsw) write (*,*) ' genfdb: nb < 0 ' stop c fading envelope generator (in dB) endif c parameters: c initialize for piece-wise generation of ns samples c fdbyfs - Doppler rate / Sampling rate i=l c seed - RNG seed for initializing fading generator nleft=ns c x - output vector containing fading sequence (dB) bufsiz=int(maxbuf/nb) c ns - Number of values in x c nb - Number of diversity Branches c generate (and combine) "nb" sections of "bufsize" samples per pass c nb>l means diversity c thr - switching diversity THReshold (dB relative to mean) 1 continue c ndw - minimum Number of samples to DWell on branch c before switching m=min(nleft,bufsiz) c nsw - Number of samples lost while switching branches c generate branch signals real fdbyfs double precision seed do 2 j=l,nb integer ns, nb k=(j-l)*m+l real x(ns) call genfd(fdbyfs, seed,buf (k) ,m, j) real thr 2 continue integer ndw, nsw c combine branches c local variables: if(nb.eq.l)then c i - index into output vector x call vcopy(buf,x(i) ,m) c j - branch counter else call divsw (buf, nb,m,x(i), nsw, ndw, thr) real.zval endif parameter(zval=2.0e6) i=i+m data br/1/, idw/0/, isw/0/ nleft=nleft-m c write(*,*) ' thr = ',thr c repeat until done . c range checks if(nleft.gt.O)goto 1 return if (nsw. It. 0) then end write (*,*)' divsw: nsw < 0 ' stop endif if (br.gt.nb)then subroutine divsw(buf,nb,m,x,nsw,ndw,thr) write(*,*)' divsw: branch > number of branches ' stop c switching diversity routine endif c NOTE: the switching and dwell counts are static so this if(ndw.It.0)then c routine cannot be used to generate independent write(*,*)' divsw: ndw < 0 ' c diversity-switched signals. stop endif c parameters: c do for all samples ... c buf - input buffer (m by nb) with m samples from each of c nb branches do 1 i=l,m c nb - number of diversity branches cm - number of samples per branch c if below threshold not switching and and dwell timer expired, c x - output vector containing the resulting fading sequence c go to next antenna and reset timers c ndw - minimum Number of samples to DWell on one branch (>=1) c (after switching is complete) if (buf (i,br) .It.thr .and. isw.eq.O .and. idw.eq. 0)then c nsw - Number of samples blanked out while switching branches br=br+l c thr - switching THReshold (dB relative to mean) if (br.gt.nb)br=l isw=nsw integer nb, m, ndw, nsw idw=ndw+nsw real buf (m,nb), x(m), thr endif c local (static!) variables: c if switching (blanking) timer has expired, select current branch' c level, else output is blanked c br - current BRanch c idw - count for timer that indicates that must DWell on if (isw.eq. 0)then c current branch x(i)=buf (i,br) c isw - count for timer for switching time else c zval - VALue value (dB) to indicate samples that should be x(i)=zval c Zero'ed. (anything > 1E6 can be used), used by "ch" endif c routine. c maxdw - maximum dwell count (to avoid overflows) c if still on, decrement switching timer

integer br, idw, isw, i if(isw.gt.O)then isw=isw-l logical sr(len) endif logical x(n) c if still on, decrement channel dwell timer i0=l il=18 if (idw.gt.O)then i2=23 idw=idw-l endif do 1 i=l,n c write (*,*) (buf (i,l) ,l=l,nb), '=> ', br, x(i) i0=i0-l if (i0.eq.0)i0=len 1 continue if (sr(il))then if (sr(i2))then return sr(i0)=.false, end x(i)=.false, else sr(i0)=.true. simgen.f x(i)=.true. endif c ******************** else c simgen.f - data and noise generators if (sr(i2))then c ******************** sr (i0) = .true. x(i) = .true. subroutine prbs(x,n,sr) else sr (i0) = . false. c PRBS generator x(i) = .false, endif c The generator's shift register is implemented as a logical array, endif c For efficiency, instead of shifting the array to the right (up) c pointers to the exclusive-or gate connections and the LS bit are il=il-l c shifted left (down the array). if(il.eq.0)il=len c The tap connection (18,23) are taken from the data scrabler c described in Appendix 2 of the CCITT standard (V.29) for a 12=i2-l c 9600 bps modem. The pattern period is 2**23-1 = 8 388 607. if (i2.eq.0)i2=len integer len parameter (len=23) 1 continue c i - counts output values call rotdwn(sr,len,iO-l) c iO, il, i2 - point to least significant bit and XOR connections return c in shift register array end c n - number of values to put in x subroutine rotdwn(sr,n,i) c x - output logical array c len - length of shift register c rotate (circular shift) the first "n" elements of logical array c sr - a logical array of len elements corresponding to the c "sr" down the array by "i" places. c elements of a prbs generator shift register. integer n, i integer i, 10, il, i2, n logical sr(n) subroutine dwg(x,n,y,m) integer j, k logical t c digital waveform generator

do 2 j=l,i c x - output logical vector t=sr(l) c n - number of values in x do 1 k=l,n-l c y - pattern definition vector (number false, number true)... sr(k)=sr(k+l) cm- number of elements in m (>=1) 1 continue sr (n)=t c if pattern counts in y are insufficient to fill x, the pattern is 2 continue c repeated starting at y(3)

return c i - index into x end c j - index into y c k - counts up to y(j)

subroutine vimp(x,n,p, seed) integer i, j, k, n, m logical x(n), tf c generates impulse noise vector integer y(m) c samples are uncorrelated with equal probability of an impulse = p c zero mean, unit average power if (m. It. 3) then c calls uniform RNG "uni" write(*,*)'dwg:pattern definition < 3 elements.' stop integer i, n endif real x(n), p, u real sqrt, uni do 1 i=l,yd) double precision seed x(i)=.false. 1 continue if(p.lt.O .or. p.gt.ljthen write(*,*)' vimp: p out of range. ' do 2 i=y(l)+l,y(l)+y(2) stop x(l)=.true. endif 2 continue

u=sqrt(l./p) tf=.false. j=3 do 1 i=l,n k=0 if (uni(seed) .lt.pjthen if (uni (seed) .gt. 0.5) then do 3 i=y(l)+y(2)+l,n . x(i)=u if (k.ge.y(j))then else tf=.not.tf x(i)=-u j-j+l endif k=0 else if (j.gt.m)then x(i)=0 endif j=3 1 continue endif endif return x(i)=tf end k=k+l 3 continue return return end end

subroutine vgrand(xo,n,seed) real function uni(seed)

integer n c modulo congruential uniform RNG on [0,1) real xo(n) c parameters are from FPS AP library routine VRAND

integer i double precision seed real r, rx, ry double precision dmod

double precision seed, dmod seed=dmod(67081293.0d0*seed+14181771.OdO, 67108864.OdO) real sqrt, alog uni=seed/67108864.

c function that returns a Gaussian distributed random number return c of zero mean, unity variance. end

c adapted from IEEE DSP program library (in MXFFT.FOR) double precision function iuni(seed)

do 1 i=l,n,2 c integer version of uni: RNG on [0,67108864) c to check integer operations using d.p. f.p. numbers 10 continue c values taken from FPS AP library routine VRAND seed=dmod(67081293.0d0*seed+14181771.OdO,67108864.OdO) RX=(seed/67108864.0d0*2.0) - 1.0 double precision seed double precision dmod seed=dmod(67081293.0d0*seed+14181771.OdO,67108864.OdO) RY=(seed/67108864.0d0*2.0) - 1.0 seed=dmod(67081293.0d0*seed+14181771.OdO, 67108864.OdO) Q. iuni=seed C c return C SUBROUTINE: NORMAL end C GENERATES AN INDEPENDENT PAIR OF RANDOM NORMAL DEVIATES C METHOD DUE TO G. MARSAGLIA AND T.A. BRAY, C SIAM REVIEW, VOL. 6, NO. 3, JULY 1964. 260-264 simmod.f c c c ****************** C OUTPUT: X,Y = INDEPENDENT PAIR OF RANDOM NORMAL DEVIATES c simmod.f - OFDM [de]modulation c ****************** C FUNCTION UNI GENERATES PSEUDO-RANDOM NUMBER BETWEEN 0.0 AND 1.0 C R = RX**2 + RY**2 subroutine encode (d,sig,ifl,if2,n) IF (R.GE.1.0) GO TO 10 R = SQRT(-2.0*ALOG(R)/R) c encode logical data into data values xo(i)=RX*R c d - logical data if(i+1.le.n)then c sig - generated data values, unit variance xo(i+l)=RY*R c ifl - index of lowest frequency endif c if2 - index of highest frequency c n - total number of values 1 continue integer ifl, if2, i, j, n logical d(n) end real sig(n) subroutine modu(sig,n,nf,serial) c zero out terms c OFDM modulation do 1 i=l,ifl-l sig(i)=0. c sig - generated signal samples, unit variance 1 continue c n - OFDM block size = number of samples generated c nf - number of data values = +/- 1 (rest assumed equal 0) c encode data into QAM (complex) format c serial - true for serial modulation (no FFTs)

1-1 integer n, nf logical serial do 2 i=ifl,if2 real sig(n) if (d(j))then real k sig(i)=l. else real sqrt, float sig(i)=-l. c real rms endif j=j+l c if OFDM (not serial) modulate the data values into an OFDM signal 2 continue c with unity power (variance = std. dev. = 1 V**2) c zero out high-frequency terms if(.not.serial)then call ffsn(sig,n) do 3 i=if2+l,n k=sqrt( float (n)/nf ) * sqrt ( float (n)/2.) sig(i)=0. call vsmul(sig,n,k) 3 continue c write(*,*) ' modu: output rms signal level = ',rmsv(sig,n) endif return end return end subroutine decode(d,sig,ifl,if2,n) subroutine demodu(sig,n,nf, serial) c recover logical data from signal values c data not in [ifl,if2] is unchanged c OFDM demodulation

integer n, ifl, if2, i, j c sig - generated signal samples, unit variance logical d(n) c n - OFDM block size = number of samples generated real sig(n) c nf - number of data values = +/- 1 (rest assumed equal 0) c serial - true for serial modulation (no FFTs) j=l do 1 i=ifl,if2 integer n, nf if(sig(i).gt.0)then logical serial d(j) = .true. real sig(n) else real k d(j) = .false, real sqrt, float endif c real rms j-j+l 1 continue c if OFDM, un-scale values and demodulate the ofdm signal samples c back into data values. return if(.not.serial)then c and SNR-to-noise level lookup tables, the look-up function c write(*,*) ' demodu: input rms signal level = ',rmsv(sig,n) c is: s2min+l + ifix(SNR)*npdb k=sqrt( float (n)/nf ) * sqrt ( float (n)/2.) c call vsmul(sig,n,l./k) c npdb is number of table entries per dB of SNR change call ffan(sig,n) c s2min is "npdb" times the minimum SNR value in the table endif c s2raax is "npdb" times the maximum SNR value in the table

return integer mxint end parameter (mxint=100)

real b, w simsnr.f logical fm, rfm real rms, peak, pk2rms c ********************* real agclim, sqlim c simsnr.f - IF/AF SNR conversion integer nintn, nints c ********************* c modified 89-3-9 to do age and squelch after corrections, real intnr(mxint), intnn(mxint), intsr(mxint), intss (mxint) c integer i, j, il, i2 subroutine s2init (b,w,rms,peak,fm,fd,rfm,agclim, sqlim, real pi, n, a, r, s2asum, e2mr, nk, sk, c, nrfm, fd + nints,intsr,intss, nintn,intnr,intnn, integer npdb, s2min, s2max + fading, noise ) real snr2s(1101), snr2n(1101) integer ix c initialize IF SNR -to- AF SNR conversion tables logical fading, noise co real alog, float, exp, sqrt c input parameters: real interp 2> real dbtor, x c fm true for an FM channel false for SSB c b IF bandwidth (Hz or kHz) common /s2com/ npdb, s2min, s2max, snr2s, snr2n c w baseband bandwidth (same units as "b") c rms rms level of the modulating signal data pi /3.14159/ c peak peak level of the modulating signal c peak-to-average ratio = (10 for voice, about 2-3 for data) c function to address 1-base arrays with negative indexes c pk2rms peak/rms c fd doppler rate (same units as "b" and "w") ix (i)=i-s2min+l c rfm true to add random fm noise c agclim SNR above which the AGC operates (dB) c function to convert db to linear (voltage) units c sqlim SNR below which the receiver output is squelched (dB) c (applied after interpolation given by intXX) dbtor (x) =10. **(x/20.) c nintn - number of elements in intnr and intnn c nints - number of elements in intsr and intss npdb=10 c intnr - SNR part of points to use to change r-n table s2min=-500 c intnn - "n" part of points to use to change r-n table s2max=600 c intsr - SNR part of points to use to change r-s table c intss - "s" part of points to use to change r-s table write(* *)'% FM, IF S AF bandwiths , fm, b, w c fading - false to disable fading (constant signal output) write (* *)'% rms, peak deviation , rms, peak c noise - false to disable noise (no noise added) write(* *)'% random FM, doppler rate , rfm, fd c mxint - number of elements in intnr, intnn, intsr, intsn (not req'd) write (* *)'% AGC S squelch limits , agclim, sqlim c write (* *)'% fading, noise , fading, noise c the arrays snr2s and snr2n contain the SNR-to-signal level CO c check number points in interpolation tables n=a*(1.0-e2mr)**2/r + nk*e2mr/sqrt(2*(r+2.35)) + nrfm

if( (nints.It.0) .or. (nints.eq.l) .or. c ( sk factor scales snr2n to make snr2s independent of b S w ) + (mod(nints,2).ne.O) ) then write(*,*) ' % s2init - warning : bad nints ' snr2n (ix (i)) =sqrt (n/sk) endif snr2s(ix(i))=(l.-e2mr)

if( (nintn.It.0) .or. (nintn.eq.l) .or. 1 continue + (mod(nintn,2).ne.O) ) then else write(*,*) ' % s2init - warning : bad nintn ' do 2 i=s2min,s2max endif snr2s (ix (i)) =10. ** (float (i) / (npdb*20)) snr2n (ix(i) )=1. c check for random FM being in valid approximation region 2 continue endif if(rfm.and.(fd.gt.0,l*w)) then write(*,*) ' s2init : doppler > .1 AF B/W ' c apply corrections to conversion tables using linear interpolation stop endif c algorithm - c for each pair of points : if(rms.le.0.)then c find indices in snr table for this pair write(*,*) ' rms <= 0. ' c for all table entries between these points : stop c if the point is in the table : endif c interpolate and substitute new table value

pk2rms = peak/rms c corrections to snr2s

if ((pk2rms) .It. 1.)then do 9 i=l,nints-l,2 write(*,*) ' s2init : (pk/rms) < 1 ' c write (*,' (a, 2f 10.3, a, 2f 10.3)') ' % snr2s corr"n : ', stop c + intsr (i),intss(i),' to ',intsr (i+1),intss(i+1) endif il=intsr(i)*npdb i2=intsr (i+1)*npdb if(fm.and.(w.ge.b/2.0)(then do 8 j=il,i2 write(*,*) ' % s2init : warning : AF B/W >= 1/2 IF B/W if( (j.ge.s2min) .and. (j.le.s2max) (then endif snr2s (ix (j)) =dbtor ( + interpl intsr(i),intsr(i+1),intss(i),intss(i+1), c modified to give snr2s=l maximum (for FM) + float(j)/npdb ) ) endif if(fm)then continue a=s2asum (b,w) 9 continue nk=8.*pi*b*w sk=pi**2/(pk2rms**2)*(b-2.*w)**2 c corrections to snr2n if(rfm)then nrfm=2.*pi**2*alog(10.)*fd**2 do 11 i=l,nintn-l,2 else c write (*,' (a, 2f 10.3,a,2f 10.3)') ' % snr2n corr"n : ', nrfm=0. c + intnr (i) ,intnn(i),' to ',intnr(i+l),intnn(i+l) endif il=intnr(i)*npdb do 1 i=s2min,s2max i2=intnr(i+l)*npdb r=10.0**(float(i)/(npdb*10)) do 10 j=il,i2 e2mr=exp (-r) if( (j.ge.s2min) .and. (j.le.s2max) )then snr2n(ix(j))=dbtor( + interp( intnr(i),intnr(i+1),intnn(i),intnn(i+1), c function to calculate a sum for calculating noise power + float (j)/npdb ) ) c for FM, see Jakes, Ch. 4. endif 10 continue real w, b, s, pi, t, tl 11 continue parameter (pi=3.14159)

C apply AGC for snrs from agclim up integer n, nmax parameter (nmax=12) j=agclim*npdb if(j.It.s2min)j=s2min tl=(-pi)*(w/b)**2 if(j.gt.s2max)j=s2max t=l. c=l./snr2s (ix (j)) s=0. do 3 i=j,s2max snr2n (ix (i)) =snr2n (ix (i)) /snr2s (ix (i)) do 1 n=0,nmax snr2s(ix(i))=1.0 s=s+t/(n+n+3) 3 continue t=t*tl/(n+1) 1 continue c scale transfer curves below age limit to make them continuous s2asum=s*4.*pi*pi*w*w*w/b do 4 i=s2min,j-1 snr2s(ix(i))=snr2s(ix(i)) *c return snr2n (ix (i)) =snr2n (ix (i)) *c end 4 continue subroutine ch(sin,sout,noisev,fadev,ns,rms,peak) c squelch for snrs below sqlim c channel simulation j=sqlim*npdb if(j.gt.s2max)j=s2max c sin/sout - input/output signal samples do 5 i=s2min,j c noisev - additive noise samples, unit variance snr2n(ix(i))=0. c fadev - signal snr levels (in dB snr) snr2s(ix(i))=0. c - any value > IE6 (dB) indicates a blanked sample 5 continue c rms rms level of the modulating signal c peak peak level of the modulating signal c if no fading integer ns i f(.not.fading)then real sin(ns), sout(ns), noisev (ns), fadev(ns), rms; peak call vfill(snr2s, s2max-s2min+l, 1.) endif integer i, j integer ifix c if no noise integer npdb, s2min, s2max if(.not.noise(then real snr2s(1101), snr2n(1101) call vfill(snr2n, s2max-s2min+l ,0.) real s, smax, smin endif real rmsv

return common /s2com/ npdb, s2min, s2max, snr2s, snr2n end c function to address 1-base arrays with negative indexes real function s2asum(b,w) integer ix ix(i)=i-s2min+l c ns - number of samples in r, s, n c snr - average snr c write(*,*) ' ch:sin:rms: ', rmsv(sin,ns) c write(*,*) ' ch:noisev:rms: ', rmsv(noisev,ns) integer ns real r(ns), s(ns), n(ns) c compute maximum and minimum signal levels real snr

smax = peak/rms integer i, j smin = -peak/rms integer ifix c multiply by fading and add noise integer npdb, s2min, s2max real snr2s(1101), snr2n(1101) do 1 i=l,ns common /s2com/ npdb, s2rain, s2max, snr2s, snr2n c check for blanking c function to index 1-base arrays with negative indices if (fadev(i) .ge.l.0e6)then integer ix sout(i)=0.0 ix(i)=i-s2min+l

else do 1 i=l,ns j=ifix( ( r(i)+snr )*npdb ) j=ifix(fadev(i)*npdb) if(j.It.s2min)j=s2min if(j.It.s2min)j=s2min if(j.gt.s2max)j=s2max if(j.gt.s2max)j=s2max j=ix(j) j=ix(j) s (i) =snr2s (j) n(i)=snr2n(j) c clip signal (at transmitter - before fading) c write(*,*) ' r2j: ', j s = sin (i) if(s.gt.smax) s = smax 1 continue if(s.It.smin) s = smin return sout(i) = s*snr2s(j) + noisev (i) *snr2n (j) end

endif real function interp(xl,x2,yl,y2,x)

1 continue c linear interpolation for value x using line between xl,yl and x2,y2 c for xl=x2, returns y2 return end real xl, x2, yl, y2, x

subroutine r2sns(r,s,n,ns,snr) if(x2.ne.xl)then interp = yl + (y2-yl)/(x2-xl) * (x-xl) c convert signal envelope input vector to s and n vectors else c used for numerical integration routine interp = y2 endif c r - received signal envelope level (dB) (0 dB mean) c s - corresponding signal scale value (linear) return c n - corresponding noise scale value (linear) end endif

c interleave the received data and the correct (transmitted) data

simfec.f if (intlv) then call scr(data ,n,.true.) c ***************** call scr(okdata,n,.true.) c simfec.f - test and/or correct a block of data endif c ***************** c initialize number of bit errors and bits examined subroutine fee(data,okdata,n,intlv,ecn,ect,ne,nbx,nwe,nwx) ne=0 c number of remaining bit errors is returned in ne nbx=0 c bits that don't fit into FEC blocks are ignored for BkER counts c and are not processed for FEC correction c count (and optionally correct) word errors c no bits corrected if number of errors in a block > ect c all bits corrected if number of errors in block <= ect nwe=0 c (this is an idealized FEC code) nwx=0 c for efficiency make ecn as large as possible i=l c data - input/output data 1 continue c okdata - correct (transmitted) data if (i+ecn-l.gt.n)goto 2 c n - number of values in data, okdata c intlv - true to do interleaving c find number of errors in this word c ecn - FEC block size c ect - maximum number of correctable errors (0 for no FEC) k=nbe(data(i),okdata(i),ecn) c ne - number of bit errors remaining c nbx - number of bits examined ne=ne+k c nwe - number of word errors remaining nbx=nbx+ecn c nwx - number of words examined c if any errors integer n c if they are correctable, correct them logical data(n), okdata (n) c else increment word error count integer ne, nwe integer nbx, nwx if (k.eq.O)then logical intlv elseif(k.le.ect)then integer ecn, ect call vlcopy (okdata(i) ,data(i) ,ecn) else integer i, k nwe=nwe+l integer nbe endif integer mod nwx=nwx+l

if(ecn.le.O)then i=i+ecn write(*,*) ' % fee : ecn <= 0 ' goto 1 stop endif 2 continue

if(ect.It.0 .or. ect.gt.ecn)then c count remaining bit errors write(*,*) ' fee : correctable errors (ect) out of range ' stop if (i.le.n)then ne=ne+nbe(data(i),okdata(i) ,n-i+l) nbx=nbx + n-i+1 endif logical out(4096) common out c un-interleave data and correct data k=int(sqrt(float(n))+0.5) if(intlv)then call scr(data, n,.false.) 1=1 call scr(okdata,n,.false.) do 1 i=l,k endif do 1 j=i,n,k if (fwd) then return out(l)=in(j) end else out(j)=in(l) integer function nbe(data,okdata,n) endif 1=1+1 c return number of differences between data and okdata continue

c data - input/output data do 2 i=l,n c okdata - correct data in(i)=out(i) c n - number of values in data, okdata (FEC block size) c ne - local error counter return end integer i, n, ne logical data(n), okdata (n) subroutine dne(data,okdata,n,intlv,ecn,nofdm,snr)

ne=0 c display number of remaining bit errors

do 1 i=l,n c data - input/output data if(data(i).neqv.okdata(i) )ne=ne+l c okdata - correct (transmitted) data 1 continue c n - number of values in data, okdata c intlv - true to do interleaving nbe=ne c ecn - FEC block size c nofdm - OFDM block size (for printing only) return snr - RF SNR (for printing only) end integer n subroutine scr (in,n,fwd) logical data(n), okdata(n) logical intlv c interleave (scramble) n in(put) data bits integer ecn c interleaving factor is sqrt(n) integer nofdm c in direction fwd real snr

integer i, j, k, 1, n integer i, j, k logical in(n) integer nwoerr logical fwd integer nbe integer mod integer int real sqrt, float if (ecn. le.O) then write(*,*) ' % fee : ecn <= 0 ' c common work vector stop endif end

c interleave the received data and the correct (transmitted) data subroutine dnew(nwoerr) integer nwoerr if(intlv)then write(*,'(1X,A2,15)') '%R', nwoerr call scr(data ,n, .true.) return call scr(okdata,n,.true.) end endif

i=l 1 continue simut.f if(i+ecn-l.gt.n)goto 2

c **************** c find number of errors in this word c simut.f - Simulation Utility Routines

c **************** k=nbe (data (i), okdata (i) ,ecn) real function vsum(x,n) c print a flag, block size, snr, number of errors in word integer n write(*,'(1X,A2,I5,F4.0,I5)') '%N', nofdm, snr, k real x(n) i=i+ecn integer i goto 1 real sum 2 continue sum=0. c compute and print error-free run lengths for the block do 1 i=l,n nwoerr=0 sum=sum+x(i) do 3 i=l,n continue if (data (i) .neqv. okdata (i)) then call dnew(nwoerr) vsum=sum nwoerr=0 else return nwoerr=nwoerr+l end endif 3 continue subroutine vmul (a,b,c,n) call dnew(nwoerr) integer n c terminate the block with a -1 real a(n), b(n), c(n) integer i call dnew(-l) do 1 i=l,n c un-interleave data and correct data c(i)=a(i)*b(i) 1 continue if (intlv) then call scr(data, n,.false.) return call scr(okdata,n,.false.) end endif subroutine vlcopy(in,out,n) return CD c copy in into out real sqrt, ssq

integer i, n if (n.le.O)then logical in (n), out (n) write(*,*) ' rms : n <= 0 ' stop do 1 i=l,n endif out(i)=in(i) 1 continue rmsv=sqrt(ssq(x,n)In) return return end end real function ssq(x,n) subroutine vxor(inl,in2,out,n) c sum of squares of elements of a vector c exclusive-or of two logical vectors integer n integer i, n real x(n), p logical inl(n), in2(n), out(n) integer i p-0. do 1 i=l,n do 1 i=l,n out(i)=inl(i).neqv.in2(i) p=p+x(i)**2 1 continue 1 continue ssq=p return return end end

subroutine vdbp(x,n) subroutine vsq(x,y,n)

c convert vector x to dB (power) c vector square y=x**2 for all n elements

integer i, n integer i, n real x(n) real x(n), y(n) real aloglO do 1 i=l,n do 1 i=l,n if (x(i) .le.0.)then 1 y(i)=x(i)**2 write(*,*) ' vdbp: argument <= 0 result set to -100 ' x(i)=-100. return else end x(i)=10.*alogl0(x(i)) endif subroutine vquant(x,n, max,k) 1 continue return c quantize all n elements of x to k bits. end c if k = 0 no quantization is done c values are assumed to lie between +/- max real function rmsv(x,n) c the range +/- max is divided into 2**k equal regions c all values within a region are converted to the mean of the region c root mean square of a vector integer n, k integer n real x(n), max real x(n) real cl, c2 integer i 1 x(i)=v integer nint return end if (k. ne.O) then subroutine vcopy (xl,x2,ns) if(k.It.0)then write(*,*) ' vquant : number of bits < 0 integer ns stop real xl (ns) ,x2 (ns) endif integer i

if (max. le.O) then do 1 i=l,ns write(*,*) ' vquant rmax < or = 0 ' x2 (i)=xl(i) stop 1 continue endif return cl=2**(k-l)/max end c2=l./cl subroutine vadd(x,n,a) do 1 i=l,n if (x(i) .gt.max)then c add a to each element of x x(i)=max elseif(x(i).It.-max)then integer n x (i) =-max real x(n), a else integer i x(i) = c2 * ( nint( x(i)*cl +0.5 ) - 0 endif do 1 i=l,n 1 continue x(i)=x(i)+a 1 continue endif return return end end subroutine vsmul(x,n,a) subroutine vifill(k,n,v) c multiply each element of x by a c fill all n elements of integer vector k with value i integer n integer i, n, k(n), v real x(n), a do 1 i=l,n integer i 1 k(i)=v return do 1 i=l,n end x(i)=x(i)*a 1 continue subroutine vfill(x,n,v) return c fill all n elements of real vector k with value v end

integer i, n c statistics routines: real x(n), v do 1 i=l,n c initialized statistics variables stmn=x/n + 0.0*x2 subroutine stinit(x,x2,n) return c x - sum of a's end c x2 - sum of a**2's c n - number of observations c sample variance

real x, x2 real function stvr(x,x2,n) integer n real x, x2 x=0. integer n x2=0. n=0 if (n.le.l)then stvr=0. return else end stvr=x2/(n-l)-x**2/(n*(n-l)) endif c update statistics variables return subroutine stat(a,x,x2,n) end c a - observed value c lower .95 CI c x - sum of a's c x2 - sum of a**2's real function stl95 (x,x2,n) c n - number of observations real stmn, stvr, t95, sqrt real a, x, x2 real x, x2, t integer n integer n

x=x+a if(n.le.O)then x2=x2+a**2 write(*,*) ' stl95 : n <= 0 ' n=n+l stop endif return end t=stvr(x,x2,n)/n if(t.lt.O)then c mean write(*,*)' stl95: negative variance, set to 0.' t=0. real function stmn(x,x2,n) endif stl95=stmn(x,x2,n)-t95(n)*sqrt(t) real x, x2 integer n return end if (n.le.O)then write(*,*) ' stmn : n <= 0 ' c upper .95 CI stop endif real function stu95 (x,x2,n) c add 0 * x2 to avoid compiler warnings real stmn, stvr, t95, sqrt oo real x, x2, t to integer n c Feb. 21, 1986

if (n.le.O)then c ref.: W. J. Cody, "Rational Chebyshev Approximation for the write(*,*) ' stu95 : n <= 0 ' c Error Function," Mathematics of Computation, 23(107), pp. 631-638, stop c 1969. endif c these functions should be accurate to the limit of single t=stvr(x,x2,n)/n c precision operations. if (t. It. 0) then write(*,*)' stu95: negative variance, set to 0. real function erfc(xO) t=0. endif logical neg stu95=stmn (x,x2, n) +t95 (n) *sqrt (t) real xO, x, x2, x3, x4, y real abs, erf, exp return ' end if(x0.lt.0.)then neg=.true. real function t95(n) else neg=.false, t-table for 0.95 confidence interval endif n is number of trials (degrees of freedom plus 1) alpha = 0.025 x=abs(x0) (rounded to 3 sig. digits) if(x.le.0.5)then integer n c evaluate indirectly real ttab(30) data ttab/ 0., 12.70, 4.30, 3.18, 2.78, y=1.0 - erf(x) 1 2.57, 2.45, 2.37, 2.31, 2.26, 2 2.23, 2.20, 2.18, 2.16, 2.15, elseif(x.ge.4.)then 3 2.13, 2.12, 2.11, 2.10, 2.09, c approximation 3 4 2.08, 2.07, 2.07, 2.06, 2.06, 5 2.06, 2.05, 2.05, 2.05, 2.04 / x2=1.0/(x*x) x4=x2*x2 if (n. It. 1) then y = exp(-x*x)/x * ( 0.5641896 + x2 * write(*,*)'t95: too few trials : ',n 1 ( -4.257996e-2 -1.960690e-l*x2 -5.168823e-2*x4 ) / elseif(n.le.30)then 2 ( 1.509421e-l + 9.214524e-l*x2 + 1.000000e00*x4 ) ) t95=ttab(n) elseif(n.le.40)then else t95=2.03 c approximation 2 elseif(n.le.60)then t95=2.01 x2=x *x else x3=x2*x t95=2.0 x4=x3*x endif return y = exp (-x2) * end 1 ( 7.373888e00 + 6.865018e00*x + 3.031799e00*x2 2 + 5.631696e-l*x3 + 4.318779e-5*x4 ) / single precision complementary error function 3 ( 7.373961e00 + 1.518491e01*x + 1.279553e01*x2 4 + 5.354217e00*x3 + 1.000000e00*x4 ) Ed Casas - UBC Electrical Engineering endif subroutine vsel(a,b,x,z,n) if (neg)then erfc=2.0-y c substitute b into a for x > z else erfc=y integer n endif real a(n), b(n), x(n), z integer i return end do 1 i=l,n if (x(i) .gt.z)then c single precision error function a(i)=b(i) endif real function erf(xO) 1 continue

logical neg return real xO, x, x2, x4, y end real abs, erfc real function berblk(a,b,c) if(xO.lt.0.)then neg=.true. c theoretical BER of an OFDM block else neg=.false, real a, b, c, d endif real erfc, sqrt

x=abs (xO) d=2.0*(b-a**2+c)

if(x.le.0.5)then if(d.lt.-O.OOOl)then c approximation 1 write(*,*)'berblk: b-a**2+c < 0 : ',d/2.0 stop x2=x*x endif x4=x2*x2 y = x * ( 2.138533el + 1.722276e0*x2 + 3.166529e-l*x4 ) / the case where a and d are close to zero is unstable 1 ( 1.895226el + 7.843746e0*x2 + 1.000000e00*x4 ) if(d.le.O.)then else if (a.gt.O) then berblk=0.0 c evaluate indirectly else berblk=0.5 y=1.0-erfc(x) endif else endif berblk=0.5*erfc( a/sqrt( d ) ) endif if (neg) then erf=-y return else end erf=y endif double precision' function dray(x,n) return end Rayleigh CPDF : prob. that signal is x dB below mean c with n ideal selection diversity branches if (if2.ge.n)then if2=n integer n endif real x double precision dexp if (ifl.gt.n)then write(*,*) ' setif: fl > N ' dray = ( l.OdO - dexp( -1.0d0*10.0**(x/10.0) ) )**n stop endif return end if(if2.lt.0)then write(*,*) ' setif: f2 < 0 ' subroutine setif (fs,n,fl,ifl,f2,if2) stop endif c (two real values per frequency, first pair has DC and fs components) if(ifl.gt.if2)then integer n write(*,*) ' setif: fl > f2 ' real fs, fl, f2 stop integer ifl, if2 endif integer mod real float return end if(fs.le.O.)then write)*,*) ' setif : fs <= 0 ' count number of O's, l's and runs stop endif subroutine runcnt(data,n,nO,nl,nr,r) c find array index corresponding to frequency fl integer n, nO, nl, nr integer i if 1=2. *f 1/f s*f loat (n) +1. real tnOnl, avgr, varr, r logical data(n), prev c round ifl up to an odd number so that it points to the c real element of the first complex number test for n > 1 c e.g. 1->1, 2->3 if (n.le.l)then ifl=ifl-mod(ifl,2)+l write(*,*) ' runcnt: n < 2 . ' stop c find array index corresponding to frequency f2 endif

if2=2.* f2/fs* float(n)+1. initialize c round if2 down to an even number so that it points to the if(data(1))then c imaginary element of the last complex number n0=0 c e.g. 2048->2048, 2047->2046 nl=l else if2=if2-mod(if2,2) nO=l nl=0 if(ifl.le.O)then endif ifl=l nr=l endif prev=data(l) c go through data and count up true, false, and changes integer nin, nout do 1 i=2,n logical inl(nin), in2(nin), out (nout) if (data (i)) then integer i, j nl=nl+l if(.not.prev)then if(2*nout.ne.nin)then nr=nr+l write(*,*) ' vl2diff : nin <> 2*nout. ' prev=.true. stop endif endif else nO=nO+l 1-1 if (prev) then do 1 i=l,nin,2 nr=nr+l out(j) = ( inl(i) .eqv. in2(i) ) prev=.false, + .and. ( inl (i+1) .eqv. in2 (i+1) ) endif j=j+l endif 1 continue 1 continue return c compute normalized r.v. (hopefully distributed n(0,l)) end

if(n0.eq.O .or. nl.eq.O)then real function dbp(x) r=0. else c convert a power to dB tnOnl = 2.0 * nO * nl avgr = 1.0 + tnOnl/float(n) real x varr = tnOnl*(tnOnl-float (n))/(float(n)*float(n)*float(n r= (float (nr) - avgr) / sqrt (varr) if(x.gt.O.)then endif dbp=10.*alogl0(x) else return write(*,*) ' dbp : db(x) for x<0 set to -99 ' end dbp=-99. endif real function norct(data,n) return c generate normalized run count (easier to call than runcnt) end

integer n, il, i2, i3 subroutine vddat(crsig, txdata,nf,f1,f2,n,snr) logical data real r integer nf, n real crsig(nf) call runcnt (data,n,il,i2,i3,r) logical txdata (nf) norct=r real fl, f2, snr integer i return real f, txmag, rxmag, txan, rxan end real atan2 integer mod subroutine vl2diff(inl,in2,nin,out,nout) real a, b

compare dibits (2-bit sequences) and generate a logical vector if (mod(nf,2) .ne.0)then map of dibit differences (.true.=difference) write(*,*) ' vddat : nf not even. ' stop c x - vector of received data values endif c data - transmitted logical data values c nx - number of elements in x and data do 1 i=l,nf,2 c nav - number of snr measurements (of x) to average c n - OFDM block size (to print) txmag=1.4142 c snr - RF SNR (to print) if (txdata (i)) then if(txdata(i+1))then integer n, nx, nav txan=45. logical data(nx) else real x(nx), svec(nx), nvec(nx) txan=-45. real fs, fl, snr endif else real f, df if (txdata (i+1)) then integer i, nsn txan=135. real dbp, float else txan=-135. call vsnv(x,data,nx,svec, nvec,nav,nsn) endif endif f=fl df=float(nav)/float(n)* (fs/2.0) rxmag=sqrt(crsig(i)**2+crsig(i+1) **2) rxan=atan2(crsig(i+1),crsig(i)) *57.3 do 1 i=l,nsn write(*,' (1X,A2,I5,F4.0,2F6.0,3F6.1)') f=f1+i*(f2-f1)/float(nf) + '%S', n, snr, f, f+df, dbp (svec (i)), dbp (nvec (i)), + dbp(svec(i))-dbp(nvec(i)) if (txdata (i)) then f=f+df a=1.0 1 continue else a=-1.0 return endif end

if (txdata(i+1)) then subroutine davsn(x, data,nx,n,snr,svec,nvec) b=1.0 else c same as dvsn but displays the average signal and noise power b=-l.0 c of several signal vectors over all frequencies. endif c x - vector of received data values write(*,' (1X,A2,2F10.4)') '%D', a, crsig(i) c data - transmitted logical data values write(*,' (1X,A2,2F10.4)') '%D\ b, crsig(i+l) c nx - number of elements in x and data c n - OFDM block size (to print) write(*,' (1X,A2,I5,F4.0,F6.0,2(F4.1,F6.0))') c snr - RF SNR (to print) + '%A', n, snr, f, txmag, txan, rxmag, rxan c nav - number of snr measurements (of x) averaged so far continue c n2av - number of snr measurements to average

return integer n, nx end logical data(nx) real x(nx), svec(nx), nvec(nx) subroutine dvsn(x,data,nx,fl,fs,n,snr,nav,svec,nvec) real snr integer nsn, n2av c nav - (maximum) number of elements of x to average real sums, sums2, sumn, sumn2 c nsn - number of elements in s and n integer nsums, nsumn real dbp, stmn integer nx, nav, nsn logical first logical data(nx) real x(nx) data first /.true./ integer mxnsn parameter (mxnsn=100) if(first)then real s(mxnsn), n(mxnsn) first=.false. call stinit(sums,sums2,nsums) real sp, np call stinit(sumn,sumn2,nsumn) integer i, k, nleft write(*,*) ' how many blocks to average ? ' read(*,*) n2av if (nx.le.O)then endif write(*,*) ' vsn : nx <= 0 .' stop call vsnv(x,data,nx,svec,nvec,nx,nsn) endif

call stat(svec(l),sums,sums2,nsums) i=l call stat(nvec(1),sumn,sumn2,nsumn) nsn=l nleft=nx n2av=n2av-l 1 continue k=min(nleft,nav) if(n2av.le.0)then call vsn(x (i) ,data(i) ,k,sp,np) write(*,' (1X,A2,I5,F4.0,3F6.1)') s (nsn) =sp + '%X', n, snr, n(nsn)=np + dbp(stmn(sums,sums2,nsums)), i=i+nav + dbp(stmn(sumn,sumn2,nsumn)), nsn=nsn+l + dbp(stmn(sums,sums2,nsums)) - nleft=nleft-nav + dbp(stmn(sumn,sumn2,nsumn)) if(nleft.gt.O)goto 1 call stinit(sums,sums2,nsums) call stinit (sumn,sumn2,nsumn) nsn=nsn-l write(*,*) ' how many blocks to average ? ', char (7) read(*,*) n2av return endif end

return subroutine vsn(x,data,nx,s,n) end c computes mean square and variance of received data values in subroutine vsnv(x,data,nx,s, n,nav, nsn) c a vector x, (to get signal and noise powers) by using negatives c of values in x whose corresponding element in data are 'false'. c computes vectors of mean square and variance of received data c values averaged over over several values vector x, (to get signal c x - vector of received data values c and noise powers as a function of frequency). c data - transmitted logical data values c nx - number of elements in tx and rx c x - vector of received data values c s - square of mean of received data values c data - transmitted logical data values c n - variance of received data values c nx - number of elements in tx and rx c s - square of mean of received data values integer nx c n - variance of received data values logical data(nx) real x(nx), s, n subroutine hwinit(data,prev,dev,tmp,neqbl. + ia,nmax,ns,fs,fl,f2,dbd,rms,peak,txemp,demp, real ts, fs, ts2, fs2, tsp, tnp, fsp, fnp + empscl,nempsc,empfr,empsc) integer i, nt, nf c generate pre- and de-emphasis and channel correction vectors if(nx.le.O)then c by measuring channel responce write(*,*) ' vsn : nx <= 0 .' stop c data - temporary logical vector, length ns endif c prev - generated pre-emphasis vector, length ns c dev - generated de-emphasis vector, length ns ts =0. c tmp - temporary real vector, length ns ts2=0. c neqbl - number of blocks to average in generating equalization fs =0. c vector fs2=0. c ia - integer*2 sample vector, length nmax nt=0 c nmax - (OFDM) block size of channel probe signal and size of nf=0 c prev/dev c ns - duration of channel probe signal (samples) do 1 i=l,nx c fs - sampling rate if (data (i) )then c fl - lower frequency limit of channel to use ts =ts + x(i) c f2 - upper frequency limit of channel to use ts2=ts2 + x(i)**2 c dbd - dE7decade of pre-emphasis to use nt=nt+l c rms - rms voltage of output signal else c peak - peak voltage of output signal fs =fs + x(i) c txemp - true to do phase/amplitude correction at transmitter fs2=fs2 + x(i)**2 c devrms - rms value of de-emphasis vector (dev) nf=nf+l c demp - true to display equalization endif c empscl - 1 continue c nempsc - c empfr - tsp = ( ts / nt )**2 c empsc - fsp = ( fs / nf )**2 integer ns, nmax, nempsc tnp = ts2 / nt - tsp logical data(nmax), txemp, demp, empscl fnp = fs2 / nf - fsp real prev(nmax), dev(nmax), tmp (nmax) real empfr(nempsc), empsc(nempsc) s = ( tsp + fsp ) / 2. integer*2 ia(ns) n = ( tnp + fnp ) / 2. integer i, neqbl, ifl, if2, nf real fs, fl, f2, dbd, rms, peak return real dbp, atan2 end integer j logical sr(23) simhw.f real devrms real rmsv $LARGE c ************************************ data sr/ c simhw.f - harware channel routines 1 .false., .true., .true., .false., .false., c ************************************ 1 .false., .true., .true., .true., .true., c 87-11-19 1 .false., .true., .false., .true., .false., 1 .true., .false., .true., .false., .true., 1 .false., .true., .false. / call encode(data,prev,if1,if2,nmax)

c write(*,*) ' fs,nmax,fl,f2 = ', fs,nmax,fl,f2 c complex divide input by output (in frequency domain) to generate c correction (de-emphasis) vector c find indices for frequency limits call cdiv (prev (ifl) ,dev(ifl), dev (ifl) ,nf) call setif(fs,nmax,fl,ifl,f2,if2) nf=if2-ifl+l c accumulate this equalization vector

call vfill(tmp,nmax,0.) call wadd (dev, tmp, tmp,nmax)

c prompt operator to turn off noise and fading 1 continue

pause ' turn noise and fading * OFF * ' c prompt operator to turn noise and fading back on

c run prbs a few times to get rid of possible transients pause ' turn noise and fading * ON * '

call prbs(data,nmax,sr) c scale by number of equalization vectors averaged call prbs(data,nmax, sr) call vsmul(tmp,nmax,1./float(neqbl)) c compute and average "neqbl" equalization vectors c re-generate pre-emphasis vector (no dynamic storage, *%!&$%) do 1 j=l,neqbl call empgen (prev (ifl) ,nf,f2/fl, dbd) c generate vector for pre-emphasis ("dbd" dB/decade) c if desired, print initial de-emphasis vector call empgen (prev (ifl) ,nf, f2/fl,dbd) c *** debug *** c generate random +/- 1 values in frequency skipping DC and fs/2 terms c write(*,*) ' ifl, if2 = ', ifl, if2 call prbs(data,nmax,sr) if(demp)then call encode(data,dev,ifl,if2,nmax) do 2 i=ifl,if2,50 call emp(dev,prev,f1,f2,fs,nmax,nmax) write(*,'(1X,A3,F6.0,F5.1,F8.0)') '%E ', call vcopy(dev,prev, nmax) + float(i)/nmax*(fs/2), + dbp(dev(i)**2+dev(i+l)**2), c modulate to time-domain + atan2(dev(i),dev(i+l))*57.3 2 continue call modu(prev,nmax,nf, .false.) endif c send it through the channel c if phase/magnitude correction is done at transmitter, c swap emphasis vectors call hwch(prev,dev,ia, nmax,ns,rms,peak) if (txemp) then c recover the (frequency-domain) channel output c normalize the old de-emphasis vector to (complex) magnitude of 1 and call demodu(dev ,nmax,nf,.false.) c copy to pre-emphasis vector c regenerate the (frequency-domain) input (before pre-emphasis) devrms=rmsv(dev(ifl) ,nf) *sqrt (2.0) call vsmul(dev(ifl),nf,1.0/devrms) call vcopy(dev,prev,nmax) c ( skip i/o for debugging ) c call vcopy(x,y(2),n-l) generate a de-emphasis vector with appropriate magnitude c y(l)=x(n) c return call empgen (dev (if 1), nf, f2/f 1, dbd) call vsmul(dev,nmax,devrms) c test peak value

endif if(peak.le.O.)then write(*,*) ' hwch : peak <= 0. ' if(empscl)then stop call empscf (prev (ifl), nf,fl, (f2-fl)/float (nf/2), endif + empsc,empfr,nempsc) endif if (peak. gt. (2.5/gf ilt)) then write(*,*) ' hwch : peak level too large. ' return stop end endif

subroutine hwch(x,y,ia,n,ns, rms,peak) c test block size and number of samples do modem i/o (with guard samples) if (n. It. 0) then write(*,*) ' hwch: n < 0 ' x - samples to be sent (variance = 1) stop y - received samples (nominal variance = 1) endif ia - integer*2 sample work vector n - number of elements in x and in y if(ns.lt.n)then ns - total number of samples to generate write(*,*) ' hwch: ns < n ' rms - rms voltage of output signal stop peak - peak voltage of output signal endif peak must be less than 2.5 (Volts) (maximum DAC output) c factor to give unit-rms samples the rms value integer i, j, k, n, nov, over, istart, iend real peak, rms kl=rms real x(n), y(n), z, kl, k2 integer*2 ia(ns) c center the n OFDM samples in the ns-sample output integer int integer io istart=ns/2-n/2+l real float iend=ns/2+n/2 voltage-to-DAC and ADC-to-voltage conversion factors, c combine dacscl and gfilt values are for a 10-bit ADC and 12-bit DAC k2=dacscl*gfilt real dacscl, adcscl parameter ( dacscl = 4096./5. ) c convert the f.p. samples to DAC levels parameter ( adcscl = 5./1024. ) c limit peak level (limits peak deviation) gain required to compensate for any (measured) filter loss c zmin= l.e30 c zmax=-l.e30 real gfilt c zrms= 0. parameter ( gfilt = 1.11 ) nov=0 goto 4 j=istart 5 continue do 1 1=1,n z=x(i)*kl c do io and stop if overrun if (z.gt .peak) then z=peak over=io(ia,ns) nov=nov+l else if (z.It.-peak)then if ( over.ne.O ) then z=-peak write(*,*) ' hwch: A/D or D/A overrun ' nov=nov+l stop endif endif

ia(j)=int( z * k2 + 0.5 ) c scale A/D samples back to FP c if (z.lt.zmin)zmin=z j=istart c if(z.gt.zmax)zmax=z do 6 i=l,n c zrms=zrtns+z**2 y (i)=float (ia (j)) * adcscl 3=3+1 j-j+l 6 continue 1 continue return c write(*,*) ' % TX signal rms = ',sqrt(zrms/n) end c write(*,*) ' % TX signal min = ',zmin c write(*,*) ' % TX signal max = ',zmax subroutine emp(x,y,fl,f2,fs,n,ns) if (nov. ne. 0) then c write (*,*)'%', 100.*float(nov)/n, ' % overflow. ' c multiply vector x by vector y over the indices ifl to if2 to do endif c pre-emphasis or de-emphasis and correction for channel gain/phase c transfer function c add guard band before data c x - vector to be corrected j=istart-l c y - correction vector i=iend c ifl - first element of x to correct 2 continue c if2 - last element of x to correct if (j. It. 1) goto 3 c n - number of values in x ia(j)=ia(i) c ns - number of values in y (multiple of n) i=i-l j=j-l integer i, j, j2, n, ns, skip goto 2 integer ifl, if2 3 continue real fl, f2, fs real a, b, c, d c add guard band after data real x(n) real y(ns) j=iend+l integer mod i=istart 4 continue if(mod(ns,n) .ne.O)then if(j.gt.ns)goto 5 write(*,*) ' emp: ns not multiple of n ' ia(j)=ia(i) stop j=j+l endif i=i+l call setif (fs,n,fl,ifl,f2,if2) a=x(i) call setif (fs,ns,fl, j,f2, j2) b=x(i+l) skip=2*ns/n z (i) =a*c-b*d z(i+l)=a*d+b*c do 1 i=ifl,if2,2 else a=y(j) write(*,*) ' % cdiv: complex divide by zero at i = ',i b=y(j+l) z(i) =0. c=x(i) z(i+l)=0. d=x(i+l) endif x(i ) = a*c - b*d 1 continue x (i+1) = a*d + b*c j=j+skip return 1 continue end

c ( debugging ) subroutine empgen(x,n, f2byfl,dbd) c write(*,*) ' emphasis results: ' c write(*,*) ' n, ns = ', n, ns c generate (complex) pre-emphasis vector c write(*,*) ' ifl, if2 = ', ifl, if2 c write(*,*) ' j, skip = ', j, skip c x - emphasis vector to be generated c write(*,*) ' results: i j a,b c,d result ' c n - number of elements (even) c write(*,900) i, j, a, b, c, d, x(i), x(i+l) c f2byfl - ratio of highest to lowest frequency c900 format(lx,2i5,6f7.3) c dbd - number of dB per decade emphasis

return integer n, i end real x(n), dbd, f2byfl real decs, xn, k, y, ss subroutine cdiv(x,y,z,n) real aloglO, sqrt, float integer mod c divide two complex vectors (z=x/y) if (mod(n,2) .ne.OJthen integer i, n write(*,*) ' empgen : n not even ' real x(n), y(n), z (n) stop real a, b, c, d, r endif integer mod c number of decades between frequency limits if (mod (n, 2) .ne.O) then write(*,*) ' cdiv: n not even ' decs = aloglO(f2byfl) stop endif c total increase (linear factor)

do 1 i=l,n,2 xn = 10. ** ( dbd * decs / 20. ) c find mag. squared of y c=y(i) c constant factor to obtain required increase d=y(i+l) r=c*c+d*d k = 10. ** ( aloglO(xn) / (n/2-1) ) if (r.ne.O.(then c set c,d = 1/y c generate scaled vector and find total power c= c/r d=-d/r y=l. c multiply by x=a,b ss=0. do 1 i=l,n,2 c x emphasis vector to be scaled x(i )=y c nx - number of real elements in x (assumed as real/imag. pairs) x(i+l)=0. c fl - starting frequency of values in x ss=ss+y**2 c df - frequency increment between values in x y=y*k c sc - the responce of the channel to be used to scale x 1 continue c fr - the upper frequency limits for each scaling value in sc c nsc - number of values in sc and fr ss=sqrt(ss/float(n/2)) integer nx, nsc c scale to unity power real x(nx), sc(nsc), fr(nsc) real fl, df call vsmul(x,n,l./ss) integer i, j c ( debugging ) real k, f, ss c write(*,*) ' f2byfl, n, dbd, k = ', f2byfl, n, dbd, k c write(*,*) ' ss = ', ss if(nsc.It.1)then c write(*,*) ' empgen power = ',rmsv(x,n)*sqrt(2.) write(*,*) ' empscf : nsc < 1 .' stop return endif end c initialize subroutine waitfor(prompt) character* (*) prompt j=l character c f=fl close(0) ss=0.0 write(0,*)prompt read(0,' (Al)')c k=10.0**(-1.0*sc(l)/20.0) return end c scale the real part of every emphasis vector pair

subroutine wadd(a,b,c,n) do 3 i=l,nx,2 c c(i)=a(i)+b(i) for i=l to n c go on to next scaling value if necessary for current frequency

integer i, n 1 continue real a(n), b(n), c(n) if ((f.le.fr(j)) .or. (j.ge.nsc))goto 2 j=j+l do 1 i=l,n k=10.0**(-1.0*sc(j)/20.0) c(i)=a(i)+b(i) goto 1 1 continue 2 continue c scale and sum squares return end x(i)=x(i)*k ss=ss+x(i)**2 subroutine empscf(x,nx,f1,df,sc,fr,nsc) f=f+df c subroutine to scale a pre- or de-emphasis vector using a c measured channel power transfer function or baseband SNR 3 continue c characteristics. ss=sqrt(ss/float(nx/2)) call vsmul(x,nx,1.0/ss) sifft.dif (diffs from FAST.FOR) return end 0al,5 > c warning !!!! : these routines have been modified to work simdum.f > c on arrays of size N instead of N+2 > c modified 87-8-14 to send all output to default output ************************************ > c simdum.f - dummy hardware channel routines for non-PC systems > C ************************************ la7,9 > C SUBROUTINE: FFA subroutine hwinit (data,prev, dev,tmp,neqbl, > C FAST FOURIER ANALYSIS SUBROUTINE + ia,ni,ns,fs,fl,f2,dbd,rms,peak,txemp,demp) > C 3cll integer neqbl, ni, ns < SUBROUTINE FFA(B, NFFT) logical data(ni), txemp, demp real prev(ni), dev(ni), tmp(ni) > SUBROUTINE FFAn (B, NFFT) integer*2 ia(ns) 37c45 real fs, fl, f2, dbd, rms, peak < WRITE (IW, 9999) ?G.

write (*,*) ' hwinit - dummy routine called ' > WRITE (*, 9999) 9; stop 72,75c80,83 < T = B(2) §: end < B(2) = 0. 5? < B (NFFT+1) = T subroutine hwch (x,y,ia,n,ns, rms,peak) < B (NFFT+2) = 0.

integer n, ns > c T = B(2) 2 real x(n), y(n), rms, peak > c B(2) =0. Q integer*2 ia(n) > c B(NFFT+1) = T > c B(NFFT+2) =0. Q write(*,*) ' hwch - dummy routine called ' 88c96 rxj stop < SUBROUTINE FFS(B, NFFT)

end > SUBROUTINE FFSn(B, NFFT) 119C127 subroutine emp(x,y, fl, f2, fs,n,ns) < WRITE (IW,9999)

integer n, ns > WRITE (*, 9999) real fl, f2, fs 123C131 real x(n), y (ns) < B(2) = B (NFFT+1)

write(*,*) ' emp - dummy routine called ' > C B(2) = B(NFFT+1) stop 710C718 < WRITE (IW,9999) end > WRITE (*,9999) 941a950,1062 >

> 0 Ol > c > C > C FUNCTION: I1MACH > C SINGLE-PRECISION > C THIS ROUTINE IS FROM THE PORT MATHEMATICAL SUBROUTINE LIBRARY > C > C IT IS DESCRIBED IN THE BELL LABORATORIES COMPUTING SCIENCE > C IlMACH(ll) = T, THE NUMBER OF BASE-B DIGITS. > C TECHNICAL REPORT #47 BY P.A. FOX, A.D. HALL AND N.L. SCHRYER > C

> c > C I1MACH(12) = EMIN, THE SMALLEST EXPONENT E. > c > C > INTEGER FUNCTION IIMACH(I) > C I1MACH(13) = EMAX, THE LARGEST EXPONENT E. > C > C > C I/O UNIT NUMBERS. > C DOUBLE-PRECISION > C > C > c I1MACH( 1) = THE STANDARD INPUT UNIT. > C I1MACH(14) = T, THE NUMBER OF BASE-B DIGITS. > c > C > c I1MACH( 2) = THE STANDARD OUTPUT UNIT. > C I1MACH(15) = EMIN, THE SMALLEST EXPONENT E. > c > C > c I1MACH( 3) = THE STANDARD PUNCH UNIT. > C I1MACH(16) = EMAX, THE LARGEST EXPONENT E. > c > C > c I1MACH( 4) = THE STANDARD ERROR MESSAGE UNIT. > C TO ALTER THIS FUNCTION FOR A PARTICULAR ENVIRONMENT, > C > C THE DESIRED SET OF DATA STATEMENTS SHOULD BE ACTIVATED BY > C WORDS. > C REMOVING THE C FROM COLUMN 1. ALSO, THE VALUES OF > C > C IlMACH(l) - I1MACH(4) SHOULD BE CHECKED FOR CONSISTENCY > C I1MACH( 5) = THE NUMBER OF BITS PER INTEGER STORAGE UNIT. > C WITH THE LOCAL OPERATING SYSTEM. > C > C > C I1MACH( 6) = THE NUMBER OF CHARACTERS PER INTEGER STORAGE UNIT. > INTEGER IMACH(16),OUTPUT > C > C > C INTEGERS. > EQUIVALENCE (IMACH(4),OUTPUT) > C > C > C ASSUME INTEGERS ARE REPRESENTED IN THE S-DIGIT, BASE-A FORM > C MACHINE CONSTANTS FOR THE VAX-11 WITH > C > C FORTRAN IV-PLUS COMPILER > C SIGN ( X(S-1)*A**(S-1) + ... + X(1)*A + X(0) ) > C > C > DATA IMACH( 1) / 5 / > C WHERE 0 .LE. X(I) .LT. A FOR 1=0,...,S-1. > DATA IMACH( 2) / 6 / > C > DATA IMACH( 3) / 5 / > C I1MACH( 7) = A, THE BASE. > DATA IMACH( 4) / 6 / > C > DATA IMACH( 5) / 32 / > C I1MACH( 8) = S, THE NUMBER OF BASE-A DIGITS. > DATA IMACH( 6) / 4 / > C > DATA IMACH( 7) / 2 / > C I1MACH( 9) = A**S - 1, THE LARGEST MAGNITUDE. > DATA IMACH( 8) / 31 / > C > c DATA IMACH( 9) / 2147483647 / > C FLOATING-POINT NUMBERS. > c imach 9 not used by fftsn > C > data imach ( 9)/ 0 / > C ASSUME FLOATING-POINT NUMBERS ARE REPRESENTED IN THE T-DIGIT, > DATA IMACH(10) / 2 / > C BASE-B FORM > DATA IMACH(11) / 24 / > C > DATA IMACH(12) / -127 / >C SIGN (B**E)*( (X(l)/B) + ... + (X(T)/B**T) ) > DATA IMACH(13) / 127 / > C > DATA IMACH(14) / 56 / >C WHERE 0 .LE. X(I) .LT. B FOR 1=1,...,T, > DATA IMACH(15) / -127 / > C 0 .LT. X(l), AND EMIN .LE. E .LE. EMAX. > DATA IMACH(16) / 127 / > C > c > C IIMACH(IO) = B, THE BASE. > IF (I .LT. 1 .OR. I ..GT . 16) GO TO 10 > c > I1MACH=IMACH(I) c external utilities > RETURN > C real stmn, stu95, stl95 > 10 WRITE (*,9000) > 9000 FORMAT(39H1ERROR 1 IN I1MACH - I OUT OF BOUNDS) c intialize variance and BER sums (and sums of squares) to zero *•> r -> c > STOP data ber /mxblsn*0.0/, bers /mxblsn*0.0/ *s. r > END C : > $INCLUDE: 'simpget.f c fdint.f c initialize snr tables $LARGE Q *************** call s2init(b,w,rms,peak,fm,fd,rfm,agclim,sqlim. c fdint.f - MC Integration + nints,intsr,intss, nintn,intnr,intnn, c *************** + fading, noisng ) c Ed. Casas 86-2-19 c do for each of ntr trials c Monte-Carlo integration program to obtain OFDM BER. c revised for variable r-sn characteristics"87-7-3 do 50 1=1,ntr c added block error rate calculations 88-11-11 c clear sum of BERs for this trial

$INCLUDE: 'simpdef.f do 60 j=l,nn c do 60 k=l,nsnr bert (j,k)=0.d0 c local variables: bkert (j,k)=0.d0 60 continue c counters c do appropriate number of passes integer i, j, k, 1 do 30 i=l,nblk c workspace to generate fading waveforms c generate a fading envelope with 0 dB mean real fade(ns) if (fading) then c vectors to store BER in one trial, sums of BERs, squares of BERs call genfdb(fd/fs,fseed,fade,ns, c and number of trials + ndbr,thr,ndw,nsw) else double precision berout, bkrout call vfill(fade,ns,0.) real bert (mxblk,mxsnr), ber (mxblk,mxsnr), bers (mxblk,mxsnr) endif real bkert(mxblk,mxsnr), bker (mxblk,mxsnr), bkers (mxblk,mxsnr) real temp c do for each snr integer ntrial(mxblk,mxsnr), nbktr(mxblk,mxsnr) do 30 k=l,nsnr c vectors for received signal and noise values and their squares c convert received envelope level to r and s values and squares real rs(ns), rn(ns), rs2 (ns), rn2 (ns) call r2sns (fade, rs,rn,ns, snr (k)) write(*,' (1X,I6,F6.1,3(1PE11.2))') na(j), snr(k), call vsq(rs,rs2,ns) + stmn (bker(j,k), bkers(j,k), nbktr(j,k)), call vsq(rn,rn2,ns) + stl95(bker(j,k), bkers(j,k), nbktr(j,k)), + stu95(bker(j,k), bkers(j,k), nbktr(j,k)) c do for each block size 200 continue

do 30 j=l,nn end c update variance and BER sums c Sum for one snr, len

call sum2(rs,rs2,rn2,ns,na(j),ecn,berout,bkrout, subroutine sum2(rs,rs2,rn2,ns,len,ecn,berout,bkrout,snr,dnerr) + snr (k), dnerr) bert (j,k)=bert (j,k)+berout c subroutine to calculate fade and snr statistics of a block and bkert(j,k)=bkert(j,k)+bkrout c correspoding BER c write(*,*) ' blk, BkER = ',i, bkrout c variables:

30 continue c counters c update statistics counts at end of a trial integer i, j, k

do 70 j=l,nn c length of received signal and noise vectors do 70 k=l,nsnr integer ns temp=bert(j,k)/nblk c vectors for received signal and noise values and squares call stat(temp, ber(j,k), bers(j,k), ntrial(j,k)) real rs(ns), rs2(ns), rn2 (ns) temp=bkert (j,k)/nblk c OFDM block length, FEC block (word) length call stat(temp, bker(j,k), bkers(j,k), nbktr(j,k)) integer len, ecn c write(*,*) ' j,k,ber,ntrial=', j,k,ber (j,k),ntrial (j,k) c added to display block snr: snr and true to display block BER 70 continue real snr 50 continue logical dnerr c print results c inverse of block length write(*,*)' % BER, -/+ .95 conf limits ' do 100 j=l,nn real invlen do 100 k=l,nsnr write(V (1X,I6,F6.1,3(1PE11.2))') na(j), snr(k), c number of blocks tested + stmn (ber(j,k), bers(j,k), ntrial(j,k)), + stl95(ber(j,k), bers(j,k), ntrial(j,k)), integer ntst, n + stu95(ber(j,k), bers(j,k), ntrial(j,k)) 100 continue c sums of BERs write(*,*)' % BkER, -/+ .95 conf limits ' do 200 j=l,nn double precision ber, berout, bker, bkrout, dtemp do 200 k=l,nsnr c sums of s, sA2, nA2 b=b*invlen c=c*invlen real a, b, c, d c write(*,*) ' a, b, b-a**2, c = ', a, b, b-a**2, c c intrinslcs c add resulting block BER to the appropriate BER averaging sum integer mod c and compute BkER assuming independent errors c external utilities dtemp=berblk(a,b,c) ber =ber +dtemp real berblk if ( dnerr ) write(*,'(IX,A2,15,F4.0,E16.7)') '%B ', c find number of OFDM blocks included in the vector fade + len, snr, dtemp

if(len.eq.O .or. mod(ns,len) .ne.0)then bker=bker+(1.OdO-(1.OdO-dtemp)**ecn) write(*,*)'sum2: bad OFDM block size.' ntst=ntst+l stop endif c write(*,*) ' BER = ', dtemp n=ns/len c write(*,*) ' BkER =', (1.OdO-(1.OdO-dtemp)**ecn) c find inverse of block length 10 continue

invlen=l./len berout=ber /ntst bkrout=bker/ntst c start at the first sample of the input block return i=l end ntst=0 ber= O.OdO bker=0.OdO c do for each block pint.f

do 10 j=l,n c **************** c Integration for large/small N a=0. c **************** b=0. c pint.f c=0. c ed.casas 87-9-16 c get statistics for this block c '• $INCLUDE: 'simpdef.f do 20 k=l,len c a=a+rs (i) b=b+rs2{i) c local variables c=c+rn2(i) i=i+l real r(2000), p(2000), s(2000), s2 (2000), n(2000), wrk(2000) 20 continue integer i, j, k a=a*invlen real al, be, ga real sber, Lber + s2init (b,w,rms,peak, fm, fd,rfm,agclim, snr (j) +thrsh (k), + nints,intsr,intss, nintn,intnr,intnn, real vsum, berblk + fading, noisng )

real snrmin, snrinc c initialize probability (Rayleigh) table integer nst parameter (nst=1100) call pgen(snrmin,snrinc,snr(j),ndbr,p,r,nst)

snrmin=-50. c find signal and noise scaling signals from snr signal snrinc=0.1 call r2sns(r,s,n,nst,0.) c $INCLUDE: 'simpget.f c compute s**2 and n**2 c call vmul(s,s,s2,nst) c can only vary one threshold (age OR squelch) at a time call vmul(n,n,n,nst)

if ( agevar .and. sqvar ) then c integrate to find averages of al(pha), be (ta), and ga(mma) write(*,*) ' pint : agevar and sqvar true. ' stop call vmul(p,s,wrk,nst) endif al=vsum(wrk,nst) c do at least one loop call vmul(p,s2,wrk,nst) be=vsum(wrk,nst) if ( nthrsh .le. 0 ) then nthrsh=l call vmul(p,n,wrk,nst) thrsh(1)=0. ga=vsum(wrk,nst) endif c use block BER equation to estimate long-block BER do 1 k=l,nthrsh lber=berblk(al,be,ga) if ( .not. (agevar .or. sqvar) ) call + s2init(b,w,rms,peak,fm,fd,rfm,agclim,sqlim, c find single-sample-block BERS and scale by the sample probability + nints,intsr,intss, nintn,intnr,intnn, + fading, noisng ) do 2 i=l,nst wrk(i) =berblk (s (i), s2 (i),n (i)) *p (i) do 1 j=l,nsnr c write!*,'(1X,I10,F10.2,5E15.3)')i,r(i), c & berblk (s(i),s2(i),n(i)),p(i),wrk (i) c initialize snr-to-signal and snr-to-noise tables 2 continue c if testing effect of varying the age limit c add up (average) to find short-block BER

if ( agevar ) call sber=vsum(wrk,nst) + s2init(b,w,rms,peak,fm,fd,rfm,snr(j)+thrsh(k), sqlim, + nints,intsr,intss, nintn,intnr,intnn, if ( agevar .or. sqvar ) then + fading, noisng ) write(*,*) snr(j), thrsh(k), sber, lber else c if testing effect of varying the squelch limit write(*,*) snr(j), sber, lber endif if ( sqvar ) call 1 continue sump=sump+p(i)

end write(*,'(1X,I10,F10.2,2E15.3)') i, r(i), p(i), sump

subroutine pgen(snrmin,snrinc,snravg,ndbr,p,r, n) snr=snr+snrinc

c generate tables of snrs and probabilities continue

c input: if (abs(sump-l.O).gt.0.001)then c snrmin - minimum snr wrlte(*,*) 'pgen:total probability <>1; = ',sump c snrinc - snr increment per step stop c snravg - average snr endif c ndbr - number of diversity branches c r - signal levels (snr) return c p - probability of a given step end c n - number of values in p integer n, ndbr io.asm real snrmin, snrinc, snravg real p(n), r (n) COMMENT $ c local variables: This Microsoft FORTRAN-callable function reads/writes a block of samples from/to the analog interface board. Ed. Casas 87-10-19. c i - counter into p and r c sump - sum of probabilities (should add to 1) The FORTRAN use is:

integer i NR=I0(IA,N) real sump where: real snrkl, snrk2, snr IA - INTEGER*2 (16-bit) array containing the D/A samples on entry c rayleigh CPDF and containing the A/D samples on return. If "convert" is double precision dray not zero the samples are left justified in binary (unsigned) format. In this case the samples should be pre-/post- c calculate signal level points and probabilities converted to two's-complement.

sump=0. N - INTEGER*4 number of values to be input and output. snr=snrmin snrkl=snrinc/2.0-snravg NR - INTEGER*4 number of samples *N0T* read/written. If this number snrk2=snrinc/2.0+snravg is not zero, an over-run occurred.

do 1 i=l,n c save the snr and probability between the two signal levels I0_TEXT segment byte public 'CODE' assume cs:I0_TEXT r(i) = snr ; timing constants p(i) = dray(snr+snrkl,ndbr) - dray(snr-snrk2,ndbr) MHZ equ 2 ; 8253 clock input frequency (MHz) c sum probabilities to check PERIOD equ 125 ; sampling period, (us) (125 minimum) LEN equ 4 ; S/H sampling time (us) (4 maximum) negate sample count so can count up to zero

; non-zero to convert between offset-binary and 2's complement not si complement di:si not di convert equ 1 ; set to 0 if get overrun errors on a slow PC add si, 1 add 1 adc di, 0 ; hardware es:bx points into sample array IBMIO equ 300H ; I/O base address for IBM prototyping card les bx, dword ptr [bp+10] PIA equ IBMIO ; 8255 par. port: MS bit=overrun, LS=sampling PI AO equ PIA+0 PIA port A ; dh retains high byte of I/O board address PIA1 equ PIA+1 ; PIA port B PIA2 equ PIA+2 PIA port C mov dh, high PIA PI A3 equ PIA+3 ; PIA control port ; hardware initialization ADC equ PIA+4 ; NEC UPD7004 A/D converter ADCO equ ADC+0 ; channel select S LS 2 bits ; set up PIA ADC1 equ ADC+1 ; "initialize" 5 MS 8 bits PIAr record modeset:l=l, Amod:2,Adir:l,Aptc:l, Bmod:l,Bdir:l,Bptc DAC equ PIA+8 ; National DAC1208 D/A converter DACO equ DAC+0 ; LS 4 bits (load second) mov dl, low PIA3 DAC1 equ DAC+1 MS 8 *AND* LS 4 bits (load first) mov al, PIAr out dx, al CLK equ PIA+12 ; 8253 timer/counter CLKO equ CLK+0 ; counter 0 ; set timers first to stop them and prevent overrun error on CLK1 equ CLK+1 ; counter 1 ; first (unused) conversion CLK2 equ CLK+2 ; counter 2 CLK3 equ CLK+3 ; mode register CLKr record counter:2, readload:2=3, clkmode:3, bcd:l=0

IO proc far start by setting timer 0 mode (and so stopping it) public 10 mov. dl, low CLK3 ; entry mov al, CLKr<0,,2,> 0 = MODE 2 (rate generator) out dx, al push bp ; save bp mov bp, sp set up timer 1 push si ; save si pushf ; save flags (S interrupt status) mov dl. low CLK3 mov al, CLKr ; 1 = MODE 1 (one-shot) ; disable interrupts out dx. al

cli mov dl, low CLK1 ; set S/H sample time mov al, low (MHZ*LEN) ; set up sample count out dx, al mov al, high (MHZ*LEN) les bx, dword ptr [bp+6] out dx, al mov si, es:[bx] ; SI has LS word of sample count mov di, es:[bx+2] ; DI has MS word of sample count up ADC, start first (unused) conversion, and clear "sampling" ; and "overrun" latches ; wait for S/H to start sampling (implies conversion complete) ADCrO record channel:3=0 ; CH 0 input ADCrl record twoscomp:l=0, divider:2=l ; binary, divide clock by 2 11: in al, dx or al, al ; test for sampling or overrun mov dl, low ADC1 jz 11 mov al, ADCrlo out dx, al ; get A/D sample and start next conversion (sampling should be complete)

mov dl, low ADCO mov dl, low ADCO mov al, ADCrOo in ax, dx ; input A/D result out dx, al xchg ax, cx ; sample to CX, get A/D control to AL out dx, al ; start A/D conversion ; finish setting up timer 0 : ; exit if MS bit of PIAO was set (overrun) ; set sampling rate and start the timer, first S/H pulse is PERIOD us ; later, the first (initialization) conversion will have completed by jl done ; then. ; replace output sample with input sample mov dl, low CLKO ; set sampling rate mov al, low (MHZ*PERIOD) if convert ; if converting in loop out dx, al mov al, high (MHZ*PERIOD) mov ax, cx out dx, al xor ax, 8000h ; convert to 2's complement rept 6 o' ; end of hardware initialization sar ax, 1 ; make right-justified endm 3 ; *** critical timing within loop: do not change code *** mov es:[bx], ax

loop: else ; if not converting, save sample as read

; load sample into DAC (to be transferred by next S/H pulse) mov es:[bx], cx

mov ax, es:[bx] endif

if convert ; if converting ; point to next element in (possibly $LARGE) array rept 4 ; make sample left-aligned shl ax, 1 add bx,2 ; increment pointer to next sample endm jnc 12 ; test for offset < 64k xor ax, 8000h ; convert to offset-binary mov ax, es ; move segment up if not endif add ax, lOOOh mov es, ax xchg al, ah ; write MS byte, then LS 12: mov dl, low DAC1 ; write DAC1 and wrap around to DACO out dx, ax ; increment (negated) sample count

; set up ADC control word in cl, and PIA address in dx inc si jnz 13 mov cl, ADCrOo inc di bO mov dl, low PIAO O 13: CO start label far code start address (init:) ; loop 'til done mem ends

jnz loop sum macro opl, cosl, opQ, cosQ lodsw ; get LS word of phase increment ; return to caller add ax, [di] ; add it to the LS word of phase stosw ; store the LS word of phase done: lodsw ; repeat for MS word adc ax, [di] ; (plus carry) not si ; negate unused count stosw ; si and di now point to next ones not di and ax, (Ncos-l)*2 ; ; MS word of phase mod Ncos *2 add si, 1 mov bx, ax ; is now cosine table offset in bx adc di, 0 opl cx, cosI[bx] ; ; add/subtact cosine value to I sum opQ dx, cosQ[bx] ; ; and to Q sum mov ax, si ; return unused count endm mov dx, di rom segment ; return assume cs:rom,ds:rom,es:rom,ss: rom org 8000h EPROM starts at 32k popf ; restore flags (s interrupt status) init: cli ; interrupts off pop si ; restore si eld set direction flag = up mov - sp,bp restore sp and bp mov ax, 0 ; set segment registers = 0 pop bp mov ds, ax ret 08h mov es, ax mov ss, ax io endp - mov cx, 9*2 clear phase counters mov di, offset phases IO_TEXT ends rep stosw 3 mov sp, 8000h set stack (not'used) end mov al,10011011b set all 8255 ports as unlatched out switch+3, al ; input and start in off mode ... off: mov dx, 0 set Q for minimum o/p sim.asm mov cx, mOdB ; and I for for OdB test al, 10000000b -ZU dB level switcn on > ; Fading simulator controller. Ed Casas and Ron Jeffery. July 24, 1987. jz 11 if not skip ahead mov cx, m20dB else set I for -20 dB idac equ 00H address of I D/A 11: jmp outpt ; and set D/As qdac equ 2 OH address of Q D/A loop: in al, switch xfer equ 40H address of common D/A output strobe test al, 00000001b ; run switch on ? switch equ 60H address of switch port (8255 port A) jz off if not, go set a fixed level Ncos equ 2048 number of entries in cosine tables and ax, 01111110b ; middle 6 bits of switch is pointer ioffst equ 2066 shl 4 measured I and Q DAC values for minimum xchg bx, ax ; to pointer to phase increments qoffst equ 2046 shl 4 RF output. 12 bits left justified mov si, pntrs[bx] ; si —> first of 9 phase increments mOdB equ 7215 DAC output for 0 dB (MS 12 bits used) mov di, offset phases ; di --> first of 9 phase variables m20dB equ m0dB/10 DAC output for -20 dB sum mov, cos3, mov, cosl \ sum add, cos2, add, cos2 | mem segment at 0 absolute memory references. (DEBUG sum add, cosl, add, cos 3 | increment phases and sum org 0400h creates file for EPROM programmer). sum <;>, , add,cos 4 | cosine table values for phases dd 9 dup (?) phase counters sum sub, cosl, add, cos3 | I (in cx) and Q (in dx) org 8000h sum sub, cos2, add, cos2 1 sum sub, cos3, add, cosl ; | write(*, ' (" ; 0 dB at ",fl0.1)')sqrt(2.*pwr) sum sub, cos4, <;>, ; 1 end sum add, cos5, add. cos5 ; / add cx, ioffst • convert I sum to offset-binary mov al, ch • move to ax and swap bytes to ptabgen.for mov ah, cl output MS byte first out idac+1, ax idac+0 is also at idac+2 C Print phase increment tables in 8088 assembler format. add dx, qoffst \ mov al, dh 1 integer*4 i, j, M, tmp(9), No, N mov ah, dl I repeat for Q sum real fs, tpi, cos, float out qdac+1, ax / out xfer, al change both outputs at same time data No/8/, N/2048/, tpi/6.28318/, fs/2958./ jmp loop repeat forever M=4*No+2 label word pointers into phase increments write(*,'(" incrmnts label word")') x = offset incrmnts , table. 4 byte * 9 increments do 2 1=0,254,2 rept 128 per frequency = 36 bytes/entry do 1 j=l,8 dw X tmp(j)=cos(tpi*float(j)/M)*i/fs*N*65536*2 x = x+36 1 continue endm tmp(9)=i/fs*N*65536*2 include tables cosl to cos5 and incrmnts write (*,'(" dd " ,4 (ill, " , " ) ,ill)') (tmp(j), j=l,5) org OfffOh reset vector write (*,'(" dd " ,3 (ill, " ," ) ,ill)') (tmp(j), j=6,9) jmp start 2 continue ends end end ceval.c ctabgen.for /* ceval.c - evaluate BCH code performance from a run-length file */ C Print scaled cosine tables in 8088 assembler format. •include integer i, j, k, N, No, tmp(8), tmsusd(5) •include real A, pwr, pi, sqrt, sin, cos, float •include data N/2048/, No/8/, pi/3.14159/, pwr/0./, tmsusd/2,2,2,1,1/ •define BUFFSIZE 4096 do 3 i=l,5 if(i.eq.5)then main(int argc, char **argv) { A=1750*sqrt (2.) *sin (pi/4.) else int A=1750*2.*sin (pi*float(i)/No) i , /* arg counter */ endif buf[BUFFSIZE], /* bit buffer */ pwr=pwr+tmsusd(i)*(A**2)/2. *p , /* pointer to start of an FEC block in buf */ write (*,'(" cos",il," label word" )') i e , /* number of errors in a block */ do 2 j=l,N,8 n=0, do 1 k=l,8 argn = 0 , /* symbols per block */ tmp(k)=A*cos(float(j+k-2)*2.*pi/N) m, argm = 0 , /* bits per symbol */ 1 continue t, argt = 0 , /* correctable symbols per block */ write(*,' (" dw " ,7 (15, ", ") ,15)') (tmp(k) ,k=l, 8) arge = 0 , /* display errors in each block */ 2 continue argi = 0 , /* do interleaving */ 3 continue argh = 0, /* produce histogram of errors/block */ argC = 0, /* display cumulative pdf */ if ( argm ) m=argm ; else m=l ; argN =0, /* normalize pdf */ if ( argt ) t=argt ; else t=0 ; args =0, /* BER, BKER summary */ nm=n*m ; nm , /* n*m */ printf("%% BCH (n=%d, m=%d, t=%d)\n",n, m, t) ; bits ; /* bits left to test in buf */ if (n <= 0 II m<=0 || t<0) err("bad parameter") ; if ( arge ) printf("%% errors per block :\n") ; long } ; sume, sumb, /* sum of errors and bits tested */ h_sum, /* sum of histogram values */ p=buf ; *phist, /* pointer to hist */ while ( bits >= nm ) { hist [BUFFSIZE+1] ; /* histogram */ if ( argi ) intlv (p, nm, 1) ; if ( nserr(p,m,n) > t ) e=nerr(p,nm) ; else e=0 FILE (hist[e])++ ; *infile=NULL ; /* input file */ sume += e ; sumb += nm. ; for (i=l ; Kargc ; i++) { if ( arge ) printf ("%d\n",e) ; if ( !strcmp(argv[i], sscanf (argv[++i], %d",Sargm) bits-=nm ; if ( !strcmp(argv[i],"-n") sscanf(argv[++i], %d",&argn) p+=nm ; if ( !strcmp(argv[i],"-t") sscanf (argv[++i], %d",Sargt) ) ; if ( !strcmp(argv[i],"-h") argh=l ; if ( !strcmp(argv[i],"-e") arge=l ; } ; if ( !strcmp(argv[i],"-i") argi=l ; if ( !strcmp(argv[i],"-C") argC=l ; /* compute sum and maybe make cumulative */ if ( !strcmp(argv[i],"-N") argN=l ; if ( !strcmp(argv[i],"-s") args=l ; h_sum = 0 ; if ( !strcmp(argv[i],"-f") for ( i=0 ; i<=nm ; i++ ) ( if ( (infile=fopen(argv[++i],"r")> = NULL ) h_sum+=hist[i] ; perror (argv[i]) ; if ( argC ) hist[i] = h_sum ; } ; /* error checks */ /* initialize histogram and bit/error counters */ if ( sumb <= 0 ) err("no input") ; for ( i=0 ; KBUFFSIZE+1 ; i++ ) hist[i] = 0 ; assert ( h_sum*n*m = sumb ) ; sume = sumb = 0 ; assert ( h_sum > 0 ) ; assert( sumb > 0 ) ; /* ensure an input file */ /* maybe display [C] pdf, maybe normalized */ if ( infile = NULL ) infile=stdin ; if ( argh ) { /* do for all FEC blocks in one OFDM block : printf("%% [CJPDF : \n") ; interleave if necessary for ( i=0 ; i<= n ; i++ ) if fewer than t symbol errors, bit errors = 0 if ( argN ) printf ("%d %g\n", else count bit errors i, ((float) ( histti] )) / h_sum ) ; update histogram and bit/error counts else printf("%d %ld\n",i,hist[i]) ; maybe print number of bit errors */ } ;

while ( (bits=get_buf (infile, buf)) >0 ) { /* maybe display summary */

if ( n <= 0 ) ( /* initialize n,m,t,nm */ if ( args ) { if ( argn ) n=argn ; else n=bits ; printf("%% BER = %g\n", (float) (sume) / (float) (sumb) ) ; printf("%% BKER = %g\n", int put_buf(FILE *file, int *p, int n) { (float) (h_sum - hist[0]) / (float) h_sum ) } ; •define put_cnt(x) fprintf (file, "%d\n\x)

} ; /* Packs a bit-error pattern (0=no error, l=error) into corresponding error-free run lengths and writes it to a file. err (char *msg) { The last (error-free) run length in the block is followed by a fputs(msg,stderr) ; -1. */ fputs(".\n",stderr) ; exit(l) ; int k ; } ; k=0; int nserr(int *p, int m, int n) { while ( n— ) if ( *p++ ) { put_cnt(k) ; k=0 ; } /* count number of m-bit symbols with errors in a block of n symbols else k++ ; put_cnt(k) ; int e=0 ; put_cnt(-l) ; while ( n— ) { } ; if ( nerr(p,m) ) e++ ; p+=m ; int intlv(int *in, int n, int dir) { /* block interleaver */ } ; return ( e ) ; int } ; out [ BUFFSIZE ], i, j, k, 1 ; int nerr(int *p, int n) ( /* compute interleaving step size (round up to make sure /* count number of bits in error in a block of n bits */ interleave all) */

int e=0 ; k = (int) floor ( 1.0 + sqrt ( (float) n ) ) ; while ( n— ) if ( *p++ ) e++ ; return ( e ) ; 1=0 ; for ( i=0 ; i= 0 ) { if ( i+k+1 >= BUFFSIZE ) k = BUFFSIZE-i-2 ; while ( k— ) { buf[i++] = 0 ; } ; buf[i++]=l ; } ; return (i ? i-1 : 0) ; to o } ; exp( (double) (factln(xl)-factln(x2)) ) ) ; bkp.c } ;

/* bkp.c */

computes average distribution of the number of bit errors in blocks /* initialize distribution */ of size N assuming independent errors within each block but different BERs for each block. The standard input contains the block BERs for ( i=0 ; i<=n ; i++ ) prob[i]=0.0 ; and the program takes one argument, the block size. At input EOF nblk = 0 ; the distribution is written to standard output. The binomial distribution is computed using the 'bico' routine from _Numerical /* loop through input BERs, compute, and sum distributions */ Recipes_. while ( scanf("%lg",Sber) == 1 ) { Ed.Casas 89-3-7 */ for ( i=0 ; i<=n ; i++) prob(i] += exp ( lnbico(n,i) + log ( 1.0-ber ) * ( n-i ) double lnbicoQ, factln(), gammlnO ; + log ( ber ) * i ) ; double ipow() ; nblk ++ ; void nrerror () ; } ;

•include /* display cumulative results */ •include sump=0. ; •define NMAX 4096 if ( nblk <= 0 ) { fprintf(stderr,"No input.\n") ; main (int argc, char **argv) { exit(l) ; } int i, n, nblk ; else for ( i=0 ; i<=n ; i++) double ber, nber ; printf("%d %lg\n", i, sump += (prob[i]/nblk) ) ; double prob [ NMAX+1 ] ; double sump ; } ;

/* check arguments */ /* the following routines are adapted from _Numerical_Recipes_in_C_

if ( argc < 2 ) { double lnbico(n,k) /* modified to return In */ fprintf(stderr,"Usage %s \n",argv[0]) ; int n,k; exit(l) ; { } ; double factln() ; return factln (n)-factln (k)-factln (n-k) ; if ( sscanf (argv[l],"%d\sn) != 1 || n > NMAX ) { ) ^ fprintf (stderr, "N (%s) bad or too large. \n",argv[l]) ; exit(l) ; •define MAXN 2048 } ; double factln(n) int n; /* test for log factorial { static double a[MAXN+l]; /* cache blocksizes up to MAXN bits */ { int xl, x2 ; double gammlnO ; printf ("enter xl and x2 "); void nrerror () ; scanf("%d %d",Sxl,sx2) ; printf ("In of factorial: = %f %f \n",factln(xl),factln(x2)) ; if (n < 0) nrerror("Negative factorial in routine FACTLN"); printf("xl!/x2! ?= %lg\n". if (n <= 1) return 0.0; if (n <= MAXN) return a[n] ? a[n] : (a[n]=gammln(n+1.0)>; else return gammln(n+1.0); out2bers.awk } # # bers.awk - extracts the block BERs for one set of N, SNR values double gammln(xx) # ed.casas 89-3-17 double xx; # A { / \ %B/ { if ( $2 == n SS $3 = snr ) print $4 } double x,tmp,ser; static double cof[6]={76.18009173,-86.50532033,24.01409822, out2runs.awk -1.231739516,0.120858003e-2,-0.536382e-5); int j; # # runs.awk - extracts the error-free run lengths for one set of x=xx-1.0; # N, SNR values tmp=x+5.5; # ed.casas 89-3-2 tmp -= (x+0.5)*log(tmp); # ser=1.0; /*\ %N/ (if ( $2 == n SS $3 == snr ) on=l ; else on=0 } for (j=0;j<=5;j++) { # un-comment next line for testing x += 1.0; #/*\ %N/ { if ( on ) print $0 } ser += cof[j]/x; /"\ %R/ ( if ( on ) print $2 ) } return -tmp+log(2.50662827465*ser); o c 5 void nrerror(error_text) Co char error_text[]; { b fprintf(stderr,"Numerical Recipes run-time error...\n"); fprintf(stderr,"%s\n",error_text); fprintf(stderr,"...now exiting to system...\n") ; exit(l); }

out2bers.csh

#!/bin/csh # # extracts block BERs from fdint output (out.bers) # Ed.Casas 89-3-17 # foreach s (10 15 20 25) foreach n (256 1024 4096) awk -f out2bers.awk n=$n snr=$s. out.bers >bers.$n.$s end end to o