PSpice circuit file

From Infogalactic: the planetary knowledge core
Jump to: navigation, search

A PSpice circuit description file (*.cir) contains the configuration data for circuit simulation with the OrCAD EE PSpice simulator. The simulator processes such files, and generates a simulation result file (*.out), as well as a binary probe data file (*.dat) for viewing waveforms. PSpice Circuit files are typically generated by OrCAD Capture or other schematic capture application, and may also be entered manually in a text editor.

The circuit file contains the component netlist, simulation options, analyses statements, and the output control statements. The component netlist comprises a list of all circuit elements, along with the node names connected to their terminals. The netlist topology is converted into an equivalent matrix which is solved to find the circuit state, and is also used to simulation output file.

Types of analyses

The type of simulation performed by PSpice depends on the source specifications and control statements. The analyses usually executed in PSpice are listed below.

DC Analysis

It is used for circuits with time–invariant sources (e.g. steady-state dc sources). It calculates all nodal voltages and branch currents over a range of values. The types of dc sweep analyses and their corresponding .(dot) commands are described below:

  • Linear sweep: .DC [LIN] <sweep variable name> <start value> <end value> <increment value>
  • Logarithmic sweep: .DC <DEC|OCT> <sweep variable name> <start value> <end value> <points value>
  • Sweep over List of values: .DC <sweep variable name> LIST <value>*

All these sweep types can also be nested by adding another set of parameter name and values at the end.

Transient Analysis

It is used for circuits with time variant sources (e.g., sinusoidal sources/switched dc sources). It calculates all nodes voltages and branch currents over a time interval and their instantaneous values are the outputs. The corresponding .(dot) command is as follows: .TRAN <print step value> <final time value> [no-print value [step ceiling value]] [SKIPBP]

AC Analysis

It is used for small signal analysis of circuits with sources of varying frequencies. It calculates the magnitudes and phase angles of all nodal voltages and branch currents over a range of frequencies. The corresponding .(dot) command is as follows: .AC <LIN|DEC|OCT> <Number of points> <Start frequency value> <End frequency value>

Designation of element values

Two types of suffixes are generally used in order to write element values viz., scale suffix and unit suffix. Scale suffixes are upper letters and multiplies the number that it follows. Some of the unit suffixes and scale suffixes normally used are as follows:

  • MEG = 1E6
  • K = 1E3
  • M = 1E-3
  • U = 1E-6
  • N = 1E-9
  • P = 1E-12

Each element in a PSpice circuit must contain a device name (such as Vs, Is, R, etc.) with an appropriate key initial letter. Upper or lower case letter can be used because PSpice is insensitive to case in circuit files. However, PSpice does not allow subscripts or superscripts. IS is thus written as IS, VS as VS and so on. PSpice automatically assigns the corresponding SI unit for each element based on the key letter of its name, so units need not be written after element values. The element values are written in standard floating point notation with unit suffixes, NOT separated by space, this is in contrast to what is required by the SI. E.g. the value of an inductor may be expressed in the netlist as 20mH or 20M. Note that M means ‘milli’ and not ‘mega’. Mega is written as MEG. E.g. 10 Mega ohms may be expressed as 10MEGOHM or just 10Meg.

Designation of nodes

The location of an element is identified by the node numbers since each element is connected between two nodes. PSpice works fundamentally with node voltages, and the circuit description requires node numbers. All nodes must be connected to at least two elements and hence appear twice. Node numbers are integers but need not be sequential in PSpice. Node O is the ground node and all nodes must have a dc path to the ground node. Node voltages are identified by node number. The voltage difference between two nodes may be written as v (node 1, node 2), which stands for v(Node 1) – v(Node 2). If two or more connection points are joined by a zero resistance path, then that combination is treated as a single node. Each element in a .PSpice circuit must connect to nodes that specify the element’s location. Consequently, even a series connection point requires identifiers and can be treated as a node. The reference polarity for node voltage is always positive relative to the node O. PSpice employs the passive combination of all elements, with the first named node taken to be at higher potential.

Designation of circuit elements

Circuit elements are designated by names and the name must start by a letter symbol. After the letter symbol it can contain either letter or numbers up to a total of eight characters. A passive element is described as follows: (element name) (positive node) (negative node) (value)

PSpice employs passive convention of elements, the first named node is taken as higher potential. The reference direction of current through the element goes from the first named node to the second i.e., the positive current flows from the first named node (N+) to the second (N-). If the nodes are interchanged, the direction of the current through the element will be reversed.

Circuit files

The circuit files contain five types of statements, some of which are optional. The statement types are:

  • The title, which must appear in the first line. This line is used by spice as a label within the output file, and is not considered in the analysis. It is compulsory to allocate the first line.
  • Device statements specifying circuit elements and having a key letter in the first column.
  • Control statement; some control statements pertain to devices, while others specify the type of simulation or output format.
  • Comment lines having an asterisk (*) in the first column. Comment may also appear in other line after a semicolon(;).
  • The .END statement forming the last line. Additional end statements may also appear within the file to separate multiple simulations each of which must also have a title line.

It may be noted that for the SPICE/Pspice program, the first line being the title line, it may contain any type of text. The last line being the .END statement, the order of lines in between is irrelevant and does not affect the results of simulation. If any Pspice statement is more than one line, the statement can continue to the next line having a +sign in the first column of the next line. A comment line can be included anywhere proceeded by an (*). Upper or lower case letters may be used for Pspice statements (upper case for SPICE 2). Number of blanks between items is insignificant except in the title line.

Device statements

It includes a user supplied name, the numbers of the nodes to which the element is connected and the element is connected and the element’s value. Independent dc voltage and current sources are described by the following scheme; the required key letter (V or I) are capitalised and is followed by the higher and lower potential node numbers (N+ and N-) respectively. The value is then given and may be +ve or –ve. Except sources, zero values are not allowed. Infinite value of any element is not feasible. Numerical values are expressed in either floating point or fixed point form. The floating point notation for R*10^p is Rep when R is any number and p is a positive or negative number. Alternatively, a number may be followed immediately by any scale factor. Numerical values in device statements may also be specified via expression. The form of statement then includes (expression) where the early brackets enclose a mathematical relation. The mathematical operators are symbolised by:- + (addition) -(subtraction) *(multiplication) /(division).

Control statements

Here the only essential one required is the last line i.e., the end statement. Pspice produces its default output consisting of:

  • Node voltage values
  • Current values through each independent voltage source
  • Total power dissipation supplied by independent voltage sources but not by current sources.

The optional control statement affects the output format and written as : Option (list)(node) (no page) When ‘list’ gives a summary of elements, ‘node’ gives a summary of connection while “no page” suppresses paging. It is usual to include .option no page to conserve paper.

PSpice output

If the Pspice default output does not provide enough information, the circuit file should be augmented to give values of other variables desired. If only the branch current is desired, the default output automatically includes the currents through all independent voltage sources. Accordingly, it is required to incorporate a current – scaling zero voltage source in the appropriate branch. This source has O voltage magnitude and acts like a short. It does not alter the circuits’ behaviour but it requires an additional node number. It is basically a dc dummy voltage source (0V) added to the specify branch and used as an ammeter to measure the current of the source.

To get several branch currents and or voltages, it is possible to use a print control statement having the general form

       .PRINT DC VAR1 VAR2……

Where VAR1, VAR2……… represent all the variables of interest. The default output is not supplied when the ckt file includes a .PRINT DC statement. The .PRINT DC statement should also be accompanied by a source control statement governing the value of an independent voltage or current source. Pspice has capability for printing and plotting of output voltages or currents. For dc sweep and transient analysis, the output voltages and currents can be obtained by the following statements:-

       V(node)             :Voltage at node with respect to ground
       V(N1, N2)        :Voltage at node N1 with respect to node N2
       V(name)         :Voltage across two terminal device
       VX(name) :Voltage at terminal x of a three terminal device
       VXY(name)        :Voltage across terminals x and y of 3 terminal device
       VZ               :Voltage at port Z
       I(name)          :Through current
       IX(name) :Current through terminal x
       IZ(name) :Current at port Z

PSpice usually does not allow measuring voltage across a passive element like V(R1), V(C1), V(L1) except when used only for outputs by .PLOT and .PRINT statement. The commands those are available in PSpice simulation to get the output are as follows:-

    (i)    .PRINT DC (output variables)

(The maximum number of variables at the output should not be more than eight)

    (ii)   .PRINT statement

(however, more than one .PRINT statement can be used to print all desired output variables)

    (iii)  .PLOT DC (output variables).

(The results from DC analysis can also be obtained in the form of line printer plots. Maximum eight variables can be obtained in such a statement and more than one .PLOT statement can be given.)

    (iv)   .PROBE

(Probe is the graphics waveform analyser and is available in the professional version of PSpice. Once the results of the simulations are processed by .PROBE command, the results are available for graphic displays).

See also