UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

OFDM/FM frame synchronization for mobile radio data communication Casas, Eduardo F. 1989

Your browser doesn't seem to have a PDF viewer, please download the PDF to view this item.

Item Metadata

Download

Media
831-UBC_1989_A1 C38.pdf [ 11.08MB ]
Metadata
JSON: 831-1.0098258.json
JSON-LD: 831-1.0098258-ld.json
RDF/XML (Pretty): 831-1.0098258-rdf.xml
RDF/JSON: 831-1.0098258-rdf.json
Turtle: 831-1.0098258-turtle.txt
N-Triples: 831-1.0098258-rdf-ntriples.txt
Original Record: 831-1.0098258-source.json
Full Text
831-1.0098258-fulltext.txt
Citation
831-1.0098258.ris

Full Text

OFDM/FM FOR MOBILE RADIO 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-fading mobile radio 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 modulation 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 squelch 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, GTFM, or GMSK). At a BER of IO" 3 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/Demodulation 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 E 6 / N 0 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 1 3 0 B.3.1 Mixers 1 3 0 B.3.2 IF Port Network 1 3 2 B.3.3 Splitters 1 3 2 B.3.4 Delay Line 1 3 2 B.3.5 Construction 1 3 2 B. 4 Performance Measurements I 3 3 B.4.1 CPDF 1 3 4 B. 4.2 Level Crossing Rate 1 3 5 C The Analog/Digital Interface 1 3 6 C l Introduction 1 3 6 C. 2 Circuit Description i 3 ^ C. 2.1 Timer Circuit 1 3 6 C.2.2 A/D I 3 7 C.2.3 A/D Status I 3 7 C.2.4 Address Decoding and D/A 138 C.2.5 A/D and D/A Analog Interface 139 C.3 Software 1 4 0 C.4 Testing 1 4 1 C.4.1 Noise 1 4 1 C.4.2 Distortion I 4 2 C.4.3 Linearity and Accuracy . I 4 2 C.4.4 Jitter 1 4 3 C.4.5 Clock Accuracy I 4 3 C.4.6 Overrun Indicator I 4 3 D RF SNR Measurement I 4 4 ix D.l R F 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 Rayleigh fading 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 . l l 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 n i i11(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 QAM 1 -modulated subcarriers [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 (radio frequency) 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 Amplitude Modulation, 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) = < , - r»/26 if r > o (2.2) 1 - e 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 fd = fcV (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. Doppler rate vehicle speed 1000 -> km/h 100-10-mi/h -100 •10 Hz 1000 100 10 carrier frequency 10000 MHz 0.1 0.01 1000 100 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]: LCR = V2^fdpe-p2 (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]: e p 2 - 1 T = 1 T 7 = ( 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 1 The 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) F M 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 M H z 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 R F 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, G T F M (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 subcarrier 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 modem 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 data in serial to parallel QAM encoder inverse FFT N parallel to serial D/A converter Receiver channel Transmitter A/D serial to parallel N FFT QAM parallel to converter decoder serial serial data 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 modems 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 F M Channel An OFDM/FM system could use the same narrowband FM radios 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 F M 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 Input Amplifier Pre-Emphasis Clipping Low-Pass Filter FM Modulator RF Amplifier RF FM Signal 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 F M Receiver RF Input RF Amplifier Mixer Oscillator IF Filter Limiter Discriminator De-Emphasis Squelch and Filter Audio Amplifier Baseband " 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]: 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. Bp ^20 + 2.35) (2.6) Chapter 2. Review of Previous Wort 18 m "O 0) a. co k _ a> o DL > a> cr -10 c CD Q -20 -30 -40 -50 -60 ~i r~ -i r r IFSNR = -20dB IF SNR = OdB IF SNR = 5dB 0.02 0.04 0.06 0.08 0.1 Frequency (fraction of IF Bandwidth) 0.2 0.4 -10 -20 -30 -40 -50 -60 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 F M baseband noise power level is: „ , , o(l - e~P) ZirBWe-P where V2 ( p + 2.35) 4it2w3 g ( -Try fwyn and W is the baseband filter noise bandwidth. The F M baseband signal level is: (2.7) (2.8) S0(p) = ^(B - 2W)2(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. g O CL O 2 10 c w -o c « 0> tn (0 m 10 - -i—1—1—1—1—1—1—1—1—1—1—1—1—; Noise (N) Signal (S) B = 14900 Hz W = 3290 Hz peak/rms = 3.16 IF SNR (dB) 20 30 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 F M 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 high frequency 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 N CD > CD CD O C CD i CU OC CD O CL co CD OC 10 -10 -20 (from DOC RSS-119) y / / / / / / / s / / / / / / / / / / / / / / / / / / // / / / 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 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 Transmitted Data IDFT IF SNR Gaussian Noise snr —• signal f8(r) snr —• noise w n DFT Received Data 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: var( Ym\Xm = D,X-m = D\r)*2 ((S2) - (s)2 + (n2)) . (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 = (n 2). 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 F M 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 F M 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 pilot signal. 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 BER b i o c k 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 (s) — s, (s2) — s2, and (n2) = n 2 . 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 BERb l o c k(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 BER l o n g b i o c k = 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 BERbi o ck are calculated. These BER bi o ck 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 Rayleigh r SN s compute table lookup n block statistics erfc Fading BER and 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) 1 A typical simulation (about 3 million samples for each of four SNRs and three block sizes) required about 8.5 hours C P U ("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 data generator QAM inverse channel encoder FFT simulator S 1 N Rayleigh Fading SN lookup tables FFT QAM decoder FEC bit and word error 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 F E C 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 Transmitter Fading Channel Simulator FM Receiver low-pass filter D/A Computer A/D low-pass 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 C O R C O M 10EK1 EMI Filter IC2AT FM Transmitter 144.15 MHz (low power mode) Ant. 11 dB Attenuator j RF Zrv^ Output (12.5 dBm) Power Imput (13 VDC) 10V Regulator Pwr. Mic. 10 VDC Audio Input (6 mV rms) Audio Attenuator , Audio Input (2.5 V peak) Figure 5.2: Experimental transmitter. ^ d B m = 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. from re-transmitter Rayleigh fading simulator modulator Q controller Kay Elemetrics model 437 RF attenuator RF power combiner/splitter Mini-Circuits ZHL-2-8 RF amplifier (noise source) to receiver HP 8558B 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 9VDC CDE1021L EMI Filter (144.15 MHz) IC2AT FM Receiver Battery Power Supply 10VDC Pwr. 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 A n 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 R F leakage and a switch to turn the transmitter on and off. The attenuator circuit is shown in Figure 5.5. 1uH to transmitter transmitter * off 50k -AMr 1nF 50k 50 from D/A 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 E M I filters were used on power supply leads to avoid R F 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 PRBS generator QPSK encoder audio input A/D DFT inverse DFT correction for linear distortion periodic extension audio output D/A S,N computation bit error counter QPSK decoder S,N BER, WER 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 E f e /N 0 , 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. 3 The 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 E b / N 0 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 E b / N 0 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 E b / N 0 when comparing OFDM with other digital modulation schemes. To convert from SNR to E f c /N 0 , 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, N 0 (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 E b / N 0 = SNR x B/R. SNR and E 6 / N 0 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 S N curves are given in Figure 5.8 along with those of an ideal discrimi-nator. 10 -10 c cn in -20 -30 -40 n 1 1 r 1 r T ~\ 1 1 r O—E3—EJ—B—-B -20 B = 14900 Hz W = 3290 Hz peak/rms (for theoretical) = 3.16 -e—e—e—e—©—e—e—e—e—e—e-13<~. noise limit due to clipping Q — B— B ~ G — • — • theoretical signal (S) theoretical noise (N) measured signal (S) measured noise (N) — B —1 1 L--10 10 20 30 IF SNR (dB) Figure 5.8: Theoretical and measured S N 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 corresponding vehicle speed 20 Hz 25 km/h at 850 MHz sampling frequency baseband frequencies used bit rate (during block) (R) 8 kHz 1 kHz to 3 kHz 4000 bps samples per block block duration bits per block 256, 1024, 4096 samples/block 32,128, 512 ms 128, 512, 2048 bits/block IF SNR IF noise bandwidth (W) Efc/No 10,15, 20, 25 dB 14.9 kHz 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: B E R 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 B E R 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 10 o 10 LU m 10 10 10 10 10 Bound for small N Bound for large N M.C. Integration & 15 20 I.F. SNR (dB) N=256 I N=1024 N=4096 25 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 55 10 10 10 10 . 'iF... Tfd=2.6 fd=80Hz, N=1024 A--— fd=80Hz, N= 256 & fd=20Hz, N=4096 & — fd=20Hz, N=1024 A - — \ Tfd=10.2 _i i i_ 15 20 LF. SNR (dB) 25 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 n 2 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 F M 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 CD 8. 'in o <s > v— £ CQ V CD o CL <D V> "o E o •o c -18 -20 -26 i i i i i i i i noise level due to clipping at normal modulation level noise level due to clipping at reduced modulation level 20 40 60 80 Doppler frequency (Hz) 100 120 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. baseband signal received signal strength antenna select Data Recovery Circuit Receiver Switching Decision 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 •j o ' I 1 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: 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. (6.1) 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 CD <5 DC 2 k _ LU "5 o 10 Number of Bits Corrected 20 30 40 50 60 70 10 10 -2 10 10 10 10 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 | MC Integration Simulation N=1024 (Tfd=2.56) Word Size: 128 bits • • n o a a o o D •••13 • • • • • • • • ' i i i i i i i i t i i i 0.1 0.2 0.3 0.4 Fraction of Bits in Word Corrected 0.5 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 dB at a BER of IO" 2, 3 dB at IO" 3, and 4 dB at 10 - 4. The improvement in E 6 / N 0 (the coding gain) is 3 dB worse than these values because the coding approximately doubles the energy per information bit. 1 The actual B C H 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 2 The actual B C H 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. CD IS or o LU m 10 10 10 -4 10 10 -6 10 10 i — 1 — 1 — 1 — 1 — r No FEC B— BCH A-RS e-RS with interleaving O -10 15 20 I.F. SNR (dB) s>. N=1024 N=4096 E 25 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 \ ^ " — -2 10 -15 dB . 20 dB 10dB --3 10 -25 dB " \ ^ ^ — 15dB _ -4 10 --5 10 — — -6 10 -20 dB --7 10 -8 10 - \ Small N Bound \ Large N Bound — -9 10 i i i l i i i i i i i , i l i i i 25 dB I l l -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 -^limit exceeded make signal estimate (modulate) 1 substitute new signal estimate into faded portion of received signal i make data estimate (demodulate) I check for errors true end 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 CD to O k _ LU CO 10 10 10 10 10 10 -7 10 10 N=256 N=256 N=1024 with DFC no DFC B N=4096 ' ' u 15 20 I.F. SNR (dB) 25 Figure 6.13: BER performance with DFC. show that there is little to be gained by allowing more than about five iterations. 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 1 I ' I ' I ' O i I i I < A 0.9 0.8 - O 0.7 in •g 0.6 o m "5 0.5 - • <= o t5 0.4 CB i — 11 • 0.3 0.2 0.1 - 8 o 0 I . I . I , ,1,1, 1 1 1 1 o 1 1 1 ' 1 25 dB I 1 o A 20 dB A 15dB o 10dB • O • D O • • A O n O 1 i I i I , I , I 1 , 0 2 4 6 8 10 12 0 2 4 6 8 10 12 Number of Iterations 0 2 4 6 8 10 12 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-diversity scheme 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 guard error time margin ( OFDM block (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 base station 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 OQAM 2 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. " ^ P r i c e q u o t e f o r 1 0 0 0 ' s q u a n t i t i e s f r o m F u t u r e E l e c t r o n i c s , A p r i l 1 9 8 9 . 2 O Q A M i s O F D M c o m b i n e d w i t h f r e q u e n c y - d o m a i n e q u a l i z a t i o n t h a t a l l o w s O F D M b l o c k s t o b e t r a n s m i t t e d w i t h o u t g u a r d t i m e d e l a y s b e t w e e n b l o c k s . 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 E b /N 0 ) , • 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 G T F M The E b / N 0 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 E 6 / N 0 . 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 E b / N 0 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 ' R a n d o m F M p r o d u c e s a n e r r o r f l o o r a t a B E R o f a p p r o x i m a t e l y 2 x l 0 - 5 f o r a D o p p l e r r a t e o f 2 5 H z , a b o u t l x l O - 4 f o r a D o p p l e r r a t e o f 5 0 H z , a n d a b o u t 3 x l 0 - 4 f o r 1 0 0 H z . Chapter 8. Comparisons With Other Modulation Methods 94 (5 tr o LU m 10 10 10 -4 10 10 -i 1 1 r "T 1 1 r 10 OFDM/SSB, Tfd= 2.6 OFDM/FM, Tfd=10.2 OFDM/FM, Tfd=2.6 — GTFM — GMSK — A 15 20 25 Eb/No (dB) 30 Figure 8.1: E b / N 0 performance of various modulation methods. 35 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 = 2 + E 6 / N 0 - (8.1) 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 E b / N 0 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 The experimental results for OFDM/FM without DFC for T/d=2.6 and T/d=10.23 (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 E 6 / N 0 for BER=10-2 13-15 a 15-21 b 18-22 c E b / N 0 for BER=10"3 18-22 d 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 ms 1 < 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 t o T / d = 0 . 6 3 , n o d e l a y s p r e a d , a s s u m i n g S I R = S N R b T / d = 1 0 . 2 w i t h D F C t o T / d = 0 . 6 4 w i t h o u t D F C . c[16] a n d [17 ] . d E s t i m a t e d f r o m [1 , F i g u r e 5 a n d F i g u r e 12] . e 0 . 5 t o 3 k H z g u a r d b a n d s . " s e c t i o n 8 .3 .3 . h 8 . 6 k b p s a t 7.5 t o 1 0 k H z . ' 4 k b p s t o 12 k b p s a t 2 5 k H z . J16 k b p s a t 2 5 k H z t o 3 0 k H z . ^ t y p i c a l , N = 5 1 2 a t / , = 1 5 k H z . ' t y p i c a l , JV = 2 5 6 a t / , = 8 k H z . m 1 6 b i t s a t 16 k b p s . " l o w c o s t i f r e t r o f i t t i n g e x i s t i n g e q u i p m e n t . 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 digital radio appli-cation," IEEE Transactions on Vehicular Technology, vol. VT-27, pp. 117-132, Aug. 105 Bibliography 106 1978. [9] A. S. Bajwa, " U H F 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 multipath propagation," 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 M H z , " IEEE Transactions on Vehicular Technology, vol. VT-26, pp. 88-93, Feb. 1977. [16] T. M i k i and M . Hata, "Performance of 16 kbit/s G M S K 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, " G M S K 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 frequency modulation 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) digital data 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, a 1 ; • • •, 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 a 2 . 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 wil l often be omitted from the expected value operators although they are implied. The received signal samples are By using the definition of the DFT, the received value on the m'th data subchannel is N-l Ym=Yl + nnwn)Wmn. (A.7) n=0 The conditional mean of the received data values, JV-l E [ Ym | Xm = D, X-m = D\ v ] = £ (E [snxn] + E [nnwn))Wmn. (A.8) n=0 Since r (and thus n) is fixed, and the noise w is zero-mean, — 5 n a : n -j- nnwn. (A.6) 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 fc=0 nk Appendix A. Conditional Mean and Variance of the Error 118 Substituting (A.9) and (A.12) in (A.8), JV-1 D. N-l E[Ym \Xm = D,X.m = D*,r] = E 5 " ^ W -nm—nm n=0 N - l n=0 JV-1 + E sn^-Wnia+nm n=0 n=0 The term ^Zn^o1 S n W 2 " " 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: var( Ym | Xm = D, X _ m = D\ v) = E [Yro Y*] - |E [Ym] |2 Using the definition of the DFT, the first term can be re-written as: E[YmY*] = E (A.15) N-lN-l E E (Wi + niWi)(sjXj + njWj)*WmiW-mj t=0 j=0 (A.16) Using the linearity of the expectation 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 + E [mwiSjXj] + E [riiWiTijWj]) Wm^-j\ Since a and n are constant because of the conditions, N-l N-l E [^^1 = E E (5i5JE [xixj] + SiUjE [xiWj] 8=0 j=0 (A.17) + niSjE [wiXj] + niiijE [wiWj]) Wm^-j\ (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 j V - i N-l E [YmYm] = Y, E ( 5 «' s i E + n » « i E W-ro<*-J'>. (A.20) i=o i=o Using the definition of the ID FT, E M = i E L E W-*W-*. (A.21) fc=0 /=o Using the conditions, and since the data symbols are zero-mean, E[XkX,] = { <J\ for k = -I DHkm + (D*)Hk{_m) for k = l (A.22) 0 otherwise so that 2 N-l 1 1 E = ]ya E W ( i _ i ) f c + ^ 2 ^ 2 W - ' m I ^ - j m + ^(D*)2WimWjm fc=0 - ^ i . ^ . . i J _ n2w->»(<+j) L D 2 w m ( « ' + j ) j\r°«' + i V 2 ^ N2 = + J _ r ; 2 (V-m(.-+*) _ yr/m^+M (A_23) N N2 \ > since D 2 = -(D*) 2 for D = ±1 ± j . Since i o is real and i.i.d. with zero mean, E[wiWj] = a2w6ir (A.24) Substituting (A.23) and (A.24) in (A.20), E [YmYm] = £ (?fs2 + o-ln2^ 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 > E E w i ( r , B , ' - ^ B i ) JV2 1=0 j=0 N / . JV-1 JV-1 . N-l N-l \ J v i = o j=o i=o j=o , (N-l H JV-1 JV-1 H JV-1 = > 2 E ^ ~ 2 m ^ E « - E ^ 2 m i E -i \j=0 j'=0 i=0 j'=0 1 / J V - I JV-1 \ = I J D 2 (S) E * j ^ ' 2 r a i - E 5'w 2 m i • (A-26) N \j=0 i=0 / As in section A.3, the sums are the DFTs of s evaluated at ± 2 r a , 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], i l > ? > < - > 2 , (A.28) and |Z>|2 = o2x, we find ^ X>? > W(*)3 » \D?^{s)N^SlW±2mi. (A.29) Thus from A.25 N <-< * " 1 1 w ~ 1 1 N »=o «=o E[YmY*} » ^ ^ E ^ + ^ ^ E ^ 2 ' <A-30> »=o t=0 and the conditional variance of the received data value is var( Ym\Xm = D,X.m = D\r)*o2x (s2) + No2w ( n 2 ) - |2?|2 (s)2 . (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 a 2 . For the case of D = ±l± j, al = 2/iV and a2x = |£>|2 = 2 , we have var( Ym\Xm = D,X.m = D\r)*2 {(s2) - (s)2 + (n 2 ) ) . (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. RF signal input power splitter Gaussian 'Q' control signal Gaussian T control signal Rayleigh fading 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. RF shield +11 dBm i transmitter o •• attenuator fading simulator modulating signal quadrature modulator simulator controller variable attenuator (30to130dB) (sets C/No) spectrum analyzer (measures C/No) received baseband signal 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 S(f) = [i-(f/fdY\ 2 f<fd o f>fd for a (maximum) Doppler rate fa and an omnidirectional vertical antenna[3]. (B.l) 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.765 E T " Q control signal 1.414 1.848 2.000 1.848 1.414 0.765 1.000 0.983 f. 0.932 f 1.848 0.850 f d "0-0.739 f d - © 0.603 f d - © -0.446 t d _ © _ 0.274 f . 0.092 U 1.000 t, 1.414 0.765 -0.765 -1.414 -1.848 -2.000 1.000 T 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 fixed value. Appendix B. The Fading Simulator 124 In this case the most significant bit selects a level of either 0 dB 1 (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 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. 0=0dB 1 = -20dB 0=stopped 1 =run Figure B.4: Switch register bits. 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 2 2 8 . If p is the period, m is the counter increment, and i is an integer, then pm = i228 or p = i2^-. If m and 2 2 8 have no common factors (for example, m is odd) then the smallest i that will make p an integer is i = m, giving p = 2 2 8 . If they do have a common factor, the period will be 2 2 8 divided by the largest common factor. Since each oscillator has a period that is a factor of 2 2 8 , the period of the fading waveform will be that of the oscillator with the longest period. A period of 2 2 8 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 RESET A16-A19 CLK A8-A15 READY AD7 AD6 AD5 AD4 MN/MX* AD3 AD2 TEST- AD1 ADO HOLD INTR Al F HOLDA NMI RD' WR' IO/M* 32 29 28 35-38 N.C. 8-2,39 _|». A8-A15 74LS373 10 12 13 14 15 16 25 30 IO/M' WR* RD* 8D 7D 6D 5D 4D 3D 2D 1D 8Q 7Q 6Q 5Q 4Q 3Q 2Q 1Q CLK OE A7 A6 A5 A4 A3 A2 A1 AO D7 D6 D5 D4 D3 D2 D1 DO 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 A15-IO/M* A5-A6-A7-IO/M*-A8-A9-74LS139 2 AO YO* A1 Y1* E* 4 3 5 1 74LS138 1 AO YO* A1 Y1* A2 Y2* Y3* 15 2 14 3 13 12 6 E1 E2* E3* 5 4 . RAMCS* . ROMCS* IO0CS* I01CS* I02CS* I03CS* 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 D0-D7 OE' CS' Vpp D0-D7 RD* 22 ROMCS* ' 20 + 5 1 62256 A0-A14 A0-A14 D0-D7 OE* WE* c s r D0-D7 RD* 22 WR* 27 RAMCS* 20 EinoLLts Data Bus Address Bus DO 11 AO 10 D1 12 A1 9 D2 13 A2 8 D3 15 A3 7 D4 16 A4 6 D5 17 A5 5 06 18 A6 4 D7 19 A7 3 A8 25 A9 24 A10 21 A11 23 A12 2 A13 26 A14 1 62256 2764/27128/27256 27 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 D7-D4 ICCSO* IOCS2* 21 WR* AO D0-D7 locsr 22 23 DI4-DI11 DI0-DI3 CS* XFER* WR1* WR2* BYTE1/BYTE2* t-5V 1k DAC1208 8255A D7-D4 22 23 DI4-DI11 DI0-DI3 CS* XFER* WR1* WR2* BYTE1/BYTE2* ^DO-07 D0-D7 AO 9 AO A1 8 A1 IOCS3* 6 CS* WR* 36 WR* RD* 5 RD' RESET 35 RESET PAD PBO-7 PC0-7 N.C. N.C. 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 3.3k 1/2 W +15V -15V 1ulit~* (Pin 4) 1uF_L- V -(pin11) —AAAr 16.9k 22.7k 10k "AA/V 1 216 3 1uF -b 10k 216 JWVTb 12 1uF -Wv-each Op-Amp 1/4 TL084 output signal (I orQ) nF 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 ferrite • \ S\ /K i i 3,4 LO IF 5,6 RF mmum 1 control signal 1nF 50 > 1nF ) ~r Merrimac 113A splitter Mini-Circuits SRA-1 DBM RF output Merrimac 113A combiner Mini-Circuits SRA-1 DBM 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 . l l shows how the measurements were made. +6 dBm fa5[.Ln9 s ' ™ u i a . ! o r 145 MHz CW Marconi 2022 signal generator CPDF LCR quadrature modulator Q simulator controller 30 kHz RBW H: 0 kHz/div V:10dB/div HP 8558B spectrum analyzer 10 bit « 8 KHz A D Computer detected video output (log scale) (0-800 mV) Figure B . l l : 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 filtering was 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 I i i 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). N X CD rr cn 2 o > CD 100 10 0.1 -^-xf^ 120 Hz _ — — e - - o - e - - © - a . Q 20 Hz - o -TJ _ .- — A" - A - A" -a—£- ^ • 2 Hz 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 1 -8 DB0-DB7 + RD* — CLKCS* — WR* — A1 — AO — 22 21 23 20 19 2 MHz N.C. Figure C.l : Timing circuit schematic. C.2.2 A/D +5V DB0-DB7 GATEO RD* OUTO CS* GATE1 WR* A1 OUT1 GATE2 AO CLK2 OUT2 CLX1 CLKO Voc GND 11 10 14 13 16 17 S*/H N.C. N.C. 24 +5V 12 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 23 +5V WR* ADCCS* RD* AO 15 18 19 22 21 20 24 Vref 1-4, 26-28 V+ c m -CH7 . N C V+ MC CHO 25 7 I V I w WR* 13 CS* RD* 11 AO 5nF -DBO- DB7 X GND GND CLK 1 6 . EOC* SMP11GY OUT Vic Ch IN Null Null V-V + S*/H N.C 17 2 MHz 14 analog in N.C. N.C. -12V +12V 1,6,8,10,12 N.C. S*/H 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 S V H ADCS WR EOC* S V H 1/4 '02 1/4 '02 1/2 74 PRE1* Q 1 CLR1* 1 3 [ 1/2 74 ' CLR2* 12 10 11 D2 CLK2 Q2 1/4 '02 WR*-PIACS*-RD* -A1 -A 0 -RESET-8255 37 27-36 36 35 PAO (sampling) PA7 (overrun) PA1-PA6 DB0-DB7 WR* CS* RD* A1 AO RESET 34-27 DB0-DB7 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-E13-U5-1 6-U5-18. E16-B2-(RSTDRV) E1,3,4,6 . E7-10 + E11 (I/O DECODE*) E12(A2)-E2 (A3). E5 (A4) • +5V-AO A1 RD* WR* RESET E18 DAC1208 WR*-DACCS*-A0 S7H + DB0-DB7 '138 4 G1A* YO* 15 5 G2B* Y1* 14 1 A Y2* 13 2 B Y3* 12 3 C 6 G1 Figure C.4: Address decoding and D/A schematic. „ 15-20,4-5^ D11-D4 Vref D3-D0 |out1 WR1* | 0 u t 2 CS* Rfb BYTE1/BYTE2* AGND XFER* DGND WR2* Vcc -10 1 6-9. 13 2 14 1 11 23 3 21 12 22 24 PIACS* ADCCS* DACCS* •N.C. H10V 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 +5V (B9) + 12 7805 in (B7) . o u t+10 -123 7905 1N4733A-JL -L 1N4733A.-U = 5.1V Y T 5.1V ¥ 1 out •10 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 24 21 9 10 13 12 +10 V out analog -10 V out interface connector (DB-25) • analog out . analog in 2.5V-10k 10pF 13 HAAH 10k 1 0 k 5.11k •%-vw 1 2 analog in ferrite 2 bead 3 196k 10k 14 NEC D7004C ADC LM336 2.5V LM336 i 2.5V SMP11GY each Op-Amp 1/4 TL084 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 attenuator RF SNR IF SNR transmitter receiver noise > 1 source down- receiver l 1 i converter IF filter discriminator J s.a. SNR spectrum analyzer down- IF i t envelope log converter —-> filter 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°° B N = - 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 Signal Generator RF output O HP8558B Spectrum Analyzer H: 0 kHz/div. 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 Marconi 2022 Signal Generator O RF output] IC2AT pp Transceiver in B&K 2426 RMS Voltmeter ant. o IF output \ c 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 Routine Monte-Carlo Integration Baseband Simulation Hardware 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 diversity combining ' 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 (BERb k ) c k) 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 # makefile for OFDM software # using Microsoft Fortran v. 4 0 compiler # Ed.Casas COMP = f l /Od /c /4Yd t disable optimize, compile only # s t r i c t declarations ADD = /4Yb /Ge # /4Yb for runtime error trace. # /Ge for stack check LINK = l i n k # l i n k command LINKOPT = /E ; # EXEPACK option D = ..\bin # binary destination directory MOVE. = ( copy $*.exe $D ; \ del $*.exe ) # i n s t a l l i n binary directory .SUFFIXES: .exe .obj .f .asm .f.obj : ${COMP} ${ADD} /Tf $< .asm.obj : masm $< ; a l l : $D\fdint.exe $D\simrun.exe \ $D\pint.exe $D\bkp.exe $D\ceval.c clean : del *.obj del *.fX # select code for for l i t t l e - or big-endian CPUs simfde.obj : simfde.f sed - f sim2ibm.sed <simfde.f >simfde.fX ${COMP} ${ADD} /4Ns /Tf simfde.fX # IEEE DSP routines don't declare variables and subscripts are wrong s i f f t . o b j : s i f f t . f ${C0MP} ${ADD} /4Ns /4Nd /4Nb /Tf s i f f t . f pint.obj : p i n t . f simpdef.f simpget.f $D\pint.exe : pint.obj simut.obj simsnr.obj ${LINK} pint simut simsnr $(LINKOPT} ${MOVE} fdint.obj : f d i n t . f simpdef.f simpget.f $D\fdint.exe : fdint.obj simsnr.obj simfde.obj \ simdiv.obj simut.obj simgen.obj ${LINK} fdint.obj simsnr.obj simfde.obj \ simdiv simut simgen ${LINKOPT} ${M0VE} simrun.obj : simrun.f simpdef.f simpget.f io.obj : \hw\pcio\io.asm masm \hw\pcio\io.asm ; $D\simrun.exe : simrun.obj simmod.obj simfec.obj \ simfde.obj simgen.obj s i f f t . o b j simsnr.obj simut.obj \ simhw.obj simdiv.obj io.obj ${LINK} simrun.obj simmod.obj simfec.obj \ simfde.obj simgen.obj s i f f t . o b j simsnr.obj simut.obj \ simhw.obj simdiv.obj io.obj ${LINK0PT} ${M0VE} $D\bkp.exe : bkp.c tc bkp.c ${MOVE} $D\ceval.exe : ceval.c tc eval.c ${M0VE} m a k e f i l e (unix) FC = f77 FFLAGS = -f68881 -c -u -C LD = f77 -f68881 LDOPT = -o $@ CVT = sed - f sim2unix.sed OBJ = fdint p i n t simrun bkp ceval BINDIR = ..\bin a l l : ${0BJ} i n s t a l l : mv ${0BJ} ../bin s i f f t . o : s i f f t . f ${FC} -f68881 -c s i f f t . f simfdeX.f : simfde.f ${CVT} simfde.f >simfdeX.f f diritx. f : f d i n t . f simpdef. f simpget. f ${CVT} f a i n t . f >fdintx.f fdi n t : fdintx.o simsnr.o simfdeX.o \ simdiv.o simut.o simgen.o ${LD} fdintx.o simsnr.o simfdeX.o \ simdiv.o simut.o simgen.o ${LDOPT) pintX.f : p i n t . f simpdef.f simpget.f ${CVT} p i n t . f >pintX.f pint : pintX.o simsnr.o simut.o ${LD} pintX.o simsnr.o simut.o ${LDOPT) simrunX.f : simrun.f simpdef.f simpget.f ${CVT} simrun.f >simrunX.f simrun : simrunX.o simmod.o simfec.o \ simfdeX.o simgen.o s i f f t . o simsnr.o simut.o \ simdum.o simdiv.o ${LD} simrunX.o simmod.o simfec.o \ simfdeX.o simgen.o s i f f t . o simsnr.o simut.o \ simdum.o simdiv.o ${LDOPT} pdf : pdf.o simut.o ${LD} pdf.o simut.o ${LD0PT} bkp : bkp.c gcc bkp.c -lm -o bkp ceval : ceval.c gcc ceval.c -lm -o ceval sim2ibm.sed /AClBM/s/cIBM/ / sim2unix.sed /A$LARGE/d /A$INCLUDE: ' simpdef.f/r simpdef.f /A$INCLUDE: 'simpdef.f/d /A$INCLUDE: 'simpget.f/r simpget.f /A$INCLUDE: ' simpget.f/d /AcSUN/s/cSUN/ / simrun.f $LARGE c **************** c simrun.f - OFDM Simulation c **************** c Ed.Casas c c l i n k with the following f i l e s : c c s i f f t . f - FFTs (adapted from IEEE DSP l i b r a r y ) c simdiv.f - switching d i v e r s i t y c simdum.f - dummy hardware interface (non-IBM PC) c simfde.f - fading envelope generation c simfec.f - FEC and bit/block error counting c simgen.f - noise and data generators c simhw.f - hardware interface (IBM PC) c simmod.f - OFDM (de)modulation c simsnr.f - IF to AF signal/noise l e v e l conversion c simut.f - various u t i l i t i e s c c includes the following f i l e s : c c simpdef.f - declarations of simulation parameters c simpget.f - input of simulation parameters c c Major Revisions: c c 85- VAX/VMS FORTRAN and FPS AP-100 routines C 86- VAX/VMS FORTRAN c 87-8 FORTRAN 77 (Microsoft v3.3 compiler subset) c program simrun c $INCLUDE: 'simpdef.f c c l o c a l variables: c i - t r i a l counter 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 i n simulation block c sp - signal power (calculated by modu) c oldsnr - fading waveform average snr c i f l - Index into array corresponding to value of f l c i f 2 - Index into array corresponding to value of f2 c nf - i f 2 - i f l + l = number of frequencies between i f l and i f 2 c nO, n l - number of non-error and errors (for runs test) c nr - number of runs (for runs test) c r - normalized number of runs s t a t i s t i c (for runs test) integer i , j , k, 1, m, n integer nO, n l , nr integer i f l , i f 2 , nf real r re a l oldsnr c s t a t i s t i c s functions: mean, lower and upper .95 CI real stmn, stl95, stu95 c convert power to dB real dbp c transmitted, received, and corrected b i t s and signal sample vectors: l o g i c a l txdata(ns), crdata(ns) rea l t x s i g (ns), rxsig (ns), c r s i g (ns) c the common block i s a ns-real-long temporary work area c used by interleaving and diversity routines rea l wrk(4*ns) common wrk c noise and fading waveform sample vectors: re a l noise (ns), fade(ns) c pre-emphasis and de-emphasis/channel-inversion vectors rea l prev(ns), dev(ns) c error measurement variables: c npass - count of dfb correction passes c nbel - b i t error count on previous pass c nbe2 - b i t error count on current pass c nwe2 - word error count on current pass c nbe, nwe - b i t and word errors (in one t r i a l ) c ber, bker - sums of BERs and BkERs runs ber2, bker2 runs2 nber, nbker nruns nb, nw nbx, nwx integer integer integer integer real real r e a l real integer integer - sums of number of runs s t a t i s t i c s - sums of squares of BERs and BkERs - sums of squares of number of runs s t a t i s t i c s - number of BER and BkER t r i a l s - number of runs s t a t i s t i c s - number of bits/words per t r i a l - number of bits/words examined i n a t r i a l nbel, nbe2, nwe2, npass nbx, nwx nbe (mxblk,mxsnr), nb (mxblk,mxsnr), ber (mxblk,mxsnr), runs (mxblk,mxsnr) ber2(mxblk,mxsnr), bker2(mxblk,mxsnr) runs2 (mxblk,mxsnr) nber(mxblk,mxsnr), nbker(mxblk,mxsnr) nruns (mxblk,mxsnr) nwe (mxblk,mxsnr) nw (mxblk,mxsnr) bker (mxblk,mxsnr) c test d i b i t s or b i t s for runs test l o g i c a l d i b i t s parameter (dibits=.false.) c i n i t i a l i z e BER, BkER, and runs s t a t i s t i c s variables data ber /mxblsn*0./, bker /mxblsn*0./, runs /mxblsn*0./ data ber2/mxblsn*0./, bker2/mxblsn*0./, runs2/mxblsn*0./ data nber/mxblsn*0 /, nbker/mxblsn*0 /, nruns/mxblsn*0 / c *** program s t a r t s here **** wri t e ( * , * ) ' % OFDM Simulation - 88-6-4.' c  $INCLUDE: 'simpget.f c  if(fs.le.O)then write(*,*) ' simrun: bad fs ' stop endif if((2*ne+n)*2.gt.4*ns)then write(*,*) ' simrun: ne too large ' stop endif c i f (hw) then c measure channel transfer function and generate pre/de-emphasis f i l t e r c i n i t i a l i z e for block of maximum lenght (ns), with sample work array c enough for 4 seconds (4*8000=32000). t x s i g i s temporary work vector. c a l l hwinit(txdata,prev,dev,txsig,neqbl, + wrk, ns,8*ns,fs,f1,f2, dbd,rms,peak,txemp,demp, + empscl,nempsc,empfr,empsc) else c i n i t i a l i z e snr-to-signal and snr-to-noise tables c a l l s2init(b,w,rms,peak,fm,fd,rfm,agclim,sqlim, + n i n t s , i n t s r , i n t s s , nintn,intnr,intnn, + fading, noisng ) endif c do ntr t r i a l s do 6 i = l , n t r c reset b i t , word, b i t error and word error counts for t h i s t r i a l c a l l v i f i l l ( n b ,mxblsn,0) c a l l v i f i l l ( n w ,mxblsn,0) c a l l vifill(nbe,mxblsn,0) c a l l vifill(nwe,mxblsn,0) c do "nblk" blocks per t r i a l do 4 j=l,nblk c generate data b i t s i f (npat.eq.O)then c a l l prbs(txdata,ns,sr) else c a l l dwg(txdata,ns,pat,npat) endif i f (.not.hw)then c i f noise enabled, generate a noise vector for proper noise density c scaling i s because measured noise powers only include frequencies in the data range. i f (noisng) then i f (impnse)then c a l l vimp(noise,ns,prbimp,nseed) else c a l l vgrand(noise, ns,nseed) endif c a l l vsmul(noise,ns,sqrt( (fs/2.0)/(f2-f1) )) else c a l l v f i l l ( n o i s e , n s , 0 . ) endif i f fading enabled, generate snr values with 0 dB mean i f (fading) then c a l l genfdb(fd/fs,fseed,fade,ns, + ndbr,thr,ndw, nsw) else c a l l v f i ll(fade,ns,0.) endif oldsnr=0. endif do for a l l snrs do 3 l=l,nsnr set the fading waveform average snr if(.not.hw)then c a l l setsnr(fade,ns,oldsnr,snr(1)) endif do for a l l data block sizes do 3 k=l,nn set the block size n=na (k) i f (n. l e . 0. or. n. gt. ns) then write(*,*) ' simrun: bad N ' stop endif set lower/upper frequency l i m i t s and number of channels c a l l s e t i f ( f s , n , f l , i f l , f 2 , i f 2 ) c continue correction passes u n t i l exceed i t e r a t i o n l i m i t or no errors n f = i f 2 - i f l + l i f (mxdf bp. gt. 0) then c do for a l l OFDM blocks i n the ns-sample block c a l l vcopy(crsig,rxsig,n) do 3 m=l,ns,n c a l l modu (rxsig,n,nf, serial) c encode the data into complex data values npass=0 nbel=ns+l c a l l encode(txdata(m),txsig,ifl,if2,n) 1 continue c do pre-emphasis i f sending over HW channel i f ( (nbe2.eq.O) .or. (npass.gt.mxdfbp) (goto 2 i f (hw) then c remodulate received data c a l l emp(txsig,prev,fl,f2,fs,n,ns) endif c a l l encode(crdata,crsig,if1,if2,n) c a l l modu(crsig,n,nf,serial) c modulate the data into an ofdm signal (unit variance) c use o r i g i n a l signal where received l e v e l > fade l i m i t c a l l modu (txsig, n,nf, serial) c a l l v s e l ( c r s i g , r x s i g , fade(m) ,fdlim(l) ,n) c send signal through noisy, fading channel c demodulate the composite signal c a l l vquant (txsig,n,tmax,tquant) c a l l demodu(crsig,n,nf,serial) i f (hw)then c a l l decode(crdata,crsig,ifl,if2,n) c a l l hwch(txsig,crsig,wrk,n,n+2*ne,rms,peak) else npass=npass+l c a l l ch(txsig, crsig,noise(m),fade(m),n,rms,peak) nbel=nbe2 endif c do [fee S] error checking c a l l vquant(crsig,n,rmax,rquant) c a l l fee(crdata,txdata(m),nf,intlv,ecn,ect, c demodulate + nbe2,nbx,nwe2,nwx) c a l l demodu(crsig,n,nf, serial) goto 1 2 continue c do de-emphasis i f sent over HW channel i f (dndfbp)then i f (hw) then write(*,' (IX,A2,15,F4.0,13,15)') c a l l emp (crsig,dev, f 1, f2, fs, n,ns) + '%D', n, s n r ( l ) , npass, nbe2 endif endif c a l l decode(crdata,crsig,ifl,if2,n) endif c do [fee &] error checking c i f required, display signal and noise powers i n t h i s block c a l l fee(crdata, txdata(m),nf,intlv,ecn,ect. if(dsn)then + nbe2,nbx,nwe2,nwx) c a l l dvsn(crsig(if1),txdata(m),nf, + f l , fs,n, snr (1) ,ndsn,wrk (1) ,wrk(ns+l)) endif if(dsnav)then c a l l davsn(crsig(ifl) , txdata (m) ,nf, + n,snr (1) ,wrk(l) ,wrk (ns+1)) endif c i f required, display transmitted and received signal values if(ddat)then c a l l vddat(crsig(if1), txdata(m),nf, + f l , f 2 , n , s n r ( l ) ) endif c i f required, display number of errors i n each fee block if(dnerr)then c a l l dne(crdata,txdata(m),nf,intlv,ecn,n,snr(l)) endif c update bit/word add bit/word error counts nbe(k, 1)=nbe(k,1)+nbe2 nb (k,l)=nb (k,l)+nbx nwe (k,l)=nwe (k,l) +nwe2 nw (k,l)=nw (k,l)+nwx c write(*,*) ' blk, BER = ', j , float(nbe2)/nbx c do runs test i f required, only consider block with minrnst runs i f ( r n s t s t ) t h e n i f ( d i b i t s ) t h e n c a l l vl2diff(crdata,txdata(m),nf,wrk,nf/2) c a l l runcnt(wrk,nf/2,n0,nl,nr,r) else c a l l vxor (crdata,txdata (m) ,wrk, nf) c a l l runcnt (wrk,nf,nO,nl,nr,r) endif if(nr.ge.minrns)then c a l l stat (r, runs (k, 1), runs2 (k, 1), nruns (k, 1)) endif endif 3 continue 4 continue c update BER and BkER s t a t i s t i c s do 5 k=l,nn do 5 l=l,nsnr n=na (k) i f (nb(k,l) .ne.O) + c a l l stat (float (nbe ( k , l ) ) / n b ( k , l ) , + ber (k,l),ber2 (k,l),nber (k,l)) i f (nw(k,l) .ne.O) + c a l l stat (float (nwe (k,l))/nw(k,l), + bker (k, 1), bker2 (k, 1),nbker (k, 1)) 5 continue 6 continue c display results: runs tests i f (rnstst)then do 7 k=l,nn do 7 l=l,nsnr i f (nruns (k,l) .ge.2)then write (*,' (4X, A, I6,F6.1,2 (1PE11.2))')'%' ,na (k), snr (1), + stl95(runs (k,l),runs2 (k,l),nruns ( k , l ) ) , + stu95(runs (k,l),runs2 (k,l),nruns (k,l)) else write(*,' (4X,A,I6,F6.1,A)')'%',na(k),snr(l), Co + ' : too few runs.' endif g continue ^ endif c display results: mean BERs and BkERs (with .95 CI) write(*,*) '% b i t error rates : ' do 8 k=l,nn do 8 l=l,nsnr i f (nber(k,l) .ne.OJthen write (*,' (IX, 16,F6.1,3 (1PE11.2))') na (k), snr (1), + stmn (ber (k,l),ber2 (k,l),nber ( k , l ) ) , + stl95(ber (k,l),ber2 (k,l),nber ( k , l ) ) , + stu95(ber (k,l),ber2 (k,l),nber (k,l)) endif 8 continue write(*,*) '% FEC block error rates : ' do 9 k=l,nn do 9 l=l,nsnr i f (nbker (k,l) .ne.OJthen write (*,' (IX, I6,F6.1,3 (1PE11.2))') na (k), snr (1), + stmn (bker (k, 1) ,bker2 (k, 1),nbker ( k , l ) ) , + stl95(bker(k,1),bker2(k,1),nbker(k,1)), + stu95 (bker (k, 1), bker2 (k, 1),nbker (k, 1)) endif 9 continue end simpdef.f c ************************ c simpdef.f - define simulation parameters c ************************ c c array sizes: c ns - maximum number of samples i n each "simulation block" c mxpat - maximum number of elements i n npat c mxblk - maximum number of elements i n na c mxsnr - maximum number of elements i n snr c mxblsn - mxblk * mxsnr c srlen - number of elements i n sr (must be 23 for CCITT v.29) c mxint - number of elements i n intnr, intnn, i n t s r , intsn c mxthr - maximum number of elements i n thrsh integer ns, mxblk, mxsnr, mxblsn, mxpat, srlen, mxint, mxemp integer mxthr parameter (ns=4096 ,mxblk=10, mxsnr=10, mxblsn=100, mxpat=20) parameter (srlen=23, mxint=100, mxemp=50, mxthr=30) c agclim - age gain l i m i t (SNR dB) c agevar - true to test effct of varying age threshold (pint only) c b - IF bandwidth (kHz) c dbd - dB per decade of pre-emphasis c demp - true to display equalization characteristics c dndfbp - true to display number of correction passes for each block c dnerr - true to display number of errors per fee work c dsn - true to display received data value signal and noise power c dsnav - true to display average of received signal and noise powers c ddat - true to display transmitted and received data values c ecn - word size c ect - correctable b i t errors per word (0=no FEC) c empfr - upper frequency l i m i t to use for scaling values i n empsc c empsc - scaling values (in dB) for scaling pre-emphasis vectors c empscl - true to do scaling of pre-emphasis vector c f l - lowest frequency to use on channel (<= 0 -> use minimum) c f2 - highest frequency to use on channel (>= fs/2 -> use maximum) c fading - true to apply fading c f d - doppler rate (Hz) c fdlim - "faded" decision levels for DFB correction (SNR dB), per SNR c fra - true for FM, false for SSB c fs - sample rate (bps) c fseed - RNG seed to i n i t i a l i z e fading generator ( l i m i t s as above) c hw - true to send samples over A/D/A board (through hardware f.s.) c impnse - true to use IMPulse (cf. gaussian) NoiSE c i n t l v - true to do interleaving before checking for word errors 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 i n t s r - SNR part of points to use to change r-s table c intss - "s" part of points to use to change r-s table c minrns - minimum number of runs i n block to use i t for runs t e s t i n g c mxdfbp - maximum number of dfb correction passes (0=no DFB) c na - array of OFDM block sizes, each a power of 2 i n [8,ns] c nblk - number of simulation blocks (ns samples) per t r i a l c ndbr - Number of Diversity BRanches c ndsn - number of channels averaged when display signal/noise powers c ndw - Number of samples to wait (DWell) after threshold crossed c ne - number of guard samples for hardware channel c nempsc - number of values i n empsc and empfr c neqbl - number of blocks to average i n measuring channel equalization c nintn - number of elements i n i n t n r and intnn c nints - number of elements i n i n t s r and i n t s s c nn - number of OFDM block sizes to be tested c noisng - true to add noise c npat - Number of elements i n data PATtern (0 for random data) SG. c nseed - RNG seed for noise generators (0 <= nseed < 67108864) 5 c nsnr - number of SNRs to test Q. c nsw - Number of samples to blank output while Switching branches 5, c nthrsh - number of squelch or age thresholds to test (pint only) ~* c ntr - number of t r i a l s done each time subroutine c a l l e d c pat - description of data PATtern c p f i l e - name of simulation parameter f i l e c rms - rms voltage of modulating signal c peak - peak voltage of modulating signal c prbimp - p r o b a b i l i t y of a sample having an impulsive noise " h i t " c rfm - true to add Random FM c rmax - Receiver A/D MAXimum (clipping) value c rnstst - true to compute runs tests c rquant - b i t s of Receiver A/D QUANTization (0=no quantization) c s e r i a l - true for " s e r i a l " (no OFDM) simulation c snr - IF SNRs (dB) c sqlim - squelch l i m i t (SNR dB) c sqval - true to test effect of varying squelch threshold (pint only) c sr - s h i f t register l o g i c a l values to generate PRBS data stream c thr - switching threshold (dB r e l . to mean) c thrsh - age or squelch thresholds to test c tmax - Transmitter D/A MAXimum (clipping) value c tquant - b i t s of Transmitter D/A QUANTization (0=no quantization) c txemp - true to amp./phase correction at transmitter (not receiver) c vname - variable name i-» c w - baseband bandwidth (kHz) 2 integer na(mxblk), nn, ntr, nblk integer ecn, ect integer ndbr, npat, pat(mxpat), nsnr integer tquant, rquant integer nsw, ndw integer ne, mxdfbp, neqbl integer nintn, nints, minrns integer ndsn, nempsc, nthrsh r e a l f s , fd, snr(mxsnr), fdlim(mxsnr) r e a l agclim, sqlim, b, w, rms, peak re a l prbimp r e a l t hr real f l , f2, tmax, rmax real dbd re a l intnr(mxint), intnn(mxint), intsr(mxint), intss(mxint) re a l empsc(mxemp), empfr(mxemp) re a l thrsh(mxthr) double precision nseed, fseed l o g i c a l fm, fading, noisng, rfm, i n t l v , impnse, hw, s e r i a l l o g i c a l dndfbp, dnerr, dsn, dsnav, demp, ddat, rnstst, txemp l o g i c a l empscl, agcvar, sqvar l o g i c a l sr(srlen) character*70 vname, p f i l e c i n t r i n s i c functions integer min c '•— simpget.f c ********************************* c simpget.f - read simulation parameters c ********************************* c write(*,*) '% simulation parameter f i l e ? ' read(*,' (A70)') p f i l e write(*,*) '% ', p f i l e open(10,file=pfile) read(10,*) vname write(*,*) '% ', vname read(10,*) vname, nn, (na(i) ,i=l,min (nn, mxblk)) if(nn.gt.mxblk)then write(*,*) ' simpget : too many blocks sizes ' stop endif write(*,*) '% na(i) =', (na(i) ,i=l,nn) read(10,*) vname, ntr, nblk write(*,*) '% ntr, nblk =', ntr, nblk read(10,*) vname, f s , fd write(*,*) '% f s , f d = \ f s , f d read(10,*) vname, nsnr, (snr (i) ,i=l,min (nsnr,mxsnr)) if(nsnr.gt.mxsnr)then write(*,*) ' simpget : too many SNRs ' stop endif write(*,*) '% snr(i) =', (snr(i),i=l,nsnr) read(10,*) vname, s e r i a l write(*,*) '% s e r i a l =', s e r i a l read(10,*) vname, fm, b, w, rms, peak write(*,*) '% fm, b, w, rms, peak =', fm, b, w, rms, peak read(10,*) vname, agclim, sqlim write(*,*) '% age, sqlim =', agclim, sqlim read(10,*) vname, fading, noisng write)*,*) '% fading, noisng =', fading, noisng read(10,*) vname, fseed, nseed write(*,*) '% fseed, nseed =', fseed, nseed read(10,*) vname, rnstst, minrns write(*,*) '% rnstst, minrns =', rnstst, minrns read(10,*) vname, mxdfbp, (fdlim(i),i=l,nsnr) write(*,*) '% mxdfbp, fdlim(i) =', mxdfbp, (fdlim(i) ,i=l,nsnr) read(10,*) vname, dndfbp, dnerr, demp, ddat write(*,*) '% dndfbp, dnerr, demp, ddat =', + dndfbp, dnerr, demp, ddat read(10,*) vname, dsn, ndsn, dsnav write(*,*) '% dsn, ndsn, dsnav =', dsn, ndsn, dsnav read(10,*) vname, i n t l v write(*,*) '% i n t l v =', i n t l v read(10,*) vname, ecn, ect write(*,*) '% ecn, ect =',ecn,ect read(10,*) vname, ndbr, thr, ndw, nsw write(*,*) '% ndbr, thr, ndw, nsw =', ndbr, thr, ndw, nsw read(10,*) vname, npat, (pat (i),i=l,min(npat,mxpat)) i f(npat.gt.mxpat)then write(*,*) ' simpget : too many pattern elements ' stop endif write(*,*) '% pat(i) =', (pat(i),i=l,npat) read(10,*) vname, (sr(i),i=l,srlen) write(*,*) '% s r ( i ) =', (sr (i) ,i=l,srlen) read(10,*) vname, rfm write(*,*) '% rfm =', rfm read(10,*) vname, irapnse, prbimp write(*,*) '% irapnse, prbimp =', impnse, prbimp read(10,*) vname, hw, ne, dbd, negbl, txemp write(*,*) '% hw, ne, dbd, neqbl, txemp =', + hw, ne, dbd, neqbl, txemp read(10,*) vname, f l , f2 write(*,*) '% f l , f2 =', f l , f2 if ( f 2 . 1 e . f l ) t h e n write(*,*) ' simpget : f2 <= f l ' stop endif read(10,*) vname, tquant, tmax, rquant, rmax write (*,*) '% tquant, tmax, rquant, rmax =', + tquant, tmax, rquant, rmax read(10,*) vname, nints, + ( i n t s r ( i ) , i n t s s ( i ) , i=l,min (nints,mxint)) if(nints.gt.mxint)then write(*,*) ' simpget : too many signal interpolation values stop endif write (*,' (a, 1000 (/"%", 2f 10.3))') + ' % i n t s r ( i ) , intss (i) =', + ( i n t s r ( i ) , intss ( i ) , i=l,nints) read(10,*) vname, nintn, + ( i n t n r ( i ) , i n t n n ( i ) , i = l , min (nintn,mxint)) if(nintn.gt.mxint)then write(*,*) ' simpget : too many noise interpolation values ' stop endif write(*,' (a,1000 (/" % " , 2 f l 0 . 3 ) ) ' ) + ' % i n t n r ( i ) , intnn(i) =', + ( i n t n r ( i ) , intnn ( i ) , i = l , nintn) read(10,*) vname, agcvar, sqvar, nthrsh, + (t h r s h ( i ) , i=l,min(nthrsh,mxthr)) if ( n t h r s h . gt.mxthr)then write(*,*) ' simpget : too many agc/squelch test thresholds ' stop endif write(*,*) '% agcvar, sqvar =', agcvar, sqvar write (*,' (a, 1000 (/" %" , f 6 . 2 ) ) ' ) + ' % thrsh(i) =', (thrsh ( i ) , i=l,nthrsh) read(10,*) vname, empscl write(*,*) '% empscl =', empscl read(10,*) vname, nempsc, + (empfr(i), empsc(i), i = l , min (nempsc,mxemp)) if(nempsc.gt.mxemp)then write(*,*) ' simpget : too many pre-emphasis scaling values ' stop endif write(*,' (a,1000 (/" %", 2fl0.3))') + ' % empfr(i), empsc(i) =', + (empfr(i), empsc(i), i = l , nempsc) close (10) simfde.f c ********************** c simfde.f - fading envelope generator (Jake's method) ********************** c 87-7-9 subroutine genfd(fdbyfs,seed,x,ns,b) c generate samples of the fading envelope c method from W. C. Jakes, 1974, p. 65 c output vector (x) i s i n dB r e a l fdbyfs integer ns re a l x(ns) double precision seed l o g i c a l i n i t integer b, m c constant to scale envelope to unity rms re a l k c max number of d i v e r s i t y branches integer nb parameter (nb=10) c storage for phase counters for di v e r s i t y branches integer*4 phs(9,nb) c word and full-word length phase counter integer*4 pf(9) integer*4 p l , p2, p3, p4, p5, p6, p7, p8, p9 integer*2 pw(18) integer*2 i l , i 2 , i 3 , i4, i 5 , i 6 , i 7 , i 8 , i9 equivalence (pf,pw) equivalence ( p f ( l ) , p l ) , (pf(2), p2), (pf(3), p3), + (pf(4), p4), (pf(5), p5), (pf(6), p6), + (pf(7), p7), (pf(8), p8), (pf(9), p9) c only one of the following two tables can be used c using the wrong table w i l l produce out-of-range subscripts c t h i s table for computers that store MS INTEGER*2 value f i r s t c e.g. MOTOROLA 68000 (SUN) cSUN equivalence (pw( 1), i l ) , (pw( 3), i 2 ) , (pw( 5), i 3 ) , cSUN + (pw( 7), 14), (pw( 9), i 5 ) , (pw(ll), 16), cSUN + (pw(13), 17), (pw(15), 18), (pw(17), i9) c t h i s table for computers that store LS INTEGER*2 value f i r s t C e.g. INTEL 8088 (IBM PC), DEC VAX-11 cIBM equivalence (pw( 2), i l ) , (pw( 4), i 2 ) , (pw( 6), i 3 ) , cIBM + (pw( 8), i 4 ) , (pw(10), i 5 ) , (pw(12), i 6 ) , cIBM + (pw(14), 17), (pw(16), i 8 ) , (pw(18), i9) c i t l i s the table length for each sine/cosine lookup table c *** values of i t l must match *** integer i t l parameter (itl=2048) c scaled sine and cosine lookup tables integer*2 c l ( i t l ) , c 2 ( i t l ) , c 3 ( i t l ) , c 4 ( i t l ) , c 5 ( i t l ) , + c 6 ( i t l ) , c 7 ( i t l ) , c 8 ( i t l ) , c 9 ( i t l ) integer*2 s i ( i t l ) , s 2 ( i t l ) , s 3 ( i t l ) , s 4 ( i t l ) , s 5 ( i t l ) , + s 6 ( i t l ) , s 7 ( i t l ) , s 8 ( i t l ) , s 9 ( i t l ) c I and Q sums integer*2 sumi, sumq c phase increments per sample integer*4 dpi, dp2, dp3, dp4, dp5, dp6, dp7, dp8, dp9 common /f d t a b l / c l , c2, c3, c4, c5, c6, c7, c8, c9, + s i , s2, s3, s4, s5, s6, s7, s8, s9 common /fdtab2/ dpi, dp2, dp3, dp4, dp5, dp6, dp7, dp8, dp9 real t p i , oldfds integer i , j real uni real f l o a t data oldfds/0./, i n i t / . f a l s e . / data tpi/6.28318/ c compute look-up tables i f have not been i n i t i a l i z e d i f ( . n o t . i n i t ) t h e n c a l l initos(k) init=.true. endif c compute phase increments and i n i t i a l i z e o s c i l l a t o r phases c i f doppler or sampling rate have changed if(fdbyfs.ne.oldfds)then c a l l initph(fdbyfs) oldfds=fdbyfs c i n i t i a l i z e phases using uniform RNG m=l do 1 1=1,nb do 1 j=l,9 p h s ( j , i ) = i t l * 65536*uni(seed) 1 continue endif c range-check branch number if( ( b . l t . l ) . o r . ( b . g t . n b ) ) t h e n write(*,*)'genfd:diversity branch out of range. stop endif c copy branch phases to phase counters do 2 i=l,9 pf (i)=phs(i,b) 2 continue c generate ns samples do 3 i=l,ns c increment o s c i l l a t o r phases ' pl=pl+dpl p2=p2+dp2 p3=p3+dp3 p4=p4+dp4 p5=p5+dp5 p6=p6+dp6 p7=p7+dp7 p8=p8+dp8 p9=p9+dp9 c keep phase modulo two p i i f ( i l . g t . i t l ) i l = i l - i t l i f ( i 2 . g t . i t l ) i 2 = i 2 - i t l i f ( i 3 . g t . i t l ) i 3 = i 3 - i t l i f ( i 4 . g t . i t l ) i 4 = i 4 - i t l i f ( i 5 . g t . i t l ) i 5 = i 5 - i t l i f U 6 . g t . i t l ) i 6 = i 6 - i t l i f ( i 7 . g t . i t l ) i 7 = i 7 - i t l i f ( i 8 . g t . i t l ) i 8 = i 8 - i t l i f ( i 9 . g t . i t l ) i 9 = i 9 - i t l c add up two sets of scaled o s c i l l a t o r outputs and f i n d mag. squared sumi=cl ( i l ) +c2 (i2) +c3 (i3) +c4 (i4) + 1 c5 (i5) +c6 (i6) +c7 (i7) +c8 (i8) +c9 (i9) sumq=sl ( i l ) +s2 (i2) +s3 (i3) +s4 (i4) + 1 s5(i5) +s6(i6) +s7(i7)+s8(18)+s9(i9) x(i) = k * ( float (sumi)**2 + f l o a t (sumq) **2 ) 3 continue c convert to dB (power) (x i s magnitude squared of envelope) c a l l vdbp(x,ns) c copy phase counters back do 4 i=l,9 phs(i,b)=pf (i) 4 continue return end subroutine initos(k) c i n i t i a l i z e o s c i l l a t o r lookup tables real p i , t p i , sqrt2 real N, NO real stk, ctk, k integer i , j real f l o a t , cos, s i n c i t l i s the table length for each sine/cosine lookup table c *** values of i t l must match *** integer i t l parameter (itl=2048) scaled sine and cosine lookup tables integer*2 c w ( i t l , 9 ) , sw(itl,9) r e a l r c ( l t l ) common /f d t a b l / cw, sw data pi/3.14159/, tpi/6.28318/, sqrt2/l.414213/ N0=8. N=4.*N0+2. c compute un-scaled o s c i l l a t o r (cosine) look-up table do 1 j = l , i t l r c ( j ) = c o s ( f l o a t ( j - 1 ) / i t l * t p i ) 1 continue c generate scaled o s c i l l a t o r tables k=0. do 3 i=l,8 ctk=1750.*2.*cos(pi*float(i)/NO) stk=1750.*2.*sin (pi*float(i)/NO) k=k+ctk**2+stk**2 do 2 j = l , i t l cw(j,i)=rc(j)*ctk sw(j,i)=rc (j) *stk 2 continue 3 continue c l a s t o s c i l l a t o r has different amplitude ctk=1750.*1. /sqrt2*2.*cos(pi/4.) stk=1750.*1./sqrt2*2.*sin(pi/4.) k=k+ctk**2+stk**2 do 4 j = l , i t l cw(j,9)=rc(j)*ctk sw(j,9)=rc(j)*stk 4 continue c compute normalization constant k=2./k w r i t e ( * , * ) ' % o s c i l l a t o r tables ( r e ) i n i t i a l i z e d ' return end c subroutine initph(fdbyfs) c i n i t i a l i z e phase increment table real fdbyfs real t p i real N, NO integer i real cos, floa t c i t l i s the table length for each sine/cosine lookup table c *** values of i t l must match *** integer i t l parameter (itl=2048) integer*4 dpf (9) common /fdtab2/ dpf data tpi/6.28318/ i f ((fdbyfs.It.0.).or.(fdbyfs.ge.0,5))then write(*,*)'genfd:doppler too high or negative.' stop endif c compute phase increments N0=8. N=4.*N0+2. do 1 i=l,8 dpf(i)=cos(tpi*float(i)/N)*fdbyfs*itl*65536. 1 continue dpf(9)= fdbyfs*itl*65536. write(*,*) '% phase increments ( r e ) i n i t i a l i z e d ' write (*,*) '% fdbyfs = ', fdbyfs return end subroutine setsnr(fade,n, oldsnr,newsnr) integer n r e a l fade(n), oldsnr, newsnr c k - temporary variable for indexing r e a l delta c nle f t - Number of samples LEFT to generate c m - number of saMples to generate i n one pass delta=newsnr-oldsnr c thr - switching THReshold (fraction of mean=l) c maxbuf - size of l o c a l buffer c a l l vadd(fade,n, delta) oldsnr=newsnr integer i , j , k, n l e f t , 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 - d i v e r s i t y c i n t r i n s i c functions c ********************** c 87-11-29 integer min, i n t c c range-check number of d i v e r s i t y branches subroutine genfdb(fdbyfs, seed,x,ns, i f ( n b . l t . l ) t h e n + nb,thr,ndw,nsw) write (*,*) ' genfdb: nb < 0 ' stop c fading envelope generator (in dB) endif c parameters: c i n i t i a l i z e for piece-wise generation of ns samples c fdbyfs - Doppler rate / Sampling rate i = l c seed - RNG seed for i n i t i a l i z i n g fading generator nleft=ns c x - output vector containing fading sequence (dB) bufsiz=int(maxbuf/nb) c ns - Number of values i n x c nb - Number of di v e r s i t y Branches c generate (and combine) "nb" sections of "bufsize" samples per pass c nb>l means div e r s i t y c thr - switching d i v e r s i t y THReshold (dB r e l a t i v e 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 lo s t while switching branches c generate branch signals re a l fdbyfs double precision seed do 2 j=l,nb integer ns, nb k=(j-l)*m+l r e a l x(ns) c a l l genfd(fdbyfs, seed,buf (k) ,m, j) real thr 2 continue integer ndw, nsw c combine branches c l o c a l variables: if(nb.eq.l)then c i - index into output vector x c a l l vcopy(buf,x(i) ,m) c j - branch counter else c a l l divsw (buf, nb,m,x(i), nsw, ndw, thr) endif i=i+m nleft=nleft-m c repeat u n t i l done . if(nleft.gt.O)goto 1 return end subroutine divsw(buf,nb,m,x,nsw,ndw,thr) c switching d i v e r s i t y routine c NOTE: the switching and dwell counts are s t a t i c so t h i s c routine cannot be used to generate independent c diversity-switched signals. c parameters: c buf - input buffer (m by nb) with m samples from each of c nb branches c nb - number of diversity branches cm - number of samples per branch c x - output vector containing the resulting fading sequence c ndw - minimum Number of samples to DWell on one branch (>=1) c (after switching i s complete) c nsw - Number of samples blanked out while switching branches c thr - switching THReshold (dB r e l a t i v e to mean) integer nb, m, ndw, nsw re a l buf (m,nb), x(m), thr c l o c a l (static!) variables: c br - current BRanch c idw - count for timer that indicates that must DWell on c current branch c isw - count for timer for switching time c zval - VALue value (dB) to indicate samples that should be c Zero'ed. (anything > 1E6 can be used), used by "ch" c routine. c maxdw - maximum dwell count (to avoid overflows) integer br, idw, isw, i real.zval parameter(zval=2.0e6) data br/1/, idw/0/, isw/0/ c write(*,*) ' thr = ',thr c range checks i f (nsw. I t . 0) then write (*,*)' divsw: nsw < 0 ' stop endif i f (br.gt.nb)then write(*,*)' divsw: branch > number of branches ' stop endif if(ndw.It.0)then write(*,*)' divsw: ndw < 0 ' stop endif c do for a l l samples ... do 1 i=l,m c i f below threshold not switching and and dwell timer expired, c go to next antenna and reset timers i f (buf (i,br) . I t . t h r .and. isw.eq.O .and. idw.eq. 0)then br=br+l i f (br.gt.nb)br=l isw=nsw idw=ndw+nsw endif c i f switching (blanking) timer has expired, select current branch' c l e v e l , else output i s blanked i f (isw.eq. 0)then x(i)=buf (i,br) else x(i)=zval endif c i f s t i l l on, decrement switching timer if(isw.gt.O)then isw=isw-l endif c i f s t i l l on, decrement channel dwell timer i f (idw.gt.O)then idw=idw-l endif c write (*,*) (buf ( i , l ) ,l=l,nb), '=> ', br, x(i) 1 continue return end simgen.f c ******************** c simgen.f - data and noise generators c ******************** subroutine prbs(x,n,sr) c PRBS generator c The generator's s h i f t register i s implemented as a l o g i c a l array, c For effic i e n c y , instead of s h i f t i n g the array to the right (up) c pointers to the exclusive-or gate connections and the LS b i t are c shifted l e f t (down the array). c The tap connection (18,23) are taken from the data scrabler c described i n Appendix 2 of the CCITT standard (V.29) for a c 9600 bps modem. The pattern period i s 2**23-1 = 8 388 607. integer len parameter (len=23) c i - counts output values c iO, il, i2 - point to least s i g n i f i c a n t b i t and XOR connections c i n s h i f t register array c n - number of values to put i n x c x - output l o g i c a l array c len - length of s h i f t register c sr - a l o g i c a l array of len elements corresponding to the c elements of a prbs generator s h i f t register. integer i , 10, i l , i 2 , n l o g i c a l sr(len) l o g i c a l x(n) i0=l il=18 i2=23 do 1 i=l,n i0=i0-l i f (i0.eq.0)i0=len i f ( s r ( i l ) ) t h e n i f (sr(i2))then sr(i0)=.false, x(i)=.false, else sr(i0)=.true. x(i)=.true. endif else i f (sr(i2))then sr (i0) = .true. x( i ) = .true. else sr (i0) = . false. x ( i ) = .false, endif endif i l = i l - l i f ( i l . e q . 0 ) i l = l e n 12=i2-l i f (i2.eq.0)i2=len 1 continue c a l l rotdwn(sr,len,iO-l) return end subroutine rotdwn(sr,n,i) c rotate ( c i r c u l a r s h i f t ) the f i r s t "n" elements of l o g i c a l array c "sr" down the array by " i " places. integer n, i l o g i c a l sr(n) integer j , k l o g i c a l t do 2 j = l , i t=sr(l) do 1 k=l,n-l sr(k)=sr(k+l) 1 continue sr (n)=t 2 continue return end subroutine vimp(x,n,p, seed) c generates impulse noise vector c samples are uncorrelated with equal probability of an impulse = p c zero mean, unit average power c c a l l s uniform RNG "uni" integer i , n re a l x(n), p, u r e a l sqrt, uni double precision seed i f ( p . l t . O .or. p.gt.ljthen write(*,*)' vimp: p out of range. ' stop endif u=sqrt(l./p) do 1 i=l,n i f (uni(seed) .lt.pjthen i f (uni (seed) .gt. 0.5) then x(i)=u else x(i)=-u endif else x(i)=0 endif 1 continue return end subroutine dwg(x,n,y,m) c d i g i t a l waveform generator c x - output l o g i c a l vector c n - number of values i n x c y - pattern d e f i n i t i o n vector (number false, number true)... c m - number of elements i n m (>=1) c i f pattern counts i n y are i n s u f f i c i e n t to f i l l x, the pattern i s c repeated starting at y(3) c i - index into x c j - index into y c k - counts up to y(j) integer i , j , k, n, m l o g i c a l x(n), t f integer y(m) i f (m. I t . 3) then write(*,*)'dwg:pattern d e f i n i t i o n < 3 elements.' stop endif do 1 i = l , y d ) x(i)=.false. 1 continue do 2 i=y(l)+l,y(l)+y(2) x(l)=.true. 2 continue tf=.false. j=3 k=0 do 3 i=y(l)+y(2)+l,n . i f (k.ge.y(j))then tf=.not.tf j-j+l k=0 i f (j.gt.m)then j=3 endif endif x(i)=tf k=k+l 3 continue return end subroutine vgrand(xo,n,seed) integer n real xo(n) integer i re a l r, rx, ry double precision seed, dmod real sqrt, alog c function that returns a Gaussian distributed random number c of zero mean, unity variance. c adapted from IEEE DSP program l i b r a r y (in MXFFT.FOR) do 1 i=l,n,2 10 continue seed=dmod(67081293.0d0*seed+14181771.OdO,67108864.OdO) RX=(seed/67108864.0d0*2.0) - 1.0 seed=dmod(67081293.0d0*seed+14181771.OdO,67108864.OdO) RY=(seed/67108864.0d0*2.0) - 1.0 C c  C SUBROUTINE: NORMAL 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 c  c C OUTPUT: X,Y = INDEPENDENT PAIR OF RANDOM NORMAL DEVIATES C FUNCTION UNI GENERATES PSEUDO-RANDOM NUMBER BETWEEN 0.0 AND 1.0 C R = RX**2 + RY**2 IF (R.GE.1.0) GO TO 10 R = SQRT(-2.0*ALOG(R)/R) xo(i)=RX*R if(i+1.le.n)then xo(i+l)=RY*R endif 1 continue return end rea l function uni(seed) c modulo congruential uniform RNG on [0,1) c parameters are from FPS AP l i b r a r y routine VRAND double precision seed double precision dmod seed=dmod(67081293.0d0*seed+14181771.OdO, 67108864.OdO) uni=seed/67108864. return end double precision function iuni(seed) c integer version of uni: RNG on [0,67108864) c to check integer operations using d.p. f.p. numbers c values taken from FPS AP l i b r a r y routine VRAND double precision seed double precision dmod seed=dmod(67081293.0d0*seed+14181771.OdO, 67108864.OdO) Q. iuni=seed return end simmod.f c ****************** c simmod.f - OFDM [de]modulation c ****************** subroutine encode ( d , s i g , i f l , i f 2 , n ) c encode l o g i c a l data into data values c d - l o g i c a l data c s i g - generated data values, unit variance c i f l - index of lowest frequency c i f 2 - index of highest frequency c n - t o t a l number of values integer i f l , i f 2 , i , j , n l o g i c a l d(n) re a l sig(n) c zero out low frequency terms do 1 i = l , i f l - l sig(i)=0. 1 continue c encode data into QAM (complex) format 1-1 do 2 i = i f l , i f 2 i f (d(j))then s i g ( i ) = l . else s i g ( i ) = - l . endif j=j+l 2 continue c zero out high-frequency terms do 3 i=if2+l,n sig(i)=0. 3 continue return end subroutine decode(d,sig,ifl,if2,n) c recover l o g i c a l data from signal values c data not i n [ i f l , i f 2 ] i s unchanged integer n, i f l , i f 2 , i , j l o g i c a l d(n) re a l sig(n) j=l do 1 i = i f l , i f 2 i f ( s i g ( i ) . g t . 0 ) t h e n d(j) = .true. else d(j) = .false, endif j - j + l 1 continue return end subroutine modu(sig,n,nf,serial) c OFDM modulation c s i g - generated signal samples, unit variance c n - OFDM block size = number of samples generated c nf - number of data values = +/- 1 (rest assumed equal 0) c s e r i a l - true for s e r i a l modulation (no FFTs) integer n, nf l o g i c a l s e r i a l r e a l sig(n) rea l k real sqrt, fl o a t c r e a l rms c i f OFDM (not se r i a l ) modulate the data values i n t o an OFDM signal c with unity power (variance = std. dev. = 1 V**2) if ( . n o t . s e r i a l ) t h e n c a l l ffsn(sig,n) k=sqrt( floa t (n)/nf ) * sqrt ( f l o a t (n)/2.) c a l l vsmul(sig,n,k) c write(*,*) ' modu: output rms signal l e v e l = ',rmsv(sig,n) endif return end subroutine demodu(sig,n,nf, s e r i a l ) c OFDM demodulation c s i g - generated signal samples, unit variance c n - OFDM block size = number of samples generated c nf - number of data values = +/- 1 (rest assumed equal 0) c s e r i a l - true for s e r i a l modulation (no FFTs) integer n, nf l o g i c a l s e r i a l r e a l sig(n) rea l k real sqrt, f l o a t c r e a l rms c i f OFDM, un-scale values and demodulate the ofdm signal samples c back into data values. i f ( . n o t . s e r i a l ) t h e n c write(*,*) ' demodu: input rms signal l e v e l = ',rmsv(sig,n) k=sqrt( f l o a t (n)/nf ) * sqrt ( f l o a t (n)/2.) c a l l vsmul(sig,n,l./k) c a l l ffan(sig,n) endif return end simsnr.f c ********************* c simsnr.f - IF/AF SNR conversion c ********************* c modified 89-3-9 to do age and squelch after corrections, c subroutine s 2 i n i t (b,w,rms,peak,fm,fd,rfm,agclim, sqlim, + n i n t s , i n t s r , i n t s s , nintn,intnr,intnn, + fading, noise ) c i n i t i a l i z e IF SNR -to- AF SNR conversion tables c input parameters: c fm true for an FM channel false for SSB c b IF bandwidth (Hz or kHz) c w baseband bandwidth (same units as "b") c rms rms l e v e l of the modulating signal c peak peak l e v e l of the modulating signal c peak-to-average r a t i o = (10 for voice, about 2-3 for data) c pk2rms peak/rms c fd doppler rate (same units as "b" and "w") c rfm true to add random fm noise c agclim SNR above which the AGC operates (dB) c sqlim SNR below which the receiver output i s squelched (dB) c (applied after interpolation given by intXX) c nintn - number of elements i n i n t n r and intnn c nints - number of elements i n i n t s r and intss c i n t n r - SNR part of points to use to change r-n table c intnn - "n" part of points to use to change r-n table c i n t s r - SNR part of points to use to change r-s table c i n t s s - "s" part of points to use to change r-s table c fading - false to disable fading (constant signal output) c noise - false to disable noise (no noise added) c mxint - number of elements i n intnr, intnn, i n t s r , intsn (not req'd) c c the arrays snr2s and snr2n contain the SNR-to-signal le v e l c and SNR-to-noise l e v e l lookup tables, the look-up function c i s : s2min+l + ifix(SNR)*npdb c c npdb i s number of table entries per dB of SNR change c s2min i s "npdb" times the minimum SNR value i n the table c s2raax i s "npdb" times the maximum SNR value i n the table integer mxint parameter (mxint=100) real b, w l o g i c a l fm, rfm real rms, peak, pk2rms real agclim, sqlim integer nintn, nints real intnr(mxint), intnn(mxint), intsr(mxint), intss (mxint) integer i , j , i l , i 2 real p i , n, a, r, s2asum, e2mr, nk, sk, c, nrfm, fd integer npdb, s2min, s2max real snr2s(1101), snr2n(1101) integer i x l o g i c a l fading, noise co real alog, f l o a t , exp, sqrt real interp 2> real dbtor, x common /s2com/ npdb, s2min, s2max, snr2s, snr2n data p i /3.14159/ c function to address 1-base arrays with negative indexes i x (i)=i-s2min+l c function to convert db to l i n e a r (voltage) units dbtor (x) =10. **(x/20.) npdb=10 s2min=-500 s2max=600 write(* write (* write(* write (* write (* * ) ' % FM, IF S AF bandwiths * ) ' % rms, peak deviation * ) ' % random FM, doppler rate * ) ' % AGC S squelch l i m i t s * ) ' % fading, noise , fm, b, w , rms, peak , rfm, f d , agclim, sqlim , fading, noise CO c check number points i n interpolation tables i f ( (nints.It.0) .or. (nints.eq.l) .or. + (mod(nints,2).ne.O) ) then write(*,*) ' % s 2 i n i t - warning : bad nints ' endif i f ( (nintn.It.0) .or. (nintn.eq.l) .or. + (mod(nintn,2).ne.O) ) then write(*,*) ' % s 2 i n i t - warning : bad nintn ' endif c check for random FM being i n v a l i d approximation region if(rfm.and.(fd.gt.0,l*w)) then write(*,*) ' s 2 i n i t : doppler > .1 AF B/W ' stop endif if(rms.le.0.)then write(*,*) ' rms <= 0. ' stop endif pk2rms = peak/rms i f ((pk2rms) . I t . 1.)then write(*,*) ' s 2 i n i t : (pk/rms) < 1 ' stop endif if(fm.and.(w.ge.b/2.0)(then write(*,*) ' % s 2 i n i t : warning : AF B/W >= 1/2 IF B/W endif c modified to give snr2s=l maximum (for FM) if(fm)then a=s2asum (b,w) nk=8.*pi*b*w sk=pi**2/(pk2rms**2)*(b-2.*w)**2 if(rfm)then nrfm=2.*pi**2*alog(10.)*fd**2 else nrfm=0. endif do 1 i=s2min,s2max r=10.0**(float(i)/(npdb*10)) e2mr=exp (-r) n=a*(1.0-e2mr)**2/r + nk*e2mr/sqrt(2*(r+2.35)) + nrfm c ( sk factor scales snr2n to make snr2s independent of b S w ) snr2n (ix (i)) =sqrt (n/sk) snr2s(ix(i))=(l.-e2mr) 1 continue else do 2 i=s2min,s2max snr2s (ix (i)) =10. ** (float (i) / (npdb*20)) snr2n ( i x ( i ) )=1. 2 continue endif c apply corrections to conversion tables using li n e a r interpolation c algorithm -c for each p a i r of points : c f i n d indices i n snr table for t h i s pair c for a l l table entries between these points : c i f the point i s i n the table : c interpolate and substitute new table value c corrections to snr2s do 9 i = l , n i n t s - l , 2 c write (*,' (a, 2f 10.3, a, 2f 10.3)') ' % snr2s c o r r " n : ', c + i n t s r ( i ) , i n t s s ( i ) , ' to ' , i n t s r (i+1),intss(i+1) il=intsr(i)*npdb i2=intsr (i+1)*npdb do 8 j = i l , i 2 i f ( (j.ge.s2min) .and. (j.le.s2max) (then snr2s (ix (j)) =dbtor ( + in t e r p l i n t s r ( i ) , i n t s r ( i + 1 ) , i n t s s ( i ) , i n t s s ( i + 1 ) , + float(j)/npdb ) ) endif continue 9 continue c corrections to snr2n do 11 i=l,nintn-l,2 c write (*,' (a, 2f 10.3,a,2f 10.3)') ' % snr2n c o r r " n : ', c + i n t n r (i) , i n t n n ( i ) , ' to ',intnr(i+l),intnn(i+l) il=intnr(i)*npdb i2=intnr(i+l)*npdb do 10 j = i l , i 2 i f ( (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 + fl o a t (j)/npdb ) ) c for FM, see Jakes, Ch. 4. endif 10 continue real w, b, s, p i , t , t l 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 l i m i t 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 l e v e l of the modulating signal c peak peak l e v e l of the modulating signal c i f no fading integer ns i f(.not.fading)then real sin(ns), sout(ns), noisev (ns), fadev(ns), rms; peak c a l l v f i l l ( s n r 2 s , s2max-s2min+l, 1.) endif integer i , j integer i f i x c i f no noise integer npdb, s2min, s2max if(.not.noise(then real snr2s(1101), snr2n(1101) c a l l v f i l l ( s n r 2 n , 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 r e a l function s2asum(b,w) integer i x ix(i)=i-s2min+l c write(*,*) ' ch:sin:rms: ', rmsv(sin,ns) c write(*,*) ' ch:noisev:rms: ', rmsv(noisev,ns) c compute maximum and minimum signal levels smax = peak/rms smin = -peak/rms c multiply by fading and add noise do 1 i=l,ns c check for blanking i f (fadev(i) .ge.l.0e6)then sout(i)=0.0 else j=ifix(fadev(i)*npdb) if(j.It.s2min)j=s2min if(j.gt.s2max)j=s2max j=ix(j) c c l i p signal (at transmitter - before fading) s = s i n (i) if(s.gt.smax) s = smax if(s.It.smin) s = smin sout(i) = s*snr2s(j) + noisev (i) *snr2n (j) endif 1 continue return end subroutine r2sns(r,s,n,ns,snr) c convert signal envelope input vector to s and n vectors c used for numerical integration routine c r - received signal envelope l e v e l (dB) (0 dB mean) c s - corresponding signal scale value (linear) c n - corresponding noise scale value (linear) c ns - number of samples i n r, s, n c snr - average snr integer ns real r(ns), s(ns), n(ns) real snr integer i , j integer i f i x integer npdb, s2min, s2max real snr2s(1101), snr2n(1101) common /s2com/ npdb, s2rain, s2max, snr2s, snr2n c function to index 1-base arrays with negative indices integer i x ix(i)=i-s2min+l do 1 i=l,ns j = i f i x ( ( r(i)+snr )*npdb ) if(j.It.s2min)j=s2min if(j.gt.s2max)j=s2max j=ix(j) s (i) =snr2s (j) n(i)=snr2n(j) c write(*,*) ' r 2 j : ', j 1 continue return end real function interp(xl,x2,yl,y2,x) c linear interpolation for value x using l i n e between x l , y l and x2,y2 c for xl=x2, returns y2 real x l , x2, y l , y2, x if(x2.ne.xl)then interp = y l + (y2-yl)/(x2-xl) * (x-xl) else interp = y2 endif return end s i m f e c . f c ***************** c simfec.f - test and/or correct a block of data c ***************** subroutine fee(data,okdata,n,intlv,ecn,ect,ne,nbx,nwe,nwx) c number of remaining bit errors is returned in ne c bits that don't f i t into FEC blocks are ignored for BkER counts c and are not processed for FEC correction c no bits corrected i f number of errors in a block > ect c a l l bits corrected i f number of errors in block <= ect c (this is an idealized FEC code) c for efficiency make ecn as large as possible c data - input/output data c okdata - correct (transmitted) data c n - number of values in data, okdata c intlv - true to do interleaving c ecn - FEC block size c ect - maximum number of correctable errors (0 for no FEC) c ne - number of bit errors remaining c nbx - number of bits examined c nwe - number of word errors remaining c nwx - number of words examined integer logical integer integer logical integer integer integer integer n data(n), ne, nwe nbx, nwx intlv ecn, ect i , k nbe mod okdata (n) if(ecn.le.O)then write(*,*) ' % fee : ecn <= 0 ' stop endif if(ect.It.0 .or. ect.gt.ecn)then write(*,*) ' fee : correctable errors (ect) out of range ' stop endif c interleave the received data and the correct (transmitted) data i f (intlv) then call scr(data ,n,.true.) call scr(okdata,n,.true.) endif c initialize number of bit errors and bits examined ne=0 nbx=0 c count (and optionally correct) word errors nwe=0 nwx=0 i=l 1 continue i f (i+ecn-l.gt.n)goto 2 c find number of errors in this word k=nbe(data(i),okdata(i),ecn) ne=ne+k nbx=nbx+ecn c i f any errors c i f they are correctable, correct them c else increment word error count i f (k.eq.O)then elseif(k.le.ect)then call vlcopy (okdata(i) ,data(i) ,ecn) else nwe=nwe+l endif nwx=nwx+l i=i+ecn goto 1 2 continue c count remaining bit errors i f (i.le.n)then ne=ne+nbe(data(i),okdata(i) ,n-i+l) nbx=nbx + n-i+1 endif c un-interleave data and correct data i f ( i n t l v ) t h e n c a l l scr(data, n,.false.) c a l l scr(okdata,n,.false.) endif return end integer function nbe(data,okdata,n) c return number of differences between data and okdata c data - input/output data c okdata - correct data c n - number of values in data, okdata (FEC block size) c ne - l o c a l error counter integer i , n, ne l o g i c a l data(n), okdata (n) ne=0 do 1 i=l,n if(data(i).neqv.okdata(i) )ne=ne+l 1 continue nbe=ne return end subroutine scr (in,n,fwd) c interleave (scramble) n in(put) data b i t s c interleaving factor i s sqrt(n) c i n direction fwd integer i , j , k, 1, n l o g i c a l in(n) l o g i c a l fwd integer i n t r e a l sqrt, flo a t c common work vector l o g i c a l out(4096) common out k=int(sqrt(float(n))+0.5) 1=1 do 1 i=l,k do 1 j=i,n,k i f (fwd) then out(l)=in(j) else out(j)=in(l) endif 1=1+1 continue do 2 i=l,n in(i)=out(i) return end subroutine dne(data,okdata,n,intlv,ecn,nofdm,snr) c display number of remaining b i t errors c data - input/output data c okdata - correct (transmitted) data c n - number of values i n data, okdata c i n t l v - true to do interleaving c ecn - FEC block size c nofdm - OFDM block size (for p r i n t i n g only) snr - RF SNR (for p r i n t i n g only) integer n l o g i c a l data(n), okdata(n) l o g i c a l i n t l v integer ecn integer nofdm real snr integer i , j , k integer nwoerr integer nbe integer mod i f (ecn. le.O) then write(*,*) ' % fee : ecn <= 0 ' stop endif c interleave the received data and the correct (transmitted) data i f ( i n t l v ) t h e n c a l l scr(data ,n, .true.) c a l l scr(okdata,n,.true.) endif i = l 1 continue if(i+ecn-l.gt.n)goto 2 c f i n d number of errors i n thi s word k=nbe (data ( i ) , okdata (i) ,ecn) c pr i n t a f l a g , block size, snr, number of errors i n word write(*,'(1X,A2,I5,F4.0,I5)') '%N', nofdm, snr, k i=i+ecn goto 1 2 continue c compute and pr i n t error-free run lengths for the block nwoerr=0 do 3 i=l,n i f (data (i) .neqv. okdata (i)) then c a l l dnew(nwoerr) nwoerr=0 else nwoerr=nwoerr+l endif 3 continue c a l l dnew(nwoerr) c terminate the block with a -1 c a l l dnew(-l) c un-interleave data and correct data i f (intlv) then c a l l scr(data, n,.false.) c a l l scr(okdata,n,.false.) endif return end subroutine dnew(nwoerr) integer nwoerr write(*,'(1X,A2,15)') '%R', nwoerr return end simut.f c **************** c simut.f - Simulation U t i l i t y Routines c **************** real function vsum(x,n) integer n real x(n) integer i real sum sum=0. do 1 i=l,n sum=sum+x(i) continue vsum=sum return end subroutine vmul (a,b,c,n) integer n real a(n), b(n), c(n) integer i do 1 i=l,n c ( i ) = a ( i ) * b ( i ) 1 continue return end subroutine vlcopy(in,out,n) CD c copy i n into out integer i , n l o g i c a l i n (n), out (n) do 1 i=l,n out(i)=in(i) 1 continue return end subroutine vxor(inl,in2,out,n) c exclusive-or of two l o g i c a l vectors integer i , n l o g i c a l i n l ( n ) , in2(n), out(n) do 1 i=l,n out(i)=inl(i).neqv.in2(i) 1 continue return end subroutine vdbp(x,n) c convert vector x to dB (power) integer i , n real x(n) real aloglO do 1 i=l,n i f (x(i) .le.0.)then write(*,*) ' vdbp: argument <= 0 result set to -100 ' x(i)=-100. else x(i)=10.*alogl0(x(i)) endif 1 continue return end re a l function rmsv(x,n) c root mean square of a vector integer n real x(n) re a l sqrt, ssq i f (n.le.O)then write(*,*) ' rms : n <= 0 ' stop endif rmsv=sqrt(ssq(x,n)In) return end re a l function ssq(x,n) c sum of squares of elements of a vector integer n real x(n), p integer i p-0. do 1 i=l,n p=p+x(i)**2 1 continue ssq=p return end subroutine vsq(x,y,n) c vector square y=x**2 for a l l n elements integer i , n re a l x(n), y(n) do 1 i=l,n 1 y(i)=x(i)**2 return end subroutine vquant(x,n, max,k) c quantize a l l n elements of x to k b i t s . c i f k = 0 no quantization i s done c values are assumed to l i e between +/- max c the range +/- max i s divided i n t o 2**k equal regions c a l l values within a region are converted to the mean of the region integer n, k re a l x(n), max real c l , c2 integer i integer nint i f (k. ne.O) then if(k.It.0)then write(*,*) ' vquant : number of b i t s < 0 stop endif i f (max. le.O) then write(*,*) ' vquant rmax < or = 0 ' stop endif cl=2**(k-l)/max c2=l./cl do 1 i=l,n i f (x(i) .gt.max)then x(i)=max elseif(x(i).It.-max)then x (i) =-max else x(i) = c2 * ( nint( x ( i ) * c l +0.5 ) - 0 endif 1 continue endif return end subroutine v i f i l l ( k , n , v ) c f i l l a l l n elements of integer vector k with value i integer i , n, k(n), v do 1 i=l,n 1 k(i)=v return end subroutine v f i l l ( x , n , v ) c f i l l a l l n elements of real vector k with value v integer i , n r e a l x(n), v do 1 i=l,n 1 x(i)=v return end subroutine vcopy (xl,x2,ns) integer ns real x l (ns) ,x2 (ns) integer i do 1 i=l,ns x2 (i)=xl(i) 1 continue return end subroutine vadd(x,n,a) c add a to each element of x integer n real x(n), a integer i do 1 i=l,n x(i)=x(i)+a 1 continue return end subroutine vsmul(x,n,a) c multiply each element of x by a integer n real x(n), a integer i do 1 i=l,n x(i)=x(i)*a 1 continue return end c s t a t i s t i c s routines: c i n i t i a l i z e d s t a t i s t i c s 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 r e a l x, x2 real function stvr(x,x2,n) integer n real x, x2 x=0. integer n x2=0. n=0 i f (n.le.l)then stvr=0. return else end stvr=x2/(n-l)-x**2/(n*(n-l)) endif c update s t a t i s t i c s 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 r e a l 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 i f ( t . l t . O ) t h e n c mean write(*,*)' stl95: negative variance, set to 0.' t=0. r e a l function stmn(x,x2,n) endif stl95=stmn(x,x2,n)-t95(n)*sqrt(t) r e a l x, x2 integer n return end i f (n.le.O)then write(*,*) ' stmn : n <= 0 ' c upper .95 CI stop endif re a l function stu95 (x,x2,n) c add 0 * x2 to avoid compiler warnings real stmn, stvr, t95, sqrt real x, x2, t oo to integer n i f (n.le.O)then write(*,*) ' stu95 : n <= 0 ' stop endif t=stvr(x,x2,n)/n i f (t. I t . 0) then w r i t e ( * , * ) ' stu95: negative variance, set to 0. t=0. endif stu95=stmn (x,x2, n) +t95 (n) *sqrt (t) return ' end re a l function t95(n) t-table for 0.95 confidence i n t e r v a l n i s number of t r i a l s (degrees of freedom plus 1) alpha = 0.025 (rounded to 3 s i g . d i g i t s ) integer n real ttab(30) data ttab/ 0., 12.70, 4.30, 3.18, 2.78, 1 2.57, 2.45, 2.37, 2.31, 2.26, 2 2.23, 2.20, 2.18, 2.16, 2.15, 3 2.13, 2.12, 2.11, 2.10, 2.09, 4 2.08, 2.07, 2.07, 2.06, 2.06, 5 2.06, 2.05, 2.05, 2.05, 2.04 / i f (n. I t . 1) then write(*,*)'t95: too few t r i a l s : ',n elseif(n.le.30)then t95=ttab(n) elseif(n.le.40)then t95=2.03 elseif(n.le.60)then t95=2.01 else t95=2.0 endif return end single precision complementary error function Ed Casas - UBC E l e c t r i c a l Engineering c Feb. 21, 1986 c ref.: W. J. Cody, "Rational Chebyshev Approximation for the c Error Function," Mathematics of Computation, 23(107), pp. 631-638, c 1969. c these functions should be accurate to the l i m i t of single c precision operations. real function erfc(xO) l o g i c a l neg real xO, x, x2, x3, x4, y real abs, erf, exp if(x0.lt.0.)then neg=.true. else neg=.false, endif x=abs(x0) if(x.le.0.5)then c evaluate i n d i r e c t l y y=1.0 - erf(x) elseif(x.ge.4.)then c approximation 3 x2=1.0/(x*x) x4=x2*x2 y = exp(-x*x)/x * ( 0.5641896 + x2 * 1 ( -4.257996e-2 -1.960690e-l*x2 -5.168823e-2*x4 ) / 2 ( 1.509421e-l + 9.214524e-l*x2 + 1.000000e00*x4 ) ) else c approximation 2 x2=x *x x3=x2*x x4=x3*x y = exp (-x2) * 1 ( 7.373888e00 2 3 ( 7.373961e00 4 + 6.865018e00*x + 3.031799e00*x2 + 5.631696e-l*x3 + 4.318779e-5*x4 ) / + 1.518491e01*x + 1.279553e01*x2 + 5.354217e00*x3 + 1.000000e00*x4 ) endif i f (neg)then erfc=2.0-y else erfc=y endif return end c single precision error function re a l function erf(xO) l o g i c a l neg re a l xO, x, x2, x4, y real abs, erfc if(xO.lt.0.)then neg=.true. else neg=.false, endif x=abs (xO) if(x.le.0.5)then c approximation 1 x2=x*x x4=x2*x2 y = x * ( 2.138533el + 1.722276e0*x2 + 3.166529e-l*x4 ) / 1 ( 1.895226el + 7.843746e0*x2 + 1.000000e00*x4 ) else c evaluate i n d i r e c t l y y=1.0-erfc(x) endif i f (neg) then erf=-y else erf=y endif return end subroutine vsel(a,b,x,z,n) c substitute b into a for x > z integer n real a(n), b(n), x(n), z integer i do 1 i=l,n i f (x(i) .gt.z)then a(i)=b(i) endif 1 continue return end real function berblk(a,b,c) c theoretical BER of an OFDM block rea l a, b, c, d real erfc, sqrt d=2.0*(b-a**2+c) if(d.lt.-O.OOOl)then write(*,*)'berblk: b-a**2+c < 0 : ',d/2.0 stop endif the case where a and d are close to zero i s unstable if(d.le.O.)then i f (a.gt.O) then berblk=0.0 else berblk=0.5 endif else berblk=0.5*erfc( a/sqrt( d ) ) endif return end double precision' function dray(x,n) Rayleigh CPDF : prob. that signal i s x dB below mean c with n i d e a l selection diversity branches integer n re a l x double precision dexp dray = ( l.OdO - dexp( -1.0d0*10.0**(x/10.0) ) )**n return end subroutine s e t i f ( f s , n , f l , i f l , f 2 , i f 2 ) c (two r e a l values per frequency, f i r s t pair has DC and fs components) integer n re a l f s , f l , f2 integer i f l , i f 2 integer mod re a l f l o a t if(fs.le.O.)then write)*,*) ' s e t i f : fs <= 0 ' stop endif c f i n d array index corresponding to frequency f l i f 1=2. * f 1/f s*f loat (n) +1. c round i f l up to an odd number so that i t points to the c r e a l element of the f i r s t complex number c e.g. 1->1, 2->3 i f l = i f l - m o d ( i f l , 2 ) + l c f i n d array index corresponding to frequency f2 if2=2.* f 2 / f s * float(n)+1. c round i f 2 down to an even number so that i t points to the c imaginary element of the l a s t complex number c e.g. 2048->2048, 2047->2046 if2=if2-mod(if2,2) i f ( i f l . l e . O ) t h e n i f l = l endif i f (if2.ge.n)then if2=n endif i f (ifl.gt.n)then write(*,*) ' s e t i f : f l > N ' stop endif i f ( i f 2 . l t . 0 ) t h e n write(*,*) ' s e t i f : f2 < 0 ' stop endif i f ( i f l . g t . i f 2 ) t h e n write(*,*) ' s e t i f : f l > f2 ' stop endif return end count number of O's, l ' s and runs subroutine runcnt(data,n,nO,nl,nr,r) integer n, nO, n l , nr integer i real tnOnl, avgr, varr, r l o g i c a l data(n), prev test for n > 1 i f (n.le.l)then write(*,*) ' runcnt: n < 2 . ' stop endif i n i t i a l i z e if(data(1))then n0=0 nl=l else nO=l nl=0 endif nr=l prev=data(l) c go through data and count up true, false, and changes do 1 i=2,n i f (data (i)) then nl=nl+l if(.not.prev)then nr=nr+l prev=.true. endif else nO=nO+l i f (prev) then nr=nr+l prev=.false, endif endif 1 continue c compute normalized r.v. (hopefully distributed n(0,l)) if(n0.eq.O .or. nl.eq.O)then r=0. else tnOnl = 2.0 * nO * nl avgr = 1.0 + tnOnl/float(n) varr = tnOnl*(tnOnl-float (n))/(float(n)*float(n)*float(n r= (float (nr) - avgr) / sqrt (varr) endif return end r e a l function norct(data,n) c generate normalized run count (easier to c a l l than runcnt) integer n, i l , i 2 , i 3 l o g i c a l data r e a l r c a l l runcnt (data,n,il,i2,i3,r) norct=r return end subroutine vl2diff(inl,in2,nin,out,nout) compare d i b i t s (2-bit sequences) and generate a l o g i c a l vector map of d i b i t differences (.true.=difference) integer nin, nout l o g i c a l i n l ( n i n ) , in2(nin), out (nout) integer i , j if(2*nout.ne.nin)then write(*,*) ' v l 2 d i f f : nin <> 2*nout. ' stop endif 1-1 do 1 i=l,nin,2 out(j) = ( i n l ( i ) .eqv. i n 2 ( i ) ) + .and. ( i n l (i+1) .eqv. in2 (i+1) ) j=j+l 1 continue return end real function dbp(x) c convert a power to dB real x if(x.gt.O.)then dbp=10.*alogl0(x) else write(*,*) ' dbp : db(x) for x<0 set to -99 ' dbp=-99. endif return end subroutine vddat(crsig, txdata,nf,f1,f2,n,snr) integer nf, n real crsig(nf) l o g i c a l txdata (nf) real f l , f2, snr integer i real f, txmag, rxmag, txan, rxan real atan2 integer mod real a, b i f (mod(nf,2) .ne.0)then write(*,*) ' vddat : nf not even. ' stop endif do 1 i=l,nf,2 txmag=1.4142 i f (txdata (i)) then if(txdata(i+1))then txan=45. else txan=-45. endif else i f (txdata (i+1)) then txan=135. else txan=-135. endif endif rxmag=sqrt(crsig(i)**2+crsig(i+1) **2) rxan=atan2(crsig(i+1),crsig(i)) *57.3 f=f1+i*(f2-f1)/float(nf) i f (txdata (i)) then a=1.0 else a=-1.0 endif i f (txdata(i+1)) then b=1.0 else b=-l.0 endif write(*,' (1X,A2,2F10.4)') '%D', a, cr s i g ( i ) w rite(*,' (1X,A2,2F10.4)') '%D\ b, crsig(i+l) write(*,' (1X,A2,I5,F4.0,F6.0,2(F4.1,F6.0))') + '%A', n, snr, f, txmag, txan, rxmag, rxan continue return end subroutine dvsn(x,data,nx,fl,fs,n,snr,nav,svec,nvec) c x - vector of received data values c data - transmitted l o g i c a l data values c nx - number of elements i n x and data c nav - number of snr measurements (of x) to average c n - OFDM block size (to print) c snr - RF SNR (to print) integer n, nx, nav lo g i c a l data(nx) real x(nx), svec(nx), nvec(nx) real f s , f l , snr real f, df integer i , nsn real dbp, floa t c a l l vsnv(x,data,nx,svec, nvec,nav,nsn) f=fl df=float(nav)/float(n)* (fs/2.0) do 1 i=l,nsn write(*,' (1X,A2,I5,F4.0,2F6.0,3F6.1)') + '%S', n, snr, f, f+df, dbp (svec ( i ) ) , dbp (nvec ( i ) ) , + dbp(svec(i))-dbp(nvec(i)) f=f+df 1 continue return end subroutine davsn(x, data,nx,n,snr,svec,nvec) c same as dvsn but displays the average signal and noise power c of several signal vectors over a l l frequencies. c x - vector of received data values c data - transmitted l o g i c a l data values c nx - number of elements i n x and data c n - OFDM block size (to print) c snr - RF SNR (to print) c nav - number of snr measurements (of x) averaged so far c n2av - number of snr measurements to average integer n, nx lo g i c a l data(nx) real x(nx), svec(nx), nvec(nx) real snr integer nsn, n2av r e a l sums, sums2, sumn, sumn2 integer nsums, nsumn re a l dbp, stmn l o g i c a l f i r s t data f i r s t /.true./ i f ( f i r s t ) t h e n f i r s t = . f a l s e . c a l l stinit(sums,sums2,nsums) c a l l stinit(sumn,sumn2,nsumn) write(*,*) ' how many blocks to average ? ' read(*,*) n2av endif c a l l vsnv(x,data,nx,svec,nvec,nx,nsn) c a l l stat(svec(l),sums,sums2,nsums) c a l l stat(nvec(1),sumn,sumn2,nsumn) n2av=n2av-l if(n2av.le.0)then write(*,' (1X,A2,I5,F4.0,3F6.1)') + '%X', n, snr, + dbp(stmn(sums,sums2,nsums)), + dbp(stmn(sumn,sumn2,nsumn)), + dbp(stmn(sums,sums2,nsums)) -+ dbp(stmn(sumn,sumn2,nsumn)) c a l l stinit(sums,sums2,nsums) c a l l s t i n i t (sumn,sumn2,nsumn) write(*,*) ' how many blocks to average ? ', char (7) read(*,*) n2av endif return end subroutine vsnv(x,data,nx,s, n,nav, nsn) c computes vectors of mean square and variance of received data c values averaged over over several values vector x, (to get signal c and noise powers as a function of frequency). c x - vector of received data values c data - transmitted l o g i c a l data values c nx - number of elements i n tx and rx c s - square of mean of received data values c n - variance of received data values c nav - (maximum) number of elements of x to average c nsn - number of elements i n s and n integer nx, nav, nsn l o g i c a l data(nx) real x(nx) integer mxnsn parameter (mxnsn=100) real s(mxnsn), n(mxnsn) real sp, np integer i , k, n l e f t i f (nx.le.O)then write(*,*) ' vsn : nx <= 0 .' stop endif i=l nsn=l nleft=nx 1 continue k=min(nleft,nav) c a l l vsn(x (i) ,data(i) ,k,sp,np) s (nsn) =sp n(nsn)=np i=i+nav nsn=nsn+l nleft=nleft-nav if(nleft.gt.O)goto 1 nsn=nsn-l return end subroutine vsn(x,data,nx,s,n) c computes mean square and variance of received data values i n c a vector x, (to get signal and noise powers) by using negatives c of values i n x whose corresponding element i n data are ' f a l s e ' . c x - vector of received data values c data - transmitted l o g i c a l data values c nx - number of elements i n tx and rx c s - square of mean of received data values c n - variance of received data values integer nx l o g i c a l data(nx) r e a l x(nx), s, n re a l t s , f s , ts2, fs2, tsp, tnp, fsp, fnp integer i , nt, nf if(nx.le.O)then write(*,*) ' vsn : nx <= 0 .' stop endif t s =0. ts2=0. fs =0. fs2=0. nt=0 nf=0 do 1 i=l,nx i f (data (i) )then ts =ts + x ( i ) ts2=ts2 + x( i ) * * 2 nt=nt+l else fs =fs + x ( i ) fs2=fs2 + x( i ) * * 2 nf=nf+l endif 1 continue tsp = ( ts / nt )**2 fsp = ( fs / nf )**2 tnp = ts2 / nt - tsp fnp = fs2 / nf - fsp s = ( tsp + fsp ) / 2. n = ( tnp + fnp ) / 2. return end simhw.f $LARGE c ************************************ c simhw.f - harware channel routines c ************************************ c 87-11-19 subroutine hwinit(data,prev,dev,tmp,neqbl. + ia,nmax,ns,fs,fl,f2,dbd,rms,peak,txemp,demp, + empscl,nempsc,empfr,empsc) c generate pre- and de-emphasis and channel correction vectors c by measuring channel responce c data - temporary l o g i c a l vector, length ns c prev - generated pre-emphasis vector, length ns c dev - generated de-emphasis vector, length ns c tmp - temporary r e a l vector, length ns c neqbl - number of blocks to average i n generating equalization c vector c i a - integer*2 sample vector, length nmax c nmax - (OFDM) block size of channel probe signal and size of c prev/dev c ns - duration of channel probe signal (samples) c fs - sampling rate c f l - lower frequency l i m i t of channel to use c f2 - upper frequency l i m i t of channel to use c dbd - dE7decade of pre-emphasis to use c rms - rms voltage of output signal c peak - peak voltage of output signal c txemp - true to do phase/amplitude correction at transmitter c devrms - rms value of de-emphasis vector (dev) c demp - true to display equalization c empscl -c nempsc -c empfr -c empsc -integer ns, nmax, nempsc l o g i c a l data(nmax), txemp, demp, empscl real prev(nmax), dev(nmax), tmp (nmax) real empfr(nempsc), empsc(nempsc) integer*2 ia(ns) integer i , neqbl, i f l , i f 2 , nf real f s , f l , f2, dbd, rms, peak real dbp, atan2 integer j l o g i c a l sr(23) rea l devrms real rmsv data s r / 1 .false., .true., 1 .false., .true., 1 .false., .true., 1 .true., .false., .true., .false., .false., .true., .true., .true., .false., .true., .false., .true., .false., .true., 1 .false., .true., .false. / c write(*,*) ' fs,nmax,fl,f2 = ', fs,nmax,fl,f2 c f i n d indices for frequency l i m i t s c a l l s e t i f ( f s , n m a x , f l , i f l , f 2 , i f 2 ) n f = i f 2 - i f l + l c a l l vfill(tmp,nmax,0.) c prompt operator to turn off noise and fading pause ' turn noise and fading * OFF * ' c run prbs a few times to get r i d of possible transients c a l l prbs(data,nmax,sr) c a l l prbs(data,nmax, sr) c compute and average "neqbl" equalization vectors do 1 j=l,neqbl c generate vector for pre-emphasis ("dbd" dB/decade) c a l l empgen (prev ( i f l ) ,nf, f2/fl,dbd) c generate random +/- 1 values i n frequency skipping DC and fs/2 terms c a l l prbs(data,nmax,sr) c a l l encode(data,dev,ifl,if2,nmax) c a l l emp(dev,prev,f1,f2,fs,nmax,nmax) c a l l vcopy(dev,prev, nmax) c modulate to time-domain c a l l modu(prev,nmax,nf, .false.) c send i t through the channel c a l l hwch(prev,dev,ia, nmax,ns,rms,peak) c recover the (frequency-domain) channel output c a l l demodu(dev ,nmax,nf,.false.) c regenerate the (frequency-domain) input (before pre-emphasis) c a l l encode(data,prev,if1,if2,nmax) c complex divide input by output (in frequency domain) to generate c correction (de-emphasis) vector c a l l cdiv (prev ( i f l ) , d e v ( i f l ) , dev ( i f l ) ,nf) c accumulate t h i s equalization vector c a l l wadd (dev, tmp, tmp,nmax) 1 continue c prompt operator to turn noise and fading back on pause ' turn noise and fading * ON * ' c scale by number of equalization vectors averaged c a l l vsmul(tmp,nmax,1./float(neqbl)) c re-generate pre-emphasis vector (no dynamic storage, *%!&$%) c a l l empgen (prev ( i f l ) , n f , f 2 / f l , dbd) c i f desired, p r i n t i n i t i a l de-emphasis vector c *** debug *** c write(*,*) ' i f l , i f 2 = ', i f l , i f 2 if(demp)then do 2 i = i f l , i f 2 , 5 0 write(*,'(1X,A3,F6.0,F5.1,F8.0)') '%E ', + float(i)/nmax*(fs/2), + dbp(dev(i)**2+dev(i+l)**2), + atan2(dev(i),dev(i+l))*57.3 2 continue endif c i f phase/magnitude correction i s done at transmitter, c swap emphasis vectors i f (txemp) then c normalize the old de-emphasis vector to (complex) magnitude of 1 and c copy to pre-emphasis vector devrms=rmsv(dev(ifl) ,nf) *sqrt (2.0) c a l l vsmul(dev(ifl),nf,1.0/devrms) c a l l vcopy(dev,prev,nmax) generate a de-emphasis vector with appropriate magnitude c a l l empgen (dev ( i f 1), nf, f2/f 1, dbd) c a l l vsmul(dev,nmax,devrms) endif if(empscl)then c a l l empscf (prev ( i f l ) , n f , f l , ( f 2 - f l ) / f l o a t (nf/2), + empsc,empfr,nempsc) endif return end subroutine hwch(x,y,ia,n,ns, rms,peak) do modem i/o (with guard samples) x - samples to be sent (variance = 1) y - received samples (nominal variance = 1) i a - integer*2 sample work vector n - number of elements i n x and i n y ns - t o t a l number of samples to generate rms - rms voltage of output signal peak - peak voltage of output signal peak must be less than 2.5 (Volts) (maximum DAC output) integer i , j , k, n, nov, over, i s t a r t , iend r e a l peak, rms re a l x(n), y(n), z, k l , k2 integer*2 ia(ns) integer i n t integer i o re a l f l o a t voltage-to-DAC and ADC-to-voltage conversion factors, values are for a 10-bit ADC and 12-bit DAC real dacscl, adcscl parameter ( dacscl = 4096./5. ) parameter ( adcscl = 5./1024. ) gain required to compensate for any (measured) f i l t e r loss re a l g f i l t parameter ( g f i l t = 1.11 ) c ( skip i/o for debugging ) c c a l l vcopy(x,y(2),n-l) c y(l)=x(n) c return c test peak value if(peak.le.O.)then write(*,*) ' hwch : peak <= 0. ' stop endif i f (peak. gt. (2.5/gf i l t ) ) then write(*,*) ' hwch : peak l e v e l too large. ' stop endif c test block size and number of samples i f (n. I t . 0) then write(*,*) ' hwch: n < 0 ' stop endif if(ns.lt.n)then write(*,*) ' hwch: ns < n ' stop endif c factor to give unit-rms samples the rms value kl=rms c center the n OFDM samples i n the ns-sample output istart=ns/2-n/2+l iend=ns/2+n/2 c combine dacscl and g f i l t k2=dacscl*gfilt c convert the f.p. samples to DAC levels c l i m i t peak l e v e l ( l i m i t s peak deviation) c zmin= l.e30 c zmax=-l.e30 c zrms= 0. nov=0 j = i s t a r t do 1 1=1,n z=x(i)*kl i f (z.gt .peak) then z=peak nov=nov+l else i f (z.It.-peak)then z=-peak nov=nov+l endif i a ( j ) = i n t ( z * k2 + 0.5 ) c i f (z.lt.zmin)zmin=z c if(z.gt.zmax)zmax=z c zrms=zrtns+z**2 j - j + l 1 continue c write(*,*) ' % TX signal rms = ',sqrt(zrms/n) c write(*,*) ' % TX signal min = ',zmin c write(*,*) ' % TX signal max = ',zmax i f (nov. ne. 0) then c write ( * , * ) ' % ' , 100.*float(nov)/n, ' % overflow. ' endif c add guard band before data j = i s t a r t - l i=iend 2 continue i f ( j . I t . 1) goto 3 i a ( j ) = i a ( i ) i = i - l j = j - l goto 2 3 continue c add guard band after data j=iend+l i = i s t a r t 4 continue if(j.gt.ns)goto 5 i a ( j ) = i a ( i ) j=j+l i=i+l goto 4 5 continue c do i o and stop i f overrun over=io(ia,ns) i f ( over.ne.O ) then write(*,*) ' hwch: A/D or D/A overrun ' stop endif c scale A/D samples back to FP j=istart do 6 i=l,n y (i)=float (i a (j)) * adcscl 3=3+1 6 continue return end subroutine emp(x,y,fl,f2,fs,n,ns) c multiply vector x by vector y over the indices i f l to i f 2 to do c pre-emphasis or de-emphasis and correction for channel gain/phase c transfer function c x - vector to be corrected c y - correction vector c i f l - f i r s t element of x to correct c i f 2 - l a s t element of x to correct c n - number of values i n x c ns - number of values i n y (multiple of n) integer i , j , j 2 , n, ns, skip integer i f l , i f 2 real f l , f2, fs real a, b, c, d real x(n) real y(ns) integer mod if(mod(ns,n) .ne.O)then write(*,*) ' emp: ns not multiple of n ' stop endif c a l l s e t i f ( f s , n , f l , i f l , f 2 , i f 2 ) c a l l s e t i f ( f s , n s , f l , j,f2, j2) skip=2*ns/n do 1 i = i f l , i f 2 , 2 a=y(j) b=y(j+l) c=x(i) d=x(i+l) x ( i ) = a*c - b*d x (i+1) = a*d + b*c j=j+skip 1 continue c ( debugging ) c write(*,*) ' emphasis results: ' c write(*,*) ' n, ns = ', n, ns c write(*,*) ' i f l , i f 2 = ', i f l , i f 2 c write(*,*) ' j , skip = ', j , skip c write(*,*) ' results: i j a,b c,d result ' c write(*,900) i , j , a, b, c, d, x ( i ) , x(i+l) c900 format(lx,2i5,6f7.3) return end subroutine cdiv(x,y,z,n) c divide two complex vectors (z=x/y) integer i , n real x(n), y(n), z (n) r e a l a, b, c, d, r integer mod i f (mod (n, 2) .ne.O) then write(*,*) ' cdiv: n not even ' stop endif do 1 i=l,n,2 c f i n d mag. squared of y c=y(i) d=y(i+l) r=c*c+d*d i f (r.ne.O.(then c set c,d = 1/y c= c/r d=-d/r c multiply by x=a,b a=x(i) b=x(i+l) z (i) =a*c-b*d z(i+l)=a*d+b*c else write(*,*) ' % cdiv: complex divide by zero at i = ',i z ( i ) =0. z(i+l)=0. endif 1 continue return end subroutine empgen(x,n, f2byfl,dbd) c generate (complex) pre-emphasis vector c x - emphasis vector to be generated c n - number of elements (even) c f2byfl - r a t i o of highest to lowest frequency c dbd - number of dB per decade emphasis integer n, i real x(n), dbd, f2byfl real decs, xn, k, y, ss real aloglO, sqrt, f l o a t integer mod i f (mod(n,2) .ne.OJthen write(*,*) ' empgen : n not even ' stop endif c number of decades between frequency l i m i t s decs = aloglO(f2byfl) c t o t a l increase (linear factor) xn = 10. ** ( dbd * decs / 20. ) c constant factor to obtain required increase k = 10. ** ( aloglO(xn) / (n/2-1) ) c generate scaled vector and f i n d t o t a l power y=l. ss=0. do 1 i=l,n,2 x ( i )=y x(i+l)=0. ss=ss+y**2 y=y*k 1 continue ss=sqrt(ss/float(n/2)) c scale to unity power c a l l vsmul(x,n,l./ss) c ( debugging ) c write(*,*) ' f2 b y f l , n, dbd, k = ', f2 b y f l , n, dbd, k c write(*,*) ' ss = ', ss c write(*,*) ' empgen power = ',rmsv(x,n)*sqrt(2.) return end subroutine waitfor(prompt) character* (*) prompt character c close(0) write(0,*)prompt read(0,' (Al)')c return end subroutine wadd(a,b,c,n) c c(i)=a(i)+b(i) for i=l to n integer i , n re a l a(n), b(n), c(n) do 1 i=l,n c(i)=a(i)+b(i) 1 continue return end subroutine empscf(x,nx,f1,df,sc,fr,nsc) c subroutine to scale a pre- or de-emphasis vector using a c measured channel power transfer function or baseband SNR c ch a r a c t e r i s t i c s . emphasis vector to be scaled number of re a l elements i n x (assumed as real/imag. pairs) s t a r t i n g frequency of values i n x frequency increment between values i n x the responce of the channel to be used to scale x the upper frequency l i m i t s f o r each scaling value i n sc number of values i n sc and f r integer nx, nsc real x(nx), sc(nsc), fr(nsc) rea l f l , df integer i , j re a l k, f, ss if(nsc.It.1)then write(*,*) ' empscf : nsc < 1 .' stop endif c i n i t i a l i z e j=l f = f l ss=0.0 k=10.0**(-1.0*sc(l)/20.0) c scale the r e a l part of every emphasis vector pair do 3 i=l,nx,2 c go on to next scaling value i f necessary for current frequency 1 continue i f ( ( f . l e . f r ( j ) ) .or. (j.ge.nsc))goto 2 j=j+l k=10.0**(-1.0*sc(j)/20.0) goto 1 2 continue c scale and sum squares x(i)=x(i)*k ss=ss+x(i)**2 f=f+df 3 continue c x c nx -c f l -c df -c sc -c f r -c nsc -ss=sqrt(ss/float(nx/2)) c a l l vsmul(x,nx,1.0/ss) return end simdum.f ************************************ simdum.f - dummy hardware channel routines for non-PC systems ************************************ subroutine hwinit (data,prev, dev,tmp,neqbl, + ia,ni,ns,fs,fl,f2,dbd,rms,peak,txemp,demp) integer neqbl, n i , ns lo g i c a l data(ni), txemp, demp re a l prev(ni), dev(ni), tmp(ni) integer*2 ia(ns) r e a l f s , f l , f2, dbd, rms, peak write (*,*) ' hwinit - dummy routine c a l l e d ' stop end subroutine hwch (x,y,ia,n,ns, rms,peak) integer n, ns real x(n), y(n), rms, peak integer*2 ia(n) write(*,*) ' hwch - dummy routine c a l l e d ' stop end subroutine emp(x,y, f l , f2, fs,n,ns) integer n, ns real f l , f2, fs real x(n), y (ns) write(*,*) ' emp - dummy routine c a l l e d ' stop end s i f f t . d i f (diffs from FAST.FOR) 0al,5 > c warning !!!! : these routines have been modified to work > c on arrays of size N instead of N+2 > c modified 87-8-14 to send a l l output to default output > c > C la7,9 > C SUBROUTINE: FFA > C FAST FOURIER ANALYSIS SUBROUTINE > C 3 c l l < SUBROUTINE FFA(B, NFFT) > SUBROUTINE FFAn (B, NFFT) 37c45 < WRITE (IW, 9999) ?G. > WRITE (*, 9999) 9; 72,75c80,83 < T = B(2) §: < B(2) = 0. 5? < B (NFFT+1) = T < B (NFFT+2) = 0. > c T = B(2) 2 > c B(2) =0. Q > c B(NFFT+1) = T > c B(NFFT+2) =0. Q 88c96 rxj < SUBROUTINE FFS(B, NFFT) > SUBROUTINE FFSn(B, NFFT) 119C127 < WRITE (IW,9999) > WRITE (*, 9999) 123C131 < B(2) = B (NFFT+1) > C B(2) = B(NFFT+1) 710C718 < WRITE (IW,9999) > WRITE (*,9999) 941a950,1062 > > 0 Ol > c > C FUNCTION: I1MACH > C THIS ROUTINE IS FROM THE PORT MATHEMATICAL SUBROUTINE LIBRARY > C IT IS DESCRIBED IN THE BELL LABORATORIES COMPUTING SCIENCE > C TECHNICAL REPORT #47 BY P.A. FOX, A.D. HALL AND N.L. SCHRYER > c  > c > INTEGER FUNCTION IIMACH(I) > C > C I/O UNIT NUMBERS. > C > c I1MACH( 1) = THE STANDARD INPUT UNIT. > c > c I1MACH( 2) = THE STANDARD OUTPUT UNIT. > c > c I1MACH( 3) = THE STANDARD PUNCH UNIT. > c > c I1MACH( 4) = THE STANDARD ERROR MESSAGE UNIT. > C > C WORDS. > C > C I1MACH( 5) = THE NUMBER OF BITS PER INTEGER STORAGE UNIT. > C > C I1MACH( 6) = THE NUMBER OF CHARACTERS PER INTEGER STORAGE UNIT. > C > C INTEGERS. > C > C ASSUME INTEGERS ARE REPRESENTED IN THE S-DIGIT, BASE-A FORM > C > C SIGN ( X(S-1)*A**(S-1) + ... + X(1)*A + X(0) ) > C > C WHERE 0 .LE. X(I) .LT. A FOR 1=0,...,S-1. > C > C I1MACH( 7) = A, THE BASE. > C > C I1MACH( 8) = S, THE NUMBER OF BASE-A DIGITS. > C > C I1MACH( 9) = A**S - 1, THE LARGEST MAGNITUDE. > C > C FLOATING-POINT NUMBERS. > C > C ASSUME FLOATING-POINT NUMBERS ARE REPRESENTED IN THE T-DIGIT, > C BASE-B FORM > C >C SIGN (B**E)*( (X(l)/B) + ... + (X(T)/B**T) ) > C >C WHERE 0 .LE. X(I) .LT. B FOR 1=1,...,T, > C 0 .LT. X(l), AND EMIN .LE. E .LE. EMAX. > C > C IIMACH(IO) = B, THE BASE. > C > C SINGLE-PRECISION > C > C IlMACH(ll) = T, THE NUMBER OF BASE-B DIGITS. > C > C I1MACH(12) = EMIN, THE SMALLEST EXPONENT E. > C > C I1MACH(13) = EMAX, THE LARGEST EXPONENT E. > C > C DOUBLE-PRECISION > C > C I1MACH(14) = T, THE NUMBER OF BASE-B DIGITS. > C > C I1MACH(15) = EMIN, THE SMALLEST EXPONENT E. > C > C I1MACH(16) = EMAX, THE LARGEST EXPONENT E. > C > C TO ALTER THIS FUNCTION FOR A PARTICULAR ENVIRONMENT, > C THE DESIRED SET OF DATA STATEMENTS SHOULD BE ACTIVATED BY > C REMOVING THE C FROM COLUMN 1. ALSO, THE VALUES OF > C IlMACH(l) - I1MACH(4) SHOULD BE CHECKED FOR CONSISTENCY > C WITH THE LOCAL OPERATING SYSTEM. > C > INTEGER IMACH(16),OUTPUT > C > EQUIVALENCE (IMACH(4),OUTPUT) > C > C MACHINE CONSTANTS FOR THE VAX-11 WITH > C FORTRAN IV-PLUS COMPILER > C > DATA IMACH( 1) / 5 / > DATA IMACH( 2) / 6 / > DATA IMACH( 3) / 5 / > DATA IMACH( 4) / 6 / > DATA IMACH( 5) / 32 / > DATA IMACH( 6) / 4 / > DATA IMACH( 7) / 2 / > DATA IMACH( 8) / 31 / > c DATA IMACH( 9) / 2147483647 / > c imach 9 not used by fftsn > data imach ( 9) / 0 / > DATA IMACH(10) / 2 / > DATA IMACH(11) / 24 / > DATA IMACH(12) / -127 / > DATA IMACH(13) / 127 / > DATA IMACH(14) / 56 / > DATA IMACH(15) / -127 / > DATA IMACH(16) / 127 / > c > IF (I .LT. 1 .OR. I . GT. 16) GO TO 10 > c > I1MACH=IMACH(I) c external u t i l i t i e s > RETURN > C real stmn, stu95, stl95 > 10 WRITE (*,9000) > 9000 FORMAT(39H1ERROR 1 IN I1MACH - I OUT OF BOUNDS) *•> r c i n t i a l i z e variance and BER sums (and sums of squares) to zero -> c > STOP *s. r data ber /mxblsn*0.0/, bers /mxblsn*0.0/ > END C : > $INCLUDE: 'simpget.f f d i n t . f c c i n i t i a l i z e snr tables $LARGE Q * * * * * * * * * * * * * * * c a l l s2init(b,w,rms,peak,fm,fd,rfm,agclim,sqlim. c f d i n t . f - MC Integration + n i n t s , i n t s r , i n t s s , nintn,intnr,intnn, c *************** + fading, noisng ) c Ed. Casas 86-2-19 c do for each of ntr t r i a l s 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 t h i s t r i a l $INCLUDE: 'simpdef.f do 60 j=l,nn c do 60 k=l,nsnr bert (j,k)=0.d0 c l o c a l 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) i f (fading) then c vectors to store BER i n one t r i a l , sums of BERs, squares of BERs c a l l genfdb(fd/fs,fseed,fade,ns, c and number of t r i a l s + ndbr,thr,ndw,nsw) else double precision berout, bkrout c a l l v f i l l ( f a d e , n s , 0 . ) r e a l bert (mxblk,mxsnr), ber (mxblk,mxsnr), bers (mxblk,mxsnr) endif rea l bkert(mxblk,mxsnr), bker (mxblk,mxsnr), bkers (mxblk,mxsnr) r e a l 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 t h e i r squares c convert received envelope l e v e l to r and s values and squares r e a l rs(ns), rn(ns), rs2 (ns), rn2 (ns) c a l l r2sns (fade, rs,rn,ns, snr (k)) c a l l vsq(rs,rs2,ns) c a l l vsq(rn,rn2,ns) c do for each block size do 30 j=l,nn c update variance and BER sums c a l l sum2(rs,rs2,rn2,ns,na(j),ecn,berout,bkrout, + snr (k), dnerr) bert (j,k)=bert (j,k)+berout bkert(j,k)=bkert(j,k)+bkrout c write(*,*) ' blk, BkER = ',i, bkrout 30 continue c update s t a t i s t i c s counts at end of a t r i a l do 70 j=l,nn do 70 k=l,nsnr temp=bert(j,k)/nblk c a l l stat(temp, ber(j,k), bers(j,k), n t r i a l ( j , k ) ) temp=bkert (j,k)/nblk c a l l stat(temp, bker(j,k), bkers(j,k), nbktr(j,k)) c write(*,*) ' j,k,ber,ntrial=', j,k,ber ( j , k ) , n t r i a l (j,k) 70 continue 50 continue c p r i n t r e s u l t s w r i t e ( * , * ) ' % BER, -/+ .95 conf l i m i t s ' do 100 j=l,nn do 100 k=l,nsnr w r i t e ( V (1X,I6,F6.1,3(1PE11.2))') na(j), snr(k), + stmn (ber(j,k), bers(j,k), n t r i a l ( j , k ) ) , + stl95(ber(j,k), bers(j,k), n t r i a l ( j , k ) ) , + stu95(ber(j,k), bers(j,k), n t r i a l ( j , k ) ) 100 continue w r i t e ( * , * ) ' % BkER, -/+ .95 conf l i m i t s ' do 200 j=l,nn do 200 k=l,nsnr write(*,' (1X,I6,F6.1,3(1PE11.2))') n a ( j ) , snr(k), + stmn (bker(j,k), bkers(j,k), n b k t r ( j , k ) ) , + stl95(bker(j,k), bkers(j,k), n b k t r ( j , k ) ) , + stu95(bker(j,k), bkers(j,k), nbktr(j,k)) 200 continue end c Sum for one snr, len subroutine sum2(rs,rs2,rn2,ns,len,ecn,berout,bkrout,snr,dnerr) c subroutine to calculate fade and snr s t a t i s t i c s of a block and c correspoding BER c variables: c counters integer i , j , k c length of received signal and noise vectors integer ns c vectors for received signal and noise values and squares real rs(ns), rs2(ns), rn2 (ns) c OFDM block length, FEC block (word) length integer len, ecn c added to display block snr: snr and true to display block BER real snr l o g i c a l dnerr c inverse of block length real invlen c number of blocks tested integer ntst, n c sums of BERs double precision ber, berout, bker, bkrout, dtemp c sums of s, s A2, n A2 rea l a, b, c, d c i n t r i n s l c s integer mod c external u t i l i t i e s r e a l berblk c f i n d number of OFDM blocks included i n the vector fade if(len.eq.O .or. mod(ns,len) .ne.0)then write(*,*)'sum2: bad OFDM block size.' stop endif n=ns/len c f i n d inverse of block length invlen=l./len c s t a r t at the f i r s t sample of the input block i = l ntst=0 ber= O.OdO bker=0.OdO c do for each block do 10 j=l,n a=0. b=0. c=0. c get s t a t i s t i c s f o r t h i s block do 20 k=l,len a=a+rs (i) b=b+rs2{i) c=c+rn2(i) i=i+l 20 continue a=a*invlen b=b*invlen c=c*invlen c write(*,*) ' a, b, b-a**2, c = ', a, b, b-a**2, c c add resulting block BER to the appropriate BER averaging sum c and compute BkER assuming independent errors dtemp=berblk(a,b,c) ber =ber +dtemp i f ( dnerr ) write(*,'(IX,A2,15,F4.0,E16.7)') '%B ', + len, snr, dtemp bker=bker+(1.OdO-(1.OdO-dtemp)**ecn) ntst=ntst+l c write(*,*) ' BER = ', dtemp c write(*,*) ' BkER =', (1.OdO-(1.OdO-dtemp)**ecn) 10 continue berout=ber /ntst bkrout=bker/ntst return end pint.f c **************** c Integration for large/small N c **************** c pi n t . f c ed.casas 87-9-16 c '• $INCLUDE: 'simpdef.f c c lo c a l variables real r(2000), p(2000), s(2000), s2 (2000), n(2000), wrk(2000) integer i , j , k real a l , be, ga r e a l sber, Lber r e a l vsum, berblk r e a l snrmin, snrinc integer nst parameter (nst=1100) snrmin=-50. snrinc=0.1 c $INCLUDE: 'simpget.f c c can only vary one threshold (age OR squelch) at a time i f ( agevar .and. sqvar ) then write(*,*) ' pint : agevar and sqvar true. ' stop endif c do at least one loop i f ( nthrsh .le. 0 ) then nthrsh=l thrsh(1)=0. endif do 1 k=l,nthrsh i f ( .not. (agevar .or. sqvar) ) c a l l + s2init(b,w,rms,peak,fm,fd,rfm,agclim,sqlim, + n i n t s , i n t s r , i n t s s , nintn,intnr,intnn, + fading, noisng ) do 1 j=l,nsnr c i n i t i a l i z e snr-to-signal and snr-to-noise tables c i f t e s t i n g effect of varying the age l i m i t i f ( agevar ) c a l l + s2init(b,w,rms,peak,fm,fd,rfm,snr(j)+thrsh(k), sqlim, + n i n t s , i n t s r , i n t s s , nintn,intnr,intnn, + fading, noisng ) c i f t e s t i n g effect of varying the squelch l i m i t i f ( sqvar ) c a l l + s 2 i n i t (b,w,rms,peak, fm, fd,rfm,agclim, snr (j) +thrsh (k), + n i n t s , i n t s r , i n t s s , nintn,intnr,intnn, + fading, noisng ) c i n i t i a l i z e p r o b a b i l i t y (Rayleigh) table c a l l pgen(snrmin,snrinc,snr(j),ndbr,p,r,nst) c find signal and noise scaling signals from snr signal c a l l r2sns(r,s,n,nst,0.) c compute s**2 and n**2 c a l l vmul(s,s,s2,nst) c a l l vmul(n,n,n,nst) c integrate to fi n d averages of al(pha), be (ta), and ga(mma) c a l l vmul(p,s,wrk,nst) al=vsum(wrk,nst) c a l l vmul(p,s2,wrk,nst) be=vsum(wrk,nst) c a l l vmul(p,n,wrk,nst) ga=vsum(wrk,nst) c use block BER equation to estimate long-block BER lber=berblk(al,be,ga) c find single-sample-block BERS and scale by the sample probability do 2 i=l,nst wrk(i) =berblk (s ( i ) , s2 ( i ) , n (i)) *p (i) c write!*,'(1X,I10,F10.2,5E15.3)')i,r(i), c & berblk ( s ( i ) , s 2 ( i ) , n ( i ) ) , p ( i ) , w r k (i) 2 continue c add up (average) to f i n d short-block BER sber=vsum(wrk,nst) i f ( agevar .or. sqvar ) then write(*,*) s n r ( j ) , thrsh(k), sber, lber else write(*,*) s n r ( j ) , sber, lber endif 1 continue end subroutine pgen(snrmin,snrinc,snravg,ndbr,p,r, n) c generate tables of snrs and pr o b a b i l i t i e s c input: c snrmin - minimum snr c snrinc - snr increment per step c snravg - average snr c ndbr - number of di v e r s i t y branches c r - signal levels (snr) c p - pr o b a b i l i t y of a given step c n - number of values i n p integer n, ndbr real snrmin, snrinc, snravg real p(n), r (n) c l o c a l variables: c i - counter into p and r c sump - sum of p r o b a b i l i t i e s (should add to 1) integer i real sump real s n r k l , snrk2, snr c rayleigh CPDF double precision dray c calculate signal l e v e l points and probabi l i t i e s sump=0. snr=snrmin snrkl=snrinc/2.0-snravg snrk2=snrinc/2.0+snravg do 1 i=l,n c save the snr and probability between the two signal levels r ( i ) = snr p(i) = dray(snr+snrkl,ndbr) - dray(snr-snrk2,ndbr) c sum p r o b a b i l i t i e s to check sump=sump+p(i) write(*,'(1X,I10,F10.2,2E15.3)') i , r ( i ) , p ( i ) , sump snr=snr+snrinc continue i f (abs(sump-l.O).gt.0.001)then wrlte(*,*) 'pgen:total p r o b a b i l i t y <>1; = ',sump stop endif return end io.asm COMMENT $ This Microsoft FORTRAN-callable function reads/writes a block of samples from/to the analog interface board. Ed. Casas 87-10-19. The FORTRAN use i s : NR=I0(IA,N) where: IA - INTEGER*2 (16-bit) array containing the D/A samples on entry and containing the A/D samples on return. I f "convert" i s not zero the samples are l e f t j u s t i f i e d i n binary (unsigned) format. In t h i s case the samples should be pre-/post-converted to two's-complement. N - INTEGER*4 number of values to be input and output. NR - INTEGER*4 number of samples *N0T* read/written. I f t h i s number i s not zero, an over-run occurred. I0_TEXT segment byte public 'CODE' assume cs:I0_TEXT ; timing constants MHZ equ 2 ; 8253 clock input frequency (MHz) PERIOD equ 125 ; sampling period, (us) (125 minimum) LEN equ 4 ; S/H sampling time (us) (4 maximum) ; non-zero to convert between offset-binary and 2's complement convert equ 1 ; set to 0 i f get overrun errors on a slow PC ; hardware IBMIO equ 300H ; I/O base address for IBM prototyping card PIA equ IBMIO ; 8255 par. port: MS bit=overrun, LS=sampling PI AO equ PIA+0 PIA port A PIA1 equ PIA+1 ; PIA port B PIA2 equ PIA+2 PIA port C PI A3 equ PIA+3 ; PIA control port ADC equ PIA+4 ; NEC UPD7004 A/D converter ADCO equ ADC+0 ; channel select S LS 2 b i t s ADC1 equ ADC+1 ; " i n i t i a l i z e " 5 MS 8 b i t s DAC equ PIA+8 ; National DAC1208 D/A converter DACO equ DAC+0 ; LS 4 b i t s (load second) DAC1 equ DAC+1 MS 8 *AND* LS 4 b i t s (load f i r s t ) CLK equ PIA+12 ; 8253 timer/counter CLKO equ CLK+0 ; counter 0 CLK1 equ CLK+1 ; counter 1 CLK2 equ CLK+2 ; counter 2 CLK3 equ CLK+3 ; mode register IO proc far public 10 ; entry push bp ; save bp mov bp, sp push s i ; save s i pushf ; save flags (S interrupt status) ; disable interrupts c l i ; set up sample count les bx, dword ptr [bp+6] mov s i , es:[bx] ; SI has LS word of sample count mov d i , es:[bx+2] ; DI has MS word of sample count negate sample count so can count up to zero not not add adc s i d i s i , 1 d i , 0 complement d i : s i add 1 es:bx points into sample array les bx, dword ptr [bp+10] ; dh retains high byte of I/O board address mov dh, high PIA ; hardware i n i t i a l i z a t i o n ; set up PIA PIAr record modeset:l=l, Amod:2,Adir:l,Aptc:l, Bmod:l,Bdir:l,Bptc mov d l , low PIA3 mov a l , PIAr<l, 01,1,1, 0,1,1> out dx, a l ; set timers f i r s t to stop them and prevent overrun error on ; f i r s t (unused) conversion CLKr record counter:2, readload:2=3, clkmode:3, bcd:l=0 start by setting timer 0 mode (and so stopping i t ) mov. d l , low CLK3 mov a l , CLKr<0,,2,> out dx, a l set up timer 1 0 = MODE 2 (rate generator) mov d l . low CLK3 mov a l , CLKr<l,,l,> ; 1 = MODE 1 (one-shot) out dx. a l mov d l , low CLK1 ; set S/H sample time mov a l , low (MHZ*LEN) out dx, a l mov a l , high (MHZ*LEN) out dx, a l up ADC, start f i r s t (unused) conversion, and clear "sampling" ; and "overrun" latches ADCrO record channel:3=0 ; CH 0 input ADCrl record twoscomp:l=0, divider:2=l ; binary, divide clock by 2 mov d l , low ADC1 mov a l , ADCrlo out dx, a l mov d l , low ADCO mov a l , ADCrOo out dx, a l ; f i n i s h setting up timer 0 : ; set sampling rate and start the timer, f i r s t S/H pulse i s PERIOD us ; l a t e r , the f i r s t ( i n i t i a l i z a t i o n ) conversion w i l l have completed by ; then. mov d l , low CLKO ; set sampling rate mov a l , low (MHZ*PERIOD) out dx, a l mov a l , high (MHZ*PERIOD) out dx, a l ; end of hardware i n i t i a l i z a t i o n ; *** c r i t i c a l timing within loop: do not change code *** loop: ; load sample into DAC (to be transferred by next S/H pulse) mov ax, es:[bx] i f convert ; i f converting rept 4 ; make sample lef t - a l i g n e d shl ax, 1 endm xor ax, 8000h ; convert to offset-binary endif xchg a l , ah ; write MS byte, then LS mov d l , low DAC1 ; write DAC1 and wrap around to DACO out dx, ax ; set up ADC control word i n c l , and PIA address i n dx mov c l , ADCrOo mov d l , low PIAO ; wait for S/H to start sampling (implies conversion complete) 11: i n a l , dx or a l , a l ; test for sampling or overrun jz 11 ; get A/D sample and start next conversion (sampling should be complete) mov d l , low ADCO in ax, dx ; input A/D result xchg ax, cx ; sample to CX, get A/D control to AL out dx, a l ; start A/D conversion ; exit i f MS b i t of PIAO was set (overrun) j l done ; replace output sample with input sample i f convert ; i f converting i n loop mov ax, cx xor ax, 8000h ; convert to 2's complement rept 6 sar ax, 1 ; make r i g h t - j u s t i f i e d endm mov es:[bx], ax else ; i f not converting, save sample as read mov es:[bx], cx endif ; point to next element i n (possibly $LARGE) array add bx,2 ; increment pointer to next sample jnc 12 ; test for offset < 64k mov ax, es ; move segment up i f not add ax, lOOOh mov es, ax o' 3 12: ; increment (negated) sample count inc jnz inc s i 13 d i 13: bO O CO start label far code s t a r t address ( i n i t : ) ; loop ' t i l done mem ends jnz loop sum macro opl, c o s l , opQ, cosQ lodsw ; get LS word of phase increment ; return to c a l l e r add ax, [di] ; add i t 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 s i ; negate unused count stosw ; s i and d i now point to next ones not d i and ax, (Ncos-l)*2 ; ; MS word of phase mod Ncos *2 add s i , 1 mov bx, ax ; i s now cosine table offset i n bx adc d i , 0 opl cx, cosI[bx] ; ; add/subtact cosine value to I sum opQ dx, cosQ[bx] ; ; and to Q sum mov ax, s i ; return unused count endm mov dx, d i rom segment ; return assume cs:rom,ds:rom,es:rom,ss: rom org 8000h EPROM starts at 32k popf ; restore flags (s interrupt status) i n i t : c l i ; interrupts o f f pop s i ; restore s i eld set direction f l a g = 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 i o endp - mov cx, 9*2 clear phase counters mov d i , offset phases IO_TEXT ends rep stosw mov sp, 8000h set stack (not'used) end mov al,10011011b set a l l 8255 ports as unlatched off: out switch+3, a l ; input and start i n off mode ... mov dx, 0 set Q for minimum o/p sim.asm mov cx, mOdB ; and I for for OdB test a l , 10000000b - Z U d B l e v e l switcn on > ; Fading simulator controller. Ed Casas and Ron Jeffery. July 24, 1987. jz 11 i f 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: i n a l , switch xfer equ 40H address of common D/A output strobe test a l , 00000001b ; run switch on ? switch equ 60H address of switch port (8255 port A) jz off i f not, go set a f i x e d l e v e l Ncos equ 2048 number of entries i n cosine tables and ax, 01111110b ; middle 6 b i t s of switch i s pointer i o f f s t 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 b i t s l e f t j u s t i f i e d mov s i , pntrs[bx] ; s i —> f i r s t of 9 phase increments mOdB equ 7215 DAC output for 0 dB (MS 12 b i t s used) mov d i , offset phases ; d i --> f i r s t 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, c o s l , add, cos 3 | increment phases and sum org 0400h creates f i l e for EPROM programmer). sum <;>, , add, cos4 | cosine table values for phases dd 9 dup (?) phase counters sum sub, c o s l , add, cos3 | I (in cx) and Q (in dx) org 8000h sum sub, cos2, add, cos2 1 3 sum sub, cos3, add, cosl ; | sum sub, cos4, <;>, ; 1 sum add, cos5, add. cos5 ; / add cx, i o f f s t • convert I sum to offset-binary mov a l , ch • move to ax and swap bytes to mov ah, c l output MS byte f i r s t out idac+1, ax idac+0 i s also at idac+2 add dx, qoffst \ mov a l , dh 1 mov ah, d l I repeat for Q sum out qdac+1, ax / out xfer, a l change both outputs at same time jmp loop repeat forever label word pointers into phase increments x = offset incrmnts , table. 4 byte * 9 increments rept 128 per frequency = 36 bytes/entry dw X x = x+36 endm include tables cosl to cos5 and incrmnts org OfffOh reset vector jmp start ends end ctabgen.for C P r i n t scaled cosine tables i n 8088 assembler format. integer i , j , k, N, No, tmp(8), tmsusd(5) r e a l A, pwr, p i , sqrt, s in, cos, flo a t data N/2048/, No/8/, pi/3.14159/, pwr/0./, tmsusd/2,2,2,1,1/ do 3 i=l,5 if(i.eq.5)then A=1750*sqrt (2.) *sin (pi/4.) else A=1750*2.*sin (pi*float(i)/No) endif pwr=pwr+tmsusd(i)*(A**2)/2. write (*,'(" c o s " , i l , " l a b e l word" )') i do 2 j=l,N,8 do 1 k=l,8 tmp(k)=A*cos(float(j+k-2)*2.*pi/N) 1 continue write(*,' (" dw " ,7 (15, ", ") ,15)') (tmp(k) ,k=l, 8) 2 continue 3 continue write(*, ' (" ; 0 dB at ",fl0.1)')sqrt(2.*pwr) end ptabgen.for C P r i n t phase increment tables i n 8088 assembler format. integer*4 i , j , M, tmp(9), No, N real f s , t p i , cos, float data No/8/, N/2048/, tpi/6.28318/, fs/2958./ M=4*No+2 w r i t e ( * , ' ( " incrmnts label word")') do 2 1=0,254,2 do 1 j=l,8 tmp(j)=cos(tpi*float(j)/M)*i/fs*N*65536*2 1 continue tmp(9)=i/fs*N*65536*2 write (*,'(" dd " ,4 ( i l l , " , " ) , i l l ) ' ) (tmp(j), j=l,5) write (*,'(" dd " ,3 ( i l l , " ," ) , i l l ) ' ) (tmp(j), j=6,9) 2 continue end ceval.c /* ceval.c - evaluate BCH code performance from a run-length f i l e */ •include <stdio.h> •include <assert.h> •include <math.h> •define BUFFSIZE 4096 main(int argc, char **argv) { i n t i , /* arg counter */ buf[BUFFSIZE], /* b i t buffer */ *p , /* pointer to start of an FEC block i n buf */ e , /* number of errors i n a block */ n=0, argn = 0 , /* symbols per block */ m, argm = 0 , /* b i t s per symbol */ t, argt = 0 , /* correctable symbols per block */ arge = 0 , /* display errors i n each block */ argi = 0 , /* do interleaving */ argh = 0, /* produce histogram of errors/block */ argC = 0, /* display cumulative pdf */ argN =0, /* normalize pdf */ args =0, /* BER, BKER summary */ nm , /* n*m */ b i t s ; /* b i t s l e f t to test i n buf */ long sume, sumb, /* sum of errors and b i t s tested */ h_sum, /* sum of histogram values */ *phist, /* pointer to hi s t */ hi s t [BUFFSIZE+1] ; /* histogram */ FILE *infile=NULL ; /* input f i l e */ for (i=l ; Kargc ; i++) { i f ( !strcmp(argv[i], i f ( !strcmp(argv[i],"-n") i f ( !strcmp(argv[i],"-t") i f ( !strcmp(argv[i],"-h") i f ( !strcmp(argv[i],"-e") i f ( !strcmp(argv[i],"-i") i f ( !strcmp(argv[i],"-C") i f ( !strcmp(argv[i],"-N") i f ( !strcmp(argv[i],"-s") i f ( !strcmp(argv[i],"-f") i f ( (infile=fopen(argv[++i],"r")> = NULL ) perror (argv[i]) ; sscanf (argv[++i], sscanf(argv[++i], sscanf (argv[++i], argh=l ; arge=l ; argi=l ; argC=l ; argN=l ; args=l ; % d " , S a r g m ) % d " , & a r g n ) % d " , S a r g t ) /* i n i t i a l i z e histogram and bi t / e r r o r counters */ for ( i=0 ; KBUFFSIZE+1 ; i++ ) h i s t [ i ] = 0 ; sume = sumb = 0 ; /* ensure an input f i l e */ i f ( i n f i l e = NULL ) infi l e = s t d i n ; /* do for a l l FEC blocks i n one OFDM block : interleave i f necessary i f fewer than t symbol errors, b i t errors = 0 else count b i t errors update histogram and bi t / e r r o r counts maybe pri n t number of b i t errors */ while ( (bits=get_buf ( i n f i l e , buf)) >0 ) { i f ( n <= 0 ) ( /* i n i t i a l i z e n,m,t,nm */ i f ( argn ) n=argn ; else n=bits ; i f ( argm ) m=argm ; else m=l ; i f ( argt ) t=argt ; else t=0 ; nm=n*m ; p r i n t f ( " % % BCH (n=%d, m=%d, t=%d)\n",n, m, t) ; i f (n <= 0 II m<=0 || t<0) err("bad parameter") ; i f ( arge ) p r i n t f ( " % % errors per block :\n") ; } ; p=buf ; while ( b i t s >= nm ) { i f ( argi ) i n t l v (p, nm, 1) ; i f ( nserr(p,m,n) > t ) e=nerr(p,nm) ; else e=0 (hist[e])++ ; sume += e ; sumb += nm. ; i f ( arge ) p r i n t f ("%d\n",e) ; bits-=nm ; p+=nm ; ) ; } ; /* compute sum and maybe make cumulative */ h_sum = 0 ; for ( i=0 ; i<=nm ; i++ ) ( h_sum+=hist[i] ; i f ( argC ) h i s t [ i ] = h_sum ; } ; /* error checks */ i f ( sumb <= 0 ) err("no input") ; assert ( h_sum*n*m = sumb ) ; assert ( h_sum > 0 ) ; assert( sumb > 0 ) ; /* maybe display [C] pdf, maybe normalized */ i f ( argh ) { p r i n t f ( " % % [CJPDF : \n") ; for ( i=0 ; i<= n ; i++ ) i f ( argN ) p r i n t f ("%d %g\n", i , ((float) ( h i s t t i ] )) / h_sum ) ; else p r i n t f ( " % d % l d \ n " , i , h i s t [ i ] ) ; } ; /* maybe display summary */ i f ( args ) { p r i n t f ( " % % BER = %g\n", (float) (sume) / (float) (sumb) ) ; p r i n t f ( " % % BKER = %g\n", (float) (h_sum - hist[0]) / (float) h_sum ) } ; } ; err (char *msg) { fputs(msg,stderr) ; fputs(".\n",stderr) ; e x i t ( l ) ; } ; i n t nserr(int *p, i n t m, int n) { /* count number of m-bit symbols with errors i n a block of n symbols in t e=0 ; while ( n — ) { i f ( nerr(p,m) ) e++ ; p+=m ; } ; return ( e ) ; } ; in t nerr(int *p, i n t n) ( /* count number of b i t s i n error i n a block of n b i t s */ in t e=0 ; while ( n — ) i f ( *p++ ) e++ ; return ( e ) ; } ; in t get_buf(FILE * f i l e , i n t *buf) { /* Reads error-free run lengths from a f i l e and unpacks the run lengths into a b i t - e r r o r pattern (0=no error, l=error). Last (error-free) run length i n the block should be followed by a -1. Returns the number of b i t s generated. */ in t i=0, k ; while ( f s c a n f ( f i l e , "%d\sk) == 1 SS k >= 0 ) { i f ( i+k+1 >= BUFFSIZE ) k = BUFFSIZE-i-2 ; while ( k— ) { buf[i++] = 0 ; } ; buf[i++]=l ; } ; return ( i ? i-1 : 0) ; } ; in t put_buf(FILE * f i l e , i n t *p, i n t n) { •define put_cnt(x) f p r i n t f ( f i l e , "%d\n\x) /* Packs a b i t - e r r o r pattern (0=no error, l=error) into corresponding error-free run lengths and writes i t to a f i l e . The l a s t (error-free) run length i n the block i s followed by a -1. */ int k ; k=0; while ( n — ) i f ( *p++ ) { put_cnt(k) ; k=0 ; } else k++ ; put_cnt(k) ; put_cnt(-l) ; } ; int i n t l v ( i n t * i n , i n t n, i n t dir) { /* block interleaver */ int out [ BUFFSIZE ], i , j , k, 1 ; /* compute interleaving step size (round up to make sure interleave a l l ) */ k = (int) f l o o r ( 1.0 + sqrt ( (float) n ) ) ; 1=0 ; for ( i=0 ; i<k ; i++ ) { /* step through offsets within blocks */ for ( j=i ; j<n ; j+=k ) { /* step through blocks */ i f ( d i r ) out [1] = i n [j] ; else out [j] = i n [1] ; 1++ ; } ; } ; for ( i=0 ; i<n ; i++ ) i n [ i ] = outti] ; } ; to o bkp.c /* bkp.c computes average d i s t r i b u t i o n of the number of b i t errors i n blocks of size N assuming independent errors within each block but different BERs for each block. The standard input contains the block BERs and the program takes one argument, the block size. At input EOF the d i s t r i b u t i o n i s written to standard output. The binomial d i s t r i b u t i o n i s computed using the 'bico' routine from _Numerical Recipes_. Ed.Casas 89-3-7 */ double lnbicoQ, f a c t l n ( ) , gammlnO ; double ipow() ; void nrerror () ; •include <stdio.h> •include <math.h> •define NMAX 4096 main (int argc, char **argv) { i n t i , n, nblk ; double ber, nber ; double prob [ NMAX+1 ] ; double sump ; /* check arguments */ i f ( argc < 2 ) { fprintf(stderr,"Usage %s <bits/block>\n",argv[0]) ; e x i t ( l ) ; } ; i f ( sscanf (argv[l],"%d\sn) != 1 || n > NMAX ) { f p r i n t f (stderr, "N (%s) bad or too large. \n",argv[l]) ; e x i t ( l ) ; } ; /* test for log f a c t o r i a l { i n t x l , x2 ; p r i n t f ("enter x l and x2 " ) ; scanf("%d %d",Sxl,sx2) ; p r i n t f ("In of f a c t o r i a l : = % f % f \n",factln(xl),factln(x2)) ; p r i n t f ( " x l ! / x 2 ! ?= %lg\n". exp( (double) (f a c t l n ( x l ) - f a c t l n ( x 2 ) ) ) ) ; } ; */ /* i n i t i a l i z e d i s t r i b u t i o n */ for ( i=0 ; i<=n ; i++ ) prob[i]=0.0 ; nblk = 0 ; /* loop through input BERs, compute, and sum d i s t r i b u t i o n s */ while ( scanf("%lg",Sber) == 1 ) { for ( i=0 ; i<=n ; i++) prob(i] += exp ( lnbico(n,i) + log ( 1.0-ber ) * ( n-i ) + log ( ber ) * i ) ; nblk ++ ; } ; /* display cumulative r e s u l t s */ sump=0. ; i f ( nblk <= 0 ) { fprintf(stderr,"No input.\n") ; ex i t ( l ) ; } else for ( i=0 ; i<=n ; i++) p r i n t f ( " % d %lg\n", i , sump += (prob[i]/nblk) ) ; } ; /* the following routines are adapted from _Numerical_Recipes_in_C_ double lnbico(n,k) /* modified to return In */ in t n,k; { double factln() ; return f a c t l n (n)-factln (k)-factln (n-k) ; ) ^ •define MAXN 2048 double factln(n) i n t n; { st a t i c double a[MAXN+l]; /* cache blocksizes up to MAXN b i t s */ double gammlnO ; void nrerror () ; i f (n < 0) nrerror("Negative f a c t o r i a l i n routine FACTLN"); i f (n <= 1) return 0.0; i f (n <= MAXN) return a[n] ? a[n] : (a[n]=gammln(n+1.0)>; else return gammln(n+1.0); } double gammln(xx) double xx; { double x,tmp,ser; s t a t i c double cof[6]={76.18009173,-86.50532033,24.01409822, -1.231739516,0.120858003e-2,-0.536382e-5); in t j ; x=xx-1.0; tmp=x+5.5; tmp -= (x+0.5)*log(tmp); ser=1.0; for (j=0;j<=5;j++) { x += 1.0; ser += c o f [ j ] / x ; } return -tmp+log(2.50662827465*ser); void nrerror(error_text) char e r r o r _ t e x t [ ] ; { fprintf(stderr,"Numerical Recipes run-time error...\n"); f p r i n t f ( s t d e r r , " % s \ n " , e r r o r _ t e x t ) ; fprintf(stderr,"...now exiting to system...\n") ; e x i t ( 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 out2bers.awk # # bers.awk - extracts the block BERs for one set of N, SNR values # ed.casas 89-3-17 # / A\ %B/ { i f ( $2 == n SS $3 = snr ) p r i n t $4 } out2runs.awk # # runs.awk - extracts the error-free run lengths for one set of # N, SNR values # ed.casas 89-3-2 # /*\ %N/ ( i f ( $2 == n SS $3 == snr ) on=l ; else on=0 } # un-comment next l i n e for te s t i n g #/*\ %N/ { i f ( on ) p r i n t $0 } /"\ %R/ ( i f ( on ) pr i n t $2 ) o c 5 Co b to o 

Cite

Citation Scheme:

        

Citations by CSL (citeproc-js)

Usage Statistics

Share

Embed

Customize your widget with the following options, then copy and paste the code below into the HTML of your page to embed this item in your website.
                        
                            <div id="ubcOpenCollectionsWidgetDisplay">
                            <script id="ubcOpenCollectionsWidget"
                            src="{[{embed.src}]}"
                            data-item="{[{embed.item}]}"
                            data-collection="{[{embed.collection}]}"
                            data-metadata="{[{embed.showMetadata}]}"
                            data-width="{[{embed.width}]}"
                            async >
                            </script>
                            </div>
                        
                    
IIIF logo Our image viewer uses the IIIF 2.0 standard. To load this item in other compatible viewers, use this url:
https://iiif.library.ubc.ca/presentation/dsp.831.1-0098258/manifest

Comment

Related Items