15 15 Lab 6: Agilent Ptolemy - QPSK Simulation Lab6: Agilent Ptolemy- QPSK Simulation 15-2 Lab 6: Agilent Ptolemy- QPSK Simulation 15 LAB 6: AGILENT PTOLEMY - QPSK SIMULATION................................................................... 15-1 15.1 OBJECTIVES: .................................................................................................................................. 15-5 15.2 THE DATA SOURCE: ....................................................................................................................... 15-5 15.2.1 Schematic Capture: .................................................................................................................. 15-5 15.2.2 Dynamic Signal Monitoring (TkPlot and TkXYPlot): ............................................................... 15-7 15.2.3 Simulation Setup (Data Flow Controller): ............................................................................... 15-8 15.2.4 Simulate and Observe the Results: ........................................................................................... 15-9 15.3 ADD BASEBAND FILTERS AND QAM MODULATOR: ..................................................................... 15-10 15.3.1 Add Baseband Filters: ............................................................................................................ 15-10 15.3.2 Add QAM Modulator: ............................................................................................................. 15-11 15.3.3 Add FFT Analyzer And TkPlots: ............................................................................................. 15-12 15.3.4 View the Constellation Diagram: ........................................................................................... 15-13 15.4 SAMPLED CONSTELLATION:.......................................................................................................... 15-14 15.4.1 Sampling Clock: ..................................................................................................................... 15-14 15.4.2 Sample and Hold Circuits: ..................................................................................................... 15-15 15.4.3 View the Sampled Constellation: ............................................................................................ 15-16 15.4.4 View the Modulated Spectrum : .............................................................................................. 15-17 15.5 QPSK DEMODULATOR: ................................................................................................................ 15-18 15.5.1 Add the QPSK demodulator: .................................................................................................. 15-18 15.5.2 Connect Timed Sinks: ............................................................................................................. 15-21 15.5.3 View Demodulated I and Q: ................................................................................................... 15-22 15.6 OUTPUT CONSTELLATION: ............................................................................................................ 15-22 15.6.1 Sample the Output I and Q: .................................................................................................... 15-22 15.6.2 View the Sampled Output Constellation: ................................................................................ 15-23 15.6.3 View the Output Eye Diagram:............................................................................................... 15-24 15.7 PHASE NOISE EFFECTS: ................................................................................................................ 15-25 15.8 LAB REVIEW: ............................................................................................................................... 15-26 15-3 Lab6: Agilent Ptolemy- QPSK Simulation 15-4 Lab 6: Agilent Ptolemy- QPSK Simulation 15.1 Objectives: Perform an Agilent Ptolemy simulation of a QPSK system using the DSP schematic page Set up TkXYPlots and TkPlots to view constellation and eye diagrams Use SampleAndHold circuits to sample Nyquist bandlimited symbols NOTE about this lab: This lab and the remaining labs will use QPSK and PI4DQPSK modulation to demonstrate the use of Agilent Ptolemy for digital communication systems analysis. The techniques used in the labs will be directly applicable to applications such as CDMA, GSM, PCS, etc. 15.2 The Data Source: 15.2.1 Schematic Capture: 1. Open the project named “d:\users\ads\CommSys_Lab6_prj”. Refer to the pictures and follow the steps to create the QPSK modulator using timed elements. Throughout this lab, you can use the F5 key (Edit > Text > Move Component Text) to move any component text if it makes connecting the circuits easier. 2. Open a schematic window and open a the design a_QPSK_Sys. 15-5 Lab6: Agilent Ptolemy- QPSK Simulation 3. The only thing on the schematic should be a “VAR” component (from the “Controllers” library/palette). The “VAR” block should look like the figure shown below: NOTE about variable units: Units such as kHz and MHz can be assigned either in the VAR item or when used as a parameter. They act as a multiplier (e.g. MHz= Hz * 1E6), so they should only be assigned in either the VAR item or when used as a parameter, but not both. Using variables and equations to establish the key relationships such as bit rate, symbol rate, the minimum Nyquist frequency, etc., is a good technique to ensure that element parameters are set up correctly. It is also flexible when parameters such as the bit rate or the number of samples per symbols need to be changed. 4. Insert a “Data” source element from the “Timed Sources” library. Set the folowing parameters: TStep to Tstep – units set to None BitTime to Bit_time – units set to None Attention: The time units for the parameters should be set to None as they are already set to the correct units in the “VAR” item. 15-6 Lab 6: Agilent Ptolemy- QPSK Simulation a. Insert a “Symbol Splitter” from the “Timed Data Processing” library. Set the following parameters: SymbolTime to Bit_time - units set to None Delay to -1 sec - for automatic synchronization. 15.2.2 Dynamic Signal Monitoring (TkPlot and TkXYPlot): 1. Insert a “TkPlot” from the “Interactive Controls and Displays” palette. Set the following parameters: Label to Input Bits XTitle to Time YTitle to Amplitude. Wire the TkPlot to the output of the Data source. 2. Insert a “TkXYPlot” from the “Interactive Controls and Displays” library. Set the following parameters: Label to Ideal Constellation XTitle to Re YTitle to Im Style to connect Wire the TkXYPlot to the Data splitter output. 15-7 Lab6: Agilent Ptolemy- QPSK Simulation About the Symbol Splitter: The SymbolSplitter will input two bits at a time and output the first bit to the Q symbol output and the second bit to the I symbol output. The resulting I & Q output symbols will have twice the duration (e.g. the output symbol duration will be 2uS for a 1uS bit time). The SymbolTime parameter references the input, or the bit time. This element essentially functions as a serial-to-parallel converter to take in two bits to define four possible symbol states (2^2= 4 possible combinations) for QPSK. 15.2.3 Simulation Setup (Data Flow Controller): Insert a “DF” (Data Flow) controller element from the “Controllers” library. Set the parameter: 15-8 DefaultTimeStop to Tstop. Lab 6: Agilent Ptolemy- QPSK Simulation 15.2.4 Simulate and Observe the Results: Look at the NRZ data stream from the data source and the ideal constellation from the data splitter. Perform a “View All” in the TkXYPlot to see the constellation. The TkPlots have a high input impedance and the data splitter output has a 50 ohm output impedance, so the symbol amplitudes are +/- 2 volts instead of +/- 1 volts. Notice that the NRZ symbols are rectangular and that the constellation is ideal since there is not yet any baseband filtering. About Tk Plots: TkPlots provide a quick and easy way to interactively display data. They are particularly useful for validating the basic configuration of a system before using the Data Display window to perform quantitative measurements. Try stopping the simulation and changing the Style for the constellation to dot and rerunning the analysis. End the simulation (click “Quit”). 15-9 Lab6: Agilent Ptolemy- QPSK Simulation 15.3 Add Baseband Filters and QAM Modulator: 15.3.1 Add Baseband Filters: Select a “LPF_RaisedCosineTimed” (Raised Cosine Lowpass filter) from the “Timed Filters” library. Set the following parameters: CornerFreq to Filt_Nyquist_freq ExcessBw to 0.35 Type to Model with pulse equalization SquareRoot to Yes Delay to Filt_delay_time - units set to None - units set to None. Connect a filter to both the I and Q outputs of the SymbolSplitter as shown. 15-10 Lab 6: Agilent Ptolemy- QPSK Simulation About the filter: The ideal rectangular symbols seen with the TkPlots will result in a wide spectrum when the I & Q symbols are modulated onto a carrier. Nyquist root raised cosine filters are typically used to filter the rectangular symbols and significantly reduce the spectral bandwidth required for transmission, with minimal degradation to the system performance. The optimal Nyquist cutoff frequency is defined to be 1/(2*symbol time) for minimal intersymbol interference. Since a brick-wall filter response is not realizable, an excess bandwidth factor is specified such as 0.35 for this example (equivalent to having 35% more bandwidth than a filter with a brickwall response). The pulse equalization setting on the filter applies a x/ (sinx) equalization to provide the correct filter response for rectangular input symbols instead of impulses. The square root setting applies an exponent of 0.5 to the filter response, allowing it to be used in both the modulator and demodulator (the product of the two filters results in one raised cosine filter response). It is typical to have one root raised cosine filter in the demodulator to provide some noise filtering in the receiver. This filter is non-causal and a delay must be added to make it causal. The filter model accuracy is proportional to the specified delay, where modeling accuracy increases with delay. 15.3.2 Add QAM Modulator: Select a “QAM_Mod” from the “Timed Modem” library and set the following parameters: Fcarrier to IF_freq - units set to None Power to +10 dBm - or type in: dbmtow(10) Connect the I & Q inputs to the raised cosine filter outputs as shown. 15-11 Lab6: Agilent Ptolemy- QPSK Simulation 15.3.3 Add Spectrum Analyzer And TkPlots: 1. Select a “SpectrumAnalyzer” from the “Sinks” library. Give it the label: Mod_Spec. Leave all the parameters at their default values. Connect it to the output of the QAM_Mod element: 2. Place a termination resistor from the “Timed Linear” library. Connect it to the Spectrum Analyzer's input and ground the other end. Set R to 50 ohms. 3. From the Interactive Controls and Displays add a TkPower meter. 4. Connect a TkXYPlot to the output of the raised cosine filters to look at the Nyquist bandlimited constellation. You can copy the TkXYplot that is connected to the output of the data splitter. Make sure you set the following parameters: Label to Filtered Constellation XTitle to Re YTitle to Im Style to connect Perform the Simulation. 15-12 Lab 6: Agilent Ptolemy- QPSK Simulation 15.3.4 View the Constellation Diagram: You should see the Filtered Constellation. After analyzing it, answer the questions about this Nyquist bandlimited constellation. QUESTIONS: Why does the constellation look so distorted? __________________________________________________________ ________ 15-13 Lab6: Agilent Ptolemy- QPSK Simulation Why wasn't this seen for the ideal constellation with rectangular symbols? __________________________________________________________ ________ Using a TkPlot to view the Nyquist filtered symbol stream may provide some clues. TkPlots display every sample they receive...is this desirable for Nyquist bandlimited symbols? _____________________________________________________________ _____ Why is the Modulator output power +13 dBm when it was set for +10 dBm? End the simulation and save your work (the name should already be “a_QPSK_Sys”). 15.4 Sampled Constellation: 15.4.1 Sampling Clock: 1. Select a “Clock” element from the “Timed Sources” library and set the following parameters: TStep to Tstep - units set to None Period to Sym_time - units set to None Delay to Filt_delay_time+(0.5*Sym_time) - units set to None. 15-14 Lab 6: Agilent Ptolemy- QPSK Simulation 2. Select a “SplitterRF” element from the “Timed Linear” library and connect it to the output of the Clock element. 15.4.2 Sample and Hold Circuits: 1. Place two “SampleAndHold” elements from the “Timed Linear” library and connect the clock inputs to the outputs of the “SplitterRF”. NOTE: Use the command Edit > Advanced Rotate/Mirror > Mirror About X to properly orient the upper element. Set the following parameters: Rin to 1 GOhm DroopRate to 0 15-15 Lab6: Agilent Ptolemy- QPSK Simulation Setting Rin to 1GOhm will allow the SampleAndHold circuits to be connected to the system without loading it down. Setting the DroopRate to 0 will hold the sampled voltage at a constant level until the next sample. 2. Connect the “Filtered Constellation” TkXYPlot to the output of the SampleAndHold circuits. The input of the TkXYPlot is high impedance so insert 50 resistors to ground at each input to match the output impedance of the SampleAndHold circuits. Connect the input of the SampleAndHold circuits to the outputs of the raised cosine filters. The final circuit should look like shown here: 15.4.3 View the Sampled Constellation: Check Simulation/Simulation Setup… and make sure Open Data Display when simulation completes is checked. Run the simulation and look at the “Filtered Constellation” plot. Why are the SampleAndHold circuits required here to look at the constellation of a Nyquist bandlimited system? Later on we’ll learn a simpler way to do this. 15-16 Lab 6: Agilent Ptolemy- QPSK Simulation About Sampled Constellations: SampleAndHold circuits are required to view a Nyquist bandlimited constellation because it is not valid to display every sample for filtered symbols. The filtered symbols have overshoot and ringing because the high frequency content has been removed from the rectangular symbols. This distortion causes minimal degradation to the system performance if the symbols are sampled in the middle of a symbol time, where the filtered symbols have a value close to the ideal rectangular symbols (+/- 1 V). This requires the symbol stream be selectively sampled starting in the middle of a symbol with a sampling period of a symbol time. The delay parameter for the Clock elements establishes the start time for the sampling using the equation: Delay=Filt_delay_time+(0.5*Sym_time) This equation accounts for the delay through the raised cosine filter and begins sampling in the middle of the first valid symbol out of the filter. The period parameter for the Clock element establishes the sampling period and is set to a symbol time so that the middle of each subsequent symbol is sampled. Downsamplers could also be used to accomplish the same functionality as the SampleAnd Hold circuits. 15.4.4 View the Modulated Spectrum : It is important to let the simulation run long enough as to allow the Spectrum Analyzer to collect sufficient data and send it to the Data Display window. A warning message will appear if the TkPlots are dismissed prematurely and a dialog box will prompt the user for a choice of continuing or quitting. Only partial data will be sent to sinks if the simulation is ended prematurely. Click on Quit to end the simulation. 15-17 Lab6: Agilent Ptolemy- QPSK Simulation A Data Display window should automatically open and place a plot of Mod_Spectrum. It may be necessary to add a dBm modifier to get the plot as shown below: dBm(Mod_Spec) 0 -10 -20 -30 -40 -50 -60 69.85 69.90 69.95 70.00 70.05 70.10 70.15 freq, MHz NOTE on timestep: The time step for the timed elements is set to the variable equation Tstep=1/(Sym_rate*Sam_per_sym), which yields a timestep of 4.115uS. The simulation bandwidth is a function of time step, where Simulation BW= Fcarrier +/1/(2*timestep). Thus, the 4.115uS time step yields a simulation bandwidth of 121.5 kHz around the carrier frequency of 70 MHz. 15.5 QPSK Demodulator: 15.5.1 Add the QPSK demodulator: 1. Disconnect the “Mod_Spectrum” Spectrum Analyzer sink and termination resistor from the output of the “QAM_Mod”. Place a “SplitterRF” from the “Timed Linear” library, and connect it between the QAM_Mod and the Spectrum Analyzer sink as shown: 15-18 Lab 6: Agilent Ptolemy- QPSK Simulation 2. Place a “QPSK_Demod” element from the “Timed Modem” library and set the following parameters: SymbolTime to Sym_time - units set to None ExcessBW to 0.35 - for the raised cosine filters Connect the RF input of the “QPSK_Demod” element to the lower output of the “SplitterRF”. 3. Place an “N_Tones” source from the “Timed Sources” library and set the following parameters: TStep to Tstep - units set to None Frequency1 to IF_freq - units set to None Power1 to +12 dBm - or type in: dbmtow(12) NOTE: The N_Tones source allows phase noise at different frequency offsets to be specified using the parameter PhaseNoiseData. 15-19 Lab6: Agilent Ptolemy- QPSK Simulation 4. Connect the output of the “N_Tones” source to the “Osc” input of the “QPSK_Demod” as shown below. 15-20 Lab 6: Agilent Ptolemy- QPSK Simulation 15.5.2 Connect Timed Sinks: 1. Select a “TimedSink” element from the “Sinks” library and change its instance name to “Iout”. Connect it to the I output of the demodulator. 2. Copy the TimedSink and connect it to the Q output of the demodulator, changing its name to “Qout”. 3. Set the input impedances of the sinks to 50 ohms by shunting 50 resistors to ground at the inputs of the sinks as shown in the diagram. 4. Perform the simulation. Start the simulation and wait until it is complete. 15-21 Lab6: Agilent Ptolemy- QPSK Simulation 15.5.3 View Demodulated I and Q: Open a DDS window and place a Stacked Rectangular Plot to display the demodulated I & Q symbol streams, Iout and Qout. QUESTIONS: What is causing the .493 mS delay? Hint: Push into the demodulator. How should this delay be accounted for when setting up Error Vector Magnitude and Bit Error Rate Measurements? 15.6 Output Constellation: 15.6.1 Sample the Output I and Q: 1. Insert a TkConstellation element at the output of the QPSK Demod element. Set its parameters to: 15-22 Label=“Demodulated Constellation” NumSamplesPerSymbol=10 Amplitude=2 SampleDelay=5 Sytle=dot Lab 6: Agilent Ptolemy- QPSK Simulation a. Place a TkEye and Set the following parameters: Label=”Tk Eye” NumSamplesPerSymbol=10 NumSymbols=2 Amplitude=2 Connect it to the Q output of the demodulator. 5. Simulate and view the results. Examine the demodulated constellation and eye diagram. 15.6.2 View the Sampled Output Constellation: 15-23 Lab6: Agilent Ptolemy- QPSK Simulation QUESTION: 15.6.3 Why does the demodulated constellation look better than the "Filtered Constellation" in the modulator? Hint: Is the raised cosine filter response distributed between the modulator and demodulator? View the Output Eye Diagram: Select “View>all” to see the eye diagram. About the plot: The x-axis represents samples, not time. There are 10 samples per symbol in this exercise, so the xRange is set from 0 to 10 to overlay 10 samples (or one symbol duration) on top of each other. The x-axis can be converted to time by multiplying the timestep by the sample number (e.g. 0 to 10 samples = 0 to 10samples*(4.115uS/sample) = 0 to 41.15uS. 15-24 Lab 6: Agilent Ptolemy- QPSK Simulation 15.7 Phase Noise Effects: Add phase noise to the “N_Tones” source and observe its effect on the constellation and eye diagrams. Edit the parameter: PhaseNoiseData to 100 -50 1000 -60 10000 -70 100000 –80 where the frequency offset is specified first (in Hz), with the phase noise following (in dBc/Hz). N_Tones N1 TStep=Tstep Frequency1=IF_freq Power1=dbmtow(12) Phase1=0.0 AdditionalTones="" RandomPhase=No PhaseNoiseData="100 -50 1000 -60 10000 -70 100000 -80" ROut=50.0 Ohm RTemp=-273.15 PN_Type=Random PN The results (constellation and eye diagrams) for the demodulated output are shown here. 15-25 Lab6: Agilent Ptolemy- QPSK Simulation The points in the constellation are spread out more, so there is more “uncertainty” in deciding the actual state. Also, the eye diagram does not have a definite “point” at the sampling moment (reason for which the constellation is spread out more). All these will finally translate into a degradation of the bit error rate (BER) for the same level of signal to noise ratio (SNR). 15.8 Lab Review: In this lab, a basic QPSK system was examined using the HP Ptolemy simulator. Fundamental relationships were established using variables and equations for accuracy and flexibility. TkPlots were used to examine constellation diagrams and eye diagrams. SampleAndHold circuits were added to selectively sample in the center of the symbol time to obtain a valid constellation for the Nyquist bandlimited system. A QPSK demodulator was used to demodulate the signal and recover the I and Q data. The demodulated I and Q symbol streams were examined and the delay resulting from the root raised cosine filters in the modulator and demodulator were observed. This delay will be important when considering qualitative measurements such as Error Vector Magnitude and Bit Error Rate measurements. The effects of local oscillator phase noise on the constellation and eye diagrams were also analyzed. 15-26