DEIS

UNIVERSITY OF BOLOGNA
D.E.I.S. - Dipartimento di Elettronica Informatica e Sistemistica

A Spice-like circuit Simulator for HP48G Calculator
 

  Author: Marco Gavesi
   
Preamble: The Spice48G determines the dc operating point of the circuit with inductors shorted and capacitors opened. Circuit may contain resistor, diodes, BJT's, OPAMPs (operational amplifiers). The program work in cooperation with SOLVESYS - Sune Bredahl - Non-linear equation solver library. The dc operating point determines the work zone of non-linear device by the system of non-linear equations. Each device are descripted by built-in models for the semiconductor device, and the user need specify only the pertinent model parameter values.
Circuit Description: The circuit to be analyzed is described by a set of elements cards. Each element in the circuit is specified by an element card that contains the element name, the voltage nodes, the current node, the parameters, the model, the value. Element will be enclosed in "{" and "}" signs.

Resistors

General form : { R I N1 N2 VALUE } where N1 and N2 are two voltage element nodes. VALUE is the resistance (in ohms) and may be positive or negative but not zero.
Examples : { R IR V1 V2 100 } { R IR 10 0 1000 }

Node

Node card generating current node equation. The tag IA, IB or IC can be also current node equations. The negative current will be enclosed in the ' ' signs.
General form : { J IA IB IC }
Examples: { J I1 I2 '-I3' } { J 'IA-IB' I2 I3} (cascade of current node equations) { J '-I1' '-I2' '-I3' }

Bipolar Junction Transistor (BJT)

The bipolar junction transistor model in SPICE is an adaptation of the simpler Ebers-Moll Model. 
General form : { Q VB VC VE IB IC IE model IS betaF betaR VA ID },where: VB = base voltage , VC = collector voltage, VE = emitter voltage, IB = base current, IC = collector current, IE = emitter current, model type = NPN or PNP, IS = transport saturation current (default = 1.0E-16), betaF = ideal maximum forward beta (default = 100), betaR = ideal maximum revers beta (default = 1) , VA = Early voltage (default = infinite (1E+99)), ID is the name of device in the circuit
Examples : { Q V1 V2 V3 I1 I2 I3 NPN 1E-15 100 1 1E99 Q1 } two parameters model { Q V1 V2 V3 I1 I2 I3 PNP 1E-15 100 10 10 Q1 } three parameters modeln

OPAMP (Operational amplifier)

General form : { O V+ V- VU AD0 R0 I- I+ Iu VUM } { ONS V+ V- VU AD0 R0 I- I+ Iu VUM } OPAMP in high gain zone { OSP V+ V- VU AD0 R0 I- I+ Iu VUM } OPAMP in positive saturation { OSM V+ V- VU AD0 R0 I- I+ Iu VUM } OPAMP in negative saturation
Where V+ = non inverting input, V- = inverting input, Vu = output voltage, AD0 = Open Loop Gain (default AD0=10E5), R0 = Output resistance (default R0=10 W), I- = inverting current, I+ = non inverting input current, Iu = Output current, VUM = Saturation voltage
Examples : { ONS V1 V2 VU 10E5 10 I1 I2 Iu 10 } { O V1 V2 VU 10E5 10 I1 I2 Iu 10 }

Diode

The dc characteristics of the diode are determined by the parameter IS.
General form : { D I VA VB IS } where I = diode current, VA = anode voltage, VB = catode voltage, IS = saturation current
Example : { D I1 V1 V2 1E-16 }

DC Analysis: At the end of this procedure the list of components must be stored in a variable. (Ex : 'ES' STO). Subsequently. you must go in the directory named DATI and store correct value of termical voltage VT in the variable named VT, store value of operating points. Now, you must go in the up directory (default directory), and press the variable ES (circuit description) and press button OP (operating point calculation program). Now you are in the SOLVESYS library program, press INIT to continue, specify the initial values (e.g. all transistors are ON) and press SOLVE to solve the system of non-linear equations. Finally, press STK-> to copy all values in the stack window.

Example: Vcc=10V, VEE=-10V, R=1KW bF=70, bR=1 VT=25mV, IS=8fA, VUM=10V. Two identical transistor with two parameters model (no Early effect) Opamp is ideal without reactive effect.

circ.jpg (11027 byte)

Problem: Calculate the V+ and V- voltage in the dc operating point correspond to Vi1=-2.9V, Vi2=-3.7V

Example Step by Step:

Go to Directory named DATI and store the RX, Vi2, Vi1 and VT values

screen3.jpg (7384 byte)

Specify the circuit schematic in the stack:
{
{ Q Vi1 VC1 VE Ii1 IC1 IE1 NPN 8.E-15 70 1 1.E99 Q1 }
{ Q Vi2 VC2 VE Ii2 IC2 IE2 NPN 8.E-15 70 1 1.E99 Q2 }
{ J IE1 IE2 '-IR' }
{ R IR VE -10 1000 }
{ R IRX 10 VC1 RX }
{ R IR2 10 VC2 1000 }
{ J IRX '-IC1' '-I' }
{ J IR2 '-IC2' '-Ip' }
{ O VC2 VC1 Vu 1000000 10 Ip Im Iu 10 }
{ J I '-Im' Iu}
{ R Iu Vu VC1 1000 }
}

screen1.gif (812 byte)
Circuit Description in Stack

Press OP button to start analysis

screen2b.jpg (8854 byte)

 

screen2.jpg (10717 byte)
System of non-linear equations that describes the circuit:
18 non-linear equations

Press OK button to start SOLVESYS

screen2c.jpg (10903 byte)

 

Specify the initial values to solve the system

screen5.gif (738 byte)
screen6.gif (604 byte)

Press SOLVE  button to start analysis

screen7.gif (658 byte)

After few minutes, the system will be solved

solve.gif (597 byte)

Press ->STK  button to copy values to stack

solve1.gif (859 byte)

The calculated values in the stack are:

solve3.gif (704 byte)

The USERRPL Code: EE (5546 bytes)
HTML Documentation and program code in zipped format: spice48g.zip
References:
  1. Zsolt M. Kovacs Vajna, Alberto Leone, Introduzione all'elettronica analogica in 50 Esercizi, Patron Editore Bologna (in Italian language)
  2. P.W.Tuinenga, SPICE, A Guide to Circuit Simulation and Analysis Using Spice, Prentice Hall
  3. W.Banzhaf, Computer Aided Circuit Analysis using SPICE, Prentice Hall  
  4. SPICE2G, User's Guide, C.L.U.P.

Marco Gavesi
DEIS - University of Bologna, Italy

Revised 28-09-2000 01:36


Alma Mater Home DEIS Home Micrel Group Home