¿ªÔÆÌåÓý

Re: How to include component values in LTSpice trace formulas


 

¿ªÔÆÌåÓý

You should first of all, read the Help. It is very information-intensive, so it needs reading carefully and reading several time. There is a special way of treating capacitors that do unusual things or are charged in unusual ways, which is at the end of the Help page on Capacitors:

There is also a general nonlinear capacitor available. Instead of specifying the capacitance, one writes an expression for the charge.

LTspice will compile this expression and symbolically differentiate it with respect to all the variables, finding the partial derivative's that correspond to capacitances.

Syntax: Cnnn n1 n2 Q= [ic=] [m=]

There is a special variable, x, that means the voltage across the device. Therefore, a 100pF constant capacitance can be written as

Cnnn n1 n2 Q=100p*x

A capacitance with an abrupt change from 100p to 300p at zero volts can be written as

Cnnn n1 n2 Q=x*if(x<0,100p,300p)

I have assumed from your message that your capacitor value is not constant. If it is constant, just put its value in the expression. You can do this even just with Waveform Arithmetic (see the Help!). Click on the title of the plot of the voltage (V(n005) for example) across your capacitor and change? the expression? to V(n005)^2*10^(-7)/2, if your capacitor is 100 nF. The y-axis is in terms of volt-squared, because LTspice doesn't know that the '10^(-7)' is a capacitor.? It ought to be plotted in joules if you multiply it by 1F/1J (1 farad/1joule), but it doesn't work because LTspice recognizes '1F' as '1 femto', i.e. 1-^(-15).

John Woodgate OOO-Own Opinions Only
J M Woodgate and Associates 
Rayleigh, Essex UK
On 2018-11-17 19:31, douglas.fay@... [LTspice] wrote:

?

Just joined the group and don't know how to search whether this has already been addressed - guidance on that would be appreciated!


But here's my question: I would like to be able to define a trace for the energy stored in a capacitor using the formula E= 1/2 * V^2 * C. But I can't find how to include component values such as capacitance, C, in the trace formulas. Is there a way to do this?


Thanks - Doug

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