PSpice Basic Examples Hayder Radha - ECE202 Example Capacitor (Tran.) * Lines with the star symbol (*) are used for comments * SIN (<DC offset><amplitude><frequency><timedelay><damping factor> <phase >) VS 1 0 SIN (0 100 200 0 0 90) C1 1 0 0.5U .PROBE * .TRAN <print step value> <final time value>+[no-print value [step ceiling value]] .TRAN 100U 20M 0 100U .END The above PSpice program performs analysis in the timedomain using the ".TRAN" mode/command. The program specifies a sinusoidal source (SIN) with: <amplitude> = 100 V that operates at a particular: <frequency> = f = 200 Hz. Note that a <phase> = 90 degree is specified within the SIN function. This provides a "cosine" source. In general, if the desired phase of the "cosine" source is ( φ ), then the "phase" parameter should be set to: ( φ + 90). Note that in this example: The time-period associated with a complete cycle = T = 1/f = 5 milliseconds. We need to keep this value in mind when specifying the parameters of the ".TRAN" command. For example, the <print step value> parameter specifies the step-size (in units of time) that PSpice would use to analyze and plot the different signals of the circuit. In general, this parameter should be much smaller than T. Here, we selected a <print step value> = 100 microseconds (100U). The <final time value> parameter specifies the end-time for the desired analysis/plots. Here and again, we need to take the value T=5msec into consideration. You need to analyze and plot the circuit over multiple cycles. Here we selected <final time value> = 20 milliseconds (20M). This represents four (20/5) cycles of the desired signals (at frequency f = 200Hz). Example Capacitor Date/Time run: 09/12/04 Temperature: 27.0 (A) ex_capacitor (active) 100V 0V -100V V(1) 100mA 0A SEL>> -100mA I(C1) 1 100mA 0A -100mA 2 100V 0V >> -100V 0s 1 5ms I(C1) 2 10ms 15ms 20ms V(1) Time Date: September 12, 2004 Page 1 Time: 23:34:40 From the above plots for the current and voltage across the capacitor, we clearly see a "shift" between the two signals. We can use PSpice to measure this "shift" in time: ts = 1.25 milliseconds. This translates into a phase (angle) shift of φ that we can evaluate using the relationship between ts and φ : ts =φ/ω. Note that a phase shift of 90 degree is what we expect between the current and voltage signals across a capacitor. Also note that the current signal "leads" the voltage signal. For example, the peak value of the current signal happens "earlier" than the corresponding peak value of the voltage signal. AC Analysis with PSpice It should be clear that measuring the phase angle by using the above PSpise program is rather cumbersome. Another approach is to use "AC" analysis under PSpise. In this case, we can analyze the circuit over any desired range of frequencies. We can also easily measure the magnitude and phase of any desired signal in steady-state at any desired frequency. The following example illustrates a PSpice AC analysis of the same (above) simple circuit. Example Capacitor (AC) * VS 1 0 AC <magnitude> <phase> AC 100 0 C1 1 0 0.5U .PROBE *.AC <sweep><points><start freq><end freq> .AC LIN 100 .END 1Hz 200Hz VM(1) / IM(C1) IM(C1) VM(1) Date/Time run: 09/13/04 200V 100V 0V 100mA 50mA 0A 400K 200K SEL>> 0 0Hz Date: September 13, 2004 50Hz Example Capacitor (AC) (A) ex_capacitor_AC (active) 100Hz Frequency Page 1 150Hz Temperature: 27.0 200Hz Time: 00:18:10 We used PSpice to plot the ratio of the voltage magnitude (VM) to the ratio of the current magnitude (IM) across the capacitor. This ratio represents the magnitude of the impedance (|V|/|I|=|Z|) of the capacitor. As expected, the capacitor's impedance decreases as we increase the frequency. From the above plot for the capacitor's impedance magnitude (VM/IM), it is difficult to observe the actual impedance values over a wide range of frequencies. Below, we modify the frequency range for our PSpice analysis in order to gain a better insight into the capacitor's impedance over that range. Example Capacitor (AC) * VS 1 0 AC <magnitude> <phase> AC 100 0 C1 1 0 0.5U .PROBE *.AC <sweep><points><start freq><end freq> .AC LIN 100 .END 100Hz 200Hz IM(C1) VM(1) Date/Time run: 09/13/04 200V 100V SEL>> 0V 75mA 50mA 25mA 3.5K 3.0K 2.5K 2.0K 1.5K 100Hz VM(1) / IM(C1) Date: September 13, 2004 120Hz Example Capacitor (AC) 160Hz (A) ex_capacitor_AC (active) 140Hz Frequency Page 1 180Hz Temperature: 27.0 200Hz Time: 00:00:51 The AC analysis under PSpice could be used to evaluate the phase of any desired signal. Also, we can plot two or more functions in the same figure. In the plots shown below, we used PSpice to plot the magnitude and the phase of the different signals. Note that the phase for the capacitor's current is 90 degree over all frequencies. This is the case for this simple (capacitor-only) circuit. For more complex circuits the phase could change over frequency. We also plotted the difference between the voltage phase (VP) and the current phase (IP). This phase difference (VP-IP) represents the phase of the capacitor's impedance. Note that the resulting phase of the capacitor's impedance is negative 90 degree over all frequencies. This is consistent with our expectation. Recall the "−j" factor in the capacitor impedance: Z = −j ( 1/ω C ) = | 1/ω C | ej(-90) . Hence, and as we expect, the capacitor's impedance phase (-90 degree) is constant over all frequencies whereas the magnitude is a function of the frequency. Therefore, we can use PSpice to evaluate the impedance of any device by observing its impedance's magnitude and phase over any desired range of frequencies. 1.0ud 0d -1.0ud 2 2 150V 100V 50V >> 0V 100mA 50mA 180d 90d 0d 0A 2 >> 0d 400K -100d 1 IP(C1) VP(1) 2 2 VM(1) Example Capacitor (AC) Frequency 100Hz (A) ex_capacitor_AC (active) Page 1 50Hz 2 VP(1)- IP(C1) IM(C1) VM(1) / IM(C1) 1 Date/Time run: 09/13/04 1 1 1 200K 0 SEL>> >> -200d 0Hz 1 Date: September 13, 2004 150Hz Temperature: 27.0 200Hz Time: 00:40:34