¿ªÔÆÌåÓý

Re: How to include component values in LTSpice trace formulas


 

Doug, you probably realized this already, but I had completely misunderstood your original question.? When you asked about "traces", I thought you meant PCB traces, A.K.A. "wires" or nets.? Silly me, I didn't realize that you meant traces in the waveform window.

Probably the easiest way to get a parameter (.PARAM) value from a schematic into the waveform section of LTspice, is to use a voltage source with value equal to the parameter, as you outlined, and as "hevans" described.? Voltage sources are cheap in SPICE.

Just be aware that .PARAMeters are evaluated only before simulation begins, so not only do their values not change over time, but they can't depend on any voltages or currents elsewhere in your circuit.

But Tony's approach of using .MEAS statements, then plotting their results from the .LOG file, is very powerful.

Most everywhere in LTspice, numbers are just numbers.? When you combine things into formulas, LTspice doesn't care that Volts really mean Farads.? I think it never complains about combining or mixing up units.? However, LTspice's plotting window is moderately intelligent about interpreting units, in order to attach helpful units to your displayed axes, but otherwise it also doesn't care.? So, for example, if your formula uses Volts as the analog of capacitance, you can try multiplying it by (1000mF/1V) and LTspice might recognize that you wanted Farads.? I'm not entirely sure that it knows Farads, Joules, or whatever, but it might.? (You'd have to do it this way instead of "1F/1V" because "1F" likely would be interpreted as 1 femto and that would scale things rather incorrectly.)

It should also be noted that there are a few situations where LTspice's waveform viewer treats units and multipliers differently than the rest of LTspice (and SPICE).? For example, I BELIEVE (not certain) that the waveform viewer lets you use MHz to mean megahertz, whereas in SPICE and in the simulation engine in LTspice, MHz is always interpreted as milli (or milliHertz but without the Hertz).? I haven't looked to see if the waveform viewer knows anything special about "Farads" when spelled out; or for that matter, if it even knows that Farads exist.? I'm sure it has a limited set of units that it understands.? This part of LTspice is not well documented.

Regards,
Andy


Join [email protected] to automatically receive all group messages.