I've been trying to simulate an MLCC capacitor in LTspice. I started with a well behaved TANH curve to generate my C(V), to plug into the nonlinear capacitor Q = C(V)×V formula. I noticed after testing that I would get a negative capacitance out of my TANH function for capacitance (which when I plug it into a BV source never goes negative as this should be mathematically impossible).
My original plan:
C1 0 1 Q=((1-TANH((ABS(X)-'TH')*'SLOPE'))/2*'CMAX'+'CMIN')*X
.param TH=3.196
.param SLOPE=0.400
.param CMIN=6.701u
.param CMAX=45.330u
If you plot this in Desmos or Excel, you can see it can't possibly go negative for any real value of X.
I tried this simple experiment to understand the issue better:
C1 1 0 Q=(47u)*X
V1 1 0 PULSE(0 10 0 10 100 100 100)
The pulse gives dV/dt = 1 so that I=C in the capacitor as V grows. The simulation runs for 10 s (0V - 10V).
I get 47 μA in the cap the whole time, so far so good.
Then I try this:
C1 1 0 Q=(47u-1u*X)*X
When I do this I see the 47 μA (representing 47 μF) at 0 V, but at 10 V I get 27 μA, as though it lost 20 μF instead of 10 μF, or as though X was 20 and not 10, but it is a straight line.
A fix I tried here was to divide the inside X by 2. This worked and I get the expected result, but why this works I don't understand so I don't trust this as a fix.
C1 1 0 Q=(47u-1u*x/2)*X
I did try this divide X by 2 in my original TANH and it did not resolve the issue at all (still gives negative C), as though the evaluation of the C(V) portion of the charge equation is following some rules that are not clear to me.
Is this a bug in my understanding of how the charge model works? What is going on here?
*X
only works for a constant capacitance. Have you read this? analog.com/en/analog-dialogue/raqs/raq-issue-192.html \$\endgroup\$