I hope you are doing well.
I’ve been working with time-modulated capacitors in NGSPICE and noticed something that seems inconsistent with the expected physics. Cutting to the chase:
The charge of a capacitor with time-dependent capacitance is
Q=C(t)V(t)
However, NGSPICE appears to neglect the (dC/dt).V term. In my test circuit (see below), the simulated capacitor current (black line in the attached figure) agrees only with the C(t).dV/dt contribution.
My questions:
– Is this a known limitation of NGSPICE’s capacitor model?
– Is there a recommended workaround to include the full time-dependent behavior (e.g. using B-sources, behavioral capacitors, or Verilog-A)?
Hi all,
I hope you are doing well.
I’ve been working with time-modulated capacitors in NGSPICE and noticed something that seems inconsistent with the expected physics. Cutting to the chase:
The charge of a capacitor with time-dependent capacitance is
Q=C(t)V(t)
and the current should be
I(t) = \frac{dQ}{dt} = \frac{dC}{dt}V(t) + C(t)\frac{dV}{dt}
However, NGSPICE appears to neglect the (dC/dt).V term. In my test circuit (see below), the simulated capacitor current (black line in the attached figure) agrees only with the C(t).dV/dt contribution.
My questions:
– Is this a known limitation of NGSPICE’s capacitor model?
– Is there a recommended workaround to include the full time-dependent behavior (e.g. using B-sources, behavioral capacitors, or Verilog-A)?
Thanks very much for any insight!
Best regards,
Lucas
This is how ngspice is dealing with variable capacitors (inpcom.c, lines 6695 ff.):
Thank you!
I modified the code to define charge instead, as Q(t)=C(t)V(t). The line in the code reads
Now it works (see atachment).
Best regards,
Lucas