Chapter 18. Two Example Simulations

We conclude our study of simulation techniques and methodology by presenting two very different examples. The first example is a simulation of a CDMA system operating in a multipath/fading environment. Thermal noise and interference are also included in the simulation model. A number of performance results can be generated by the simulation model. These include the bit error rate (BER) as a function of the thermal noise level (PE versus Eb/N0), BER as a function of the spreading factor (spread-spectrum processing gain), and BER as a function of the number of interfering signals. Even though the system presented here is more complex than those presented in previous chapters, a number of simplifications are made so that the MATLAB code can be executed with a reasonable runtime. If desired, the simplifications can be removed and the resulting simulations can be coded in a compiled language for faster execution. Thus, this example can serve as a template for more advanced investigations. Monte Carlo simulation is used for this first example.

The second example is a multichannel (FDM) satellite communications system. A nonlinear power amplifier is assumed, and the purpose of the simulation is to evaluate the effect of the nonlinearity on the performance of the system. This second simulation makes use of the semianalytic simulation technique. Since semianalytic simulations typically execute much faster than Monte Carlo simulations, simplifying the simulation model is not as important as in the CDMA example.

A Code-Division Multiple Access System

The code-division multiple access (CDMA) simulator emulates a simple CDMA communications link. CDMA systems are widely deployed, and also serve as building blocks for more advanced systems. They are described in detail in the literature [1, 2]. A block diagram of the simulation model is illustrated in Figure 18.1. The simulation includes the effects of Additive White Gaussian Noise (AWGN), specular multipath, and Multiple Access Interference (MAI). Using this simulation, one can estimate the BER as a function of the bit energy to noise spectral density ratio (Eb/N0), the number of interferers (NoI), and the spreading factor (SF). One may apply any specular multipath channel provided that the channel has no more than five multipath components.

Methodology for CDMA example.

Figure 18.1. Methodology for CDMA example.

The System

Unlike FDMA (frequency division multiple access) or TDMA (time division multiple access), which separate wireless users by assigning different frequency bands or time slots, respectively, CDMA separates users through the assignment of different signature (code) sequences. Accordingly, a particular CDMA system will have at its disposal a signature sequence set consisting of a collection of pseudo-random sequences. This collection of sequences must have low cross-correlation properties; that is, the inner product of any two sequences in this collection must be small. This is necessary so that the receiver can accept the signal from a desired wireless user while rejecting the signals from the other (undesired) co-channel wireless users. In addition, each sequence in this collection must have correlation properties that allow the multipath effects commonly found in wireless channels to be exploited through the use of RAKE receivers or through space-time reception techniques.

The CDMA system assigns each user a specific signature sequence from the signature sequence set. This signature sequence is used to generate a spreading waveform, whose symbol rate (hereafter called the chip rate) is much higher than the symbol rate of the information-bearing signal (hereafter called the symbol rate). The ratio of the chip rate to the symbol rate is called the spreading factor or processing gain. Spreading factors typically range from values as low as 8 to values as high as 512.

CDMA systems typically use direct sequence spread spectrum techniques. The information-bearing waveform is modulated (multiplied) by the user’s spreading waveform to produce a spread spectrum signal, which is then radiated into the channel. At the channel output, the receiver (we assume a simple correlation receiver) correlates the incoming signal with the user’s spreading (signature) waveform. This accomplishes two tasks. It allows the user’s information-bearing signal (the desired signal) to pass through the correlation receiver, and it rejects the information-bearing signals (interference) of all other users.

In order to create a computationally efficient simulation of a CDMA communications link, the following simplifications/assumptions are incorporated:

  1. Perfect power control is assumed, and each signal is assumed to arrive at the receiver with equal average power.

  2. The signature/spreading sequence for the desired signal is a PN-sequence, as discussed in Chapter 7. Accordingly, the allowable spreading factors must be equal to 2R − 1, where R is a positive integer.

  3. The signature/spreading sequence used for each MAI signal is the same PN-sequence. However, the PN-sequence is shifted in a circular fashion so as to achieve the desired correlation properties. It is important to note that, even though these desired correlation properties are guaranteed in an AWGN channel, it is possible to lose these correlation properties in a specular multipath channel, as modeled here, since the desired and interfering signals are separated in time by an integer number of chips. There is a small probability that these delays may equal the multipath delays, resulting in pessimistic results when simultaneously simulating interference and multipath.

  4. Binary phase shift keying modulation is assumed and pulse shaping is neglected.

  5. The multipath channel exhibits Rayleigh fading on each multipath component with the exception of the line-of-sight component, which is not faded. The interfering signals do not exhibit fading.

  6. The delays of each multipath component are limited to integer multiples of the chip duration.

  7. The desired signal and all MAI signals are chip synchronized at the receiver.

  8. The receiver is a simple correlation receiver. No rake receiver is used.

Neglecting the detailed modeling of the pulse shape and the corresponding matched filters at the receiver has a dramatic effect on the speed at which the simulation executes, since the underlying waveforms in the system can be executed at one sample per chip. Reasonable results will be obtained if zero-ISI pulse shapes (e.g., root raised cosine pulse shape) are used in the system.[1]

In a practical application, channel measurements would be used to determine a power-delay profile, and the simulation would be executed using a suitable approximation to the measured power-delay profile. This ensures that the simulation model accurately characterizes the environment in which the wireless system is deployed. In this simulation, however, it is important to note that a delay profile is explicitly specified and the power profile is computed so that a given Ricean K-factor is satisfied. The motivation for doing this lies in the fact that students of communication theory have some understanding of the relationship between system performance and the Ricean K-factor. For example, for K large, system performance is essentially equivalent to performance in an additive Gaussian noise environment. For K ≅ 0, the environment is Rayleigh fading and can be flat fading or frequency selective fading depending on the number of multipath components and the delays associated with those components. Analytical solutions for the BER exist for both of these limiting situations [3], and these solutions serve as sanity checks for the simulation results.

For this simulation, the multipath delay profile is simply a vector of integers, where each integer represents the delay of each multipath component in terms of the chip periods, which is the symbol period divided by the spreading factor. The simulation assumes that the first element in this vector corresponds to the line-of-sight (LOS) component and that the remaining elements correspond to the scattered (multipath) components. The length of this vector is determined by the total number of received components (the LOS component plus the scattered components).

After the delay profile and the Ricean K-factor is specified, a power profile is calculated so that the specified K-factor is realized. The resulting power profile, along with the delay profile, can be displayed by the postprocessor if desired. One may also modify the simulation code to support the input of both a delay and power profile. Such a modification is a straightforward endeavor.

We now examine the manner in which the power profile is determined so that the specified Ricean K-factor is satisfied. The average amplitude of each scattered component is produced via a random number generator, having outputs uniformly distributed between 0 and 1. Let

Equation 18.1. 

denote the average amplitude of each scattered component. Note that M is the total number of multipath components (M − 1 scattered signals plus the line-of-sight component). One can then compute the average scattered energy, which is given by

Equation 18.2. 

The average energy in the LOS component is computed as

Equation 18.3. 

where K is the Ricean K-factor. The average amplitude of the LOS component is then

Equation 18.4. 

The average amplitude profile is obtained by adding αLOS to the vector for the scattered components Ascat. The resulting vector is then normalized so that the strongest multipath component has a value of 1.0. Thus:

Equation 18.5. 

The power profile is then obtained by squaring the elements in A. Therefore:

Equation 18.6. 

Clearly, for cases where K > 1, the LOS component will be the strongest received component, and aLOS = 1.0. However, for the case in which K ≤ 1, the situation is not as clear. In such a case, the average scattered energy exceeds the average energy in the LOS component. However, the average scattered energy, Escat, may be spread across several multipath components. In such situations, the LOS component may, or may not, be the strongest multipath component. Displaying the power profile will, of course, allow the user to identify the strongest received component.

Once the delay profile and the amplitude (power) profile are specified, the channel model is determined. The channel model is illustrated in Figure 18.2. The Rayleigh random process generator is illustrated in Figure 18.3 and is implemented as discussed in Chapter 7. Two independent Gaussian random variables, xd[n] and xq[n], are generated and filtered to produce yd[n] and yq[n]. The filter type in the Rayleigh process generator is arbitrary and was chosen to be a fourth-order Chebyshev filter with 0.5 dB passband ripple and a bandwidth equal to the doppler frequency. The magnitude, , is a Rayleigh random variable.

Channel model for CDMA example.

Figure 18.2. Channel model for CDMA example.

Rayleigh random process generator.

Figure 18.3. Rayleigh random process generator.

The simulation also requires the specification of the Eb/N0 parameter. This parameter determines the ratio of the average bit energy in the strongest multipath component (the LOS component for K > 1) to the thermal noise energy, that is, Eb/N0. Note that the average power of the strongest multipath component will be normalized to unity. Accordingly, the simulation scales the energy of the white Gaussian (thermal) noise so that average Eb/N0 in the strongest multipath component equals the Eb/N0 parameter

The Simulation Program

The example CDMA simulation has a block serial structure in which blocks of 1,000 symbols are serially processed. As discussed in Chapter 10, the block serial structure is used for computational efficiency. The simulation is completely contained in the function c18_cdmasim. It is invoked by the MATLAB call

Equation 18.7. 

The MATLAB code for the function c18_cdmasim is given in Appendix A. The preceding line of MATLAB code fully defines the main simulation program (the simulation engine). To this is added a preprocessor and a postprocessor. For our application, these are combined into a single program. An example preprocessor/postprocessor is also given in Appendix A. These should be viewed only as examples, and the student is encouraged to experiment with these and customize them as desired.

The input parameters are defined in Table 18.1. It is important to observe the restrictions. Note that these restrictions apply to each call to the simulator. One may certainly develop a preprocessor in which a given parameter is iterated over a range of values.

 

Table 18.1. CDMA System Input Parameters

Parameter

Type

Description

Restrictions

N

Scalar

Number of symbols simulated

None

SF

Scalar

Spreading factor

SF = 2n, n ≤ 12

Eb/N0

Scalar

Ratio of bit energy to noise PSD

None

NoI

Scalar

Number of Interferers

0 NoI SF − 1

MPathDelay

Vector

Multipath delay profile

Vector of monotonically increasing non-negative integers

KfactordB

Scalar

Ricean K-factor in dB

None

Example Simulations

Baseline Validation

In order to ensure that the simulation is properly calibrated, the CDMA simulator was first executed with a Ricean K-factor of 100 dB. This K-factor is sufficiently large to ensure that, even though a very small level of multipath is present, the scattered power is sufficiently attenuated to make the approximation that all of the received power is in the LOS component. Thus, the only degrading effect is Gaussian noise and, as a result, the error probability for the system is

Equation 18.8. 

The simulation was performed with N = 200,000 symbols processed for each value of Eb/N0. The value of Eb/N0 was varied from 0 to 8 dB in 1-dB steps. The MATLAB dialog for the simulation run is

>> c18_cdmacal
Enter number of symbols to be processed > 200000
Enter Eb/No vector > 0:8

The results are given in Table 18.2 and in Figure 18.4. The number of errors occurring for each value of Eb/N0 are given in Table 18.2. This data is particularly important in a calibration run to ensure that a sufficient number of errors are obtained at each value of Eb/N0 to provide sufficient statistical reliability. The probability of error PE as a function of Eb/N0 is given in Figure 18.4. The solid line gives the theoretical result described by (18.8) and the simulation results are indicated by the plus signs at integer values of Eb/N0. It can be seen that accurate results are achieved except, perhaps, for Eb/N0 = 8 dB. Table 18.2 indicates that the error probability for Eb/N0 = 8 dB is based on 53 errors, which is small compared to the number of errors occurring at other values of Eb/N0. The MATLAB preprocessor code is given in Appendix B (c18_cdmacal.m).

Table 18.2. Error Counts for Calibration Run

Eb/N0 (dB)

0

1

2

3

4

5

6

7

8

Errors

15773

11347

7583

4516

2416

1169

475

159

53

Result of calibration run.

Figure 18.4. Result of calibration run.

Performance as a Function of Eb/N0 and the Ricean K-factor

This example generates the BER as a function of both Eb/N0 and the Ricean K-factor. Thus, two of the variables given in Table 18.1 must be iterated. Specifically, Eb/N0 is stepped from 0 dB to 10 dB in 1-dB steps. Three values of the Ricean K-factor are used; −20 dB, 0 dB, and 20 dB. The processor/postprocessor (c18_cdmaex1.m) used to generate these results is given in Appendix B. The following dialog is used:

>> c18_cdmaex1
Enter number of symbols to be processed > 100000
Enter Eb/No vector > 0:10
Enter KfatordB vector > [-20 0 20]

Executing the program yields the results illustrated in Figure 18.5. The top curve in Figure 18.5 corresponds to a K-factor of −20 dB (K = 0.01), which produces a result closely approximating Rayleigh fading. The bottom curve in Figure 18.5 corresponds to a K-factor of 20 dB (K = 100), which produces a result closely approximating performance in a Gaussian noise environment. Results for both large K and K ≅ 0 can be derived analytically [3] and used to verify the simulation. The middle curve corresponds to a K-factor of 0 dB (K = 1) and is usually derived using simulation. Note that the middle curve (K = 1) is less smooth than the other curves. This is due to the time-varying nature of the channel, which is most pronounced for intermediate values of K, where the power in the LOS component and the total scattered power are approximately equal. Very long simulations are required to smooth out these temporal variations.

Error probability as a function of Eb/N0 with the Ricean K-factor as a parameter. (K = 100 (bottom curve), K = 1 (middle curve, and K = 0.01 (top curve))

Figure 18.5. Error probability as a function of Eb/N0 with the Ricean K-factor as a parameter. (K = 100 (bottom curve), K = 1 (middle curve, and K = 0.01 (top curve))

There are many other possibilities for making interesting investigations. The interested student should develop a preprocessor that allows one to study the effect of the spreading factor for a given delay profile and at a given Eb/N0. This should be done at several different values of Eb/N0 and for several different delay profiles. A similar study can be conducted by varying the number of interferers.

It is clear from the preceding paragraph that a number of meaningful simulations can be generated using this simplified CDMA simulation. As the simplifications are removed, more parameters are introduced into the simulation model. Running parametric studies on systems having a large number of parameters generates a huge amount of data, all of which must be analyzed before a “best” design can be selected. As a result, the simulation study must be organized carefully so that the data created by the various simulations can be “mined” in a way that supports the design by identifying the most critical parameters and acceptable ranges for these parameters. The process of organizing multiple simulations and mining the data created by these simulations is not covered in this book. This is, however, an important topic and should receive attention prior to beginning a detailed simulation study in which many different simulations are conducted.

Development of Markov Models

Figure 18.1 shows the generation of a hidden Markov model (HMM) for the CDMA system. This is easily accomplished using the tools discussed in Chapter 15. In order to determine and evaluate the HMM, three different MATLAB programs are developed. (The semi-Markov model is used in order to reduce the computational burden.) The first of these programs executes the CDMA simulation and determines the semi-Markov model. The second program generates an error vector based on the state transition matrix of the semi-Markov model. In addition, the bit error rates based on the CDMA system, the bit error rate predicted by the semi-Markov model, and the bit error rate based on an error sequence generated by the semi-Markov model are compared. The third program compares the error vectors created by the original simulation and by the semi-Markov model. Both the statistical quantity Pr{0m|1} and a histogram of the error-free run lengths are used in this comparison. These three programs are now examined.

Program 1: c18_cdmahmm1.m

In this program the parameters of the CDMA simulation are defined and the simulation is executed. As shown in (18.7), two outputs are generated by the simulation. These are the bit error rate BER and the run-length error vector required for determining the Markov model, which is denoted ErrorRun. Here we generate the semi-Markov model for the channel operated at K = 1 (0 dB) and an Eb/N0 of 5 dB. The MATLAB program follows:

% File: c18_cdmahmm1.m
N = 100000;
EoNdB = 5; EbNo = 10^(EoNdB/10);    % specify Eb/No and Eb/No in dB
KdB = 0; SF = 7; NoI = 0;           % specify parameters
MPathDelay = [0 3 4];               % specify multipath delay
%
% Run CDMA simulation.
%
[BER,ErrorRun] = c18_cdmasim(N,SF,EbNo,NoI,MPathDelay,KdB);
%
% Develop runlength vector in required form.
%
lenER = length(ErrorRun);
row2 = zeros(1,lenER);
row2(2:2:lenER)=1;
runcode1(1,:) = ErrorRun; runcode1(2,:) = row2;
%
% Generate semi-Markov model.
%
[A_matrix, pi_est] = c15_semiMarkov(runcode1,50,[2 1]);
save cdmadata1 N BER ErrorRun A_matrix runcode1
% End of script file.

Executing the first program, c18_cdmahmm1, provides the semi-Markov model based on 50 iterations. This result is

Equation 18.9. 

Note that a number of variables are saved to disk. These variables are required in the other two programs and are saved so that the other two programs can be executed at a later date.

Program 2: c18_cdmahmm2.m

In the second program, an error vector is generated by processing a sequence of symbols through the channel represented by the semi-Markov model generated by the preceding program. In addition, the probability of error is generated using three techniques. The first bit error probability is generated by the original CDMA simulation. The second bit error probability is the BER predicted by the semi-Markov model (raising  to a high power as described in Chapter 15). The third bit error probability is determined by counting the errors resulting from passing a large number of symbols (25,000 in this case) through the semi-Markov channel model. The MATLAB program follows:

% File: c18_cdmahmm2.m
load cdmadata1                         % load data from c18_cdmahmm1
NN = 25000                             % number of points to be used
[out] = c18_errvector(A_matrix,NN);    % generate error vector
%
% Compute and display three error probabilities.
%
pe2 = A_matrix^100;
pe2 = pe2(1,3);
pe3 = sum(out/NN);
a = [' The predicted error probabilities for the CDMA system:'];
b = [' From the original simulation PE = ',num2str(BER),'.'];
c = [' Predicted from the semi-Markov model PE = ',num2str(pe2),'.'];
d = [' From the reconstructed error vector ',num2str(pe3),'.'];
%
disp(a)
disp(b) % display PE from simulation
disp(c) % display PE predicted from semi-Markov model
disp(d) % display PE from reconstructed error vecor
save cdmadata2 out
% End of script file.

The error vector based on the HMM is generated by the function c18_errvector, which is essentially identical to c15_errvector, which was originally discussed in Chapter 15. The program c18_errvector is given in Appendix C. The only differences between c18_errvector and c15_errvector is that c18_errvector is a function rather than a script and that it generates the error vector for a specific state transition matrix. Executing the second program, c18_cdmahmm2, provides the following results:

>> c18_cdmahmm2
NN =
    25000
The predicted error probabilities for the CDMA system:
    From the original simulation PE = 0.03185.
    Predicted from the semi-Markov model PE = 0.032054.
    From the reconstructed error vector 0.03204.

We see that the three error probabilities agree closely. It should also be noted that the error probabilities agree with the point given on Figure 18.5 for K = 1 (middle curve) and Eb/N0 = 5 dB.

Program 3: c18_cdmahmm3

The third program allows comparison of the original error sequence generated by the CDMA simulation and the error sequence generated by the semi-Markov model. We use two comparisons. The first of these is to plot Pr{0m|1} for both error sequences, as was done in Chapter 15. The second method of comparison is the histogram of the error-free runs for both sequences. The MATLAB code for accomplishing this follows:

% File: c18_cdmahmm3.m
load cdmadata1                         % load data from c18_cdmahmm1
load cdmadata2                         % load data from c18_cdmahmm2
runcode2 = c15_seglength(out);
c15_intervals2(runcode1,runcode2)      % display intervals
%
% Build histograms.
%
aa1 = runcode1(1,:);
efd1 = aa1(1:2:length(aa1));
aa2 = runcode2(1,:);
efd2 = aa2(1:2:length(aa2));
figure
subplot(2,1,1)
[N,x] = hist(efd1,20);
%hist(efd1,x)
bar(x,N,1)
xlabel('Histogram Bin')
ylabel('Number of Samples')
subplot(2,1,2)
hist(efd2,x);
xlabel('Histogram Bin')
ylabel('Number of Samples')
% End of script file.

Executing the program yields the interval display illustrated in Figure 18.6, and the histograms of the error-free run lengths illustrated in Figure 18.7. In both of these figures, the results from the CDMA system simulation are shown in the top frame, and the results from the semi-Markov model are shown in the bottom frame. Both figures show reasonably good agreement. In Figure 18.7 note the difference in the scaling for the bar heights. This difference in scaling results because the CDMA simulation was performed for 100,000 symbols, and in testing the semi-Markov model, 25,000 symbols were used. Thus, the scale difference is four.

Pr {0m|1} for original error vector (top frame) and Pr{0m|1} for the reconstructed error vector (bottom frame).

Figure 18.6. Pr {0m|1} for original error vector (top frame) and Pr{0m|1} for the reconstructed error vector (bottom frame).

Histogram of error-free run for original error vector (top frame) and for the reconstructed error vector (bottom frame).

Figure 18.7. Histogram of error-free run for original error vector (top frame) and for the reconstructed error vector (bottom frame).

There are several reasons for the differences in the top and bottom frames in Figures 18.6 and 18.7. First, the HMM must be an accurate representation of the original channel. This requires that the data sequence upon which the model is derived be sufficiently long, and that a sufficient number of iterations in deriving the model be performed, in order to ensure that convergence is reached. Also, an appropriate number of states must be used. In addition, once the model is derived it must be tested by processing a sufficient number of symbols in order to obtain statistically reliable results. These concerns are typically addressed by performing experiments such as those discussed here.

FDM System with a Nonlinear Satellite Transponder

The primary objective of this example is to examine a simulation study that illustrates several important modeling and simulation techniques. Important concepts illustrated in this example include the lowpass representation of FDM signals, AM/AM and AM/PM nonlinear models for high-power amplifiers, and semianalytic BER estimation.

System Description and Simulation Objectives

The system being simulated in this example is a communication link in a satellite data network consisting of 48 ground stations sending high-speed data to eight regional data centers. Each data center processes six channels of data, referred to as an FDM group. The modulation format used for each channel is QPSK at a symbol rate of 8 Msymbols/second. The signal is filtered by a square root raised cosine (SQRC) filter[2] with a roll-off factor of 20%, amplified by a linear power amplifier and transmitted in the uplink to the satellite. The 48 ground stations in the network access the satellite using an FDMA scheme in which each ground station is assigned a different carrier frequency by the network controller. Carriers are separated by a guard band of 400 KHz, and the carrier spacing is 10 MHz. The frequency plan for the 48-channel transponder is illustrated in Figure 18.8.

Frequency plan for a 48-channel transponder system.

Figure 18.8. Frequency plan for a 48-channel transponder system.

All 48 uplink signals are received by a single uplink antenna at the satellite. The received signal at the satellite can be expressed as

Equation 18.10. 

which can be written

Equation 18.11. 

where f0 is the reference frequency used to define the overall complex envelope. The lowpass complex envelope from the ith ground station is the complex baseband (QPSK) signal ai(t)exp[i(t)]. It is transmitted at carrier frequency fi. The uplink transmitter for the ith ground station is illustrated in Figure 18.9. The time delay, τi, represents the propagation delays of the ith channel uplink. The lowpass complex envelope of x(t) is, from (18.11),

Equation 18.12. 

The ith transmitter (uplink).

Figure 18.9. The ith transmitter (uplink).

The uplink signals are filtered by the input filters on the satellite, as shown in Figure 18.10, to form eight FDM groups, as shown in the frequency plan (Figure 18.8). Each group is amplified by a high-power traveling wave tube amplifier (TWTA). The amplified signals are filtered again to remove out-of-band spectral regrowth and intermodulation (IM) products. Each carrier group is then transmitted from the satellite to the regional data centers via eight downlink spot beams, with each beam directed toward a regional center.

Details of satellite transponder.

Figure 18.10. Details of satellite transponder.

In order to provide maximum power in the downlink, the TWT amplifiers are operated close to saturation. However, since six FDM carriers are amplified by each TWTA, intermodulation (IM) distortion will have a significant impact on the BER performance in the downlink. Adjacent channel interference (ACI) is another factor that affects link performance. The goal of this study is to simulate one of the downlinks (consisting of one group of 6 FDM carriers) from the satellite to the regional data center and assess the impact of thermal noise, IM distortion, intersymbol interference (ISI) introduced by the filters, and ACI on the downlink performance.

The Overall Simulation Model

The simulation model is illustrated in Figure 18.11. The FDM signal is generated by mapping six random binary bit streams into QPSK symbols and modulating them at appropriate carrier frequencies. The initial steps in creating the simulation model for this example are the following:

  1. Time and frequency scaling: The symbol rate is scaled by 8(106), that is, the symbol rate is normalized to 1 symbol/second so that all rates and frequencies can be specified in units of Hz rather than MHz, and time units are in seconds rather than microseconds.

    Simulation model for satellite communications system.

    Figure 18.11. Simulation model for satellite communications system.

  2. Reference frequency for lowpass equivalent representation: Lowpass equivalent representations of the signals and system elements are used in this simulation. The six FDM carriers are spaced by Δf = 1.25 Hz. For simulation purposes we will use a reference frequency of zero corresponding to the center frequency of the six carrier groups so that the carrier frequencies (offsets) in the lowpass equivalent representation will be

    Equation 18.13. 

    This is illustrated in Figure 18.12.

    Lowpass equivalent representation of the six FDM carriers.

    Figure 18.12. Lowpass equivalent representation of the six FDM carriers.

  3. Sampling rate: The sampling rate is chosen on the basis of the overall bandwidth of the lowpass equivalent representation shown in Figure 18.12, which is 3.75 Hz. Hence, a sampling rate of 16 × 3.75 = 60 will be adequate. Since the symbol rate is 1 symbol/second for each QPSK source, a sampling rate of 64 samples per symbol is chosen for all the simulations.

  4. BER estimation method: Since the noise in the downlink is additive and Gaussian, and the receiver is linear, we can use a semianalytic estimator for this example. The semianalytic QPSK BER estimator discussed in Chapter 10 is used.

  5. Simulation length: With semianalytic error rate estimation, the simulation length is determined by the number of symbols needed to simulate ISI and adjacent channel interference. Since the filters are SQRC, ISI is mainly due to the input and output multiplexing filters which are fairly wideband with near ideal frequency response. Hence it is not necessary to simulate a very long input sequence. We choose a simulation length of 512 symbols, with the first 256 symbols used for calibration purposes, and the last 256 symbols used for semianalytic BER estimation.

With these overall simulation parameter values established, we now turn our attention to the simulation models for the transmitter, the filters, the nonlinear amplifier, the demodulator, and the semianalytic estimator.

Uplink FDM Signal Generation

The group of six FDM carriers arriving in the uplink from six different ground stations can be modeled as coming from a single ground station, with arbitrary delays and phases associated with each carrier. The signals representing the traffic are generated by mapping the data symbols from each ground station to a QPSK constellation, filtering it through an SQRC filter, and modulating the filter output with the appropriate carrier frequency. The SQRC filters are implemented in the time domain as FIR filters using a sampled and truncated version of the impulse response given by

Equation 18.14. 

with R = 1 and β = 0.2. The impulse response is truncated to a duration of eight symbols. Since the filters are implemented using the impulse response, the input to the filters are impulse sequences rather than pulse sequences.

The six filtered signals that form an FDM group are modulated and added to create the uplink FDM signal. A phase offset and time delay is introduced for each of the six carriers to represent the random propagation delays from different ground stations to the satellite. These operations can be summarized as:

  1. The kth QPSK signal is defined as

    Equation 18.15. 

    where Akm and Bkm are the direct and quadrature components of the kth input, 1 ≤ k ≤ 6, Ts is the symbol time, τk is a time delay, N is the total number of symbols in the sequence, and fs is the sampling frequency.

  2. The kth filtered signal is defined as

    Equation 18.16. 

    where p[n] is the impulse response of the root raised cosine filter, as defined by (18.14), and ⊛ denotes convolution.

  3. The kth modulated signal is defined by

    Equation 18.17. 

    where ak and fk are the amplitude and frequency of the kth carrier, respectively, and θk represents a random phase offset.

  4. The FDM signal is defined by

    Equation 18.18. 

Satellite Transponder Model

The satellite transponder consists of an input multiplex (IMUX) filter that isolates each of the eight carrier groups, a TWT amplifier for each six-carrier FDM group, and an output multiplex (OMUX) filter. There is also a frequency translation operation that takes place in the satellite since the uplink and downlink frequencies are usually different. We will assume this frequency translation to be ideal. For this simulation, the IMUX and OMUX filters are implemented using fourth-order Butterworth filters having a 3-dB bandwidth of 4 Hz. The ISI introduced by these filters is minimal. The TWT amplifier is modeled as an AM-to-AM and AM-to-PM memoryless nonlinearity with unit gain as discussed in Chapter 12. The AM-to-AM and AM-to-PM characteristics are assumed to be given in table form. The “backoff” is the only parameter of the model.

Receiver Model and Semianalytic BER Estimator

The six carriers in each FDM group are demodulated individually at the receiver in the ground station at each of the regional centers. We are interested in estimating the BER for one of the FDM carriers, and the demodulation of any of the six carriers can be accomplished by a frequency translation operation followed by SQRC filtering as shown in Figure 18.13. For demodulation and detection purposes, it is necessary to have timing and phase reference. While these functions are normally performed by the synchronization subsystems in the receiver, we are not explicitly simulating these functional blocks in this example. Synchronization is assumed to be perfect.

Receiver model at the downlink ground station.

Figure 18.13. Receiver model at the downlink ground station.

The impact of ISI introduced by the filters and the effects of the nonlinear amplifier, including IM distortion and downlink noise, can be estimated using a semianalytic error rate estimator, since the receiver is linear and the downlink noise is additive and Gaussian at the receiver input. A number of calibration operations need to be completed prior to estimating the error rate as a function of the downlink Eb/N0. These operations include:

  1. Estimating Eb at the receiver input for each carrier

  2. Cross-correlating the input and output waveforms and estimating timing and phase offsets from the cross-correlation function

  3. Estimating the noise bandwidth of the receiver by injecting an impulse at the receiver input, and squaring and adding the values of the impulse response to obtain the noise bandwidth designed by (10.12)

  4. Delaying the input waveform appropriately prior to error rate estimation

Simulation Results

In this section we present simulation results illustrating the effects of nonlinear distortion and additive Gaussian noise on the BER performance of the FDM system. The simulation program is given in Appendix D. The purpose of the simulation is to illustrate the combined effect of the nonlinear TWT model, ACI, and additive noise. The simulation products include plots of the power spectral density (PSD) at the input and output of the TWT model, the signal constellation illustrating the effects of the nonlinearity, and the BER due to nonlinear distortion and noise. (Since semianalytic BER estimation is used, the point scattering observed in the signal constellation is due to the nonlinearity, ACI, and filtering. Noise effects are not included in the signal constellation.) Only two simulation results are examined here in detail. By changing the carrier amplitudes, spacing, and the TWT input backoff, the interested student can easily examine a number of interesting effects.

Baseline Validation

It is obviously important to “sanity check” the baseline simulation so that the individual functional blocks in the simulation model and the overall methodology are validated. In all subsequent simulations, the models and the methodology remain the same and only the parameter values are changed. Thus, the baseline validation simulation establishes the credibility for all subsequent simulations. This can easily be accomplished by executing the simulation for a single channel and ensuring that the TWT model is operated in the linear region. By setting

Equation 18.19. 

we ensure that ACI does not occur. By operating with an input backoff of −20 dB we ensure that nonlinear distortion within the bandwidth of the Channel 1 signal is negligible. Thus, the only significant degrading effect is additive Gaussian noise, and the result for this case is well-known. (Note that the small amount of ISI induced by the IMUX and OMUX filters is not considered significant.)

The PSD at the input and output of the TWT model, operating at −20 dB backoff, is illustrated in Figure 18.14. The fact that only one channel is active is obvious. Also, spectral spreading due to intermodulation is negligible, which illustrates that the TWT is operating in a region that is very nearly linear.

PSD at input and output of the TWT model (input backoff is −20 dB.

Figure 18.14. PSD at input and output of the TWT model (input backoff is −20 dB.

The signal constellation, without the effects of noise, is illustrated in the left-hand frame in Figure 18.15. Note that there is some slight scattering of the signal points, illustrating that there is a very small residual nonlinear effect and/or ISI present. The signal points in the signal constellation are used to generate the BER performance, which is illustrated in the right-hand frame of Figure 18.15. Note that the difference between the simulation result and the ideal (theoretical) result is negligible. Thus, the baseline simulation is validated.

Signal constellation due to nonlinear effects, and BER due to noise.

Figure 18.15. Signal constellation due to nonlinear effects, and BER due to noise.

Nonlinear and Noise Effects −5 FDM Carriers

In this simulation, the amplitude of Carrier 5 is set equal to zero, with all other carrier amplitudes set equal to one. (Carrier 5 is chosen in order to produce a spectrum with a gap and, also, to ensure that those channels yielding the most significant ACI to Channel 1 are active.) The input backoff of the TWT is set equal to −5 dB in order to dramatically illustrate the nonlinear operation of the TWT model. In other words, we use the parameters

Equation 18.20. 

and

Equation 18.21. 

The computed spectra at the input and output of the TWT are illustrated in Figure 18.16. Note the gap in the input PSD at the spectral position defined by f5. The PSD at of the TWT output shows that this portion of the spectrum is partially filled in due to the intermodulation distortion caused by the nonlinearity. This “filling in” is called spectral regrowth, and is a major source of error in a FDM system operating with a nonlinearity. The interested student should rerun the simulation with a TWT input backoff of −20 dB, where the TWT operates as a nearly linear amplifier, and show that the spectral regrowth is greatly diminished.

PSDs at the input and output of the TWT model (the input backoff is −5 dB).

Figure 18.16. PSDs at the input and output of the TWT model (the input backoff is −5 dB).

The effects of ISI, ACI, noise, and distortion due to the TWT is illustrated in Figure 18.17. The signal constellation, illustrating the point scattering primarily due to nonlinear effects resulting from the small backoff used in the TWT model, is illustrated in the left-hand frame of Figure 18.17. These signal points are used by the semianalytic BER estimator to determine the BER for the overall system, which is illustrated in the left-hand frame of Figure 18.17. The degrading impact of the nonlinearity on the BER can clearly be seen.

BER and signal constellation (input backoff = −5 dB and, for the signal constellation, Eb/N0 = 8 dB).

Figure 18.17. BER and signal constellation (input backoff = −5 dB and, for the signal constellation, Eb/N0 = 8 dB).

Summary and Conclusions

In this example we presented an end-to-end simulation study of a complex communication system. The example illustrates several fundamental principles in modeling and simulation, including the lowpass equivalent representation of FDM signals, the simulation of nonlinearities, semianalytic BER estimation, verification of the calibration of the simulation, and the overall methodology of simulating a nonlinear multichannel system. We also illustrated a systematic approach to building confidence in the simulation results by starting with a baseline simulation of a near ideal version of the system, and then including transmission impairments one at a time, and comparing the incremental as well as overall performance degradations at each step with the results obtained in the previous step.

We hope that this example provided the reader with a better “feel” for how to approach a complex simulation problem.

References

Appendix A: MATLAB Code for CDMA Example

% File:  c18_cdmasim.m
function [BER,ErrorRun]=c18_cdmasim(N,SF,EbNo,...
    NumInterferers,MPathDelay,Kfactor_dB)
rand('state',sum(100*clock)); randn('state',sum(100*clock));
NIterate = 1e3;                              % default block size
NumberOfIterations = ceil(N/NIterate);
ErrorState = 0; ErrorRun = []; RunCount = 1; % itialize
Kfactor = 10^(Kfactor_dB/10);                % linear units
EbNolinear = 10^(EbNo/10);                   % linear units
MPathComponents = length(MPathDelay);
%
% Determine amplitude in multipath components and store as
% vector.  Determine the total power in all the scattered components.
% Determine LOS component.
%
MPathAmp(2:MPathComponents) = rand(MPathComponents-1,1);
ScatPower = MPathAmp*MPathAmp.';
MPathAmp(1) = sqrt(ScatPower*Kfactor);       % LOS component.
%
% Determine which component has the largest energy (amplitude).
% Normalize vector so that strongest component has unit amplitude.
%
[fee MaxComponent] = max(MPathAmp); MPathAmp = MPathAmp/fee;
%
% Design IIR filter for fading signal.
%
FilterOrder = 4; Ripple = 0.5; BW = 0.01;     % filter parameters
[b,a] = cheby1(FilterOrder,Ripple,BW);        % 4th order fitler
%
% Error checking.
%
if NumInterferers > (SF-1)
    error(['NumInterferers must not exceed ',int2str(SF-1),'.'])
end
if length(MPathDelay) ~= length(MPathAmp)
    error('MPathDelay and MPathAmp must have the same length.')
end
if min(MPathDelay) < 0
    error('MPathDelay must not have negative components.')
end
fee = diff(MPathDelay);
if min(fee) <= 0
    error('MPathDelay must be monotonically increasing.')
end
clear fee
%
% End Error Checking.
%
% Generate spreading sequences. The spreading sequences for
% the interferers are shifted versions of the desired sequence
% with a shift offset.
%
DesiredSequence = MSequence(SF+1); % desired signal
offset = fix(length(DesiredSequence)/(NumInterferers+1));
M = length(DesiredSequence);
for k=1:NumInterferers
    InterfererSequence(k,:)  = [DesiredSequence(M-(k-1)*offset:M) ...
        DesiredSequence(1:M-1-(k-1)*offset)];
end
%
% The simulation loop begins here.
%
zf = zeros(FilterOrder,MPathComponents);
for cnt=1:NumberOfIterations
    %
    % Generate and spread symbols for dsired and interfering users.
    %
    DesiredSymbols = sign(rand(1,NIterate)-0.5);
    InterferingSymbols = sign(rand(NumInterferers,NIterate)-0.5);
    DesiredChips = reshape(DesiredSequence.'*DesiredSymbols,1,...
        M*NIterate);
    for k=1:NumInterferers
        InterferingChips(k,:)  = reshape(InterfererSequence(k,:).'*...
            InterferingSymbols (k,:),1,M*NIterate);
    end
    %
    % Generate noise.
    %
    NoiseAmplitude = sqrt(SF/(2*EbNolinear));
    MaxDelay = max(MPathDelay);
    DesiredNoise = NoiseAmplitude*randn(1,M*NIterate+MaxDelay);
    %
    % Apply multipath.
    %
    MPathLinAmp = MPathAmp;
    MPathComponents = length(MPathDelay);
    DesiredMPathSignal = zeros(1,M*NIterate+MaxDelay);
    if NumInterferers > 0,
        InterferingMPathSignal = ...
            zeros(NumInterferers,M*NIterate+MaxDelay);
        for k=1:MPathComponents
            index = 1+MPathDelay(k):NIterate*M+MPathDelay(k);
            InterferingMPathSignal(:,index) = ...
                InterferingMPathSignal(:,index) + ...
                MPathLinAmp(k)*InterferingChips;
        end
    end
    for k=1:MPathComponents
        if k==1, fading = ones(1,M*NIterate);
        else
            fading = randn(size(DesiredSymbols))+...
                j*randn(size(DesiredSymbols));
            [fading zf(:,k)] = filter(b,a,fading,zf(:,k));
            fading = interp(fading,SF);
            fading = abs(fading/sqrt(mean(fading.*conj(fading))));
        end
        if k == MaxComponent
            fadesign = sign(fading);
        end
        faa(k,:)  = MPathLinAmp(k)*fading;
        index = 1+MPathDelay(k):NIterate*M+MPathDelay(k);
        DesiredMPathSignal(index) = ...
            DesiredMPathSignal(index)+...
            (MPathLinAmp(k)*fading).*DesiredChips;
    end
    %
    % Add intererence and noise.
    %
    if NumInterferers > 0
        IncomingSignal = DesiredMPathSignal+...
            sum(InterferingMPathSignal,1)+DesiredNoise;
    else
        IncomingSignal = DesiredMPathSignal+DesiredNoise;
    end
    %
    % Receive and detect incoming signal.
    %
    index = 1+MPathDelay(MaxComponent):M*NIterate+...
        MPathDelay(MaxComponent);
    IncomingChips = reshape(fadesign.*...
        IncomingSignal(index),M,NIterate);
    DespreadSymbols = DesiredSequence*IncomingChips;
    DetectedSymbols = sign(DespreadSymbols);
    %
    % Compute Bit Error Rate
    %
    ErrorVector = 0.5*abs(DetectedSymbols-DesiredSymbols);
    ErrorsIterate(cnt) = sum(ErrorVector);
    BERIterate(cnt) = ErrorsIterate(cnt)/NIterate;
    for k=1:NIterate
        if (ErrorVector(k) == 0) & (ErrorState == 0)
            RunCount = RunCount+1;
        elseif (ErrorVector(k) == 0) & (ErrorState == 1)
            ErrorRun = [ErrorRun RunCount];
            RunCount = 1; ErrorState = 0;
        elseif (ErrorVector(k) == 1) & (ErrorState == 0)
            ErrorRun = [ErrorRun RunCount];
            RunCount = 1; ErrorState = 1;
        elseif (ErrorVector(k) == 1) & (ErrorState == 1)
            RunCount = RunCount+1;
        else
            s1 = sprintf('ErrorVector(%d)=%d, ...
                ErrorState=%d!  Unexpected Condition!'),
            error(s1);
        end
    end
end
Errors = sum(ErrorsIterate); BER = mean(BERIterate);
ErrorRun = [ErrorRun RunCount];
% End of function file.

Supporting Functions

MSquence.m

% File:  MSequence.m
function Sequence=MSequence(SF)
SFlog2=log2(SF);
if rem(SFlog2,1) ~= 0, error('SF must be an integer power of 2'), end
switch SFlog2
case 3
    R = 3; instate = zeros(1,3); instate(R) = 1;
    N = 2^R-1; generator = [0 1 3];
case 4
    R = 4; instate = zeros(1,4); instate(R) = 1;
    N = 2^R-1; generator = [0 1 4];
case 5
    R = 5; instate = zeros(1,5); instate(R) = 1;
    N = 2^R-1; generator = [0 2 5];
case 6
    R = 6; instate = zeros(1,6); instate(R) = 1;
    N = 2^R-1; generator = [0 1 6];
case 7
    R = 7; instate = zeros(1,7); instate(R) = 1;
    N = 2^R-1; generator = [0 3 7];
case 8
    R = 8; instate = zeros(1,8); instate(R) = 1;
    N = 2^R-1; generator = [0 2 3 4 8];
case 9
    R = 9; instate = zeros(1,9); instate(R) = 1;
    N = 2^R-1; generator=[0 4 9];
case 10
    R = 10; instate=zeros(1,10); instate(R) = 1;
    N = 2^R-1; generator = [0 3 10];
case 11
    R = 11; instate = zeros(1,11); instate(R) = 1;
    N = 2^R-1; generator = [0 2 11];
case 12
    R = 12; instate = zeros(1,12); instate(R) = 1;
    N = 2^R-1; generator = [0 1 4 6 12];
otherwise
    error('SF must be a power of 2, >= at 8 and <= 2^12.')
end
[Sequence,Outstate] = ...
    LinearFeedbackShiftRegister(R,generator,instate,N);
Sequence = 1 - 2*Sequence;
% End of function file.

LinearFeedbackShiftRegiater,m

%File:  LinearFeedbackShiftRegister.m
function [y,outstate]=...
    LinearFeedbackShiftRegister(R,generator,instate,N)
if max(generator) > R
    error(['The degree of the generator polynomial, ',...
        int2str(max(generator)),', cannot exceed R, ',int2str(R),'.']);
end
if length(instate) > R
    error(['The length of the input state vector, ',...
        int2str(length(instate)),', cannot exceed R, ',int2str(R),'.']);
end
a = sort(generator); P = length(generator); M = length(instate)+1;
for k=1:N
    fee = instate((generator(2)));
    for q=3:P
        fee = bitxor(fee,instate(generator(q)));
    end
    instate = [fee instate]; y(k) = instate(1); instate(M) = [];
end
outstate = instate;
% End of function file.

Appendix B: Preprocessors for CDMA Application

Validation Run

% File: c18_cdmacal.m
N = input('Enter number of symbols to be processed > '),
EoN = input('Enter Eb/No vector > '),
SF = 7;
NoI = 0;
MPathDelay = [0 3 4];
KfactordB = 100;
len_EoN = length(EoN);
BER = zeros(1,len_EoN);
h = waitbar(0,'Calibration Run'),
for j=1:len_EoN
    EbNo = EoN(j);
    [BER(j),ErrorRun] = c18_cdmasim(N,SF,EbNo,NoI,MPathDelay,...
        KfactordB);
    waitbar(j/len_EoN)
end
close(h)
z = 10.^(EoN/10);
BERT = q(sqrt(2*z));
semilogy(EoN,BER,'+k',EoN,BERT,'-')
xlabel('E_b/N_0 in dB')
ylabel('Probability of Symbol Error')
grid
% End of script file.

Study Illustrating the Effect of the Ricean K-Factor

% File: c18_cdmaK.m
N = input('Enter number of symbols to be processed > '),
EoN = input('Enter Eb/No vector > '),
KdB = input('Enter KfatordB vector > '),
SF = 7;
NumInterferers = 0;
MPathDelay = [0 3 4];
len_EoN = length(EoN);
len_KdB = length(KdB);
BER = zeros(len_KdB,len_EoN);
for i=1:len_KdB
    KfactordB = KdB(i);
    for j=1:len_EoN
        EbNo = EoN(j);
        [BER(i,j),ErrorRun] = ...
            c18_cdmasim(N,SF,EbNo,NumInterferers,MPathDelay,...
                KfactordB);
        display = ['KfactordB = ',num2str(KfactordB),...
            ' Eb/No = ',num2str(EbNo),'.'];
        disp(display)
    end
end
semilogy(EoN,BER)
xlabel('E_b/N_0 in dB')
ylabel('Probability of Symbol Error')
grid
% End of script file.

Appendix C: MATLAB Function c18_errvector.m

% File: c18_errvector.m
function [out] = c18_errvector(A_matrix,NN)
A = A_matrix;
B = [1 1 0; 0 0 1];
state = 1;                   % initial state
total_states = size(A,1);
out = zeros(1,NN);           % initialize error vector
state_seq = zeros(1,NN);     % initialize state sequence
h = waitbar(0,'Calculating Error Vector'),
%
u2 = rand(1);                % get random number
if u2>B(1,state)             % test for error
    out(1) = 1;              % record error
end
state_seq(1) = state;        % record state
for t=2:NN
    u1 = rand(1);            % get random number
    cum_sum = [0 cumsum(A(state,:))];
    for i=1:total_states     % loop to determine new state
        if u1>=cum_sum(i) & u1<cum_sum(i+1);
            state = i;       % assign new state
        end
    end
    state_seq(t) = state;    % new record state
    u2 = rand(1);            % get random number
    if u2>B(1,state)
        out(t) = 1;          % record error
    end
    waitbar(t/NN)
end
close(h)
% End of function file.

Appendix D: MATLAB Code for Satellite FDM Example

% File: c18_nlsat.m
%
% Frequently adjusted parameters
%
a1 = 1.0; a2 = 1.0; a3 = 1.0;             % carrier amplitudes
a4 = 1.0; a5 = 0.0; a6 = 1.0;             % carrier amplitudes
ibo = -5;                                 % TWT input backoff in dB
%
% Default parameters
%
R = 1; tsymbol = 1/R;                     % symbol rate/time
df = 1.244;                               % carrier spacing
beta = 0.2;                               % beta
nsamples = 64;                            % samples/symbol
nsymbols = 256;                           % total symbols
ncorr = 64;                               % symbols for correlation
nstart = 64;                              % BER start (symbol #)
ebn0db = 0:1:8;                           % ebno vector in dB
%
tb = tsymbol/2; fs = nsamples*R; ts = 1/fs;
%
% Set up frequency, delays, and phase offsets
% for the six FDM signals.
%
f1 = (df/2); f2 = f1+df; f3 = f2+df; f4=-f1; f5=-f2; f6=-f3;
delay1 = 0; delay2 = 8; delay3 = 16;
delay4 = 32; delay5 = 40; delay6 = 50;
phase1 = 0.0; phase2 = pi/64; phase3 = pi/32;
phase4 = pi/48; phase5 = pi/16; phase6 = pi/40;
omega1 = 2*pi*f1; omega2 = 2*pi*f2; omega3 = 2*pi*f3;
omega4 = -omega1; omega5 = -omega2; omega6 = -omega3;
%
% Begin Simulation
%
% Carrier 1 is demodulated, so set it up first.
% Genereate the first QPSK impulse sequence and convert to NRZ.
% Note that in vector x, the first nsample/2-1 samples are zero.
%
M = 4;                                       % QPSK
[xin1] = mpsk_impulses(M,nsymbols,nsamples); % QPSK impulse is
                                             %     middle sample
b = ones(1,nsamples);
x = filter(b,1,xin1);                        % NRZ QPSK waveform
                                             %     samples
nduration = 8;                               % duration of impw in
                                             %    symbols
[imp1,impw] = sqrc_time(R,beta,nsamples,nduration);
txout1 = filter(imp1,1,xin1);                % SQRC filtered
                                             %     Chanel 1 signal
%
% Generate 5 other QPSK impulse sequences
%
[xin2] = mpsk_impulses(M,nsymbols,nsamples);
[xin3] = mpsk_impulses(M,nsymbols,nsamples);
[xin4] = mpsk_impulses(M,nsymbols,nsamples);
[xin5] = mpsk_impulses(M,nsymbols,nsamples);
[xin6] = mpsk_impulses(M,nsymbols,nsamples);
%
% Stagger inputs to make unsynchronized
% to minimize envelope transitions
%
[xin2] = delayr1(xin2,delay2);
[xin3] = delayr1(xin3,delay3);
[xin4] = delayr1(xin4,delay4);
[xin5] = delayr1(xin5,delay5);
[xin6] = delayr1(xin6,delay6);
%
% SQRC filter the five symbol waveforms
%
txout2 = filter(imp1,1,xin2);
txout3 = filter(imp1,1,xin3);
txout4 = filter(imp1,1,xin4);
txout5 = filter(imp1,1,xin5);
txout6 = filter(imp1,1,xin6);
%
% Modulate all six carriers and generate txout
%
KNN = 1:nsymbols*nsamples;
txout1 = a1*txout1.*exp(i*omega1*KNN*ts)*exp(i*phase1);
txout2 = a2*txout2.*exp(i*omega2*KNN*ts)*exp(i*phase2);
txout3 = a3*txout3.*exp(i*omega3*KNN*ts)*exp(i*phase3);
txout4 = a4*txout4.*exp(i*omega4*KNN*ts)*exp(i*phase4);
txout5 = a5*txout5.*exp(i*omega5*KNN*ts)*exp(i*phase5);
txout6 = a6*txout6.*exp(i*omega6*KNN*ts)*exp(i*phase6);
txout = txout1+txout2+txout3+txout4+txout5+txout6;
%
% Input MUX filter (Normalized BW = 4.5 Hz)
%
[bmi ami] = butter(4,4.5/(fs/2));
imuxout = filter(bmi,ami,txout);
%
% TWTA Model
%
run('twt_data1'), twtdata = data;                    % Get TWTA Data
ampout = twt_model(imuxout,twtdata,ibo);             % TWT model
%
% Output MUX filter (Normalized BW = 4.5 Hz)
%
[bmo amo] = butter(4,4.5/(fs/2));
omuxout = filter(bmo,amo,ampout);
%
% Plot (if desired) TWTA input and output PSD
%
psdflag = 1;                                % omit psd calculation?
if psdflag==1
    nfft = (nsymbols/2)*nsamples;nmax=nsymbols*nsamples;
    temp(1:nfft) = imuxout(nfft+1:nmax);
    [logpsd,freq,ptotal,pmax] = log_psd(temp,4096,ts);
    figure;subplot(2,1,1);
    plot(freq,logpsd); axis([-10 10 -40 0]);
    title('PSD of the TWTA input'), ylabel('PSD'), grid;
    temp(1:nfft) = ampout(nfft+1:nmax);
    [logpsd,freq,ptotal,pmax] = log_psd(temp,4096,ts);
    subplot(2,1,2)
    plot(freq,logpsd); axis([-10 10 -40 0]);
    title('PSD of the TWTA output'), ylabel('PSD'), grid;
end
%
% Compute eb at the input to the RX filter for a single carrier
%
[n1 n2] = size(omuxout); nxx=n1*n2;
eb = 0.5*tb*sum(sum(abs(omuxout).^2))/nxx;
%
% Compute eb for one carrier only
%
eb = eb*(a1*a1)/(a1*a1+a2*a2+a3*a3+a4*a4+a5*a5+a6*a6)
%
% Demodulate: Frequency shift the first carrier
%
ydemod = omuxout.*exp(-i*omega1*KNN*ts);
%
% Receive SQRC filter
%
nduration = 16;
[imp2,impw] = sqrc_freq_nosinc(R,beta,nsamples,nduration);
y = filter(imp2,1,ydemod);
%
% Simulation is complete.
%
% Set up BER estimator.
%
hh = impz(imp2,1); ts=1/fs;
nbw = (fs/2)*sum(abs(hh).^2) % noise BW of the receiver
corlength = ncorr*nsamples;
%
% Find the maximum magnitude of the cross correlation
% and find the lag corresponding to it.
%
[cor lags] = vxcorr(x(1:corlength),y(1:corlength));
cmax = max(max(abs(cor))); nmax = find(abs(cor)==cmax);
timelag = -lags(nmax); corrmag = cmax; theta = -angle(cor(nmax));
%
y = y*exp(-i*theta);                            % derotate
%
% Delay the input, and do BER estimation starting with nstart.
% Make sure the index does not exceed number of input points.
% eb is the true (real) signal power computed at the RX input.
% Decision time is the mid sample in each bit + timing_offset.
%
maxindex = nsymbols*nsamples-(3*nsamples/2)-timelag;
%
% Index is the array of pointers to mid points of each symbol
% Start BER estimation at nstart (skip the first few symbols).
%
index = ((nstart)*nsamples+(nsamples/2):nsamples:maxindex);
%
timelag1 = timelag+(nsamples/2); % middle sample decision statistics
xx = x(index);                   % first symbol in x is first
                                 %     nsample/2
yy = y(index+timelag1+1);
%
% QPSK BER estimation
%
[peideal,pesystem] = qpsk_berest(xx,yy,ebn0db,eb,tb,nbw);
%
% Plot results
%
figure; subplot(1,2,1)
yscale = 1.5*max(real(yy));
plot(yy,'+')
xlabel('Direct Sample'), ylabel('Quadrature Sample'), grid;
axis([-yscale yscale -yscale yscale])
subplot(1,2,2)
semilogy(ebn0db,peideal,'-.',ebn0db,pesystem); grid;
xlabel('E_b/N_0'), ylabel('Bit Error Rate')
legend('Ideal','System')
% End of script file.

Supporting Functions

A number of the supporting functions for this exmple appeared previously and are not given here. These are:

mpsk_impulses.m

function [x]=mpsk_impulses(M,nsymbols,nsamples)
% This function generates a random complex MPSK impulse sequence
% nsymbols in length. Each symbol is sampled at a rate of
% nsamples/bit. All samples except the 'middle' sample within a
% symbol interval are zero.
u = rand(1,nsymbols);
rinteger = round((M*u)+0.5);
phase = pi/M+((rinteger-1)*(2*pi/M));
x = zeros(1,nsymbols*nsamples);
for m=1:nsymbols
    index = (m-1)*nsamples + round(nsamples/2);
    x(1,index) = exp(i*phase(m));
end
% End of function file.

sqrc_time.m

% File: sqrc_time.m
function [imp,impw] = sqrc_time(R,beta,nsamples,nsymbols)
%
%
% This function provides the impulse response for
% an FIR implementation of the sqrc filter
% ****** This version does not include a 1/sinc ******
% R is the symbol rate; 0<beta<1; beta is normalized by R/2
% nsamples is the number of samples per symbol
% nsymboles is the duration of the impulse response in symbols
% Impulse response extends from -nsymbols/2 to +nsymbols/2
%
beta = beta*(R/2);
a = R+(2*beta); b = R-(2*beta);
length1 = fix(nsamples*nsymbols/2);
ts = (1/R)/nsamples;
time = [-length1*ts:ts:(length1-1)*ts] + 0.00000013;
n = length(time); w = hanning(n);
term1 = a*pi*time; term2 = b*pi*time;
cos1 = cos(a*pi*time); sin1 = sin(b*pi*time);
denominator = (pi*sqrt(R))*((1-((8*beta*time).^2)));
for k=1:n
    numerator = (8*beta*(cos1(k)))+(sin1(k)/time(k));
    if(denominator(k)==0)
        imp(k) = 1;
    else
        imp(k) = numerator/denominator(k);
    end
    impw(k) = imp(k)*w(k);
end
yy = sum(impw.^2);
impw = impw/(yy^0.5);
impw = impw/sqrt(nsamples);
yy = sum(imp.^2);
imp = imp/(yy^0.5);
imp = imp/sqrt(nsamples);
% End of function file.

sqrc_freq_nosinc.m

% File: sqrc_freq_nosinc.m
function [imp,impw] = sqrc_freq_nosinc(R,beta,nsamples,nsymbols)
% This function computes the impulse response of an SQRC
% filter using a frequency domain/ifft approach; It includes a
% 1/sinc; R = symbol rate; 0<beta<1
% nsamples = number of samples per symbol
% nsymbols = total duration of the impulse responce in symbols
% Number of points in the impulse response = nsymbols*nsamples
% R = 1; nsymbols = 16; nsamples = 32; beta = 0.25
%
n = nsamples*nsymbols; fs = R*nsamples; df = fs/n;
a = ((1-beta)*0.5*R); b = ((1+beta)*0.5*R);
%
% Fill up the transfer function array with zeros upto fs/2
% Compute and store the values of sqrc up to R
%
H = (zeros(1,n));
for k=1:(n/2)+1
    f = (k-1)*df;
    if(beta==0)
        beta=0.0000001;
    end
    H(k) = cos((pi/(2*beta*R))*(f-a));
    if f < a
        H(k) = 1;
    end
    if f>=b
        H(k) = 0;
    end
end
%
% Fold the negative frequency components to [fs/2/to fs]
%
H((n/2)+2:1:n) = H((n/2):-1:2);
%
%Take inverse fft
%
[impc,time] = linear_fft(H,n,df);
imp = real(impc);
window = hanning(n)';
impw = imp.*window;
yy = sum(impw.^2);
impw = impw/(yy^0.5);
impw = impw/sqrt(nsamples);
yy = sum(imp.^2);
imp = imp/(yy^0.5);
imp = imp/sqrt(nsamples);
% End of function file.

delayr1.m

function [xout] = delayr1(xin,ndelay)
n = max(max(size(xin)));
if (ndelay==0)
    xout = xin;
else
    xx = zeros(1,ndelay);
    xout = [xx xin(1,1:n-ndelay)];
end
% End of function file.

twt_model.m

% File: twt_model.m
function [y] = twt_model(x,twtdata,ibo)
% ibo is a negative value in db indicating the operating point
% ibo = -3db implies that the input POWER is attenuated by 1/2
% When the input power = pave, output power is maximum (=1)
% Normalized input power = (pinstantaneous/pave)*optn_real
%
pwrin = twtdata(:,1); pwrout = twtdata(:,2); phaseout = twtdata(:,3);
n = length(x); ibo_real = 10^(ibo/10);}
%
% Find the average input power and the instantaneous input power
% Normalize the instantaneous input power by the average power.
%
instpwr = 0.5*(abs(x).^2);
avepwr = mean(instpwr);
instpwr = instpwr*(ibo_real/avepwr);
%
% Compute output power and phase
%
outpwr = interp1(pwrin,pwrout,instpwr);
outmag = sqrt(2*outpwr);
outphase = (pi/180)*interp1(pwrin,phaseout,instpwr);
%
% Compute complex envelope of the output
%
y = outmag.*exp(sqrt(-1)*(outphase+angle(x)));
% End of function file.

twtdata1.m

% File: twt_data1.m
% x in a vector of input complex envelope values
% y is a vector of output complex envelope values
% First column is input power in real values (real power)
% Second column is real output power;
% Third column is phase offset in degrees.
% Data is assumed to be increasing order of input power
% First entry should be input power = 0.0, output power = 0.0
% Last entry should be well beyond the max value of the input
% signal power.
%
data=[
0.0000       0.0000         32.8510
0.0110       0.0500         32.8510
0.0120       0.0560         32.7570
0.0140       0.0630         32.6540
0.0150       0.0700         32.4840
0.0170       0.0790         32.3210
0.0190       0.0880         32.1930
0.0220       0.0980         31.9740
0.0250       0.1100         31.5650
0.0280       0.1230         31.2160
0.0310       0.1370         30.8170
0.0350       0.1520         30.4400
0.0390       0.1690         30.0840
0.0440       0.1890         29.6240
0.0500       0.2100         29.1450
0.0560       0.2330         28.6350
0.0630       0.2570         28.0410
0.0700       0.2840         27.3180
0.0790       0.3130         26.3990
0.0890       0.3440         25.6150
0.1000       0.3770         24.8700
0.1120       0.4130         23.9820
0.1250       0.4510         23.0500
0.1410       0.4910         22.0380
0.1580       0.5320         21.0060
0.1770       0.5730         19.9700
0.1990       0.6150         18.6400
0.2230       0.6570         17.3930
0.2510       0.6970         16.0620
0.2820       0.7370         14.8880
0.3160       0.7770         13.5740
0.3540       0.8130         12.2540
0.3980       0.8480         11.0110
0.4460       0.8770          9.7070
0.5010       0.9050          8.3830
0.5620       0.9320          6.9150
0.6300       0.9510          5.4690
0.7070       0.9700          4.1550
0.7950       0.9810          2.8770
0.8910       0.9920          1.4660
1.0000       1.0000          0.0000
1.1220       0.9980         -1.5710
1.2580       0.9980         -3.0480
1.4120       0.9890         -4.7500
1.5840       0.9820         -6.5670
1.7780       0.9760         -8.3850
1.9950       0.9700        -10.2020
2.2480       0.9630        -12.0190
2.5110       0.9570        -13.8360
2.8120       0.9510        -15.6530
3.1620       0.9450        -17.4710
3.5480       0.9380        -19.2880
3.9810       0.9320        -21.1050
4.4660       0.9260        -22.9220
5.0110       0.9200        -24.7390
5.6230       0.9140        -26.5570];
% End of data file.


[1] At the time of this writing, a detailed simulation of the wideband CDMA (WCDMA) uplink and downlink standards, which does not contain these resrtictions, can be downloaded from the Virginia Tech MPRG web site. The URL is http://www.mprg.org/research/wcdma/wcdmasim.php.

[2] See Example 5.9. Note that the input symbols are represented by a sequence of impulses.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset