EEM 206 Electrical Circuits Laboratory Spice is a very popular software to analyse the given electrical and electronics circuits. This software, called as “pspice” is introduced by MicroSim Corporation. This program simulates and calulates the considered circuit. A circuit must bespecified terms of element name, element value, nodes, variables parameters, and sources. NODES Node is connection point where two or more elements are connected in the circuit. The node number to wich an element is connected are specified after the name element. Node numbers are chosen as the integer number from 0 to 9999 (for student version). ELEMENTS The library of this software has lots of electrical and electronics elements, sources, and devices. Common elements are given in Table 1. In Table 2, the unuit suffixes are given. Thus, each element in the considered circuit is defined such as “Ra 1 2 125 OHM” . Element Variable Unit Variable Vaule Resistor R OHM P 10-12 Capatior C F N 10-9 Inductor L H U 10-6 Voltage Source V V M 10-3 K 10 3 MEG 10 6 G 10 9 Current Source I A Table 1. Circuit elements Table 2. Element vaules TYPES of ANALYSIS There exist three type analysis such as dc, transient and ac analysis. Once time dome response is determined using transient analysis, (small-signal) frequency response is found by ac analysis. It is know that, dc analysysis is used for dc model of circuit. VOLTAGE and CURRENT SOURCES The sources are decomposed into two types such as independent and dependent. Now, we consider the independen sources. They can be modelled by some waveforms (see, Fig. 1). Exponential source has exponential waveform and its symbol and code for pspice is given as EXP (V1 V2 TRD TRC TFD TFTC) where, the variable definitions are given in Table 3. Variable Figure 1. Exponantial waveform Meaning Unit Initial V1 volt voltage Pulsed V2 volt voltage Rise delay TRD seconds time Rise time TRC seconds constant Fall delay TFD seconds time Fall time TFC seconds constant Table 3. Model parameters of exp source Pulse source is defined as Fig. 2 (see for detail, Table 4). The symbol and code of this source type for pspice is given as PULSE(V1 V2 TD TR TF PW PER) where, the variable definitions are given in Table 4. Note that, this source is used for periodic pulse sources. Figure 2. Pulse waveform Variable V1 V2 TD TR TF PW PER Meaning Initial voltage Pulsed voltage Delay time Rise time Fall time Pulse width Period Unit volt volt seconds seconds seconds seconds seconds Table 4. Model parameters of pulse source Piecewise Linear Source The source waveform can be descrined as point by point such that the considered source signal is divided N points. Then, each point is defined by time and the vaule of current/voltage at this time (Ti,Vi) , where i Є {1,2,...,N}. The symbol and code of this source type for pspice is given as PWL(V1 T1 V2 T2 ...... VN TN) AC Source This source is defined as a formula V(t)= v0+va e-ψ(t-Ø)sin(2*pi*f(t-Ø)+(µ/360)) where, v0 denotes the offset voltage, va indicates the amplitude, f is frequency, Ø denotes time delay, ψ indicates the damping ratio, and µ indicates the phase degree. This source is repesented such as SIN(v0 va f Ø ψ µ) The Dependent Sources There exists four types dependet source such that Voltage controlled voltage source E<name> N+ N- CN+ CN- <gain> Voltage controlled current source G<name> N+ N- CN+ CN- <gain> Current controlled voltage source F<name> N+ N- VN <gain> Current controlled current source H<name> N+ N- VN <gain> Here, each source (element) in the circuit is defined using the connected node numbers. If a voltage source is considered, then once the first node number (N+) denotes is positive node and the second node number (N-) indicates negative node and if a current source is considered, then the current direction is importans such as from N+ to N-. Note that, N+ and N- denote the node numbers. Also, CN+ and CN- indicate the node numbers of the reference voltage. In Pspice, the current must be defined by depending a voltage source. Thus, VN denotes the voltage source that the considered current crosses. Finall, gain is the coeficient value. FILES for PSPICE The input file whose extension is cir (circuit) is an ascii file. This file includes the definition of the considered circuit using node number and the analysis type. Let us an example circuit (Fig. 3). We find the voltage at the resistor R3. Example Vsource 1 R1 1 R2 3 R3 5 . PRINT DC V(5,0) . END 0 3 5 0 DC 12V 100 OHM 20 OHM 30 OHM Figure 3. Example circuit In the example program, called as ex1.cir, the first line is detail line and PRINT and END are command for analysis in the line whose the first character is dot. Note that, Pspice is a case sensivitive software. After the nodes are determined, each element is defined using its node numbers. The output file, ex.out, contains the voltage at R3. The input file must be compalied to obtain the results such as EX-2 EX-3 Homework: AC ANALYSIS Ac analysis is used to determine frequency of the given circuit. This analysis is described as Here, this command analyses the given circuit between FSTART (Hz) and FSTOP (Hz). This frequency interval is divided to the number of sweep using linear/octave/decade. Let us a circuit as Here, if Vs(t) = 40 sin(Wt) V and the frequency interval between 100 Hz and 600 Hz. TRANSIENT ANALYSIS This analysis is used to determine the considered measuruments at the time interval such that TRAN TSTEP TSTOP, where TSTEP denotes the time incerement and TSTOP indicates the final time. Note that, this analysis always starts at 0 sec. MAGNETIC ELEMETS The magnetic elements are mutual inductors (transformers). The symbol coupling is K. The general form is given as K<name> L<first inductor> L<second inductor> <coupling> Let us consider a circuit Now, we find the magnitude and phane angle of output current. This desired is constructed such as AC analysis R1 1 2 0.5 L1 2 0 0.5MH L2 0 4 0.5MH Ka L1 L2 0.999 R2 4 6 0.5 Ro 6 7 150 Vx 7 0 DC 0V . AC LIN 3 60Hz 120Hz . PLOT AC IM(Vx) IP(Vx) . PROBE . END Here, PROBE is a command for plotting in Pspice. Note that, the first node is positive node which is signed by dot for the inductorr L1 and L2. OP-AMP The op-amp is modelled as DC / AC model for Pspice (see, Fig. 4). However, an opamp (741) is simulated by using the library of Pspice. If DC / AC model is used, then this model is defined as circuit such that the starting is .SUBCKT (sub-circuit like as sub-function) and .ENDS terminates this sub-circuit. a) DC model b) AC model Figure 4. DC / AC models for op-amp Let us consider op-amp circuit as The inverter amplifier can be wrote the input file as . SUBCKT OPMAP 1 2 5 4 RIN 1 2 2MEG R0 3 5 75 EA 3 4 2 1 20000 . ENDS OPAMP . PRINT DC V(5,0) . END This file finds the output voltage. REFERENCE M. H. Rashid, “Spice for Circuit and Electronics Using Pspice,” Perntice Hall, New Jersey, 1990.