This is only a preview of the September 2017 issue of Silicon Chip. You can view 59 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Fully adjustable, 3-way active loudspeaker crossover Pt.1":
Items relevant to "Dead simple radio IF alignment with DDS":
Items relevant to "LTspice Tutorial Part 3: Modelling an NTC Thermistor":
Articles in this series:
Items relevant to "Arduino Data Logger Part 2":
Items relevant to "Arduino “ThingSpeak.com” ESP8266 data logger":
Items relevant to "El Cheapo modules Part 9: AD9850 DDS module":
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
LTspice
Part 3:
by Nicholas Vinen
Modelling an
NTC thermistor
Last month, we designed a relay simulation and added it to our
SoftStarter circuit. But to completely simulate the SoftStarter, we need
an NTC Thermistor model and LTspice has no such model. Well, there's
only one solution. . . make one! In the process, we'll learn a lot about
designing simulation models and design some very handy building
blocks that can be re-used later.
A
thermistor is a non-linear resistor which changes in value as the
temperature changes. The resistance
of an NTC Thermistor varies inversely
to the temperature. In other words, its
resistance drops as it heats up.
High power NTC thermistors are
useful for reducing inrush current,
especially in mains-powered circuits,
as they have a high enough initial re-
sistance to limit the current drawn by
capacitor-input power supplies and
motors, but a low enough resistance
(once they warm up) that they don’t
interfere with the load’s operation and
don't waste much power.
We took this a step further in our
SoftStarter, published in the April
2012 issue (www.siliconchip.com.au/
Article/705). By building a circuit
which shorts out a current-limiting
thermistor with a relay a few seconds
after mains power is applied, we get
the best of both worlds; once the relay
activates, the power loss in the thermistor is zero. The circuit for that project is shown here, in Fig.1.
Developing that circuit took some
trial-and-error as we had to build it and
assess its performance in order to tweak
Fig.1: the original circuit from our SoftStarter, published in the April 2012 issue. This reduces inrush current to the
connected device each time mains power is applied. This was revised to add load current sensing in the Soft Starter for
Power Tools, in the July 2012 issue but this month we’re simulating the more basic circuit shown here.
78 Silicon Chip
siliconchip.com.au
the component values. If you look
at the original article, we published
some simulation curves showing how
an NTC thermistor can be used to reduce inrush current. So why didn’t we
simulate the circuit before building it?
It was because SPICE does not have
built-in support for any kind of variable resistance device, which would
allow us to simulate the behaviour of
an NTC thermistor. But it is possible
to build a (fairly complex) sub-circuit
to do the job instead and this article
will show you how.
The variable resistance is created using two high-voltage Mosfets in series,
connected source-to-source, with their
gates joined together. They are then
shunted with a resistor, setting the
maximum resistance of the device. The
minimum resistance is determined by
the properties of the Mosfets and how
their gates are controlled.
The reason for using two Mosfets is
to prevent body diode conduction in
one direction, as the body diodes are
facing in opposite directions. Since
their gates and sources are joined,
they both must always have the same
gate-source voltage, so they are simple
to control and the on-resistance of the
combination is simply twice the onresistance of a single Mosfet.
Note that SPICE generally does not
model the body diode conduction in a
Mosfet. To simulate a realistic Mosfet,
you may need to connect a zener diode
across it, with the zener voltage equal
to the avalanche breakdown voltage of
the Mosfet you've chosen.
But just in case SPICE decides to get
clever and simulate avalanche breakdown for us, our back-to-back Mosfets
will work just like they would in reality, preventing current from flowing
unless they are both switched on.
Before we proceed, please note that
all the sub-circuits, symbols and test
circuits shown in this article are available for download in a ZIP package
from the Silicon Chip website (free
for subscribers). So you may wish to
download this and “play along” with
the tutorial. You can easily experiment
with the circuits, changing values and
seeing the effects.
depending on the simulated temperature of the NTC thermistor. We need a
way to track dissipation and average/
accumulate the instantaneous power
to determine the temperature, then use
this to vary the resistance.
The simulated temperature also
needs to drop over time when dissipation is low, simulating the normal
cooling process and that temperature
needs to translate into an appropriate
voltage to drive the Mosfets, to achieve
the right resistance value for a given
simulated temperature.
Broadly, our solution is as follows.
We charge a capacitor via a diode and
resistor to simulate thermistor heating.
The voltage across this capacitor will
represent the temperature. A resistor
across this capacitor will simulate
cooling to ambient temperature.
We will then amplify and level-shift
this temperature-proxy voltage and apply it to the Mosfet gate, and adjust the
amplification factor and RC time-delay
constants until the result closely matches the behaviour of a real thermistor.
To charge the capacitor representing
temperature, we need a voltage that's
proportional to the instantaneous dissipation in the thermistor and this can
be calculated as the product of the
voltage across and current through the
thermistor. That sounds simple but it
isn’t easy to arrange in SPICE.
For a start, heating does not depend
on the polarity of the voltage or the
direction of the current so we need to
compute their absolute values before
multiplication. And unfortunately,
there's no easy way to multiply two
voltages in SPICE. So we have to build
an analog multiplier circuit for this job.
Measuring voltage and current
The complete sub-circuit for our
thermistor simulation is shown in
Fig.2, with its corresponding symbol
at top. In the lower left-hand corner,
you can see our two back-to-back Mosfets, M1 and M2, with 10W resistor
R1 across them. We have chosen 10W
since this matches the nominal cold
resistance of the SL32 10015 type NTC
thermistor used in the SoftStarter.
We are using IPB200N25N3 Mosfets because they have a high voltage
rating along with a low RDS(on) of
20mW. Since they are in series, this
gives a minimum thermistor resistance of 40mW. The SL32 10015 typically measures 48mW at the full rated
current of 15A, with its body temperature at 228°C.
It doesn't matter that the Mosfet
resistance is slightly lower since the
whole sub-circuit incorporates feedback and it will adjust the Mosfet gate
voltage to achieve the required resistance, to keep the body temperature
steady for a given current. The Mosfets
just need to have a low enough RDS(on)
to be able to give the required current.
We have placed a voltage source,
V1, in series with the simulated thermistor. It is set to 0V DC. It might seem
weird to have a voltage source of zero
volts but voltage sources also double
as current meters in SPICE. So V1 is
used to measure the current through
Building the control circuitry
So that's how we're going to provide
a controlled resistance but that leaves a
rather complex problem to solve, which
is how to actually produce a Mosfet gate
voltage to give a resistance which varies
siliconchip.com.au
Fig.2: our complete NTC thermistor simulation sub-circuit, along with its symbol
at top. X1 and X2 are precision rectifiers while X3 is an analog multiplier that
calculates the instantaneous dissipation of the simulated thermistor. This is
accumulated in capacitor C1 and the voltage across it is ultimately applied to
the gates of Mosfets M1 and M2 to control the transconductance appropriately.
September 2017 79
the thermistor. Note that the points labelled "a" and "b" are the ports used for
external connection to the thermistor.
H1 is a current-controlled voltage
source and you can see that its value
field is set to "V1". As a result, the
voltage across H1 will track the current through V1, ie, with 1A through
V1, there will be 1V across H1; you
can change the ratio but in this case,
the default of 1A:1V is fine.
We then feed the output of H1 to subcircuit X2, which produces an output
that is the absolute value of the voltage at the input. Similarly, the voltage
across the thermistor is fed to another
absolute voltage sub-circuit, X1.
Calculating absolute voltage
The sub-circuit to calculate the absolute value of a voltage is shown in
Fig.3. It's quite straightforward.
In the real world, this is typically
done with a "precision full-wave rectifier" comprising two op amps, two
diodes plus some resistors. The op
amps cancel out the forward voltage
of the diodes. We could simulate such
a circuit, however, it would slow the
overall simulation down as it would
have to simulate two op amp ICs plus
a bunch of other components.
So we came up with this much
simpler circuit using just two voltagecontrolled switches (S1 & S2) and two
voltage-controlled voltage sources (E1
& E2).
Both E1 and E2 are set for a gain
of unity ("1"), with the input voltage
and ground connected to their + and
– inputs respectively. So essentially
they are just buffers. But because E1's
output is floating, if we hook up its
output terminals in reverse, it acts as
a voltage inverter.
Both switch models are set up so
that the switch is on its input is positive (ie, positive input voltage higher
than negative input voltage). The
threshold for S2 is 1µV higher than S1,
to prevent them both conducting if the
input voltage is exactly 0V.
So if the input voltage is positive, S1
connects the buffered signal from E2
directly to the output terminal. And if
it's negative, the output of E1 is positive and this is instead connected to
the output terminal.
You can see the simple symbol we
came up with for this sub-circuit at the
top of Fig.3. The test circuit is shown in
Fig.4, with the results of the simulation
shown above. The input is a 3V peak80 Silicon Chip
Fig.3: our precision rectifier sub-circuit is quite simple; it either applies the
input voltage (buffered by E2) to the output, via voltage-controlled switch S1, or
if the input is negative, it is inverted by voltage-controlled voltage source E1 and
this positive voltage is applied to the output instead.
Fig.4: test circuit for the precision rectifier, which shows a sinewave with a DC
offset in green overlaid with the output of the rectifier, in blue.
to-peak sinewave offset by 0.5V and
shown in green. The output is shown
in blue. As you can see, the output is a
perfectly rectified version of the input.
Tracking instantaneous power
So, the outputs of X1 and X2 shown
in Fig.2 are a rectified (always-positive) version of the voltage and current
across the simulated resistor respectively. Both voltages are referenced to
the bottom end of the thermistor (terminal "b"), which is effectively the ground
for this circuit. As a thermistor is only
a two-terminal device, it must "float".
The outputs of X1 and X2 are fed
to voltage-controlled voltage sources
E2 and E3 which both have a gain of
0.05, ie, they attenuate the voltages
by a factor of 20. This is to ensure the
resulting voltages are quite low (just
a few volts), so they can be fed to the
analog multiplier block, X3. X3 has a
"power supply" of 15V, so the inputs
need to be in the range of 0-15V.
We could use resistive dividers to
reduce the voltages for X3 but then the
source impedance seen by X3 would
be non-zero and might affect its operation. SPICE components such as
voltage-controlled voltages sources
are “ideal” in that they have infinite
input impedance and zero output impedance.
The output voltage from multiplier
block X3 is the product of its input
voltages and so the output voltage
corresponds to the instantaneous dissipation in the thermistor, scaled down
by a factor of 400 (20 x 20). So 1V out
corresponds to 400W dissipation in
the simulated thermistor.
siliconchip.com.au
Fig.5: the analog multiplier is based on a real circuit and uses log/anti-log stages
and summation to multiply the two input voltages, at Vin1 and Vin2. Vin2 is
converted into a current which is sunk from the emitters of Q1 and Q2. The
voltage at Vout is almost exactly equal to the product of the two input voltages.
V1 exists to measure the current at
the collector of Q1. F1 is set up to provide exactly the same current, as its
“value” field is set to V1. F1 also has
a gain value, not shown in the circuit,
which we’ve set to 1.
The output voltage which is the
product of Vin1 and Vin2 appears at the
collector of PNP transistor Q3. This is
then fed to voltage-controlled voltage
source E2, which acts as a buffer and
gain stage. We’ve set its gain to 7.3 as
we found that this provides an output
of 1V when Vin1 = 1V and Vin2 = 1V.
The test circuit for this sub-circuit
is shown in Fig.6. Both input signals
(green and blue) are sinewaves which
vary between 0V and 1V but at different
frequencies, so the peaks and troughs
coincide at various points throughout
the 10ms simulation time. The output
of the multiplier is shown in red.
Note that the red curve is very close
to 0V when either input is at 0V and
very close to 1V when both inputs are
at 1V. So it is operating effectively as
a multiplier.
Ideal diode model
Fig.6: our analog multiplier test circuit. Its inputs are sinewaves with 1V peak
amplitude, shown in green and blue, with the resulting product shown in red.
Analog multiplier operation
The internals of X3 are shown in
Fig.5, with its symbol at top. We got
the basis of this circuit from the following URL:
www.sayedsaad.com/montada/
showthread.php?t=22594
Essentially, the circuit computes the
logarithm of the two input voltages,
adds them, then exponentiates the result to produce the output voltage. The
result will be proportional to the product of the input voltages, Vin1 and Vin2.
Vin1 is fed to a voltage-controlled
voltage source, E1, with a gain of unity. This acts as a voltage buffer so that
the source impedance won’t affect the
rest of the circuit. Voltage source V6
provides a -0.15V bias to this signal,
which we experimentally determined
was necessary in order to achieve a 0V
siliconchip.com.au
output when Vin1 = 0V (regardless of
the magnitude of Vin2).
Vin2 is fed to voltage-controlled current sink G1, with resistor R6 (10MW)
in parallel. R6 is not in the original
design but we found that this sped up
the SPICE simulation, because in cases
where Vin2 is very close to zero, the
simulation of this circuit breaks down.
As you can see, G1’s gain factor is one
ten-thousandth, ie, 0.0001. This is so
that for Vin2 of 1V, G1 sinks 100µA,
to match fixed current source I1 and
provide correct scaling of the output.
I1 is connected to the positive rail
(V+) to supply transistors Q4 and Q5
which are configured as diodes. The
collectors of transistors Q1 and Q2 are
fed by a current mirror formed by voltage source V1 and voltage-controlled
current source F1.
As shown in Fig.2, the output of
X2 which represents the dissipation
(labelled “pout” for “power output”)
passes through diode X4 then 10GW
resistor R2, before charging 5nF capacitor C1. R2 limits the rate of C1’s
charging to represent the fact that the
thermistor body doesn’t increase in
temperature instantly when the dissipation increases; it has thermal inertia.
Resistance values that high are rarely seen in real circuits because leakage
currents can overwhelm them but that
isn't an issue in a simulation; it’s the
time constant that’s critical.
The purpose of diode X4 is to model
the fact that the rate of thermistor heating depends on dissipation but the rate
of cooling depends on its temperature.
In other words, a very high dissipation
should heat the thermistor up fast but if
dissipation falls to zero, it cannot cool
down back to its original temperature
in that same time; it might take much
longer. So this diode only allows the
“heat” to flow in one direction.
But we don’t want to use a real diode model because its forward voltage
would interfere with this process. It
would not conduct until the dissipation rose above a certain level and
would then reduce the maximum
voltage applied to C1. We would prefer an “ideal” diode which essentially
September 2017 81
acts as a switch, turning on as soon as
the voltage at the anode is above the
cathode and switching off as soon as
that reverses.
So that’s exactly how we’ve modelled it. The sub-circuit and corresponding symbol are shown in Fig.7.
The voltage controlled switch’s control
terminals are connected directly to
the switch terminals. The threshold is
set to 0.1mV and the hysteresis value
is the same. That means the voltage
across the ideal diode during forward
conduction will be well under 1mV.
Finishing the thermistor model
Getting back to Fig.2, the time constant of R2/C1 determines how quickly
the modelled thermistor heats up due
to internal dissipation while R4/C1 set
its cool-down characteristics.
Placing resistor R4 across C1 accurately models cooling since, in the real
world, the rate of cooling is proportional to the difference between an object’s
temperature and the ambient temperature. In the simulation, current through
R4 is proportional to the voltage across
C1 (a proxy for the temperature) and so
the rate that “heat” leaves the model is
directly related to its temperature.
So the simulated temperature, labelled “temp”, is applied to the inputs
of another voltage-controlled voltage
source, E1, with a gain value of 500.
Besides applying gain, the other reason for E1 is that it stops the following
circuitry from drawing current from C1
and affecting the thermal simulation.
Voltage source V4 has a fixed value
of 3.2V and this provides the Mosfet
gate switch-on bias voltage for M1 and
M2. Note that E1’s negative output
terminal is connected to the sources
of M1 and M2. This means that with
a simulated temperature at ambient, the gates of M1 and M2 are 3.2V
above their source terminals, just on
the edge of conduction. For each 2mV
across C1, the gate-source voltage increases by 1V.
This gain figure was determined
experimentally, by comparing the behaviour of the simulated thermistor to
figures in the SL32 10015 data sheet.
This figure was found to give a realistic
time constant and ultimate resistance
under sustained load.
It’s important to realise that this model contains a negative feedback path. As
the voltage across C1 increases, Mosfets
M1 and M2 switch on harder, reducing
the voltage across R1 and this, in turn,
82 Silicon Chip
Fig.7: another type of precision rectifier, this time in the form of an ideal diode
(ie, a half-wave rectifier). This is basically just a switch which allows current to
flow from input to output only when the input voltage is higher than the output
voltage.
Fig.8: a simple test circuit for our now complete NTC thermistor model, utilised
here as X1. The load is primarily capacitive so draws the most current around
the mains peak. You can see how the capacitor voltage (green) rises relatively
slowly, over around 50ms, while the thermistor dissipation (blue) starts very
high but drops down to a low level after around 100ms.
reduces the dissipation and thus the
voltage at “pout”. That then allows the
voltage across C1 to stabilise at a value
that depends on the voltage and current flow between points “a” and “b”.
1W resistor R3 between E1/V4 and
the gates of M1/M2 provides a tiny
delay for this negative feedback which
helps the simulation converge faster
(see the side panel for more details on
this phenomenon). The 100MW bleed
resistor effectively between the gate
and source terminals of M1/M2 was
added for a similar reason.
Testing the NTC thermistor
Fig.8 shows the test circuit. We have
a 325V peak sinewave representing the
mains, with the thermistor in between
it and the test load. There’s a simple
half-wave rectifier feeding a 1000µF
high-voltage capacitor with a 100W
bleeder/load resistor. This is intended
to crudely simulate a capacitor-input
switchmode power supply with a load.
Above it, you can see the result of
the simulation, with the voltage across
R2 in red, voltage across C1 in green
and instantaneous dissipation in X1 in
blue. (By the way, to plot dissipation of
a component in Windows, hold down
the ALT key while clicking on that
component. Once you’ve done that, to
display the average power, zoom over
the relevant portion of the waveform
and hold CTRL while clicking on the
siliconchip.com.au
run the simulations very slowly or halt
altogether. This is due to a failure to
converge – see the side panel explaining this problem.
Putting it all together
Fig.9: another test of the NTC thermistor model, this time with a primarily
resistive load of around 15A. It takes around 100ms for the load voltage to rise
close to the full 230VAC with thermistor dissipation initially averaging 600W,
dropping down to 10W in the steady-state condition after around 200ms.
Fig.10: we can now complete our simulation of the SoftStarter. It uses the relay
and NTC thermistor sub-circuits we’ve developed plus a typical load comprising
an EMI suppression capacitor, bridge rectifier, mains filter capacitor and 100W
equivalent resistive load. We can probe the voltages and currents at various
points more easily than with the real circuit, which floats at mains potential.
formula at the top of the plot window.)
As shown, the voltages rise quite
gradually, over the first few mains cycles. If you remove X1 from the circuit,
C1 charges almost instantly, in under
1ms, drawing a peak current of almost
1000A! A real capacitor would have
too much parasitic resistance/inductance to draw quite so much current
but the contrast is still educational.
Note how the thermistor dissipation
drops initially, then rises a little before
finally dropping down to a stable level. That’s because after the thermistor
heats up a little initially and its resistance drops, it allows more current to
flow into C1 which briefly increases its
dissipation before the voltage across X1
siliconchip.com.au
drops, further reducing its dissipation.
Fig.9 shows a variation on this test
circuit, where we have replaced the
capacitor input power supply with
a resistive load shunted with an EMI
suppression capacitor. With a load resistor of 16W, it will draw 14.4A RMS
on a continuous basis (ie, 230VAC ÷
16W). As you can see, in this case,
the thermistor heats up a little more
gradually and as the voltage across R2
approaches the full 230V RMS, dissipation in the thermistor drops from
an initial average of 600W down to
around 10W after about 200ms.
Note that if you are experimenting
with these circuits, you may find that
certain changes will cause SPICE to
Fig.10 shows our now complete
SoftStarter circuit at bottom, based on
what we finished with last month (ie,
incorporating the relay model we developed then) but now also including
our thermistor, X2, plus a test load circuit comprising EMI suppression capacitor C4, bridge rectifier D7-D10, filter capacitor C5 and resistive load R6.
The simulation output at top shows
the mains voltage at V1 (green), voltage
across the load at C5/R6 (cyan), current
through simulated thermistor X2 (blue),
voltage across the relay coil (mauve)
and thermistor dissipation (red).
As you can see, the inrush current is
limited to around 20A, which is pretty
much the same peak current that the
load draws during normal operation.
You can see the thermistor dissipation is very high over the first few
cycles but drops to below 10W after
about 500ms, at which time the relay
coil voltage rises and the thermistor
is shorted out.
Its dissipation then drops to almost
zero; if the relay didn’t close then, its
dissipation would continue to drop,
to a steady-state value of around 4W.
So in other words, the simulation is
working correctly and showing how
the real circuit behaves!
Note that a small amount of current
is still shown flowing through the thermistor even after the relay contacts
close. This is as a result of the non-zero
relay contact resistance we’ve programmed into our model. But because
the product of current and voltage is
so low, dissipation still appears as a
flat line once the relay latches.
Note also that Fig.10 shows the voltage across the relay coil of X1, even
though that part of the circuit is not
connected directly to ground. This
can be achieved by right-clicking in
the plot window and selecting “Add
Trace”, then typing in the expression
V(x)-V(y), where “x” and “y” are nodes
in the circuit.
This is one reason why it’s a good
idea to label nodes in the circuit (as
we have with VOUT) since the automatically generated node names like
“n004” can change if you modify the
circuit.
You also need to figure them out (by
September 2017 83
Simulation slowness, pausing or intermittent failure
SPICE simulations have two distinct phases, the first of which is optional, but normally present. The first phase is where it determines the initial DC operating point. In other words, for every component which has state – primarily capacitors (charge)
and inductors (magnetic field strength) – it needs to determine the steady-state condition* with which to start the simulation.
If you have something like an oscillator in the circuit, it won’t have a steady state, but SPICE will still attempt to determine a reasonable starting point – a condition which a real circuit may find itself in at some point in time, prior to any AC signals being applied.
Various circuit configurations can make this impossible. One thing that often throws SPICE off and prevents it from finding
the initial DC operating point is nodes which have no DC current path to ground. For example, it’s perfectly valid to apply an AC
signal to a pair of series-connected capacitors, with them operating as a capacitive voltage divider.
But unless you have a way for current to flow from the junctions of these capacitors to ground, SPICE will often throw up its
arms in disgust. The usual solution to this problem is to connect a high-value resistors from this junction to ground. It will have
negligible effect on the operation of the circuit but may help SPICE to converge on an initial operating point solution.
If you’ve drawn up a circuit and can’t figure out any way to get SPICE to get past this initial hurdle and start the simulation,
your other option is to get it to skip this step entirely and either start with everything in a default state (capacitors and inductors
discharged etc). Or alternatively, you can specify the initial state of the components yourself.
In fact, you can even adopt a “mix-and-match” approach, providing initial states for some component and letting SPICE figures
the other out. You may need to use trial and error to determine which components need their initial conditions defined before
the software will reliably complete this step.
To set the initial condition of a component, modify its value and add " ic=xx" to the end, where xx is the initial value. For example, a capacitor can have a value of "10uF ic=5V" and an inductor can have a value of "100uH ic=1A". If you also add " uic"
to the end of the simulation command (labelled "skip initial operating point solution" in the LTspice configuration dialog), all
components will start with a value of 0V/0A unless the initial condition is specified.
Note that you can also abort the initial operating point solution, if it gets stuck, by pressing the ESC key on your keyboard.
SPICE will then take whatever its last guess was as to the initial conditions and run the simulation.
SPICE can also get stuck during the simulation, for similar reasons. This is often at the point where a transistor is moving
into or out of conduction, a diode is becoming forward biased and so on. The rapid changes in circuit behaviour at these points
can cause it to move forward in smaller and smaller time steps. It will normally eventually get past that point but it may take a
long time, and it may get stuck again soon afterwards.
There are various techniques you can use to avoid or mitigate this. First, it helps to understand why this happens. The following
course notes contain some useful information on this aspect of SPICE: www3.imperial.ac.uk/pls/portallive/docs/1/7292571.PDF
This document is from the Department of Electrical and Electronic Engineering, Imperial College London. On page 24, it
states “There are convergence problems associated with very high conductance [… and] very high resistance”.
On pages 23 and 24, it shows an example of attempting to iteratively solve a circuit involving a current source, resistor and
diode and shows how, depending on the algorithm used, the software may not be able to converge on the solution.
The following pages discuss the GMIN parameter, one of several you can adjust in LTspice which may help prevent it from getting stuck. This can be changed by going to the “Control Panel” menu option in the “Tools” menu and clicking on the SPICE tab.
We experimented with some of these options and found that changing the “Default Integration Method” from “modified trap”
to “trapezoidal” sometimes caused our simulations to run much more smoothly with a range of different component parameters.
Changing the “Solver” from “Normal” to “Alternate” had an even bigger effect on the simulation’s performance. There were
times where it would absolutely crawl with the Normal solver but ran very fast and reliably with the Alternate solver. So if you
find your simulation getting stuck, it’s well worth trying to change these parameters before resorting to modifying your circuit.
If you do need to modify the circuit, we suggest the following: add high-value resistors across capacitors, or from the ends
of capacitors to ground. Add high-value resistors or low-value capacitors across diodes and/or transistor junctions. For generic
components, try different component models, or try using models of similar parts.
Many of these changes can have negligible impact on the accuracy of your simulation while potentially making SPICE run
much faster and without getting “stuck” as often. For example, in our SoftStarter simulation (shown in Fig.10), we sometimes
get an error message that the initial operating point solution failed, implicating diode D7. While changing the Default Integration
Method helped, another solution we found was to put a low-value capacitor across D7. This has hardly any effect on the results
but seemed to overcome that particular problem. So that’s one example of a way to modify your circuit when SPICE is “playing up”.
* a circuit may have zero, one or many steady-state conditions. These are conditions where the series of simultaneous equations that represent
the circuit's behaviour converge to a fixed set of values. This is important for transient simulations as without a steady-state condition, SPICE
cannot model the behaviour of the circuit.
hovering the mouse over a point in the
circuit and looking at the bottom of the
window) before you can enter the expression, whereas if the circuit nodes
are labelled, the names are obvious.
Conclusion
So what is this simulation good for?
First, it would allow us to more easily
tweak the power supply component
84 Silicon Chip
values, the time constant values which
set the relay delay time and so on. It
also allows us to examine the voltages
and currents applied to each component to verify that they will not experience conditions outside their ratings.
For example, we can examine the
expected inrush current for various different types of load and whether the relay time delay is sufficient to allow the
thermistor to finish its job of limiting
that current before it’s shorted out. We
could also see the effect of disconnecting the load and then re-connecting it
some time later, before the thermistor
has had a chance to fully cool down.
That’s it for this month. In our next
SPICE tutorial, we will look at simulating audio circuits, especially those
which involve op amps.
SC
siliconchip.com.au
|