# How to write inductor ODE equation properly?

I've drawn a following scheme, and now want to write ODE system for describing inner processes, in order to explore it:

simulate this circuit – Schematic created using CircuitLab

I wrote the first part, and it is clear enough, as I have a leaky capacitor:

$$\\frac{dV_m}{dt} = \frac{I_{in} - \frac{V_m}{R_m} - I_a*SW1}{C_m}\$$

But second part is not clear at all, and is not working. I thought like it should work basically the same as capacitor:

$$\\frac{dI_a}{dt} = \frac{V_m*SW1 - \frac{I_a}{R_a}}{L_a}\$$

It kind of creates knee on current graph(when i close switch) - follow the red arrow on following screenshot:

Green knee is ok, its just due to Iin set to zero via heaviside function somewhere else in program, sorry for it, just distracts.

But for red I feel that desired behaviour should be like sinc stuff, so what was expected is like this, because it has some L:

So.. Could you correct me? Or, how to write correct formulas, describing processes in this circuit?

## PS

For the curious, its real-world warm-lamp doomsday device. It connects directly to the mains through series lamp, its very dangerous, so you should not do this at home: It has +310VDC on a thyristor radiator..

• What does "ODE" stand for? – Transistor Apr 30 at 17:55
• @Transistor Ordinary differential equation – xakepp35 Apr 30 at 17:59
• Thanks. By the way, when you use the CircuitLab button on the editor toolbar an editable schematic is saved in your post. That makes it easy for us to copy and edit in our answers. You don't need a CircuitLab account, no screengrabs, no image uploads, no background grid. – Transistor Apr 30 at 18:03
• Your 2nd part shudbe $\frac{dI_a}{dt} = \frac{V_m*SW1-I_a \cdot R_a}{L_a}$ – Sunnyskyguy EE75 Apr 30 at 19:17
• @SunnyskyguyEE75 wut. Since when could we use MathJax in the comments? – DKNguyen Apr 30 at 19:44

Managed to get that up and running: http://jsfiddle.net/zo2xuhds/embedded/result/

Trick was in a wrong gate logic. A gate must:

• transfer power in one direction, from capacitor to inductor, but not vice versa (not sure if there are real-world analogs, maybe triac?..)
• open when a capacitor absolute voltage exceeds some threshold Vopen (no matter negative or positive),
• close when current will become less than holding current Ihold (again, no matter of its sign)

@SunnyskyguyEE75 mentioned mistake in inductor ODE: Indeed, the Ia⋅Ra is correct term. I've messed resistances up with conductances, which are typically used in neuronal studies.

Certainly, what was noticed during my home-made research, is that:

• Cm(membrane capacitance) and La(axon inductance) are responsive for frequency ranges and may be chosen low and even fixed.
• timestep dt(=1) and cap leakage Gm(=1/Rm) are rarely useful and could almost be omitted from model.
• Ra and Vopen are capable of producing chaotic behaviours, and different kinds of tonic bursts:

Such a simple thing is capable of creating non-linear pwm signals

Very pleased with it, I've finally done that, without using exponentials, and even squaring. Probably that puts some restrictions on the model's computational power, but I haven't figured out them yet.