Copyright (C) 2000, Gennady Serdyuk.
refers to the collection of files distributed by the Copyright Holder.
Holder" is the person is named in the copyright or copyrights for the package.
is you, if you're thinking about using, copying or distributing this Package.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
In no event shall Copyright Holder become liable to Recipient or any other party, for any loss or damages, consequential or otherwise, including but not limited to time, money, or goodwill, arising from use or possession, authorized or not, of Package by Recipient or any other party..
This is still pre-release of documentation, so some items may
be not finished or not clear. Let me know -I will fix (gs).
Circuits may contain linear components (resistors, capacitors, inductors, transmission lines) and nonlinear (diodes and MESFETs).
Program implements piecewise harmonic balance (HB) technique, which is quite widely used in RF&MW CAD industry.
HbFree uses own input file format, but is equipped with translator, which can translate SPICE files (with minor changes) to simulator's input file format.
HbFree package consists of translator, simulator, utilities and documentation.
Harmonic balance technique is derived from circuit description equation (it is system of nonlinear ordinary differential equations, in general):
By applying Fourier transformation to it, it is possible to transfer the first equation to frequency domain.
Where Xn - n -th harmonic (complex).
Using of Fourier transformation implies fundamental assumption about periodic processes in system. In the case of nonautonomous circuit excitations A(t) should be periodic. After Furrier transformation have been applied system equations formulated at every frequency in the circuit - namely basic frequencies (frequencies of excitations) and high-order frequencies (harmonics and combinations, if excitation is multitone). These nonlinear equations have to be solved to obtain result - amplitudes and phases of variables.
Frequency-domain formulation is native for linear elements - lumped and distributed. Contrary, it is hard enough to represent most distributed elements in time domain. It is the first advantage of the harmonic balance approach vs. direct time-domain integration of system equations. The second is explicitiness of solution. If time-domain integration of circuit equation is used, it is necessary to over the transient process (for high quality circuits it may takes hundreds of periods), detect steady state (for mixers period of intermediate frequency may exceeds thousands of periods of local oscillator or signal frequency) and make Fourier transformation of resulting solution. If period is taken improperly, then certain errors in results will occur. In case of harmonic balance amplitudes and phases are the direct results of solution process.
The node voltages basis is used to formulate harmonic balance equations. This implies some restrictions onto available elements and/or values of parameters. E.g. resistors should not be equal to zero, voltage sources should have internal resistance, etc. It may violate results (in strict sense), but, practically, all parameters can be set to values, that resultiong error can be neglected.
Some special efforts was made in the field of global convergence of used nonlinear equations solution method. Two main approaches was tested - using the a-priory information about ``working point'' of the nonlinearities and applying modifications to Newton process (namely - linear search along Newton direction, as it was described in []). The second approach delivers better robastness and convergence speed.
HB approach is used to simulate non-autonomous processes in nonlinear circuits.
In the HB approach it is assumed, that circuit is driven with several periodic sources.
Consider simple nonlinear circuit, which is diven by sinusoidel source with frequency F1. Steady state respone of such circuit will be periodical (with the same period as excitation) but will contain (precisely - infinite) number of harmonic members with frequencies n*F1. We can put correspondent frequencies on the X axis and amplitudes on the Y axis. Thus we obtain spectrum of responce as at Fig. .
And now consider, that circuit is driven by two sinusoidal sources with frequencies F1 and 2*F1. We can use the same representation - second excitation will coinside with second harmonic of fundamental (F1) exciation.
But things are not so simple in general. Assume, that second frequency is independent to F1. This is usuall in mixers and power amplifiers under two-tone exciation. In this case specrum became more complicated - not only harmonics, but combination frequencies are present in responce. And we can see as at the Fig. .
It is possible to represent this case as 2-dimensional. Essential frequencies are represented onto frequency plane as solid crosses. In this case fundamentals have coordinates (0,1) and (1,0), DC have usual coordinate (0,0) and all harmonics of first fundamental have coordinates (n,0), n=2.. ¥. Compare with representation 1-tone spectre onto 2-dimensional plane ( Fig. 1.)
HaBala uses 2-dimesional representation of the spectre, present into the circuit. To specify circuit responce, it is necessary to set F1 and F2 and to list pairs of integers of all combinations, which are assumed as nonzero.
Package consists of several programs, which should interact in a certain way.
Flowchart Fig. is intended to explain main components of Package.
``hb'' (also called ``HaBala'' or HABALA - means HArmonic BALAnce) is the central part of package. It is HB simulator itself. As it uses own circuit description format (which definition is not included in the documentation), translator to this format is provided. This translator (named ``s2h'') translates SPICE circuit description into intermediate representation, suitable for HABALA. To provide additional data, necessary for proper translation of SPICE circuit to HABALA input, translator configuration file is used. During translation variables names are changed. To restore initial variables names, which was changed by translator, ``hnr'' program is used.
S2h translator produces three useful files. The first one is the intermediate circuit description file will be used by simulator immediately after translation. The second one - ``spice-habala'' node table will be used later to restore initial node names. The third - log - should be rewieved in case translation errors - see ``Translator'' section.
HABALA produces two files as output. The first one is the log file, which contains information about solution process and results. It should be reviewed after simulation to detect the reason - why simulation was finished. Iterative procedure is used to solve the system of HB equations; it may coverge to solution, but may do not. More precisely it will be described in ``Translator'' section.
``hbf'' script (or executable - depending on the system) describes the way components should be integrated.
Task description consists of circuit description and regime description. Both parts may be mixed into one file.
The first line of file is treated as task name.
Each line started with ``*'' is treated as comment line.
Each line started with ``+'' is treated as previous line continuation.
Circuit description is almost conform to SPICE input landuage with some restrictions.
Many SPICE directives ( they started with ``.'' in the first position of the line) are ignored. As HbFree is intended for HB simulation, so usual SPICE's analisys types (.AC, .DC, .DISTO, .NOICE, .OP, .PZ, .SENS, .TF and .TRAN) are not supported and correspondent directives will be ignored. SPICE directive .OPTIONS will be ignored too.
Supported directives are:
.SUBCKT - subcircuit definition
.ENDS - end subcircuit definition
.END - end file
.INCLUDE - include file
.MODEL - model definition
New directive .HB is added to describe main parameters of simulation (circuit regime), if many .HB directives are denoted, only last directive will be used. New directive .HB_OPTIONS is added to describe additional simulation parameters (desired precision tolerances, etc.).
Unfortunately, do not all SPICE devices are implemented. More, HB simulation program (named ``hb'' or ``HaBala'') was designed independently, so it have own model library. Compatibility between SPICE and HABALA models is described in respective sections.
Circuit may contain usual types of elements: R, L, C, I, V, T, O, D, Z.
Values may be followed by scaling suffixes - f, p, n, u, m, mil, K, Meg, G, T
Nodes in element description can be denoted as numbers or as strings.
.MODEL directive is used to define model of the element.
.SUBCKT / .ENDS directives are used to define subcircuit.
There are two aditional directives to set circuits regime and paremeters of solution process: .HB and .HB_OPTIONS
.HB directive looks like this:
+ 6 0 7 0 8 0 9 0
+ 0 2 1 1 2 0 1 -1
+ 0 3 1 2 2 1 3 0 2 -1 1 -2
+ 0 4 1 3 2 2 3 1 4 0 3 1
It looks like the following:
For proper translation of SPICE input file into HaBala representation additional parameters should be specified. They are gathered into Translator configuration file.
All parameters may be divided onto two groups. The first group consists of parameters, which are necessary to complete elements description, the second - default values to control the solution process.
Translator configuration file have the following look:
* may
PARAMETER = value
...
* another one comment
PARAMETER = value
Available parameters are defined in the following sections.
Gc = 1.e-5
Ri = 0.001
In addition to ``.MODEL'' parameters, several paremeters are specified into Translator Configuration File:
DU=0.1
Some default and boundary values for MESFET model transformation are specified in configuration file too. These parameters mostly described in section .
MESFET_STEPM=0.12
The following variables switches print mode in HaBala:
CXXXX node1 node2 value
G value is described into translator configuration file.
R value is described into translator configuration file.
+ [PULSE(..)|SIN (..)|EXP(..)|PWL(..)|SFFM(..)]
+ [DISTOF1 F1MAG [F1PHASE]]
+ [DISTOF2 F2MAG [F2PHASE]]
IXXXX N+ N- [[DC] DCVALUE] [AC ACVALUE [ACPHASE]]
+ [PULSE(..)|SIN (..)|EXP(..)|PWL(..)|SFFM(..)]
+ [DISTOF1 F1MAG [F1PHASE]]
+ [DISTOF2 F2MAG [F2PHASE]]
AC section is ignored by translator
PULSE, SIN, EXP, PWL and SFFM sections are ignored by translator, but parameters should be enclosed into parenthesis.
DC/RAN value will be assumed as value of DC source.
DISTOF1 value (and phase) will be assumed as value of frequency F1 (see .HB directive 6.2.1), and DISTOF2 - respectively F2. Voltages and currents are effective (not maximum - in contrast to SPICE). Phases are in degrees.
Voltage sources assumed have internal (parasitic) resistance Ri (see Transator Configuration File 6.3)
+ [IC=...]
TD or F and NL should be specified.
In Translator Configuration File one more parameter is specified. It is Rline - series resistance of line in ``short circuit'' resonance'' (resistance to ground of 1/4-wavelength stub at resonance frequency).
.MODEL <MODELNAME> LTRA R=<val> [L=<val> G=<val>] C=<val>
+ [LEN=<val>]
+ [OTHER_PARAMS]
The reason is HABALA feature. It have model of lossless line and models for strip/microstrip lines, but not have model for lossy line. As model of lossy transmission line will be implemented in HABALA, it will be reflected in this guide.
L and C values should be specified.
LEN assumed =1 if not specified.
OTHER_PARAMS are ignored.
.MODEL DIODEMODEL D IS=<val> RS=<val> N=<val> TT=<val> CJ0=<val>
+ VJ=<val> M=<val>
+ [OTHER_PARAMS]
| SPICE parameter | HABALA parameter | Notes |
| IS | Is0 = IS*AREA | |
| RS | Rs = [(RS)/(AREA)] | >Rsmin |
| N | as = [(q)/((k·T·N))] = [36.6676/(N)] | |
| TT | - | assumed = 0 |
| CJO | Cj0 = CJ0·AREA | |
| Vj | f = Vj | |
| M | - | assumed = 0.5 |
| Cp = 0 | ||
| Ls = 0 |
In addition several paremeters are set into Translator Configuration File:
DU=0.1
.MODEL MNAME (NMF | PMF) VTO=<val> BETA=<val> B=<val>
+ ALPHA=<val> LAMBDA=<val>
+ RD=<val> RS=<val>
+ CGS=<val> CGD=<val>
+ PB=<val>
+ [OTHER_PARAMS]
Main formulaes of the model are:
|
|
|
It is diffrent from Statz model [], so translations are used.
| SPICE parameter | HABALA parameter | Notes |
| VTO | Vth = -VTO | |
| BETA | b = BETA*AREA | |
| B | - | assumed B=1 |
| ALPHA | a = ALPHA | |
| LAMBDA | l = LAMBDA | |
| RD | R1 = RD/AREA | RD ³ MESFET_RDMIN 1 ) |
| RS | R3 = RD/AREA | RS ³ MESFET_RSMIN 1 ) |
| CGS | C230 = CGS | 2 ) |
| CGD | C12 = CGD | constant 2 ) |
| PB | f = PB | |
| R2 = MESFET_RG | MESFET_RG 1 ) | |
| C13 = MESFET_CDS | MESFET_CDS 1 ), 2 ) | |
| I0 = MESFET_IS0 | MESFET_IS0 1 ), 2 ) | |
| as = [(q)/((k·T·MESFET_N))] = [36.6676/(MESFET_N)] | MESFET_N 1 ) | |
| R31 = MESFET_RDS | MESFET_RDS 1 ) | |
| R23 = MESFET_RGS | MESFET_RGS 1 ) | |
| 1 ) parameter is defined in config file | ||
| 2 ) parameter should be dependent on AREA, but it is not implemented. | ||
Number of hamonics should not be larger than 20.
Owerall task size should not be larger than 180 complex variables.
Task size TS=NN*HN, where:
NN - total number of nonlinear nodes. Note, that each diode yields 2 nonlinear nodes, each MESFET - 3;
HN - number of harmonics in .HB directive (see 8.1).
Elements quantity is not limited explicitly. Limitations are derived from the following:
Maximum number of parameters = 1000;
Maximum number of units to store information about elements = 1000;
Gennady Serdyuk,
ZAO ForaTech,
Ukraine, Kiev,
04111, Scherbakova, St., 36A
E-mail: gserdyuk@mail.ru
ph/fax: 380 44 443-4984;
http://users.sovamua.com/foratech/gserdyuk