Sujet : Re: irrational Spicing
De : bill.sloman (at) *nospam* ieee.org (Bill Sloman)
Groupes : sci.electronics.designDate : 31. Oct 2024, 04:04:43
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vfus4j$2dfgf$3@dont-email.me>
References : 1
User-Agent : Mozilla Thunderbird
On 31/10/2024 7:07 am, john larkin wrote:
Things I've seen, and even done, in Spice sims...
Bypassing voltage sources (not me!)
Worrying about resistor power dissipation
Using standard parts values, like 4.7K ohms or 33nF, when the control
loop will be mostly code anyhow
Using +-12 or some such opamp supply voltages, and scaling signal
levels to fit. The LT Spice universal opamps will work with hundreds,
or thousands, of volt supplies.
Real op amps don't, and SDpice is a bout modelling what real op amps do.
Drawing hideously ugly schematics without a title, author, date, or
named nodes.
Every node on a Spice netlist is named, even if the names aren't user-friendly. Every .asc file has a date and a name, even if they aren't automatically designed to fit in with John Larkin's expectations.
Somebody who post pencil sketches as sloppy as his isn't really in a position to complain about LTSpice schematics.
So I'm rescaling a power supply sim (I'm waiting for a run to finish
now) to have everything in actual 1:1 units. Then we will write the
control loop code to work in those same real engineering units, not
some goofy scaled integers or anything like that.
Keeping everything in true units as floats is ideal, but the RP2040
floating point ops are kinda slow, so we may express things as 32-bit
values, 16 bits of signed integer and 16 bits of fraction, as a sort
of fast and cheap float. But 12.5 volts is still visibly 12.5, just
as if it were a float. That will be handy for debugging.
S16.16 is plenty good to express voltages and currents in a power
supply.
Not always. Rounding error gets to be a problem when you subtract two big numbers and end up with a very small difference. Do it repeatedly, as you can when running a Spice simulation, and it can build up to an inconvenient error.
I ran into that as a graduate student when I was numerically integrating a differential equation to model the chemical reaction whose rate I was trying to measure. A couple of critical variables had to be triple precision numbers to keep the integral stable.
-- Bill Sloman, Sydney