Download the manual in PDF now -

Objective – By the end of this lecture, the student should be able to perform a Fourier analysis on a circuit.

Sec. 7-1  Fourier analysis

            Fourier analysis is useful when the harmonic distortion of the circuit is to be determine.  For this part of the lecture, we will be using a simple full wave rectifier circuit, refer to fig. 7-1.  This circuit takes a voltage source, a sinewave and output a DC voltage.  This circuit does yield a significant amount of harmonic distortion.

Fig. 7-1 – Full wave rectifier circuit
  1. Create the circuit as shown in fig. 7-1
  2. Change the reference for the VSIN to Vs
    1. Set the VAMPL to 35V
    2. Set the Freq to 60 Hz
  3. Change the reference for the resistor to RL
  4. Create a new simulation profile
  5. Select Transient Analysis as the analysis type
  6. Type in 50ms for the Run Time
  7. Type in 1ms for the Maximum Step Time
  8. Click on Output File Option
    1. Check the Perform Fourier Analysis option
    2. Type in 60 for the Center Frequency
      This is the frequency of the input and output signal
    3. Type in 19 for the Number of Harmonics
      This specify the number of harmonics to calculate
    4. Type in I(rL) for the Output Variable
      This specify to perform the FFT on the current through the load resistance
  9. Click OK
  10. Click OK
  11. Run the simulation

After the simulation is run, go to the Probe window and click on View/Output File.  The following is an except from the output file:


DC COMPONENT =  -5.959139E-01

HARMONIC   FREQUENCY    FOURIER    NORMALIZED    PHASE    NORMALIZED   

  NO         (HZ)     COMPONENT    COMPONENT    (DEG)       PHASE(DEG)

 1    	 6.000E+01    6.197E-02    1.000E+00    1.178E+02    0.000E+00

 2     	 1.200E+02    2.926E-02    4.721E-01    5.142E+01   -6.635E+01

 3       1.800E+02    1.759E-02    2.838E-01   -1.324E+01   -1.310E+02

 4       2.400E+02    1.133E-02    1.829E-01   -7.686E+01   -1.946E+02

 5       3.000E+02    7.447E-03    1.202E-01   -1.394E+02   -2.572E+02

 6       3.600E+02    4.905E-03    7.915E-02    1.597E+02    4.188E+01

 7       4.200E+02    3.233E-03    5.217E-02    1.016E+02   -1.613E+01

 8       4.800E+02    2.154E-03    3.476E-02    4.789E+01   -6.987E+01

 9       5.400E+02    1.488E-03    2.402E-02   -1.686E+00   -1.195E+02

10       6.000E+02    1.088E-03    1.756E-02   -4.953E+01   -1.673E+02

11       6.600E+02    8.406E-04    1.357E-02   -9.944E+01   -2.172E+02

12       7.200E+02    6.677E-04    1.078E-02   -1.533E+02   -2.710E+02

13       7.800E+02    5.400E-04    8.715E-03    1.499E+02    3.216E+01

14       8.400E+02    4.340E-04    7.004E-03    9.303E+01   -2.474E+01

15       9.000E+02    3.479E-04    5.615E-03    3.830E+01   -7.946E+01

16       9.600E+02    2.676E-04    4.318E-03   -1.718E+01   -1.350E+02

17       1.020E+03    2.079E-04    3.355E-03   -7.627E+01   -1.940E+02

18       1.080E+03    1.569E-04    2.533E-03   -1.390E+02   -2.567E+02

19       1.140E+03    1.329E-04    2.145E-03    1.519E+02    3.412E+01

		TOTAL HARMONIC DISTORTION =   6.024097E+01 PERCENT

The output listing show the DC component, or the fundamental frequency, it also shows the total harmonic distortion, or THD.  This listing is quite useful, but to really see the result clearing, the harmonics should be plotted.  PSpice does not do this, so the data should be exported to an external application such as MS Excel and graphed.

Sec. 7.2 Exporting data to Excel

For this part of the lecture, we will be using the program MS Excel to plot the harmonics plot.

  1. Select the listing from the output file, and click on Edit/Copy
    Choose only the part that’s relevant to the data, refer to fig. 7-2.
  2. Open up the program Notepad, and select Edit/Paste, refer to fig. 7-2
    Notepad can be access by clicking Start/Programs/Accessories/Notepad

    Fig. 7-2 – Notepad window

  3. Save the file with a .txt extension
  4. Open up the saved file in Excel.
    1. Once the file is open, Excel will present the text wizard import dialog box, refer to fig. 7-3

      Fig. 7-3 – Excel text import wizard option dialog box step one

    2. In the option, select Delimited
    3. Click Next
    4. Select Space under the Delimited field
    5. This will put each data between spaces in its own cell
    6. Click Finish
  5. From the Excel window, click on a new column and type in Norm Mag
    1. Click on a cell below Norm Mag.
      This column will be the normalize magnitude with respect to the first harmonics. 
    2. Type in the formaula =c4/$c$4This formula divides the first harmonics into the subsequent harmonics.  The $ sign is an absolute addressing.
    3. Copy the equation from this cell and paste it to the following cell, refer to fig. 7-4

      Fig. 7-4 – Formula pasted into cells.

  6. Create a graph using the Chart Wizard
    1. Select the Norm Mag column and the Harmonic No column
    2. Select Column for the Chart Type

The chart you get should be similar to fig. 7-5.

With this plot, it is easy to see the amount of distortion each harmonics contribute.

*Note – I am assuming the students have sufficient knowledge in using Excel, so I won’t go into details on using Excel*

Fig. 7-5 – Harmonic plot

Sec. 7.3 Importing data into PSpice

            There are ways to import data into PSpice so it could be simulated concurrently with the PSpice circuit.  The easiest way I found to do this is to using the PWL (Piecewise Linear model).  The PWL can either be a voltage source or a current source.  The PWL have a few parts in which to import the data; one is to enter the data in manually; the other is to specify a data file. 

            The data file that the PWL will accept can be any data file as long as it’s in CSV format.  The data file has to have two column data with the first column being the second and the second column being either the voltage or current.  Between the two data, it has to be separate by a comma.  A sample format would be as follow:

0,35
0.01,34
0.015,31

This would then be saved into a file and call from PSpice.

            To call the file in PSpice, the best part to use is the VPWL_FILE located in the source library.

Sec. 7.4 Using PWL to create a one shot pulse wave

Technique 1

  1. Create the circuit in fig. 7-6

    Fig. 7-6 – One shot pulse wave

  2. For the voltage source, use the part call VPWL in the source library
  3. Double click on the VPWL to access the data sheet
    1. For T1 type in 0
    2. For V1 type in 0
    3. For T2 type in 0.01
    4. For V2 type in 0
    5. For T3 type in 0.010001
    6. For V3 type in 5
    7. For T4 type in 0.02
    8. For T5 type in 0.020001
    9. For V5 type in 0
  4. Create a transient analysis
  5. Plot the voltage waveform for the VPWL, the waveform should look like fig. 7-7

Fig. 7-7 – Single shot pulse using PWL

Technique 2

  1. Open up Notepad
  2. Type in the following values:
    0,0
    0.01,0
    0.010001,5
    0.02,5
    0.02001,0
  3. Save the file as one_shot.txt
    PSpice does not allow file with spaces, so an underscore should be used to separate the words for the file name.
  4. Create the circuit in fig. 7-8
    1. For the voltage source use VPWL_FILE
    2. Double click on the <file> near the part
    3. Type in one_shot.txt
      *NOTE – Make sure that one_shot.txt is located in the same folder as the PSpice file*
  5. Create a transient analysis for 50ms
  6. Run the simulation
  7. Add a trace to plot he voltage of the VPWL_FILE

The plot should be the same as fig. 7-7.

            The PWL is also useful if an uncommon signal need to be modeled or an almost perfect impulse function.

Fig. 7-8 –One shot pulse using VPWL_FILE