1
\$\begingroup\$

With this setup

enter image description here

ngspice produces, for an 1ms dip-to-zero spike, this output

Voltage source

pwl(0 15 1m 15 2m 0 3m 0 4m 15 5m 15 2 15) r=0

enter image description here

If I make R12 = 0, this is what happens

enter image description here

Do these oscillations also happen in real life, and if so, do they look bad enough to warrant any attendence to them?

Where does ngspice pull its L value from (there must be one I suppose)?

edit

I might have run into a plotting bug.

.option meThOD and .option MAXORDER made no difference,

but choosing lower time steps did

edit 2

updating libngspice.so from v28 to v41 has also helped

\$\endgroup\$
4
  • \$\begingroup\$ The resistor may have an L value. If it is wire-wound, and not wound for inductance cancellation, it will have inductance in real life as well. \$\endgroup\$ Commented Aug 12, 2023 at 18:57
  • \$\begingroup\$ The capacitor may also have an L value associated with it. \$\endgroup\$ Commented Aug 12, 2023 at 19:06
  • 2
    \$\begingroup\$ Try setting integration to GEAR (or whatever ng calls it). \$\endgroup\$ Commented Aug 12, 2023 at 20:22
  • 2
    \$\begingroup\$ Unless they changed it very recently, KiCad does not add hidden parasitic simulation values to your components (check the SPICE netlist to verify). The comments above are for real-world considerations, and/or if you want to add those parasitics yourself into the simulation to try to predict the real-world outcomes better. e.g. add an explicit series inductor if you want to add series inductance. \$\endgroup\$
    – Ste Kulov
    Commented Aug 14, 2023 at 16:02

1 Answer 1

1
\$\begingroup\$

Presuming your question is not a trick question (presumption of innocence rules, and even if otherwise, I am writing for the benefit of visitors to this post), take care of the simulator report: Warning: V0: no DC value, transient time 0 value used.

Ngspice User’s Manual Version 40, section 4.1 Independent Sources for Voltage or Current, informs users of the syntax used to describe a voltage source component

VXXXXXXX N + N - < DC / TRAN VALUE > < AC < ACMAG < ACPHASE > > >

+ < DISTOF1 < F1MAG < F1PHASE > > > < DISTOF2 < F2MAG < F2PHASE > > >

DC/TRAN is the dc and transient analysis value of the source. If the source value is zero both for dc and transient analyses, this value may be omitted. If the source value is time-invariant (e.g., a power supply), then the value may optionally be preceded by the letters DC.

When used without the DC token (as in V0 N1 N2 15), the simulator computes the initial operating point for a zero-valued voltage source V0 and starts the transient analysis ramping the V0 voltage from zero to 15 V over a period of 0s. You see the initial transient of the kind at both plots. Only you can give details of your simulation to help answer the question why these transients are recurring with a two second interval; if it happens with a simple contiguous, unbroken transient analysis, ask ngspice maintainers about this phenomenon.

So, if you are sincerely at loss (sorry my precaution when giving this advice, I believe the related questions must have been discussed a few times in ngspice-related forums), try to add this DC token to the voltage source (as in V0 N1 N2 DC 15), either via the netlist or through the user interface. The voltage/current jumps for a non-zero R12 simulation must go. As for a circuit where the ideal voltage source directly charges the ideal capacitor, its transient behavior (insolvability in the finite domain, surely so for non-zero voltage, but, because of finite numerical precision, even for zero voltage) is well known and does not depend on the simulator used.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.