SCEPTRE: Simulation of Nonlinear Electrical Circuits
SCEPTRE is an automatic circuit analysis program capable of determining initial condition, transient, frequency and steady-state response of electrical networks and dynamic systems. It is considered a general-purpose tool for engineers and can be used to assist in the design and analysis of various circuits. The problem of interest is described in a free-format, easy-to-learn, engineer-oriented language. The basic set of network elements consists of linear and nonlinear resistors, capacitors, inductors, voltage and current sources, and mutual inductances.
In addition, SCEPTRE has a “Defined Parameter” mode allowing it to solve state equations, which might be written to describe non-electrical systems. This outstanding feature allows the user to couple electrical networks with differential equation systems giving a great deal of versatility, especially for interdisciplinary problems like mechatronics.
If the problem of interest cannot be described by the built-in functions, the user can describe his problem as an ultima ratio via a FORTRAN program. The program uses the state variable method. Other highlights are the model library, reruns with automatic varied network quantities, extended DC options (sensitivity, worst-case, Monte Carlo, optimization), and several integration routines for accurate and fast solution of even “stiff” problems.
To give the uninitiated some idea of the input data required to accommodate a simple but practical problem, consider the electrical schematic of the Darlington pair in Figure 1. The SCEPTRE version of the circuit appears in Figure 2 with the assumption that a transistor equivalent circuit named 2N706A has been stored in the model library at some previous time.
The problem is to determine the output voltages across R3 and R4 and the power requirements of this circuit under nominal conditions and after the current gain of the first-stage transistor has been degraded to various levels. Defined Parameters will be used to calculate the power consumption (PEC, PEIN). The rerun feature accommodates the additional runs required for the degraded alpha version (P1T1). The SCEPTRE input is shown in Listing 1.
This section describes the preparation of circuits and the basics of the circuit description language for better understanding of the examples.
Assuming the user wants to analyse an electric circuit, the following steps should be considered:
Draw an equivalent circuit consisting of resistors, capacitors, inductors, mutual inductances, voltage sources, current sources or models containing these elements. All of these elements may be linear or nonlinear.
Assign to each node an arbitrary alphanumeric name.
Give each element in the circuit a unique name, where the first character classifies the component according to Table 1.
Choose a consistent set of parameter units. SCEPTRE assumes no set of units for the element values. It operates directly on the numbers supplied by the user. For numerical reasons, users should select a set of units so that the voltage and current responses expected in the solution are as close to unity as possible. A consistent set of units is one which satisfies the following equations simultaneously: U = I R, t = R C = L/R.
Choose an arbitrary current flow in each passive circuit element, indicate the direction of positive current flow in each current source and voltage source.
SCEPTRE statements are entered under major headings and subheadings. The most important headings used are the following:
MODEL DESCRIPTION CIRCUIT DESCRIPTION ELEMENTS DEFINED PARAMETERS OUTPUTS FUNCTIONS RERUN DESCRIPTION END
The actual problem is described under the major heading CIRCUIT DESCRIPTION. For the temporary definition or permanent storage of models, the corresponding input data go under the heading MODEL DESCRIPTION. The RERUN DESCRIPTION heading is always used whenever the rerun feature is exercised. All changes to the master network must appear under this heading.
The network topology of a circuit must be written under the subheading ELEMENTS in the general form:
element, fromnode - tonode = value
in case of mutual inductances:
M..., Lname1 - Lname2 = value
value may be a number, defined parameter, reference to a table, mathematical expression using any intrinsic FORTRAN function, reference to a statement function or user-defined FORTRAN function.
Controlled sources (E..., J...) may depend on any circuit quantity (linearly dependent sources). Mainly for the analysis of semiconductor devices, current sources may depend on diode tables or built-in diode equations (primary dependent current sources) or even on other primary dependent current sources (secondary dependent current sources). In this way, the simulation is carried out in a cost-effective manner. SCEPTRE determines the correct sequence for the circuit calculation to avoid computational delays normally introduced by these nonlinearities. The controlled sources will run in an AC analysis without modification.
For the Monte Carlo, worst-case and optimization calculations, resistors and sources may be provided by bounds.
Mathematical expressions are entered in two ways. The direct way has the general form
X name (mathematical_definition)
and is preferred when handling an equation, which is used only by a single reference. Using the mathematical sequence for several purposes, the equation form
Q name (par1, par2, ... ) = ( ... )
is the more efficient way. It serves as a statement function and must be entered under the subheading FUNCTIONS.
The same subheading holds the table entries. Data are entered as point pairs with the independent variable in increasing algebraic order. To produce step functions, it is permissible to supply two consecutive independent-variable values that are equal but have different dependent-variable values.
Reference to an element voltage and element current is accomplished by prefixing the element name with the single character V and I, respectively. These references may be used as output variables under the subheading OUTPUTS, expressions, equations, tables and defined parameters. One of the most powerful features in SCEPTRE is the user-defined parameters under the subheading DEFINED PARAMETERS. The general form is
P name = value
where value denotes the possible entries mentioned before. If the user specifies the time derivative
DP name = value
SCEPTRE calculates the integral:
P name = ò DP name dt
This allows the solution of simultaneous differential equations, which need not be coupled to any network quantity. By canonical substitution, transfer functions to any order can be evaluated. Thus, the subheading ELEMENTS is not mandatory. For the AC analysis, the defined parameters may be complex-valued.
A variety of run controls can be entered under the subheading RUN CONTROLS and used to control the simulation to a fine degree.
The simulation is carried out in two phases. In the first phase, SCEPTRE analyses the input data and, if the input statements are free of errors, generates the appropriate FORTRAN subroutines which solve the network equations. In the second phase, these subroutines are compiled and linked with modules from the SCEPTRE library and eventually with user-defined routines. Finally, the binary to be executed contains only those modules needed by the actual problem. Moreover, the working buffers are dimensioned accordingly.
During execution, the actual simulation time (or frequency in the AC analysis) with the requested output quantities is monitored (no graphics), but may be suppressed to considerably speed up the simulation. The results are written into a direct access file.
A postprocessor called NGP is available, which reads the direct access file and enables the user to select the requested quantities. NGP then calls GNUPLOT for the final graphical representation.
Despite its apparent complexity, to get full use of SCEPTRE, only a text editor is needed along with two system commands to start the simulation and the postprocessing.
It was the intention of the author to keep the organization of SCEPTRE as simple as possible without losing its power. The shell scripts for SCEPTRE and NGP, which control the flow of all actions, are kept simple, allowing the user to modify them according to his requirements. NGP comes with the source code. Thus, it is possible to adapt NGP to graphic software other than GNUPLOT. Moreover, the monitoring interface routine, which is called after each time or frequency step, is also available as source and may be modified for on-line graphics.
Requirements and Availability
The version of SCEPTRE now available runs under any Linux kernel. It needs a FORTRAN compiler and GNUPLOT. The X11 Window System is not required. The binaries of SCEPTRE, including libraries, NGP (source), auxiliary routines (source), English and German documentation and a set of examples are available at ftp://novilux.fh-friedberg.de/pub/sceptre_linux. The archive also contains a suitable GNUPLOT version and a FORTRAN compiler.