Expanding the model set of the Microsim PSpice package.
TV
The demonstration package of the Microsim circuit simulator
package has no support for automatically expanding the model
set for the simulator, so only diode models can be added to
the supplied set models.
This text described the method tho expand the model and part
set by editing the library files, so external models can be added,
including completely new parts.
I didn't test editing the graphics that represents new parts,
but expect no problems as long as no completely new icons are
needed.
The purpose of this exercise is to have the possibility to
simulate circuits with different transistor and opamp models
than provided. Spice models are available for free from various
internet sources (National, Questlink), and are small enough to
conveniently treat as text files.
The required files
SLB
===
The .slb file contains a list of 'symloc' references, where (most
coveniently at the end of the list) the new symbol should be added,
cont the number of characters in the model, starting after
'*symbol ', until the last newline, and use this as the last
argument to symloc. The first argument is the first argument of
the
previous entry plus its second argument, basically the the arguments
are starting point ant character count, indexing the rest of the
file
starting at the first symbol definition.
Take a comparable part as the starting point for the new model,
edit the description ('d') and fillin the right model in the
attributes section, if you feel up to it edit the graphics
section, if there is a need, you may try to use the supplied editor
to create a new or edited part, save it's description, and include
it here, I just used existing graphics. Don't forget to count
the characters and add the count as the last 'symloc' field, to
make the parser happy.
PLB
===
The .plb file has a similar 'symloc' indexing table as its header,
so the same recepy holds, again take a parts description that matches
your new part as a starting point and paste it at the end.
You may want to edit the 't' tpe field which describes the type
of
package, or the pin definitions.
LIB
===
The lib file contains the actual model, ot is file that imo goes
straight to SPICE, so basically just paste your SPICE model
(minding the first-letter-defines-the-type convention) with
the same name as you've used in the SLB file.
Models that use the same model more than once, for instance the
model of a chip with four identical circuits in the same package,
use a subcircuit decription with the model decription inside the
.SUBCKT ... .ENDS text.
Spice model definitions use + symboles to link the lines of one
model together.
I'm not sure, but I'd say that all comment ('*') lines are
not needed.
Push-pull end stage, low power, idealized loop amplifier, gain = 1000
Driving this circuit (the end stage) directly, a harmonic distortion
of over 3% (@ 1kHz, 1Vtt drive, ca 10 mA rest current)
results, taking the first 10 harmonics as a reference, and using Spice
.FOUR analysis, not the .DIST command, and adjusting
the number of transient analysis steps (including their ceiling) to cause
for less distortion than the circuit under test (20 nS).
HARMONIC FREQUENCY FOURIER
NORMALIZED PHASE
NORMALIZED
NO
(HZ) COMPONENT COMPONENT
(DEG) PHASE (DEG)
1 1.000E+03
9.981E-01 1.000E+00 -6.519E-05
0.000E+00
2 2.000E+03
1.896E-06 1.900E-06 -4.093E-02
-4.087E-02
3 3.000E+03
3.501E-05 3.508E-05 3.363E+00
3.363E+00
4 4.000E+03
1.720E-06 1.723E-06 -1.580E+02
-1.580E+02
5 5.000E+03
2.112E-05 2.116E-05 -1.977E+00
-1.977E+00
6 6.000E+03
1.687E-06 1.690E-06 9.715E+01
9.715E+01
7 7.000E+03
1.006E-05 1.008E-05 -5.073E+00
-5.073E+00
8 8.000E+03
1.121E-06 1.124E-06 -8.124E+00
-8.124E+00
9 9.000E+03
5.283E-06 5.293E-06 9.426E+00
9.426E+00
10 1.000E+04
8.257E-07 8.274E-07 -1.134E+02
-1.134E+02
TOTAL HARMONIC DISTORTION =
4.265431E-03 PERCENT
0.005 percent is pretty good, at least this thing could be a nice headphone
amp. There is no dynamic element i the driver stage, but then again, it
has a gain of only 1k.