A
analog
Guest
LTspice contains many useful, undocumented A-sources. With a little
attention, experimentation and intelligent guessing it may be
possible to successfully explore and map out most (or at least the
most interesting) of these hidden treasures. For example, Mike
Engelhardt (the program's author) has more or less quietly disclosed
the most important workings of the OTA building block (which is part
of the recently released one and two pole opamp models). Also, the
undocumented JK flip-flop is so similar to the Set/Reset flip-flop
that its pinout, functionality and parameter set can undoubtedly be
simply inferred.
However, this post is about exploring the extosc A-source, the
external oscillator building block. Modeling the sawtooth oscillator
typically used in most PWM ICs is actually difficult to do well
because there is an especially strong conflict between accuracy and
simulation speed when standard elements are used. Uncertainties in
the timing and levels of the trip points of the sawtooth effect
apparent gain and stability of the PWM model. Forcing the simulator
to use smaller time steps than is absolutely necessary is very costly
to run times since the oscillator is changing continuously even when
the rest of the circuit is at steady state.
The extosc A-source seems to make use of the oscillator's periodic
nature to predictively signal the simulator's time step regulator
when a state change is imminent, thus allowing the fastest possible
run times while maintaining good accuracy. This is *very* desirable
for PWM IC model building.
The extosc A-source may be tested simply by right clicking on an
instance of a digital AND gate and renaming it "extosc". (The AND
gate is convenient for this purpose because its graphical symbol has
the complete set of A-source pins available in a straightforward
pattern. The inputs from top to bottom are pins 1 through 5 and the
outputs likewise are pins 6 and 7.)
For the extosc A-source element pin 1 is where the timing capacitor
is connected and pin 2 is the current mirror connection point for the
current setting resistor to ground. The open circuit voltage on pin 2
is set by the parameter "vextres" (pin 2 is nominally 1.69 volts
through 100 ohms). The capacitor charge and discharge currents are
nominally 1 and 9 times the current through Rset, but can be changed
via the parameters "icharge" and "idischarge" (e.g. icharge=1 idis-
charge=9). The trip points for the capacitor's sawtooth voltage are
set via the threshold and hysteresis parameters "vtcap" and "vhcap".
The voltage on pin 3 (if connected) is a multiplier for the charge
and discharge currents. Among other uses, this can be used to
realistically squelch the oscillator during undervoltage conditions.
The voltage on either of pins 4 or 5 appears to be a sync input with
parameters "vtgo" and "vhgo" for setting threshold and hysteresis and
"invgo" as a flag parameter that inverts sync polarities. Take these
with a grain of salt as I haven't had a chance to verify these
functions. Other possible extosc parameters (which may actually
belong to other A-sources) that have yet to be explored are "areset",
"nobreak", "invburst", "reciprocal" and "rclamp". Anyone care to
guess as to their function?
Happy hunting. -- analog
attention, experimentation and intelligent guessing it may be
possible to successfully explore and map out most (or at least the
most interesting) of these hidden treasures. For example, Mike
Engelhardt (the program's author) has more or less quietly disclosed
the most important workings of the OTA building block (which is part
of the recently released one and two pole opamp models). Also, the
undocumented JK flip-flop is so similar to the Set/Reset flip-flop
that its pinout, functionality and parameter set can undoubtedly be
simply inferred.
However, this post is about exploring the extosc A-source, the
external oscillator building block. Modeling the sawtooth oscillator
typically used in most PWM ICs is actually difficult to do well
because there is an especially strong conflict between accuracy and
simulation speed when standard elements are used. Uncertainties in
the timing and levels of the trip points of the sawtooth effect
apparent gain and stability of the PWM model. Forcing the simulator
to use smaller time steps than is absolutely necessary is very costly
to run times since the oscillator is changing continuously even when
the rest of the circuit is at steady state.
The extosc A-source seems to make use of the oscillator's periodic
nature to predictively signal the simulator's time step regulator
when a state change is imminent, thus allowing the fastest possible
run times while maintaining good accuracy. This is *very* desirable
for PWM IC model building.
The extosc A-source may be tested simply by right clicking on an
instance of a digital AND gate and renaming it "extosc". (The AND
gate is convenient for this purpose because its graphical symbol has
the complete set of A-source pins available in a straightforward
pattern. The inputs from top to bottom are pins 1 through 5 and the
outputs likewise are pins 6 and 7.)
For the extosc A-source element pin 1 is where the timing capacitor
is connected and pin 2 is the current mirror connection point for the
current setting resistor to ground. The open circuit voltage on pin 2
is set by the parameter "vextres" (pin 2 is nominally 1.69 volts
through 100 ohms). The capacitor charge and discharge currents are
nominally 1 and 9 times the current through Rset, but can be changed
via the parameters "icharge" and "idischarge" (e.g. icharge=1 idis-
charge=9). The trip points for the capacitor's sawtooth voltage are
set via the threshold and hysteresis parameters "vtcap" and "vhcap".
The voltage on pin 3 (if connected) is a multiplier for the charge
and discharge currents. Among other uses, this can be used to
realistically squelch the oscillator during undervoltage conditions.
The voltage on either of pins 4 or 5 appears to be a sync input with
parameters "vtgo" and "vhgo" for setting threshold and hysteresis and
"invgo" as a flag parameter that inverts sync polarities. Take these
with a grain of salt as I haven't had a chance to verify these
functions. Other possible extosc parameters (which may actually
belong to other A-sources) that have yet to be explored are "areset",
"nobreak", "invburst", "reciprocal" and "rclamp". Anyone care to
guess as to their function?
Happy hunting. -- analog