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
CT circuit
*==============================================================
.param freq=500k $ source frequency
.param dt=1/freq/400 $ time step for transient analysis
.param tau=20/freq $ evolution time
* Voltage source
Vs1 v1 0 SIN(0 1 {freq})
* Time modulated capacitance
Ck v1 0 {1000p*(1+0.9*cos(3.14159*freq*time))}
* Also tried: --> gives the same result.
* Ck v1 0 C = {1000p*(1+0.9*cos(3.14159*freq*time))}
*--------------------------------------------------------------
*--------------------------------------------------------------
* Transient analysis specs
*--------------------------------------------------------------
.tran {dt} {tau} uic
*==============================================================
.control
run
set wr_singlescale
wrdata current.dat V(v1) I(Vs1)
.endc
.END