Problem with Inductor simulation?

Please see this circuit:

Real time simulation does not agree with calculated values. Cause? Bug?

Thanks for UR comments.

by anon203
March 23, 2013

Hi anon,

Sorry, I don’t know much about theory (ideal source, inductor, …) but try to add a realistic R, say 1Ohm, to source or load, it may help to point at the problem?

Regards, Sancho

by Sancho_P
March 24, 2013

Not a bug.

An understandable misunderstanding about the exact nature of the circuit and the initial conditions.

:)

You have an ideal voltage source (Rsource = 0) driving an ideal inductor (Rser = 0).

Time constant t_LR = L/R = infinite!

Current in inductor is integral of voltage across it. Initial voltage = 0 then climbs +ve and drops back to zero at 1st half cycle then drops to -ve and climbs back to zero.

Integral of this is always greater than or equal to zero.

Time constant of infinity means that the integrator is perfect so current in inductor never droops towards symmetry around 0A.

Note that although the peak to peak current is approx 5.2A, mid swing to peak = 5.2/2 = 2.6A i.e. approx 2.65A.

If you set the voltage to zero at T=1ps but then switch in a cosine then the current will swing symmetrically about 0.

You have to have the ustep(T-1) in the expression. Without it the cosine forces the inductor current to have climbed to infinity because CL - in common with most simulators - assumes that the initial voltage was present for all time before the sim started and we did nothing to specify an initial inductor current. The 1ps delay is required because CL doesn't assert the ustep until T = 0+ i.e. immediately after T=0:

If you added some (realistic) series R tp you original circuit as @Sancho_P suggested and then ran the sim for long enough (but still with small enough timesteps!) then you would see the current slowly droop down to a symmetrical swing about 0A.

See also:

https://www.circuitlab.com/circuit/653up7/damping-vs-time-step-01/

https://www.circuitlab.com/circuit/4erqjv/damping-vs-time-step-02/

https://www.circuitlab.com/circuit/y97g97/damping-vs-time-step-03/

by signality
March 24, 2013

I think anon expected a “real world” result (I love it ! ) so the R was missing. Clearly CL must not add (assume) a resistor if there is no default resistance defined in the source or inductor.

However, when asked, I’d vote for a realistic default value corresponding to the default L, no real inductor has zero (one could set it to zero if needed). Same applies to a capacitor. Zero is such an extreme value, nearly always wrong, useful only for the ivory tower.

Rem1: In reality I may not be that extreme as it seems here, but I try to make the point for an electronics hobbyist who simply wants to simulate his real circuit.

Rem2: I’d love to see the parameter box for caps re-arranged, to look like the L’s parameter box, i.e. the cap value below the cap’s name. Confusing otherwise.

@anon203 was talking about a source with sin function only, thus I did not mention my “Time Controlled Switch” workaround.

For the cos function (or any phase shift in between) you know I call that dubious initial conditions a bug, because I can not specify what should be before the big bang in CL - and a simulator must not “assume” anything being there either.

Now the time step dependency:

I understand that there will be a problem when I force the solver to unreasonable time steps. However, a warning would be “nice” ...

Anyway, I have problems when I look @Signality’s “Damping vs. Time Step 0x” examples. The solver shows some ringing at 160kHz with some damping (why?), and indeed, even changing the time step to 30u increases the damping. Um, why why?

Is this a unique property (I’d call it a bug) of CL or is it again a feature “copied” from His Highness?

Could I trust the 160kHz? With any time step?

BTW, I dropped (nice, I love it ! ) a Time Controlled Switch into your example to avoid the ustep() … got a nasty error message but had expected some fA at T=0 because an open switch is not an open switch here (which is an other story).

;-)

Regards, Sancho

by Sancho_P
March 27, 2013

@Sancho_P,

I didn't mean to suggest that any of the “Damping vs. Time Step 0x” examples show the "correct" damping.

As explained in the notes in the schematic, they don't. This is because:

(a) there's an undocumented leakage resistance across the capacitors in CL and there may be a similar resistance across the inductors and/or a small resistance in series with them;

(b) the maths of the solver algorithms in simulators always seems to impose some compromise between convergence and energy conservation, i.e. how much damping there is in a ringy circuit.

There's some good stuff about it here:

http:///tech/node24.html

It's well beyond me: I just know about the consequences.

The “Damping vs. Time Step 0x” examples are just to make people aware of the existence of this apparently strange behaviour.

"I dropped (nice, I love it ! ) a Time Controlled Switch into your example to avoid the ustep() … got a nasty error message but had expected some fA at T=0 because an open switch is not an open switch here (which is an other story)."

The examples use an ideal current source and the mathematical ustep() expression instead of a switch to minimise the uncertainty about what may have been happening before T = 0 and also to minimise the uncertainty of undocumented component parasitics.

I can't remember from other sims like this but if you make the switch close at 1ps as in the ustep() expression then you may avoid the error.

I haven't done similar tricks to check for resistances of the various switches but I have established that there's a very large but finite resistance across the contacts of the relays:

https://www.circuitlab.com/forums/support/topic/3cqy484b/relays/

Bear in mind that whilst a hobbyist might expect "realistic" behaviour to include lossy reactive components, an electronics engineering student may in fact expect to see ideal components and to add sources of loss explicitly. That seems to be how such things are taught at least in the first year or so.

It depends on your view point.

by signality
March 27, 2013

"The examples use an ideal current source ... "

No they don't.

Git!

(It's my posting: I can be as rude about it as I want.)

They use an ideal behavioural voltage source modulated by the ustep() function.

:)

by signality
March 28, 2013

Absolutely no problem with direct speech if it’s honest, on the contrary, love it.

Content matters, not the package.

The package is for fun / joy only, otherwise totally wasted.

… Um, so you got an “ideal behavioural voltage source modulated by the ustep() function”, named it “I1” and made it delivering 1A after 1psec using the ustep() function?

Is it because of the “u” in “ustep”?

OK, sounds interesting, but I’m afraid you will have to explain that to poor Sancho in case we find a nice tavern at the end of the day. Who’s going to pay for the wine, Sire? ;-)

Regarding the switch with T=0 the error message is like “Solver returned no data” and exactly that’s my concern:

It sounds as it would be a solver problem but the problem is using an ideal current source with an open circuit, this is basically a bad circuit (a user problem, not a problem of the solver, to make it clear). I’d prefer a “Warning! Voltage at I1 exceeds 1kV at 0usec. Do you want to proceed?”

However, I don’t understand why - when the switch is already closed at T=0 - there would be a problem with an open circuit. I guess this leads back to the “before big bang” issue.

BTW the direct speech: I don’t like if questions are not answered, especially mine.

May I repeat: Is CL’s “incorrect” damping feature copied from His Highness or is it home made?

I’m eagerly waiting for your electronic students watching CL’s ideal components and damping feature!

;-)

Regards, Sancho

by Sancho_P
March 28, 2013

"… Um, so you got an “ideal behavioural voltage source modulated by the ustep() function”, named it “I1” and made it delivering 1A after 1psec using the ustep() function?

Is it because of the “u” in “ustep”?"

I just said the wrong thing.

My example doesn't use a current source at all. It uses a voltage source that is set to be zero up to T = 1ps and then is whatever V1 is doing after then.

"Regarding the switch with T=0 the error message is like “Solver returned no data” and exactly that’s my concern:

It sounds as it would be a solver problem but the problem is using an ideal current source with an open circuit, this is basically a bad circuit (a user problem, not a problem of the solver, to make it clear). I’d prefer a “Warning! Voltage at I1 exceeds 1kV at 0usec. Do you want to proceed?”"

This is actually what set me off blathering about current sources. If you had used a current source then I could understand the error message because you might be seeing huge voltages that the simulator detects as an error up until the time that the switch is closed.

Now, here's a things: I just tried the time controlled switch in:

https://www.circuitlab.com/circuit/yf52wm/

and with T= 0 or T = 1p, it worked fine!

Is that the thing you'd tried and had an error with?

Maybe the CL code fixing pixies have been at work since your posting ...?

"May I repeat: Is CL’s “incorrect” damping feature copied from His Highness or is it home made?

I’m eagerly waiting for your electronic students watching CL’s ideal components and damping feature!"

One of them has already been by:

https://www.circuitlab.com/forums/support/topic/47yds792/rlc-resonant-circuit/

Speaking of Taverns ... One of the finest coffees I've ever had was a cafe solo in a restaurant in La Mancha. Can't remember the name of the town but it was in an area where some of the town was built in a steep winding gorge with massive white cliffs around it and the rest of the town was right at the top of the cliffs looking straight down onto the river below.

Can't comment on the wine: I was driving.

:(

by signality
March 29, 2013

“I just said the wrong thing.”

Hmmm, didn’t find it ... Happy Easter, anyway!

Ah!

Sorry, I didn’t really follow your cos example, because anon was asking sinus and I (think I) know about the cos start condition problem (well, you know, I’d call it …).

And I wrote:

“Anyway, I have problems when I look @Signality’s “Damping vs. Time Step 0x” examples. … BTW, I dropped (nice, I love it ! ) a Time Controlled Switch into your example to avoid the ustep() …”

So I was referring to your three examples, fascinated by your your time step hint. There you’ve used a current source and after examining the damping / time step issue I wanted to see how close is 0 (zero) to the big bang for the solver (“… until the time that the switch is closed”). Here I got the error.

Double misunderstanding, easy solution. Miracle me no miracles.

[cough] But you don’t want to sell me Piero as an EE student, do you? Yep, tkellman with the caps maybe one, unfortunately he found an undocumented parallel resistor which is not mentioned in his study books ...

That brings me to your coffee. In our adventures you’ve promised me an island, and I, not knowing what that would be, was then searching all over the world. Finally, after centuries, I found it, small, but mine, in the veeeery south of Europe: Here I am! And I guess you’d also love our famous “leche y leche” (the very opposite of café solo).

And the wine … :-))

However, (my) questions are delimited by a trailing question mark (“?”) only.

Regards, Sancho

by Sancho_P
March 31, 2013

Aaaah.

""Confusion will be my epitaph, ... "

(From:

http://en.wikipedia.org/wiki/Tarkus_(song)#Reception )

:)

Yes, if you use a switch with the current sources in the “Damping vs. Time Step 0x” examples then whilst it is open circuit, the voltage across the current source heads off towards infinity.

If you use both throws of the SPDT time-controlled switch then you can arrange to short the current source until it is connected to the load. That might prevent the error if the changeover time is negligible in CL space.

I shall now scour Google maps for an island at the southernmost tip of Europe ... looking for white coffee rings on dark coloured street cafe tables.

by signality
April 01, 2013

I’ve already tried that shortcut at the switch, it works, which points at a (“the”) pre-big-bang” problem …

To see the famous high voltage and the end of ringing I have now added a second switch, unfortunately there seems to be another CL problem (at least in Safari):

The solver silently stops when the switch opens, no error message, I’m afraid that’s another bug (would say only a glitch because nothing “wrong” with the values, but I dunno the reason, should be investigated by CL).

BTW my favorite from EPL is “Pictures at an Exhibition” ;-)

Regards, Sancho

by Sancho_P
April 01, 2013

Post a Reply

Please sign in or create an account to comment.