How can I replace a switch in series RL circuit with a variable resistor?

ogwd

Joined Jun 28, 2019
3
Hello all, I am just a newbie in this forum.
I am trying to get a differential equation for a series RL circuit
includes a switch for my study.

Vi(t) ----- sw ----- R ----- L ----- Vo(t)
i(t) →
GND ------------------------------ GND

When the switch is on or off, it is so easy to get equations as follows;

OFF: di(t)/dt = -(R / L) i(t) (Eq. 1)
ON: di(t)/dt = -(R / L) i(t) + (1 / L) {Vi(t) - Vo(t)} (Eq. 2)

I just want to simulate a broken switch, which can not turn off perfectly.
At first, I tried to replace the switch with a variable resistor "Rsw",
which ranges from 0 to larger value (maybe giga ohm).

Vi(t) ---- Rsw ----- R ----- L ----- Vo(t)
i(t) →
GND ------------------------------ GND

Then, a differential equation is derived as

di(t)/dt = -((R + Rsw) / L) i(t) + (1 / L) {Vi(t) - Vo(t)} (Eq. 3)

Eq. 3 is equal to Eq. 2 (switch is closed) when Rsw = 0, it is OK.
I believe that the Eq. 3 shall be equivalent to Eq. 1 (switch is opened)
when Rsw is quite large since the opened switch is like a resistor of which value is so large.
But, setting Rsw = ∞ doesn't give Eq. 1.

Where is the point that I am missing?
I need a equation that simulates opened / closed / half opened switch by alter Rsw dynamically.

WBahn

Joined Mar 31, 2012
25,918
I think you have a bigger problem. Where is your differential equation for the switch open coming from? You define i(t) as the current flowing out of the Vi(t) source (at least that's how it appears to me). With the switch open, how is that current flowing in the R or the L? Does your equation really represent the application of KVL around a loop?

MrAl

Joined Jun 17, 2014
7,669
Hello all, I am just a newbie in this forum.
I am trying to get a differential equation for a series RL circuit
includes a switch for my study.

Vi(t) ----- sw ----- R ----- L ----- Vo(t)
i(t) →
GND ------------------------------ GND

When the switch is on or off, it is so easy to get equations as follows;

OFF: di(t)/dt = -(R / L) i(t) (Eq. 1)
ON: di(t)/dt = -(R / L) i(t) + (1 / L) {Vi(t) - Vo(t)} (Eq. 2)

I just want to simulate a broken switch, which can not turn off perfectly.
At first, I tried to replace the switch with a variable resistor "Rsw",
which ranges from 0 to larger value (maybe giga ohm).

Vi(t) ---- Rsw ----- R ----- L ----- Vo(t)
i(t) →
GND ------------------------------ GND

Then, a differential equation is derived as

di(t)/dt = -((R + Rsw) / L) i(t) + (1 / L) {Vi(t) - Vo(t)} (Eq. 3)

Eq. 3 is equal to Eq. 2 (switch is closed) when Rsw = 0, it is OK.
I believe that the Eq. 3 shall be equivalent to Eq. 1 (switch is opened)
when Rsw is quite large since the opened switch is like a resistor of which value is so large.
But, setting Rsw = ∞ doesn't give Eq. 1.

Where is the point that I am missing?
I need a equation that simulates opened / closed / half opened switch by alter Rsw dynamically.

Hi,

You really need to add a load, like a load resistor RL then this will make sense and your limit will lead you to 0v for Vout.
For example something like:
-i*RL-i*(R+Rs)-L*di/dt+Vin=0

then solve that (or whatever you get) in time, then take your limit as Rs goes to +inf.
With Rs open, the output has to be 0v, but to see that clearly you need a load too.

WBahn

Joined Mar 31, 2012
25,918
Hi,

You really need to add a load, like a load resistor RL then this will make sense and your limit will lead you to 0v for Vout.
For example something like:
-i*RL-i*(R+Rs)-L*di/dt+Vin=0

then solve that (or whatever you get) in time, then take your limit as Rs goes to +inf.
With Rs open, the output has to be 0v, but to see that clearly you need a load too.
Even if you put a load on it, when you open the switch you have an open circuit -- and an open circuit that has an inductor with current flowing in it.

You either need to model the arc characteristics of the switch, or have your variable resistance ramp from zero to infinity over some finite amount of time.

But none-the-less a load really is needed since the present equations, even if correct, apply to circuits that are always open circuited, hence i(t) is always identically zero.

ogwd

Joined Jun 28, 2019
3
I really thanks for your advice, WBahn and MrAl.

> WBahn
> Where is your differential equation for the switch open coming from?
> You define i(t) as the current flowing out of the Vi(t) source (at least that's how it appears to me).
> With the switch open, how is that current flowing in the R or the L?
> Does your equation really represent the application of KVL around a loop?

> MrAl
> You really need to add a load, like a load resistor RL then this will make sense
> and your limit will lead you to 0v for Vout.

> WBahn
> Even if you put a load on it, when you open the switch you have an open circuit
> -- and an open circuit that has an inductor with current flowing in it.

The circuit above is a part of my simulation model, and
the circuit is connetted to a load, which is a parallel RC circuit
consists of resistance Ra and conductor Ca (for this time).
In this case, Vo is given as
dVo(t)/dt = -(1 / (RaCa)) Vo(t) + 1/Ca i(t)

I should explain about that, but, I wanted to simulate a one-way valve
(from Vi side to Vo side) by turning off switch when Vo >= Vi.
Vo = Vi makes Eq. 2 be equal to Eq. 1

My model consists of simultaneous differential equations as
dVo(t)/dt = -(1/(RaCa)) Vo(t) + (1/Ca) i(t)
di(t)/dt = -(1/L) Vo(t) - (R/L) i(t) + (1/L) Vi(t)
(Eqs. 4 & 5)
and can be solved with an ODE solver.

> You either need to model the arc characteristics of the switch, or have your variable
> resistance ramp from zero to infinity over some finite amount of time.

My analysis is not for any actual circuits but for a hydraulic model based on
analogy with electric circuit.
So that, I do not need the arc characteristics.
Maybe I should consider moderate change in Rsw as you proposed.

> But none-the-less a load really is needed since the present equations, even if correct,
> apply to circuits that are always open circuited, hence i(t) is always identically zero.

Of course you are right that i(t) becomes 0 in steady state.
Meanwhile, my simulation includes transient state just after switch is turned off
during my circuit is in operation.
Then, R i(t) + L di(t)/dt = 0 as shown in https://physics.info/circuits-rl/

> For example something like:
> -i*RL-i*(R+Rs)-L*di/dt+Vin=0
> then solve that (or whatever you get) in time, then take your limit as Rs goes to +inf.
> With Rs open, the output has to be 0v, but to see that clearly you need a load too.

Hmｍ, your equation is converted to
di/dt = (1/L) Vin - (R + Rs + RL) i(t)
so that, Rs →∞ makes di/dt → -∞.
It leads to my equations diverge.

MrAl

Joined Jun 17, 2014
7,669
Even if you put a load on it, when you open the switch you have an open circuit -- and an open circuit that has an inductor with current flowing in it.

You either need to model the arc characteristics of the switch, or have your variable resistance ramp from zero to infinity over some finite amount of time.

But none-the-less a load really is needed since the present equations, even if correct, apply to circuits that are always open circuited, hence i(t) is always identically zero.
Hi,

I have been away with someone for a while.

The way i saw it was that if there was an infinite resistance then there would be a voltage divider. The lower resistor would be the load say 1k or even 10k or even 100k, and the upper resistor would be infinite so the question then looks like can an infinite resistance drop all the voltage created by a current source.
I'll go over the math again though when i get a chance.

WBahn

Joined Mar 31, 2012
25,918
Hi,

I have been away with someone for a while.

The way i saw it was that if there was an infinite resistance then there would be a voltage divider. The lower resistor would be the load say 1k or even 10k or even 100k, and the upper resistor would be infinite so the question then looks like can an infinite resistance drop all the voltage created by a current source.
I'll go over the math again though when i get a chance.
What is the voltage drop across an infinite resistor when the switch is opened while the inductor has any current at all in it?

MrAl

Joined Jun 17, 2014
7,669
What is the voltage drop across an infinite resistor when the switch is opened while the inductor has any current at all in it?
Hello again,

Well, what do you think it is?
Any current at all through an infinite resistance and we can look at it as creating an infinite voltage.
E=i*R, and with i=1ua and R infinite the voltage must be infinite. This would give us an infinite voltage drop. Now in the load, we have a finite voltage drop. So the ratio of the load voltage to this infinite voltage approaches zero. That's one way of looking at it.

Another view is that a current can only flow in a closed circuit. An open switch creates something that is no longer a circuit. Our circuit laws are based on actual circuits not a discontinuous current path.

But what is your take on this and those views?

WBahn

Joined Mar 31, 2012
25,918
Hello again,

Well, what do you think it is?
Any current at all through an infinite resistance and we can look at it as creating an infinite voltage.
E=i*R, and with i=1ua and R infinite the voltage must be infinite. This would give us an infinite voltage drop. Now in the load, we have a finite voltage drop. So the ratio of the load voltage to this infinite voltage approaches zero. That's one way of looking at it.

Another view is that a current can only flow in a closed circuit. An open switch creates something that is no longer a circuit. Our circuit laws are based on actual circuits not a discontinuous current path.

But what is your take on this and those views?
If the inductor has current flowing in it and you open circuit it, then that inductor will create however high a voltage is required in order to keep that current continuous over that event. If that means generating tens of thousands of volts, that's what it will do. That's how car ignition systems work. Trying to model a system in which you instantaneously open circuit an inductor that has current flowing in it is unrealistic unless you model the mechanism by which that inductor is going to force the current to be continuous.

MrAl

Joined Jun 17, 2014
7,669
If the inductor has current flowing in it and you open circuit it, then that inductor will create however high a voltage is required in order to keep that current continuous over that event. If that means generating tens of thousands of volts, that's what it will do. That's how car ignition systems work. Trying to model a system in which you instantaneously open circuit an inductor that has current flowing in it is unrealistic unless you model the mechanism by which that inductor is going to force the current to be continuous.
Hello,

For your first statement, that is normally true, but we dont have just one infinity to consider we have two. And you know how two infinities can change things.

I did the math two different ways and get zero volts across the load resistor both ways.
But you are free to show your solution.

A simpler example is a resistor R1 in series with an inductor L1 in series with another resistor R2 and R2 free end connected back to R1 free end. That forms a loop. Now with L1 having some initial current, calculate the voltage across R2 the load.
That's about as simple as it gets, and once R1 goes to infinity the voltage across R2 appears to go to zero.
Why this happens we can talk about. One idea is that it is no longer a circuit. Another idea is that the infinite resistor absorbs the finite current completely causing an infinite voltage drop. Another idea is that the ratio of the voltage across the infinite resistor is so much greater than the voltage across the load resistor that it makes it look like zero volts across the load.

WBahn

Joined Mar 31, 2012
25,918
Hello,

For your first statement, that is normally true, but we dont have just one infinity to consider we have two. And you know how two infinities can change things.

I did the math two different ways and get zero volts across the load resistor both ways.
But you are free to show your solution.

A simpler example is a resistor R1 in series with an inductor L1 in series with another resistor R2 and R2 free end connected back to R1 free end. That forms a loop. Now with L1 having some initial current, calculate the voltage across R2 the load.
That's about as simple as it gets, and once R1 goes to infinity the voltage across R2 appears to go to zero.
Why this happens we can talk about. One idea is that it is no longer a circuit. Another idea is that the infinite resistor absorbs the finite current completely causing an infinite voltage drop. Another idea is that the ratio of the voltage across the infinite resistor is so much greater than the voltage across the load resistor that it makes it look like zero volts across the load.
Could you please provide a schematic of the circuit you are talking about? The one provided by the TS makes no sense as it has a non-zero current flowing in an open circuit at t=0-.

MrAl

Joined Jun 17, 2014
7,669
Could you please provide a schematic of the circuit you are talking about? The one provided by the TS makes no sense as it has a non-zero current flowing in an open circuit at t=0-.

Yes ok.

In the drawing, R1 is the switch and R2 is the load.
There is initial current in the inductor as shown.
If R1 opens what happens to the voltage across R2.

Attachments

• 5.1 KB Views: 5

WBahn

Joined Mar 31, 2012
25,918
Yes ok.

In the drawing, R1 is the switch and R2 is the load.
There is initial current in the inductor as shown.
If R1 opens what happens to the voltage across R2.
The voltage across R2 doesn't change -- it still has the initial current flowing through it.

The voltage across R1 spikes toward infinity until something breaks down -- most likely an arc across R1 (or to something else) or between the turns of the inductor. That would need to be modeled.

MrAl

Joined Jun 17, 2014
7,669
The voltage across R2 doesn't change -- it still has the initial current flowing through it.

The voltage across R1 spikes toward infinity until something breaks down -- most likely an arc across R1 (or to something else) or between the turns of the inductor. That would need to be modeled.
Hi,

It is questionable if R2 has the current through it because things change drastically.
If we dont have a complete circuit, how could we get current flow? That's only one of the questions that comes up in pure theory.

Yeah but the idea is to put some regular math to it and see what turns up, in theory.
The voltage goes toward infinity, but then again so does the resistance. So we dont have finite voltage and we dont have finite resistance.
If we wanted to go pure reality, then we delve into the physical constraints. Of course there will be many. But for the pure theory we can see what happens.

For pure math, regular circuit analysis, we can analyze the circuit with two resistors, then let R1 go to infinity.
Try some math and see what turns up.

The diff equation for this is simple to write so we have something to start with. The diff equation is for one inductor and two resistors of course, which is easy to write.

WBahn

Joined Mar 31, 2012
25,918
Hi,

It is questionable if R2 has the current through it because things change drastically.
If we dont have a complete circuit, how could we get current flow? That's only one of the questions that comes up in pure theory.
Simple -- the inductor produces enough voltage to FORCE the current to remain continuous. Again, this is how an standard automobile ignition system works. Get some current flowing in a coil and then open circuit the inductor via the points. The coil then produces several tens of thousands of volts because that's what it takes to get an arc to jump the gap of the spark plug.

MrAl

Joined Jun 17, 2014
7,669
Simple -- the inductor produces enough voltage to FORCE the current to remain continuous. Again, this is how an standard automobile ignition system works. Get some current flowing in a coil and then open circuit the inductor via the points. The coil then produces several tens of thousands of volts because that's what it takes to get an arc to jump the gap of the spark plug.
Hi,

Yeah but i dont see any math to back that up. As you know, talk is cheap, intuition does not always work,I have math to back my claim up, and maybe you can back yours up too, but i'd like to see it. The reason i ask is maybe you really can and that's what id like to see.
If you like i can present mine first no problem.

ogwd

Joined Jun 28, 2019
3
Excuse me that I was out of office since last Thursday.
I am surprised that deeper discussion is started while I was away.

Well, recently I had got a point about what bothered me.
I had tried to simulate my imperfect switch with PSpice.
Please see my screenshot here.
# Please do not care about voltage / ampere / resistance / inductance range
# since this model is originally for a hydraulic model.

When switch ON resistance is smaller (5ohm), spikes during switch has been just turned on/off
become reasonable one, meanwhile, they become extremely large when ON resistance is large
(10,000 ohm).

In my equation di(t)/dt = -(1/L) Vo(t) - (R/L) i(t) + (1/L) Vi(t) (Eq.2)
R →∞, i(t) → 0, thus, small i(t) and large R cancels each other.
But this equation diverges so easily because i(t) and R are on an unsteady balance.

It is like "zeros-poles problem" in electric circuits.
I guess my first strategy, which uses 2 equations for simulating ON/OFF of the switch,
could (luckily) avoid such a sensitive problem.

Maybe I should modify my model to cope with this problem.
I guess adding small capacitance near the switch will bypass sudden voltage increase / decrease.
My tricky solution is adding peak limiter for di(t)/dt in my differential equation model.
That works for me for this moment.

Anyway, thanks for your big helps!

MrAl

Joined Jun 17, 2014
7,669
Hi,

Yes it gets a little tricky in theory and even more so in a simulator because we have to know what constraints the simulator imposes on the components like the switch where there could be a minimum 'off' resistance like 1 gigohm or something like that. So it would not be theoretically open just practically open and there is a big difference between the two.

However, the resistance and the voltage developed are not independent of each other they are related by a function, and so as R1 increases the voltage increases accordingly. In the limit the output voltage appears to go to zero, but only in the limit as R goes to infinity.
So show this we only have to develop the time equation and we end up with an exponential like so:
Vout=i0*R*e^(-t*R/L)
(where R in the exponential absorbs the other resistance too)
and here as R goes toward infinity the voltage peaks but then goes toward zero the higher R gets.

To investigate in real life, we'd have to know more about the inductor and the humidity and stuff like that. For example, the breakdown voltage rating of the inductor wire insulation could cause arc over within the inductor itself and thus absorb a lot of the energy that was stored before the switch was opened. So this quickly turns into an advanced physics and materials science problem if we really wanted to get super practical.

"R →∞, i(t) → 0, thus, small i(t) and large R cancels each other."
I think what you meant here was that finite current 'i' and infinite R cancels each other.

Last edited: