# 幸运飞艇超稳计划群

MacSpice > Tutorials > OP Analysis

# MacSpice Tutorials

## OP Analysis of Quiescent State

### 2.1 Introduction

an operating point (op) analysis finds the quiescent state of a circuit using a form of modified nodal analysis:

• [Wikipedia]

### 2.2 Linear Network of Resistors and Sources

 CW180402-01. A linear network with a single operating point.

our first example will find the operating-point of circuit cw180402-01 (above), where the nodes have been labelled in red text. this requires creation of a source-file as follows:

create a new source file named 'cw180402-01.cir' in the macspice working directory:

• ~/Documents/MacSpice/

 CW180402-01 Linear Network Example V1 in 0 DC 9.0V V2 1 0 DC 1.5V R1 2 in 47 R2 2 1 180 R3 2 3 220 R4 3 out 1K R5 0 out 560 .end

    MacSpice 1 -> source CW180402-01.cir

try, in order, the following interactive commands:

The parameters output by show are listed in Appendix B of the User's Guide:

You can use the MacSpice edit command to edit the current source file, or to create a new one. For example, to create a new circuit called foo.src:

    MacSpice 8 -> edit foo.src

### 2.3 RTL Bistable

 CW180402-02. R-S Bistable.

circuit cw180402-02 is an r-s bistable. in normal operation its stable states are selected by grounding the 'set' or 'reset' nodes. this circuit also has a third metastable state. this type of circuit is a challenge for op analysis, which can only find one of the three possible states and, due to the non-linear nature of the problem, in some circumstances it may fail to converge on a solution.

into the macspice working directory, open it and perform an op analysis.

• MacSpice 10 -> source CW180402-02.src
• MacSpice 11 -> op
• MacSpice 12 -> print v(out1) v(out2)
v(out1) = 2.42210e+00
v(out2) = 2.42210e+00

the solution found is the metastable one, which is not useful; it is not observed in the physical circuit because device tolerances and/or noise drive it into one of the stable states.

#### 2.3.1 The '.NODESET' Statement

adding one or more '.nodeset' statements to the netlist defining a circuit:

    .nodeset v(out1)=9.0V

• MacSpice 13 -> source CW180402-02.src
• MacSpice 14 -> op
• MacSpice 15 -> print v(out1) v(out2)
v(out1) = 8.69356e+00
v(out2) = 3.86566e-02

#### 2.3.2 The 'OFF' Parameter for Semiconductors

when using a .nodeset statement is inappropriate, semiconductor and switch devices can be forced into their non-conducting state by specifying 'off' as a parameter.

if a device is specified off, the op analysis commences with the (internal) terminal voltages for that device set to zero. after convergence is obtained, the iterative solver continues to obtain the actual values for the terminal voltages.

for example, specifying on line 11 of the example file that q2 should be 'off':

    q2 out2 b2 0 BC107BP off

and repeating the analysis finds the stable state with out2 high:

• MacSpice 13 -> source CW180402-02.src
• MacSpice 14 -> op
• MacSpice 15 -> print v(out1) v(out2)
v(out1) = 3.86566e-02
v(out2) = 8.69356e+00

#### 2.3.3 Other Approaches

another method of finding the desired operating point is to use a tran analysis to simulate the switch-on transient behaviour of the circuit by ramping the power-supplies from zero to their normal values in a realistic manner. this approach will be discussed in a later tutorial.

### 2.4 Accuracy and Tolerances

macspice solves the circuit equations by an iterative process that terminates when both these conditions hold:

• The nonlinear branch currents converge to within a tolerance of 0.1% or 1 picoamp (10−12 A), whichever is larger.
• The node voltages converge to within a tolerance of 0.1% or 1 microvolt (10−6 V), whichever is larger.

these tolerances, which were chosen with simulation of bipolar integrated circuits in mind, can be modified by setting the values of some frontend variables:

Name Default Value Units
ABSTOL1.0e-12A
RELTOL1.0e-03
VNTOL1.0e-06V