Cognitiveradiotechnologies.com



Simulation Code

December 23, 2009

Prepared by: Dr. James Neel

Cognitive Radio Technologies, LLC

james.neel@

540-230-6012

Prime Contractor: Diversified Technology, Inc

Principal Investigator: Bill Bolick

Subcontractor: Cognitive Radio Technologies, LLC

Subcontract Title: Development of SDR, CR, and Software Controlled Antenna Systems

Subcontract #: SCWA 11449

Deliverable 3: Updated Simulation Code

TABLE OF CONTENTS

Change History iv

Document Scope iv

Acronyms iv

1 Introduction 1

1.1 Modeled system 1

1.2 Document Organization 3

2 Simulation of FSK PHY 4

2.1 Scope 4

2.2 General Simulation Information 5

2.2.1 Data Structures 5

2.2.2 System Requirement and Running Environment 5

2.2.3 General Component Design 5

2.2.4 Program Flow 6

2.3 Functional Architecture 6

2.3.1 System Overview 6

2.3.2 Decomposition of Primary AMPS FSK (Data) Blocks 7

2.4 File Listing 9

2.5 Build Environment 10

2.6 Functional Component Descriptions 10

2.6.1 Bit Voter 10

2.6.2 BCH Encode / Decode 11

2.6.3 Channel 14

2.6.4 CMA Equalizer 15

2.6.5 FM Modulator 16

2.6.6 Frequency Lock Loop 17

2.6.7 Initial Frame Synchronization 18

2.6.8 Maintenance Frame Synchronization 21

2.6.9 Framing 22

2.6.10 Manchester Encoding / Decoding 24

2.6.11 Phase Lock Loop (PLL) 26

2.7 System Testing Results 26

2.8 References 29

3 Simulation of FM PHY 29

3.1 File Listing 32

3.2 General Design Considerations 33

3.3 References 33

3.4 Routine References 34

3.4.1 Audio Filter 34

3.4.2 Audio Source 36

3.4.3 Channelizer 37

3.4.4 Compressor / Expander 40

3.4.5 Demodulator 44

3.4.6 Deviation Limiter 44

3.4.7 FM Modulation 45

3.4.8 Phase Locked Loop 46

3.4.9 Post Deviation-Limiter Filter 52

3.4.10 Pre-emphasis / De-emphasis 54

3.4.11 SAT Detection / Reception Block 58

3.4.12 SAT / ST Generation 62

3.4.13 Squelch 63

3.4.14 ST Detect 66

3.4.15 Upconversion 67

3.5 Simulation Block References 68

3.5.1 Forward Link Test (AMPS_forward_link_test.m) 68

3.5.2 AMPS BS Transmitter (AMPS_BS_TX_PHY_FM.m) 69

3.5.3 AMPS Mobile System Receiver (AMPS_MS_RX_PHY_FM.m) 70

3.5.4 Channel 71

3.5.5 Reverse Test (AMPS_reverse_link_test.m) 73

3.5.6 AMPS Mobile System Transmitter (AMPS_MS_PHY_TX.m) 73

3.5.7 AMPS Base Station Receiver (AMPS_BS_FM_PHY_RX.m) 75

4 SCWA Simulation 77

4.1 Modeled System 77

4.2 Modeling Considerations 78

4.2.1 Modeling Tuner Behavior 78

4.2.2 Antenna Behavioral Modeling 80

4.3 File Listing 81

4.4 Functional Component Descriptions 81

4.4.1 Integrated system 81

4.4.2 Antenna model 82

4.4.3 Tuner model 82

4.5 Example simulation results 83

4.6 References 84

5 Link Layer Simulation 85

5.1 General Simulation Methodology 86

5.2 Link Layer Overview Communications Channels 87

5.2.1 The Primary Data Channel 87

5.2.2 The Maintenance Channel 87

5.3 Major node processes 87

5.4 Handoffs 90

5.4.1 Measuring Signal Quality 90

5.4.2 Handoff State Machine 91

5.4.3 The Scanning Process 94

5.4.4 Rendezvous 95

5.5 Packet Structure 95

5.5.1 Link Payload Packet (LPP) 95

5.5.2 Forward Link Maintenance Packet (FLMP) 96

5.5.3 Reverse Link Maintenance Packet (RLMP) 97

5.6 File Listing 98

5.7 Functional Component Descriptions 98

5.7.1 Build_Send_FLMP 99

5.7.2 Build_Send_LPP 99

5.7.3 Build_Send_RLMP 100

5.7.4 Destination Payload Processor 100

5.7.5 Bit Error Count Filters 100

5.7.6 Link Integrity 101

5.7.7 Master / Slave Link Controller 101

5.7.8 Master / Slave Receive Packet 102

5.7.9 Master / Slave Rx Link Controller 102

5.7.10 Master / Slave Send Packet 102

5.7.11 Master / Slave TX Controller 102

5.7.12 Primary / Scan State Machine 103

5.7.13 Read Config File 103

5.7.14 Source Payload Processor 103

5.7.15 Software Init 104

5.7.16 System State Machine 104

Change History

12/23/09 Initial Release

Document Scope

This document reviews the simulation code created as part of the development of the SDR and waveform for the SCWA. It covers the simulation of FM and FSK physical layers, which were based on AMPS physical layer functions (see J. Neel, “Advanced Mobile Phone System (AMPS) Specification Document,” version 1.0 Oct 14, 2008), link layer processes intended to support make-before-break handoffs and HF communications using FlexRadio frontends and HPCS for processing, and behavioral modeling for the SCWA in transmit mode. To gain a complete understanding of the SCWA system, the reader should consult earlier reports. Also note that simulation design and implementation may evolve as prototyping evolves and issues are identified.

Acronyms

AMPS Advanced Mobile Phone System

API Application Programming Interface

ARQ Automatic Repeat request

ATU Antenna Tuner Unit

BCH Bose Chaudhuri Hocquenghem (a forward error correcting code)

BS Base Station

BSP Board Support Package

CCS TI Code Composer Studio

CRT Cognitive Radio Technologies, LLC

DMA Direct Memory Access

DSP Digital Signal Processor (Processing)

DSP / BIOS TI DSP Basic Input / Output System

DTI Diversified Technology, Incorporated

EDMA Enhanced Direct Memory Access

FIFO First In First Out

FLL Frequency Lock Loop

FLMP Forward Link Maintenance Packets

FM Frequency Modulation

FPGA Field Programmable Gate Array

FRS Family Radio Service

FSK Frequency Shift Keying

GPP General Purpose Processor

GUI Graphical User Interface

HF High Frequency (3 to 30 MHz)

HPCS High Performance Computer System

ID Identifier

IDMA Internal Direct Memory Access

ISE Xilinx Integrated Software Environment

JTAG Joint Test Action Group

LPP Link Payload Packet

MPI Message Passing Interface

MS Mobile Station

OS Operating System

PC Personal Computer

PHY Physical Layer

Pkt Packet

PLL Phase Lock Loop

PHY PHYsical layer

RCV Receive

RLMP Reverse Link Maintenance Packets

RF Radio Frequency

RSS Received Signal Strength

RTDX Real Time Data eXchange

RTOS Real Time Operating System

RX Receive

SAT Supervisory Audio Tone

SCA Software Controlled Antenna

SCPI Standard Commands for Programmable Instruments

SDD Software Design Document

SDR Software Defined Radio

SFF Small Form Factor SDR from Lyrtech

SMA Surface Mount Assembly

SNR Signal-to-Noise Ratio

SSP Spectrum Signal Processing

ST Signaling Tone

TI Texas Instruments

TX Transmit

VAC Virtual Audio Cable

Introduction

Phase I of this project developed a FM / FSK simulation and implementation code to support a demonstration of DTI’s software controllable antenna on a single radio (Lyrtech SFF). In Phase II, the waveform is being ported to a multi-radio environment - High Performance Computing System (HPCS) with two FlexRadios – to support a demonstration of HF communications in the HF bands (the SFF had a lower band limit of 200 MHz) with the SWCA. This demonstration will maintain a data link for 24 hours while automatically moving channels with make-before-break handoffs to maintain connectivity as the ionosphere propagation characteristics change during the day. To support the make-before-break handoff requirement and HF operation, we have redesigned the waveform as follows:

• Added packet numbers to the data packets and sequence trapping in anticipation of higher layer functionality (ARQ, handoffs)

• Received signal strength measurements capability – an earlier SNR capability was implemented for the squelch circuit, but this tied in with the AGC process to estimate signal strength.

• Support for multiple (RF) radio chains with mutual control and information sharing between the chains

• Adding an auxiliary (scanning) communications channel in addition to the primary (communications) communications channel

• Scanning routines to measure channel quality (to guide channel selection in handoffs)

• A low-bandwidth bursty FSK protocol for link management on the auxiliary channel

• Support for FlexRadio interface and control

• Support for HPCS implementation

1 Modeled system

The planned experiment is intended to demonstrate the ability to construct and maintain a reliable long-distance (beyond-the-horizon) communications link in time-varying HF bands. By operating in the HF bands, range can be greatly extended via waveguide effects in the ionosphere. However, these effects vary over time as the solar energy impingent on the earth changes, e.g., due to variances in sun spot activity and the rotation of the earth, so that link propagation characteristics may degrade at one frequency while being enhanced at another frequency. Thus to maintain an uninterrupted stream of communications, it will be necessary to move the link’s operating frequency in response to changing channel conditions.

In the demonstration setup, two communications systems will be used – one stationed in DTI’s facilities in Jackson, MS and another at the end-customer’s premises in Colorado as illustrated in Figure 1. The link will be managed and controlled by the system in Jackson, MS with guidance from the station in Colorado. The system in Jackson, MS will track and store all performance statistics during the demonstration to allow for verification of operation at the end of the 24-hour demonstration. During its operation, it is expected that the communications link’s carrier frequency will need to shift between a 2 MHz band and a 6 MHz band and back again.

[pic]

Figure 1: An HF communications link will be established and maintained between Jackson, MS and Colorado by leveraging ionospheric propagation effects and high power transmitters.

Each communications system will consist of the following:

• a High Performance Computing System (HPCS)

• Two FlexRadio 5000As to facilitate HF communications

• DTI provided tunable HF antennas

• Communications software for managing and logging the results of the HF communications link.

The last (communications system software) is the focus of this effort. The system is made up of two physical full duplex communication links. The primary link carries both payload data and maintenance information. The secondary link scans between the remaining frequency pairs to determine if there is a better choice to become the primary link. Figure 2 shows the functional blocks which make up the FM/FSK data communications system where the Master controller will be based in Jackson and the Slave controller in Colorado. To support two simultaneous links, two FlexRadio 5000As will be needed for each system and two transmit antennas.

[pic]

Figure 2: Basic components in planned communications system.

2 Document Organization

As part of the development effort, the blocks shown in Figure 3 have been simulated where the color coding refers to the section in this document where the simulation is discussed. The FM and FSK modems (light red) are discussed in Sections 2 (FSK) and 3 (FM) along with the simulation of various channel models (light red). The antenna behavioral model (grey) is presented in Section 4 and the master and slave processes used for link management (blue) are discussed in Section 5. Each of these sections contains information on the design and execution of the simulated components.

[pic]

Figure 3: Simulated Components

To access the delivered simulation code, please refer to the following zip files which were included as part of this report.

• FM_FSK_SIM.zip => contains FM and FSK code (C / Matlab) used to simulate the PHY

• SCA_Behavioral_Sim.zip => conains code (Matlab) to simulate the expected behavior of a tuner / antenna combo in transmit mode

• HF_link_simulation.zip => contains code (C) used to simulate the link layer operations for the make-before-break HF link

Simulation of FSK PHY

In the first phase, this project developed FM / FSK simulation and implementation code to support a demonstration of DTI’s software controllable antenna. This was originally envisioned as part of a final demonstration intended to be compatible with the unclassified single-channel FM / FSK signals used in SINCGARS, e.g., as used in the Harris RF-5800M-MP Manpack radio. However, because of the current unavailability of an unclassified version of the single-channel, unencrypted SINCGARS standard, the project is proceeding with the AMPS (Advanced Mobile Phone System) standard – an FM/FSK-based cellular standard that may be similar. When an unclassified specification document for SINCGARS becomes available, this document and subsequent work will be revisited.

AMPS is an analog 800 MHz cellular standard first ratified in 1983 (as EIA/TIA-553) to facilitate the use of compatible mobile station (MS) and base station (BS) equipment in the 800 MHz band. It was later amended to support interoperability with other cellular standards and to support E-911 location-based services, with the final revision in 1999 in EIA/TIA-553A. As illustrated in Error! Reference source not found., AMPS connects mobiles ([pic]) to base stations (BS) which control the operation of the mobiles. The BSs are connected via the mobile telephone switching office (MTSO) to each other and to the Public Telephone Switched Network (PTSN). The MTSO also controls the operation of the BSs and facilitates handoffs of mobiles between BSs.

[pic]

Figure 4: Major components and connections of the AMPS network

This development effort included both a simulation and an implementation phase. The results of the simulation phase were used in the testing of the implementation code. Now, the code implemented and tested on the Lyrtech SFF is being ported and tested for use with FlexRadio 5000A software defined HF radio with all processing to occur on the HPCS. It is expected that the PHY will be modified at a later date to conform to SINCGARS specifications or to a Military standard HF data modem (e.g., MIL_STD-188-110B) though Link layer operations may be preserved.

1 Scope

The AMPS FSK (data) simulation was used to help aid the design of the eventual demonstration by providing a means for refining / evaluating design decisions (filter coefficients, algorithms) and to provide a mechanism for verifying the implementation code (by comparing simulation results with implementation results).

This section reviews the simulation of the AMPS-based FSK PHY, in particular the processes needed to implement simulations of the components that will be used on the “BS” and “MS” in the demonstration experiment for PHY FSK data. It covers the overall functional architecture, the primary functions, the interfaces between those functions, and the expected operation of each function.

2 General Simulation Information

1 Data Structures

All variables will be vectors/matrices of doubles (Matlab’s native type). The original intent was to use floats in the demonstration, but work transitioned to a fixed point implementation to better model the target platforms and included steps so data-types will have to be recast and steps taken to ensure proper scaling and overflow protection.

No objects will be used in this procedural simulation.

2 System Requirement and Running Environment

Programming tool: Matlab, C (and compiler)

In theory, since Matlab is an interpretative language and the C code will be compiled on the target platform, the simulation can be executed on any OS. However, it will be developed on a Windows XP platform.

3 General Component Design

To simplify the porting process and to increase the fidelity of the modeling, the Matlab components that will be fielded on the radio are coded as Mex files (C code that can be called from within the Matlab environment) and all operations should be written in a procedural format (as opposed to exploiting Matlab’s vector / matrix operators). Thus the PHY and Link layer processes are implemented in C code that can be called from Matlab while the SCWA behavioral model is implemented entirely in Matlab.

[pic]

Figure 5: General flow for a Mex Function that allows the development effort to use the same C code for both modeling and implementation.

4 Program Flow

The simulation consists of several different simulations designed to test/validate the behavior of components and to refine the design of the FM voice components and FSK data components as needed. Each simulation is designed to test a component or the interaction of several components and will have a different test script associated with it. A test script is responsible for parameterizing the components, passing the data between the components, and performing the post-processing (e.g., comparing inputs to outputs, aggregating statistics, generating plots) required to complete a test. The test script should log the results and parameters of each test (see Section 2.6.7). These test scripts will implement the test defined in the test specification documents to be developed over the next month as part of the simulation development process.

3 Functional Architecture

1 System Overview

The simulation is intended to model the physical layer operations of AMPS FSK data communications across various states. There are two links in an AMPS voice system – from BS to MS and from MS to BS and data is transferred over two logical channels – voice and data. Because the SAT tone transmitted by the BS must be looped back from the MS to the BS, an accurate simulation will require both links to be operational as illustrated in Figure 6. In Figure 6, all inputs from the link layer (e.g., setting channel, enabling ST tone) will be treated as a top-level simulation variables and all outputs to the link later as top-level simulation results.

[pic]

Figure 6: End Simulation System Architecture

However, for purpose of testing and development we will also develop simulations of the Forward Link (BS transmitter to MS receiver), Reverse Link (MS Transmit to BS Receive), and each of the four principle AMPS blocks (BS Transmit, MS Receive, MS Transmit, and BS Receive).

2 Decomposition of Primary AMPS FSK (Data) Blocks

The following figures show the data flow of the components within each of the primary AMPS FSK voice blocks illustrated in Figure 6 (all except for the channels). Note that many blocks in the BS transmitter are replicated in the MS transmitter and many of the blocks in the BS receiver are replicated in the MS receiver. Functional descriptions of these blocks are given in Section 2.6.

[pic]

Figure 7: BS AMPS FSK Transmitter Communications Blocks

[pic]

Figure 8: MS AMPS FSK Receiver Communications Blocks

[pic]

Figure 9: MS AMPS FSK Transmitter Communications Blocks

[pic]

Figure 10: BS AMPS FSK Receiver Communications Blocks

4 File Listing

The following gives a listing of the files included in the included release with a brief description of its function. Details on design, use, and testing are given in subsequent sections.

• AMPS_MS_RX_PHY_FSK.m PHY FSK block receiver

o AMPS_CMA_equalizer.m Restore constant envelope

o AMPS_BS_PLL.m FM demodulation.

o AMPS_CMA_equalizer.m Constant Modulus equalizer

o AMPS_FSK_init_sync.c Achieve initial synchronization

o AMPS_FSK_maint_sync.c Maintain synchronization

o AMPS_FM_demod.m PLL output scaling

o AMPS_manchester_decode.c Perform Manchester decode

o AMPS_bch.c Perform BCH decode.

o AMPS_bit_voter.c Perform bit voting.

o AMPS_fir_filter.c Perform fir filtering.

o AMPS_deframer.c De-frame messages

o AMPS_correlator_init.c Synch Correlation initialization.

o AMPS_rx_PHY.c Main physical layer routine

o AMPS_rx_state_machine.c Controls receive processes

o AMPS_RX_PHY_FM.c Mex file

• AMPS_BS_TX_PHY_FSK.m PHY FSK block transmitter

o AMPS_bch.c BCH encoder

o AMPS_framer.c Frames (FOCC,RECC,FVC,RVC)

o AMPS_fm_mod.c FSK modulator

o AMPS_manchester_encoder.c Perform Manchester encoding

o AMPS_tx_chan_selects.c Selects channel to frame

o AMPS_tx_state_machine.c Controls transmit processes

o AMPS_tx_PHY.c Main physical layer routine

o AMPS_TX_PHY_FSK.c Mex file

• Test scripts and design files

o AMPS_link_test.m Forward/Reverse link system test

o AMPS_FSK_VC_BER_test.m Collects voice channel BER data

o AMPS_FSK_CC_BER_test.m Collects control channel BER data

o AMPS_ber_cc.m Displays control channel BER info

o AMPS_ber_vc.m Displays voice channel BER info

o BER_FOCC_curves.m Displays FOCC BER curves

o BER_RECC_curves.m Displays RECC BER curves

o BER_FVC_curves.m Displays FVC BER curves

o BER_RVC_curves.m Displays RVC BER curves

o BER_RVC_init_sync_curves.m Displays RVC init synch BER curve

o AMPS_BCH_forward_test Tests BCH in forward link in C

o AMPS_BCH_reverse_test Tests BCH in reverse link in C

5 Build Environment

The primary Matlab files to begin execution are found in the directory named “AMPS_FSK_BUILD”. The file names are “AMPS_link_test.m” for general testing, and for bit error rate BER testing “AMPS_FSK_VC_BER_test.m” and “AMPS_FSK_CC_BER_test.m”. The receiver and transmitter code is written in a combination of Matlab and C.

To execute C code in a Matlab environment Mex Files are used as an interface between the two languages. The mex files are “AMPS_TX_PHY_FSK.c” and “AMPS_RX_PHY_FSK.c”. The mex files are compiled under Matlab using the “mex AMPS_TX_PHY_FSK.c” or mex “AMPS_RX_PHY_FSK.c” commands. The two BCH tests “AMPS_BCH_forward_test” and “AMPS_BCH_reverse_test” are written in C and found in the directory named “Projects”.

6 Functional Component Descriptions

The following components (functions) are necessary to realize a simulation of AMPS (FSK) data links.

• BCH Encode / Decode

• Bit vote

• Channel Equalizer (constant modulus)

• Channel

• FLL

• FM Modulator / Demodulator

• Frame Synchronization

• Framing

• Manchester Encoding

• PLL

• Symbol Synch / Demodulation

The following gives a brief description of each component (function), its inputs and outputs, and its operation. For relatively simple processes, the operation is described in the following subsections; more complicated processes are referenced to external documents.

1 Bit Voter

The frame structures of AMPS employ repetition coding in each of the four FSK data channels. The forward control channel (FOCC) contains two words (words A and B), with each word repeating five times. The reverse control channel (RECC) contains up to seven words[1] each of which is repeated five (5) times. The reverse voice channel (RVC) contains two words, each repeated five (5) times. The forward voice channel (FVC) contains two words, each word is repeated eleven (11) times.

The bit voter determines which bits should be passed to the BCH decoder by buffering the repeated words and for each bit of the word, outputting the bits that occur the most frequently (e.g., if 3 words have a 1 and 2 a 0, then a 1 is output).

1 Usage

void AMPS_bit_voter(int *voter_input_buffer[],

int input_num_repeats,

int *rcvr_bit_vector[],

int output_vector_length,

int zero_count_vector[])

2 Inputs

voter_input_buffer[] => vector of bits to be voted on

input_num_repeats => number of bits to be voted on

output_vector_length => length of ouput vector

3 Internal Variables

int i,j ; // general purpose counters

int *ptr_input ; // pointer to input vector

int zero_counter ; // counts number of zeros repeated

int bit ; // temporary bit decision register

4 Outputs

rcvr_bit_vector[] => vector containing elected bits

zero_count_vector[]=> vector containing count of zeros

of each elected bit.

(used as a signal quality indicator)

5 Operation

This bit voter routine votes on the bits of repeated words and outputs a bit vector containing the elected bits.

This routine counts the number of zeros corresponding to each repeated bit of the received message. The resulting count of zeros is compared with half the number of repeats plus one. If the resulting count is greater, zero is elected; otherwise, a one is elected. The value zero_count_vector [] is passed out of the routine and can be used a signal quality indicator.

2 BCH Encode / Decode

Words transmitted digitally are formed by encoding the content bits into systematic linear block code implemented as a BCH code with a Hamming distance of 5. The generator polynomial for this BCH code is given by (1).

[pic] (1)

When formed into words for transmission, the left-most bits (earliest in time) are treated as content bits and the 12 right-most bits as parity bits with the left-most bit as the most significant bit. For the reverse voice and control channels, 36 content bits are encoded by this polynomial to create a (48, 36; 5) BCH code; for the forward voice and control channels, 28 bits are used to create a (40, 36; 5) BCH code.

1 Usage

Multiple functions are employed for this process. See Section 2.6.2.5 (Operation) for more details.

2 Inputs

The first function:

read_p((int*)p); /* read generator polynomial g(x) */

Inputs: None

The second function:

generate_gf((int) n, (int) m, (int*)p, (int*)index_of, (int*)alpha_to); /* generate the Galois Field GF(2**m) */

Inputs: n code word length

m order of the field GF

p(x) primitive polynomial

The third function:

gen_poly((int) n,(int) k,(int) d,(int*)g,(int*) index_of,(int*) alpha_to); /* Compute the generator polynomial of BCH code */

Inputs: index_of[] = antilog table of GF(2**6)

alpha_to[] = log table of GF(2**6)

The fourth function:

encode_bch((int)n, (int)k, (int*)data, (int*)bb); /* encode data */

Inputs: n = code length

k = n - deg(g(x)) = data bit length

data[] = coefficients of data polynomial, i(x)

The fifth function:

decode_bch((int)n, (int)k, (int*)recd, (int*) index_of, (int*), (int*) alpha_to &num_errors);

Inputs: n = code length

k = n - deg(g(x)) = data bit length

recd = received code word vector plus errors

index_of[] = antilog table of GF(2**6)

alpha_to[] = log table of GF(2**6)

3 Internal Variables

m = order of the field GF(2**6) = 6

n = length

t = 2 = error correcting capability

d = 2*t + 1 = 5 = designed minimum distance

k = n - deg(g(x)) = 36 = dimension

p[] = coefficients of primitive polynomial used to generate GF(2**6)

g[] = coefficients of generator polynomial, g(x)

alpha_to [] = log table of GF(2**6)

index_of[] = antilog table of GF(2**6)

data[] = coefficients of data polynomial, i(x)

bb[] = coefficients of redundancy polynomial (x**(12) i(x)) modulo g(x)

numerr = number of errors

errpos[] = error positions

recd[] = coefficients of received polynomial

4 Outputs

The first function:

read_p((int*)p); /* read generator polynomial g(x) */

Outputs: p=> polynomial g(x)

The second function:

generate_gf((int) n, (int) m, (int*)p, (int*)index_of, (int*)alpha_to); /* generate the Galois Field GF(2**m) */

Outputs: index_of[] => antilog table of GF(2**6)

alpha_to[] => log table of GF(2**6)

The third function:

gen_poly((int) n,(int) k,(int) d,(int*)g, (int*) index_of, (int*) alpha_to); /* Compute the generator polynomial of BCH code */

Outputs: g[] => generator polynomial

The fourth function:

encode_bch((int)n, (int)k, (int*)data, (int*)bb); /* encode data */

Outputs: bb[] => redundency bits

The fifth function:

decode_bch((int)n, (int)k, (int*)recd, (int*) index_of, (int*) alpha_to, (int*) &num_errors);

Outputs: recd => decoded code word

num_errors => number of errors detected and corrected.

5 Operation

In this specific case, there is no need to use the Berlekamp-Massey algorithm, since the error locator polynomial is of at most degree 2. Instead, in the case of two errors, two simultaneous equations are simply solved to give the coefficients of the locator polynomial. In the case of one error, the location is given by the first syndrome. There are five functions which make up the AMPS BCH encode/decode operation. The simulation code is written in the C programming language.

The first function:

read_p((int*)p); /* read generator polynomial g(x) */

The function reads the polynomial of degree 6 and returns the result in p(x).

The second function:

generate_gf((int) n, (int) m, (int*)p, (int*)index_of, (int*)alpha_to); /* generate the Galois Field GF(2**m) */

The function generates the Galois Field GF(2m) from the irreducible polynomial p(x) in p[0]… p[m]. The first generated lookup table alpha_to[] contains the elements alphai in polynomial form. The second lookup index_of[] uses alpha_to[] as and index to recover the primitive elements of alphai.

The third function:

gen_poly((int) n,(int) k,(int) d,(int*)g, (int*) index_of, (int*) alpha_to); /* Compute the generator polynomial of BCH code */

This function computes the generator polynomial for the BCH code.

[pic]

The generator polynomial given above generates a full length (n, k,t) code of (63,51,2). The value 63 indicates the code word length. The value 51 indicates message length and the value 2 indicates an error correction capability of two bits. The full length code word is shortened to 48 bits in the reverse channel and 40 bits in the forward channel.

The fourth function:

encode_bch((int)n, (int)k, (int*)data, (int*)bb); /* encode data */

This function encodes the code word to be transmitted.

The fifth function:

decode_bch((int)n, (int)k, (int*)recd, (int*) index_of, (int*) alpha_to, (int*) &num_errors);

This function decodes the generated code word.

3 Channel

The channel block is intended to model the processes that the signal undergoes from transmission to reception. This block models various channel conditions. The first is signal plus Gaussian white noise (AWGN). The second is a faded signal with a line-of-site from transmitter to receiver plus Gaussian white noise (Ricean). The third is a faded signal with no line-of-site plus Gaussian white noise (Rayleigh). The fading is caused by movement of the receiver with respect to the transmitter. The Matlab Communications Toolbox must be installed for fading channel operation. If the toolbox is not installed the block implements an AWGN channel

1 Usage

%USAGE: [out_msg] = AMPS_forward_channel(msg, model_name, SNR, Fs, fd)

2 Inputs

msg => input signal

model_name => channel model name, AWGN, Ricean, Rayleigh (or any other known channel)

SNR => output SNR

Fs => sampling rate

fd => absolute value of doppler shift

3 Internal Variables

None

4 Outputs

out_msg => message out of channel (to receive antenna / ADC)

5 Operation

The channel block will model AWGN (LoS) and Rayleigh channels, and varying multipath and Doppler shifts. Since the channel is not an implemented block on the SDR, the simulation block can be implemented using Matlab functions.

This reused the channel coded for the FM simulation. [AMPS_FM]

4 CMA Equalizer

Multipath components can significantly reduce the performance of a communications link. Since FM (and FSK) is a constant amplitude signal, the effect of multipath can be undone by using a blind constant-modulus algorithm (CMA) to adjust a receive filter’s taps to “undo” the effect of the channel. In reality, the CMA equalizer has no actual knowledge of the channel taps; rather it attempts to minimize an error signal defined as the time difference between the filtered signal’s amplitude.

1 Usage

%USAGE: [I_msg_out,Q_msg_out] = AMPS_CMA_equalizer(I_msg,Q_msg)

2 Inputs

I_msg => inphase input message

Q_msg => quadraphase input message

3 Internal Variables

Fc => carrier frequency

Fs => sampling rate

CMA_I_states=> inphase input signal buffer

CMA_Q_states=> quadraphase input signal buffer

CMA_I_taps => inphase equalizer channel taps

CMA_Q_taps => quadraphase equalizer channel taps

CMA_length => length in samples of the equalizer

step_size => equalizer tap adaptation rate

4 Outputs

I_msg_out => equalized inphase out message

Q_msg_out => equalized quadraphase output message

5 Operation

The objective of CMA is to restore the faded signal output [pic] to a constant envelope signal on average. This is accomplished by adjusting the weight vector [pic] to minimize the cost function J given by:

[pic] (2)

In this application p and q are set to (1,2) for high noise tolerance and increased stability. From the above cost function the following equations may be obtained.

[pic] (3)

[pic] (4)

[pic] (5)

Where:

[pic] => faded signal restored to constant envelope.

[pic] => tracking adaptation rate.

[pic] => error signal.

[pic] => complex conjugate of input signal.

[pic] => CMA filter coefficients. [pic]

[pic] => faded input signal.

Equation 3 shows the finite response filter which restores the faded input [pic] to a constant modulus signal[pic]. Equation 4 shows the coefficient update equation and Equation 5 shows the error calculation[pic]. The equalizer implementation is written using complex numbers.

[pic]

Figure 11: CMA Equalizer Output

Figure 11 shows the CMA equalizer output in a Ricean fading channel. The CMA equalizer attempts to restore the constant envelopment of the transmitted signal.

5 FM Modulator

The FM modulator modulates the phase of the RF carrier with the as shown in (6) where ( is the index of modulation, m(t) is the message signal, fc is the RF carrier frequency.

[pic] (6)

1 Usage

AMPS_FM_mod((int) AMPS_number_bits_to_process,

(int*)&manchester_encoded_vector[0],

(double*)&FM_modulated_samples[0]) ;

2 Inputs

Inputs: manchester_encoded_vector => input message to modulate

AMPS_number_bits_to_process=> bits remaining to modulate

3 Internal Variables

Fc => carrier frequency

Fs => Sampling rate

freq_dev => deviation frequency

phase => phase of modulator

4 Outputs

Output: FM_modulated_samples => modulated FM waveform

5 Operation

This function is the same one as used in the FM simulation. [AMPS_FM] The input is the output of the Manchester encoding module .

6 Frequency Lock Loop

While higher-order Phase Lock Loops (PLL)s can also perform frequency lock, PLLs have a limited pull-in range and higher-order PLLs are less stable. To address this issue (particularly for hopping systems), a separate loop can be used to correct frequency offset errors.

A simple way to do this is to put two filters where the transition bands of the received signal is expected to lie as shown in Figure 12. Energy levels are evaluated for the two filters where a higher energy level implies the filter is closer to the carrier and a lower energy level implies the filter is further from the carrier. Evaluating the difference between the two filter energy estimations can then be used to increase or decrease the estimation of the carrier.

[pic]

Figure 12: : Conceptual Filter Location of a FLL

For signals with symmetric transition bands, the filters should have an equal offset from the carrier; for asymmetric transition bands, the filters could be spaced differently or could have their energy levels scaled. It will be needed to identify the exact spacing / scaling factors for the filters.

1 Usage

Not currently implemented

2 Inputs

(double vector) samples from channelizer

3 Internal Variables

Filter state

Carrier estimate

4 Outputs

(double vector) samples modulated at the carrier frequency

5 Operation

A simple difference between filter power levels run at a downsampled rate and controls the frequency of the channelizer.

7 Initial Frame Synchronization

The goal of the frame synchronization routine is to correlate the known dotting sequence and the synchronization word sequences against the incoming signal to identify the correct beginning location of a received message. There are two types of frame synchronization which must be accomplished: initial synchronization (acquisition) and maintenance synchronization. Initial frame synchronization is the process of correlating with the dotting and synchronization word sequences before the signal has been previously acquired. Equation (7) shows the correlation.

[pic] (8)

Where:

[pic] => output correlation and the current sample time.

[pic] => current sample time.

[pic] => correlation sample index.

[pic]=>coefficients of the correlation sequence.

The initial synchronization sequence for the FOCC is the Manchester encoded 10 bits of dotting and 11 bits of word sync. The resulting Manchester encoded sequence is twice the sum of the bit length (42 samples long). The initial synchronization sequence for RECC is the Manchester encoded 30 bits of dotting and 11 bits of word sync. The resulting Manchester encoded sequence is 84 samples long. The initial synchronization sequence for FVC and RVC is the Manchester encoded 101 bits of dotting and 11 bits of word sync. The resulting Manchester encoded sequence is 224 samples long.

Maintenance synchronization (tracking) is discussed as a separate routine in Section 2.6.8.

1 Usage

int initial_sync_correlator(double in_sample,

double in_sample_soft_buf[],

int in_sample_hard_buf[] ,

int *numOfMatches,

double *sum_correlation,

int init_sync_corr_length)

2 Inputs

in_sample => input sample from PLL.

init_sync_corr_length = > length in manchester samples of the correlation sequence.

3 Internal Variables

double initial_soft_correlation_buf[]; //soft bit corr pattern

Int initial_hard_correlation_buf[]; //hard bit corr pattern

4 Outputs

input_sample_ptr => ptr to the position of maximum correlation against the synchronization sequence.

5 Operation

The basic operation will be a correlation search over the sequence of half-symbols from the symbol synchronization routine against the dotting and word sequence. Two types of correlation will be used. The output of a soft bit correlation will compared with a fixed threshold to find a possible initial synchronization sequence candidate. The detected candidate must be then validated using the hard bit correlation. The hard bit correlation counts the number of hard bit matches and compares the result against the desired correlation sequence. If the number of matches exceeds the threshold initial synchronization is declared.

[pic]

Figure 13: : Soft Correlation Output

Figure 13 shows the output of a soft correlation. The point of maximum energy is the position of initial synchronization (sample 1060).

[pic]

Figure 14: Soft Correlation Output

Figure 14 shows the output of a hard bit correlation over the RVC frame at high signal to noise. The point having the maximum number of matches against the synchronization sequence is the position of initial synchronization. The maximum number of matches is equal to the length of the correlation pattern (dotting = 101 +synch word = 11) times two for Manchester encoding (224 at sample number 1060). The nine smaller peaks are equal to the shorter synchronization patterns in the RVC frame (dotting =37 + synch word= 11) times two for Manchester encoding (96 samples).

[pic]

Figure 15: Soft Correlation Output

A test is run by continuously reacquiring initial synchronization on the first frame. Figure 15shows a bit error rate comparison of data contained in the first frame assuming perfect initial synchronization verses achieving initial synchronization using the correlation algorithm. The plot above was generated using the Matlab script “BER_RVC_init_sync_curves.m”.

8 Maintenance Frame Synchronization

The goal of the maintenance frame synchronization routine is to correlate the dotting sequence and the word sequence against the incoming signal to detect whether or not the sample of peak energy has changed. A change in sampling time could occur because of a difference in reference clocks between the transmitter and the receiver. Should the maintenance correlation detect more energy at an adjacent sample position it will add or subtract a sample position from the counter and then point to the new sample of peak energy.

1 Usage

maintenanceSync((double)in_sample,

(int) &inputSamplePtr,

(int) maint_sync_window_ctr,

(int) &first_sync_maint_pass,

(int) maint_sync_corr_length) ;

2 Inputs

in_sample => input sample from PLL

maint_sync_corr_length = > length in manchester samples (2*bit_lenth of the correlation sequence)

3 Internal Variables

None

4 Outputs

input_sample_ptr => ptr to the position of maximum correlation against the synchronization sequence.

5 Operation

The basic operation will be a correlation search over the sequence of Manchester half-symbols from the symbol synchronization routine against the dotting and word sequence.

This function implements a multiphase correlation. The number of phases are equal to the over sampling rate of each Manchester sample which in this case is five.

[pic]

Where:

[pic] => output correlation and the current sample time.

[pic] => current sample time. (range 1 thru 5)

[pic] => correlation sample index. 2*(length of dotting +synch word)

[pic]=>coefficients of the correlation sequence.

The function maintains a counter of each sample in the frame to determine the next expected position of maximum correlation. Upon counting down to the expected next position of maximum correlation, the function compares the soft correlation output of each phase of the multiphase correlation. The position of maximum correlation is selected as the optimum sample for bit detection. In addition to the above algorithm, frame to frame averaging of the five correlation phase outputs provides more robust performance in a fading environment. The equation for the leaky integration is shown below.

[pic] (9)

Where: [pic] =>represents an averaged phase correlation output.

[pic] =>The value range of 1 thru 5 corresponds to each possible phase output.

[pic] =>integration time constant.[pic]

[pic] =>phase correlation output.

9 Framing

Different frame structures are used for the four (4) logical channels (forward voice, reverse voice, forward control, and reverse control). Each of these frames has a different structure and includes synchronization information and an effective repetition code of the transmitted words.

For example the Reverse Voice Channel (RVC) data is formatted using the frame shown in Figure 16 where the dotting sequence is 37 bits of the form (101010…101) and the word sequence (WS) is the 11-bit word (11100010010). Note that a single frame is repeated 5 times with the second word formed in the same format as the first word.

[pic]

Figure 16: RVC Frame. From Figure 2.7.2-1 in [AMPS_99]

1 Usage

The prototype for the forward control channel framing function is below.

AMPS_focc_frame((FOCC_MESSAGE*) &S_focc_cmd,

(AMPS_FRAME*) AMPS_frame_contents) ;

The prototype for the reverse control channel framing function is below.

AMPS_recc_frame((RECC_MESSAGE*) &S_recc_cmd,

(AMPS_FRAME*) AMPS_frame_contents) ;

The prototype for the forward voice channel framing function is below.

AMPS_fvc_frame((FVC_MESSAGE*) &S_fvc_cmd,

(AMPS_FRAME*) AMPS_frame_contents) ;

The prototype for the reverse voice channel framing function is below.

AMPS_fvc_frame((RVC_MESSAGE*) &S_rvc_cmd,

(AMPS_FRAME*) AMPS_frame_contents) ;

2 Inputs

The first function:

AMPS_focc_frame( FOCC_MESSAGE *AMPS_focc_cmd,

AMPS_FRAME *AMPS_frame_contents) ;

Inputs: AMPS_focc_cmd structure containing message information.

The second function:

AMPS_fvc_frame( FVC_MESSAGE *AMPS_fVc_cmd,

AMPS_FRAME *AMPS_frame_contents) ;

Inputs: AMPS_fvc_cmd structure containing message information.

The third function:

AMPS_recc_frame( RECC_MESSAGE *AMPS_recc_cmd,

AMPS_FRAME *AMPS_frame_contents) ;

Inputs: AMPS_recc_cmd structure containing message information.

The fourth function:

AMPS_rvc_frame( RVC_MESSAGE *AMPS_rvc_cmd,

AMPS_FRAME *AMPS_frame_contents) ;

Inputs: AMPS_rvc_cmd structure containing message information.

3 Internal Variables

int dotting[] = {1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1};// dotting

int sync_word[]={1,1,1,0,0,0,1,0,0,1,0}; // sync word

int busy_idle ;// used in FOCC to flag ReCC availability

4 Outputs

The first function:

AMPS_focc_frame( FOCC_MESSAGE *AMPS_focc_cmd,

AMPS_FRAME *AMPS_frame_contents) ;

Outputs: AMPS_FRAME *AMPS_frame_contents.

The second function:

AMPS_fvc_frame( FVC_MESSAGE *AMPS_fVc_cmd,

AMPS_FRAME *AMPS_frame_contents) ;

Outputs: AMPS_FRAME *AMPS_frame_contents.

The third function:

AMPS_recc_frame( RECC_MESSAGE *AMPS_recc_cmd,

AMPS_FRAME *AMPS_frame_contents) ;

Outputs: AMPS_FRAME *AMPS_frame_contents.

The fourth function:

AMPS_rvc_frame( RVC_MESSAGE *AMPS_rvc_cmd,

AMPS_FRAME *AMPS_frame_contents) ;

Outputs: AMPS_FRAME *AMPS_frame_contents.

5 Operation

Each of the framing function builds the corresponding frame in an unpacked format.

10 Manchester Encoding / Decoding

Non-return to zero (NRZ) data are encoded using Manchester encoding such that each NRZ one is transformed to a one-to-zero transition and each NRZ zero is encoded as a zero-to-one transition. The bits encoded by the Manchester encoding need to be modified such that the modulation applied to transmitter carrier results in a direct binary frequency shift keying (BFSK) signal where a one into the modulator corresponds to a nominal peak frequency deviation of 8 kHz above the carrier and a zero to 8 kHz below the carrier frequency.

1 Usage

Encoder:

Functions: AMPS_manchester_encode(AMPS_FRAME*AMPS_frame_contents,

int *AMPS_position_in_frame,

int AMPS_number_bits_to_process*2*5,

double *manchester_encoded_vector[]);

Decoder:

Functions: AMPS_manchester_decode(int *manchester_encoded_vector[],

int *bit_vector[],

int output_vector_length)

2 Inputs

Encoder:

AMPS_frame_contents => contains input bits to encode

AMPS_position_in_frame => contains pointer to next bit to process

AMPS_number_samples_to_process => length(num_bits*2*upsample_rate)

Decoder:

manchester_encoded_vector => vector containing encoded bits

output_vector_length => number of output bits to decode

3 Internal Variables

Encoder:

int input_vector_length ; // length of data bits to encode

int *ptr ; // pointer to output vector of encoded bits

Decoder:

int i ; // general counter

int *ptr_input ; // pointer to manchester encoded vector input

int *ptr_output; // pointer to decoded bit vector

4 Outputs

Encoder:

manchester_encoded_vector => vector containing encoded bits upsampled by five and deviation scaled.

Decoder:

bit_vector => contains decoded output bits.

5 Operation

Encoding is a straight-forward process, but its output sampling rate and amplitude should match that of the FM modulator. Accordingly, the Manchester encoding function performs the following tasks: Manchester encoding, upsampling by five, and deviation scaling. The length of the output vector is equal to the number of bits to encode times 2 (from Manchester encoding) times 5 (up sample rate before modulation).

Decoding requires help from frame synchronization to ensure proper alignment of Manchester encoded symbols.

11 Phase Lock Loop (PLL)

While the FLL will remove much of the RF carrier, this is a very coarse process (though very useful for initial carrier acquisition). A finer estimation / carrier recovery process can be performed by following an FLL with a PLL.

A PLL is used to recover (and remove) the carrier frequency (and phase) of an incoming signal. It will be important for proper coherent recovery of FSK and is used to demodulate FM (with the phase estimation “errors” being the message signal).

The PLL design is described in the document “Advanced Mobile Phone System (AMPS) FM Simulation” [AMPS_FM].

1 Usage

[phase_diff] = AMPS_PLL(msg, Fc, Fs, enable_bits)

2 Inputs

msg => input message to modulate

3 Internal Variables

ptr_signal_output_vector=> pointer to output demodulated signal vector.

hilbert_buf[] =>hilbert transform filter data buffer.

delay_buf[] =>inphase data buffer.

msg_I_vector[]=>inphase component of the message.

msg_Q_vector[]=>quadraphase component of the message.

est_I =>Current inphase phase carrier estimate.

est_Q =>Current quadraphase phase carrier estimate.

real_val =>Baseband inphase message value.

imag_val =>Baseband quadraphase message value.

phase_acc =>Phase accumulator value.

phase_err =>Phase error value.

LF_acc =>Loop Filter Integration Accumulator.

4 Outputs

Phase_diff => demodulated message

5 Operation

This will reuse the code from the FM simulation. [AMPS_FM]

7 System Testing Results

The simulation results for each of the four data channels are shown in a series of bit error rate (BER) plots. This simulation is an end-to-end test which exercises both the transmitter and receiver code builds. In the transmitter, the message bits are BCH encoded, inserted in the selected frame format, Manchester encoded, and then FM modulated. In the receiver, the signal is demodulated, bit voted, BCH decoded and the original message recovered. The Matlab scripts used to collect data for these plots are “AMPS_FSK_VC_BER_test.m” and “AMPS_FSK_CC_BER_test.m”. The Matlab scripts used to display the BER plots are “BER_RECC_curves.m”, “BER_FOCC_curves.m”, “BER_FVC_curves.m”, and “BER_RVC_curves.m”. Each plot shows the BER performance in a Gaussian white noise environment. There are five curves on each of the plots. The curve labeled “raw bits” shows the BER performance including all of the detected bits (e.g. dotting, synchronization word and message) at the output of the PLL without and channel coding. The curve labeled “message bits voting BCH” shows the expected performance in the system with both voting and BCH channel coding. The curve labeled “no voting BCH” shows the improvement in performance with only the BCH channel coding. The curve labeled “message bits no voting no BCH” shows the performance of the detected message bits with no channel coding. The curve labeled “message bits voting no BCH” shows the improvement in performance of the detected message bits with voting but no BCH.

=

The first channel shown is the reverse control channel (RECC). The curves for the BER RECC are show below.

[pic]

Figure 17: RECC BER curves

The second channel shown is the reverse control channel (FOCC). The curves for the BER of FOCC are show below.

[pic]

Figure 18: FOCC BER curves

The third channel shown is the reverse control channel (FVC). The curves for the BER of FVC are show below.

[pic]

Figure 19: FVC BER curves

The fourth channel shown is the reverse control channel (RVC). The curves for the BER of RVC are show below.

[pic]

Figure 20: RVC BER curves

8 References

The following documents are used as sources of information when using this test plan.

• [AMPS_SDD] J. Neel, “Advanced Mobile Phone System (AMPS) Specification Document,” version 1.0 Oct 14, 2008.

• [AMPS_FM] J. Neel, “Advanced Mobile Phone System (AMPS) FM Simulation,” v 1.0, Dec 12, 2008.

• [AMPS_99] TIA/EIA-553-A “Mobile Station – Base Station Compatibility Standard,” November 1999.

Simulation of FM PHY

As described in (J. Neel, “AMPS FM (Voice) Simulation Design Document,” version 1.0 Oct 22, 2008.), the simulation was initially intended to model the physical layer operations of AMPS FM voice in the Conversation state as a first step towards SINCGARS. Currently, the FM voice application has been implemented on the Lyrtech SFF and is being ported to the FlexRadio solution.

There are two links in an AMPS voice system – from BS to MS and from MS to BS. Because the SAT tone transmitted by the BS must be looped back to the MS to the BS, an accurate simulation will require both links to be operational as illustrated in Figure 6. In Figure 6, all inputs from the link layer (e.g., setting channel, enabling ST tone) will be treated as a top-level simulation variables and all outputs to the link later as top-level simulation results.

[pic]

Figure 1: End Simulation System Architecture

However, for purpose of testing and development we will develop simulations of the Forward Link (BS transmitter to MS receiver), Reverse Link (MS Transmit to BS Receive), and each of the four principle AMPS blocks (BS Transmit, MS Receive, MS Transmit, and BS Receive).

The following figures show the data flow of the components within each of the primary AMPS FM voice blocks illustrated in Figure 6 (all except for the channels) as originally designed. Note that many blocks in the BS transmitter are replicated in the MS transmitter and many of the blocks in the BS receiver are replicated in the MS receiver.

[pic]

Figure 2: BS AMPS FM Transmitter Communications Blocks

[pic]

Figure 3: MS AMPS FM Receiver Communications Blocks

[pic]

Figure 4: MS AMPS FM Transmitter Communications Blocks

[pic]

Figure 5: BS AMPS FM Receiver Communications Blocks

1 File Listing

The following gives a listing of the files included in the initial release with a brief description of its function. Details on design, use, and testing are given in subsequent sections.

• AMPS_BS_RX_PHY_FM.m BS PHY FM block receiver

o AMPS_BS_audio_filter.m Separate audio from SAT / ST

o AMPS_BS_channelizer.m Digital down conversion

o AMPS_BS_CMA_equalizer CMA equalizer

o AMPS_BS_De_emphasis.m De-emphasis filter

o AMPS_BS_expander.m Expander

o AMPS_BS_PLL.m Phase-locked loop

o AMPS_BS_SAT_block.m SAT recover / detect

o AMPS_BS_ST_detect.m Detect ST

• AMPS_BS_TX_PHY_FM.m BS PHY FM block transmitter

o AMPS_BS_compressor.m 2:1 Syllabic compressor

o AMPS_BS_deviation_limiter.m Deviation

o AMPS_BS_FM_Mod.m FM Modulator

o AMPS_BS_gen_SAT.m SAT generator

o AMPS_BS_post_limit_filter.m Post deviation-limiter filter

o AMPS_BS_Pre_emphasis.m Pre-emphasis filter

o AMPS_BS_upconvert Upconvert carrier

• AMPS_MS_RX_PHY_FM.m BS PHY FM block receiver

o AMPS_MS_audio_filter.m Separate audio from SAT / ST

o AMPS_MS_channelizer.m Digital down conversion

o AMPS_MS_CMA_equalizer CMA equalizer

o AMPS_MS_De_emphasis.m De-emphasis filter

o AMPS_MS-FM_demodulate.m Remove frequency scaling

o AMPS_MS_expander.m Expander

o AMPS_MS_PLL.m Phase-locked loop

o AMPS_MS_SAT_block.m SAT transponder / detect

• AMPS_MS_TX_PHY_FM.m BS PHY FM block transmitter

o AMPS_MS_compressor.m 2:1 Syllabic compressor

o AMPS_MS_deviation_limiter.m Deviation

o AMPS_MS_FM_Mod.m FM Modulator

o AMPS_MS_gen_ST.m ST generator

o AMPS_MS_post_limit_filter.m Post deviation-limiter filter

o AMPS_MS_Pre_emphasis.m Pre-emphasis filter

o AMPS_MS_upconvert Upconvert carrier

• Support scripts

o calculate_chan_freq.m return frequency for chan #

o gen_audio_source.m sampled audio (file or random)

o has_toolbox.m check if Matlab has a toolbox

o link_plots.m Time and frequency domain + error

o scale_phase.m phase => [0 2()

o rockytop.wav sample 8 ksps audio file

• Test scripts and design files

o AMPS_forward_link_test.m Forward link system test

o AMPS_reverse_link_test.m Reverse link system test

o AMPS_errr.m FM MSE estimate

o Channelizer_test.m Channelizer / upconverter tests

o Compressor_test.m compressor / expander test

o Dev_filter_design.m post deviation limiter filter design

o Eval_Carson_BW.m An FM modulation test

o Eval_peak_nominal_deviation.m Verifying peak nominal deviation

o FM_demod_test.m Modulation / demodulation test

o FM_modulate_test.m Simple modulation comparison

o gen_SAT_test.m verify generation of SAT

o PLL_design.m initial parameter selection / test

o post_filter_test .m Post-deviation limit filter test

o pre_emp_design.m Pre-emphasis filter design

o squelch_filter_design.m squelch design

o squelch_test.m squelch test

2 General Design Considerations

The following general design considerations are made in the simulation:

• All functions are implemented to process blocks of samples rather than individual samples (as is done in some sample-based simulations) or calling each block once with the entire set of simulation samples. This reduces execution time for simulation and implementation, will be more in line with how the system will need to be implemented (buffered samples), and will be critical for proper modeling of interactions between layers.

• To facilitate block processing, routines store internal states between calls (e.g., filter states, phases in tone generators).

• Since the design will likely need to change in several ways as the implementation platform is defined (e.g., block size based on DMA buffer and sampling rates) and as we transition to SINCGARS-lite (e.g., modulation index, compressors / expanders), routines are designed such that changes in major design decisions automatically update the processing of each routine. The exception to this principle is automatic filter generation which could significantly slow down the simulation.

• All routines are currently implemented as .m files. These were transitioned to mex files (C-code called from within Matlab) as part of the implementation process to provide another means of code verification (C-code should be sample-for-sample equivalent to Matlab for identical inputs).

3 References

The following documents are used as sources of information when using this test plan.

• J. Neel, “Advanced Mobile Phone System (AMPS) Specification Document,” version 1.0 Oct 14, 2008.

• J. Neel, “AMPS FM (Voice) Simulation Design Document,” version 1.0 Oct 22, 2008.

• TIA/EIA-553-A “Mobile Station – Base Station Compatibility Standard,” November 1999.

• IEEE 829-1983 “IEEE Standard for Software Test Documentation,” March 21, 1991.

4 Routine References

The following covers the use, design, and test results for each of the routines called by the MS and BS transmitters and receivers. Since many routines are reused between the BS and the MS, they are only discussed once. When there are differences between the implementations, those differences are noted.

1 Audio Filter

The audio filter is intended to remove the higher frequency components on the audio branch after FM demodulation (see below).

[pic]

Figure 3-6: Audio filter location in a receiver

1 Usage

%AMPS_MS_audio_filter

%

%Filters out components above 4 kHz (e.g., SAT tones) from audio branch

%Assumes sampling rate of 30 kHz

%

%USAGE: [out_sig, out_states] = AMPS_MS_audio_filter(msg, in_states)

% msg => demodulated message

% [optional] in_states => internal filter states

%

% out_sig => output signal

% [optional] out_states => internal states

2 Design Considerations

The output of the FM demodulator / PLL is sampled at 30 ksps (for better tracking performance) with subsequent branches designed to be sampled at the same rate. Because the phase and amplitude of the output signal carries, a linear phase, equiripple FIR is desirable. Audio information is carried from 0 to 4 kHz and undesired information above 5.9 kHz.

Filter design parameters:

Sampling rate = 30ksps

Fpass = 4 kHz

Fstop = 5 kHz

Stopband attenuation = 40 dB

Passband ripple = 0.01

Filter coefficients (via fdatool):

b = [-0.003142926263170 -0.004199523552945 0.002998076220919 0.002391661669087 0.003696816706031 -0.000434537633437 -0.004050873795509 -0.005467065992568 -0.001664849865071 0.004476414669704 0.008018782874840 0.004787072860083 -0.003687891909247 -0.010715122932666 -0.009320562818586 0.001127641283793 0.012964223112006 0.015438923688475 0.004019122188674 -0.013969424870446 -0.023319631365764 -0.013043559639283 0.012502185615295 0.033602200050262 0.028867023989863 -0.006008412484403 -0.049079259530669 -0.062056443682625 -0.015312921357986 0.088402193690618 0.209221166019303 0.290115540998982 0.290115540998982 0.209221166019303 0.088402193690618 -0.015312921357986 -0.062056443682625 -0.049079259530669 -0.006008412484403 0.028867023989863 0.033602200050262 0.012502185615295 -0.013043559639283 -0.023319631365764 -0.013969424870446 0.004019122188674 0.015438923688475 0.012964223112006 0.001127641283793 -0.009320562818586 -0.010715122932666 -0.003687891909247 0.004787072860083 0.008018782874840 0.004476414669704 -0.001664849865071 -0.005467065992568 -0.004050873795509 -0.000434537633437 0.003696816706031 0.002391661669087 0.002998076220919 -0.004199523552945 -0.003142926263170];

Filter frequency response:

[pic]

3 Testing

Testing was performed by alternating between enabling and disabling the audio filter. As can be seen below, eliminating the SAT component from the audio chain significantly reduced the presence of undesirable higher frequency components and reduced mean-square error by about an order of magnitude – from 1.3813e-003 to 2.3208e-004. Peak error was also reduced by about a factor of 2.

| |Power spectral density |Time domain |Error |

|Without Filter| |[pic] |[pic] |

| |[pic] | | |

|With Filter | |[pic] |[pic] |

| |[pic] | | |

2 Audio Source

To aid the simulation, a routine was written to either return audio samples from a .wav file or simulate an audio source sampled at 8 ksps. This function also includes a subroutine to resample the generated audio signal to output the audio at the desired sampling rate.

1 Usage

%AMPS_MS_gen_audio_source

%

%Generates white noise then filters it to appear like an audio signal

%If a filename is specified, that is used instead

%Defaults to 30kHz output Sampling rate

%

%USAGE: out_msg = AMPS_MS_gen_audio_source(Num_samp, Fs, filename)

% Num_samp => Number of samples

% [optional] Fs => output sampling rate

% [optional] filename => alternate source for samples

%

% out_msg = audio signal

2 Design

As reading samples from a file is straight-forward, this section focuses on the generation of random audio samples.

To generate random audio samples, white noise is generated and then filtered to conform with audio spectrum. To determine the audio spectrum, a PSD for a .wav file (rocky top) was evaluated. Then a minimal order filter was designed to conform with this PSD.

This resulted in the following filter coefficients in a first-order IIR.

b = [0.2929 0.2929];

a = [1.0000 -0.4142];

[pic]

To achieve the desired 30 ksps, the result of this filtering process is upsampled to 30 ksps.

3 Testing

To test the generation of white noise, the spectrum of the our random audio source was compared against our wav file as shown below.

[pic]

3 Channelizer

The channelizer (down converter) extracts 30 kHz from a real 40 Msps signal (assumed ADC sampling rate).

1 Usage

%AMPS_MS_channelizer

%

%Via a 5 stage decimator / filter structure, AMPS_MS_channelizer

%downconverts signal at specified channel #, extracts 30 kHz signal sampled

%at 100 ksps. Assumes 40 Msps input signal.

%

%USAGE: [msg_out] = AMPS_MS_channelizer(msg, chan_num)

% msg => real message from ADC (40 Msps)

% chan_num => chan# where signal is located (see AMPS standard)

%

% msg_out => extracted signal @ 100 ksps

2 Design Considerations

If we assume that the front end digitizes all 10 MHz (333 channels) simultaneously with an oversampling factor of 4, that implies an ADC sampling rate of 40 MHz.

At the input to the PLL, we would like a single FM signal (30 kHz BW) oversampled by approximately a factor of 4 (120 kHz). Since 120 kHz does not neatly divide into 40 MHz (implying a more complicated resampling process), we use 100 kHz. This implies a decimation factor of 400. As large decimation / filtering factor can be more efficiently implemented in a multi-stage form, we implement decimation over four stages (x5, x4, x5, x4).

Since we need to both translate the desired signal to baseband and downsample, the digital downconversion routine is implemented by performing an initial frequency translation to baseband followed by the four decimation stages. A final filtering stage is used to limit the final signal bandwidth to 30 kHz (channel bandwidth). The basic design is illustrated below.

[pic]

Design parameters for each decimator and filter and shown below with filter coefficients following. Because phase information must be preserved at multiple frequencies, linear phase FIR filters are used.

|Stage |Fs in |Fs out |Fpass |Fstop |

|Decimator 1 |40 Msps |8 Msps |1 MHz |3 MHz |

|Decimator 2 |8 Msps |2 Msps |100 kHz |900 kHz |

|Decimator 3 |2 Msps |400 ksps |50 kHz |150 kHz |

|Decimator 4 |400 ksps |100 ksps |30 kHz |50 kHz |

|Output LPF |100 ksps |100 ksps |30 kHz |35 kHz |

Coefficients

b1 = [0.001184572728033 0.002827713058872 0.005799022218677 0.010304984490724 0.016532606431296 0.024479327545031 0.033909605533120 0.044333106006387 0.055038260948726 0.065160025110236 0.073784840296574 0.080076225495291 0.083395231290952 0.083395231290952 0.080076225495291 0.073784840296574 0.065160025110236 0.055038260948726 0.044333106006387 0.033909605533120 0.024479327545031 0.016532606431296 0.010304984490724 0.005799022218677 0.002827713058872 0.001184572728033];

b2 = [0.001532769801304 0.004490382268067 0.010080156251386 0.018865500941027 0.031004527418311 0.045981598961127 0.062532807471416 0.078777778907817 0.092536237950146 0.101766913270534 0.105018769915506 0.101766913270534 0.092536237950146 0.078777778907817 0.062532807471416 0.045981598961127 0.031004527418311 0.018865500941027 0.010080156251386 0.004490382268067 0.001532769801304];

b3 = [-0.002179248628590 -0.003374003909342 -0.005193061094693 -0.006754560125014 -0.007374780543155 -0.006242024354510 -0.002545098171039 0.004347497156960 0.014719381659733 0.028370653105620 0.044553878893949 0.062006712841855 0.079088244661314 0.093999088068192 0.105050579464221 0.110933438795678 0.110933438795678 0.105050579464221 0.093999088068192 0.079088244661314 0.062006712841855 0.044553878893949 0.028370653105620 0.014719381659733 0.004347497156960 -0.002545098171039 -0.006242024354510 -0.007374780543155 -0.006754560125014 -0.005193061094693 -0.003374003909342 -0.002179248628590];

b4 = [0.001332195480680 0.001977823939546 0.002552768925043 0.002291896961152 0.000812246580882 -0.001836256776405 -0.004994198740078 -0.007461635516893 -0.007861224944972 -0.005223151008536 0.000410432546899 0.007645513335298 0.013899754113758 0.016142714629032 0.012057458504639 0.001247813830527 -0.013996827542400 -0.028788341798022 -0.036724916223938 -0.031763191415547 -0.010333862345303 0.027018714462061 0.075112678971543 0.125029042618526 0.166274443043237 0.189598640945224 0.189598640945224 0.166274443043237 0.125029042618526 0.075112678971543 0.027018714462061 -0.010333862345303 -0.031763191415547 -0.036724916223938 -0.028788341798022 -0.013996827542400 0.001247813830527 0.012057458504639 0.016142714629032 0.013899754113758 0.007645513335298 0.000410432546899 -0.005223151008536 -0.007861224944972 -0.007461635516893 -0.004994198740078 -0.001836256776405 0.000812246580882 0.002291896961152 0.002552768925043 0.001977823939546 0.001332195480680];

b5 = [-0.001385930336432 -0.004910417613090 -0.000812634755176 0.003677030538957 -0.002743663299278 -0.002149848328284 0.005954685819876 -0.002926078617513 -0.005310561312236 0.009223806701905 -0.001875790062027 -0.010576403279944 0.012933118119029 0.001374052860769 -0.018639785953022 0.016691018913165 0.008431718602306 -0.031150217390599 0.020036577482161 0.023203886241155 -0.053500436240989 0.022559590363544 0.062224736903565 -0.118489522260608 0.023913351537814 0.538571426022072 0.538571426022072 0.023913351537814 -0.118489522260608 0.062224736903565 0.022559590363544 -0.053500436240989 0.023203886241155 0.020036577482161 -0.031150217390599 0.008431718602306 0.016691018913165 -0.018639785953022 0.001374052860769 0.012933118119029 -0.010576403279944 -0.001875790062027 0.009223806701905 -0.005310561312236 -0.002926078617513 0.005954685819876 -0.002149848328284 -0.002743663299278 0.003677030538957 -0.000812634755176 -0.004910417613090 -0.001385930336432];

3 Testing

To test the performance of the channelizer, two different messages were upconverted and then input to the channelizer. Upconverted power spectrum is shown below on the left. On the right, the downconverted signal and the original modulated signal are shown.

|[pic] |[pic] |

We also input the wrong channel number (off by 5) and verified that signal power was dramatically decreased (essentially filtered noise @ -140 dBm),

[pic]

As a system test, the upconverter and channelizer were integrated into a link simulation and the error vector evaluated as shown below.

[pic]

4 Compressor / Expander

The compressor routines implements a 2:1 (2 dB increase in input results in a 1 dB increase in output) syllabic compressor with an attack time of 3 ms and a nominal recovery time of 13.5 ms, time constant is 20 ms. The expander undoes this operation at the receiver.

1 Usage

%USAGE: ans = AMPS_expander(msg, Fs, state)

% msg => input message to compress

% Fs => Sampling rate, defaults to 15 kHz

% in_state (optional) => state of LPF from previous call

%

% ans => modified message, length(ans) = length(msg)

% out_state => final state of LPF filter

2 Design Considerations

The design for the compressor was adopted from (P. Black, et al., "Digital FM Audio Processing in a dual-mode %communication system, US Patent 6,246,885 B1. Issued Jun 12 2001) which can be implemented as shown below.

[pic]

where for a sampling rate of 30 ksps the following loop filter parameters are used.

• a = 1/30e3/20e-3;

• Kc = 1/8.6e-3;

The expander uses the same loop filter, but reverses this operation as shown below.

[pic]

Note that (P. Black, et al., "Digital FM Audio Processing in a dual-mode %communication system, US Patent 6,246,885 B1. Issued Jun 12 2001) suggests interpolating and decimating by a factor of 3 before and after the abs() block for greater phase resolution. However this is not necessary for our implementation as the implementation is clocked at 30 ksps (P. Black is implemented at 8x3 = 24 ksps), implying a natural greater phase resolution.

3 Testing

To test the 2:1 compressor and expanders we swept the power of the signal input to the compressor and expander from -6 dBw to 14 dBw. The results are shown below for the input/output ratios for the compander alone (top), expander alone (middle) and the compander followed by the expander (bottom).

[pic]

Example time domain signals for a random audio signal before compression, after compression, and after compression – then-expansion is shown below.

[pic]

The induced error in the process was measured (by comparing input and output signals) and seen to be very low as shown below.

[pic]

5 Demodulator

Nominally, with phase extraction / residual carrier removal performed by a PLL, the output signal takes the form [pic] so that output message is scaled by the ratio of frequency deviation to the sampling rate. This routine restores proper scaling.

1 Usage

%AMPS_MS_FM_demodulate

%

%Scales the input msg by the specified factor

%

%USAGE: ans = AMPS_MS_FM_demodulate(msg,scale)

% msg => input message to compress

% scale => scale factor

%

% ans => modified message, ans = msg * scale

2 Design

This process simply multiplies the input message vector by a scalar to undo scaling effects, so this design discussion is greatly abbreviated.

While the output signal takes the form [pic] so that output message is scaled, the loop filter also imparts a gain, so the calculation is not as straight forward. Currently that scalar is set to 7 which was determined empirically.

6 Deviation Limiter

The deviation limiter ensures that the audio signal does not drive the deviation of the FM signal beyond some specified limit thereby creating out-of-band interference for other signals. In AMPS, the maximum frequency deviation is limited to ±12 kHz, though this is not applied to the SAT or the ST. The simplest way to implement a deviation limiter is to clip audio signals above a given amplitude level.

1 Usage

%AMPS_BS_DEVIATION_LIMITER

%

%Implements a deviation limiter to limit audio modulation to a maximum

%instantaneous frequency deviation of 12 kHz

%

%USAGE: ans = AMPS_BS_deviation_limiter(msg, lambda)

% msg => input message to limit

% lambda => Maximum magnitude

%

% ans => modified message, length(ans) = length(msg)

%

% Lambda should be set to 8 kHz for a maximum nominal deviation of 10.9

% kHz and worst case to less than 12 kHz

%

% Operation

% ans(i) = lambda; msg(i) >= lambda

% ans(i) = msg(i); -lambda < msg(i) < lambda

% ans(i) = -lambda; msg(i) ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download