Sub topic 11
Circuits with switches and multiple switching events
This chapter assumes you know the continuity rules (capacitor voltage and inductor current cannot jump) and the general formula x(t) = x(∞) + [x(0⁺) − x(∞)]e^(−t/τ). It shows how to apply them when a switch operates once or several times.
The method: one interval at a time
A switch changes the circuit, so each switch position is a separate first-order problem. Treat every interval between switching events on its own, and pass information from one interval to the next through the continuous quantity.
- Find the state just before the switch moves. Assume earlier intervals lasted long enough to reach steady state, unless the problem gives a time. In DC steady state a capacitor is an open circuit and an inductor is a short circuit.
- Carry over the continuous variable: vC(0⁺) = vC(0⁻) or iL(0⁺) = iL(0⁻).
- Redraw the circuit for the new switch position. Find the final value x(∞) with the same open/short rule.
- Find Req seen by the storage element, then τ = Req·C or L/R_eq.
- Write the formula for that interval, using local time measured from the switching instant.
Worked example: charge, then discharge
A 5 V source charges C = 100 nF through R₁ = 10 kΩ. At t = 0 the switch is open and the capacitor is empty. At t = 2 ms, a switch moves the capacitor to a discharge path through R₂ = 5 kΩ to ground.
Interval 1 (0 ≤ t < 2 ms). vC(0) = 0 V and vC(∞) = 5 V. τ₁ = R₁C = 1 ms. So v_C(t) = 5(1 − e^(−t/1 ms)).
At t = 2 ms, which is 2τ₁, v_C = 5(1 − e^(−2)) = 4.323 V.
Interval 2 (t ≥ 2 ms). Continuity gives vC(2 ms⁺) = 4.323 V. The final value is 0 V. Now τ₂ = R₂C = 0.5 ms. Using t′ = t − 2 ms, vC = 4.323·e^(−t′/0.5 ms).
The second interval decays faster because its resistance is smaller. Using the wrong τ, usually the one from the first interval, is the most common error in multi-switch problems.
import math
V, C = 5.0, 100e-9
R1, R2 = 10e3, 5e3
t_switch = 2e-3
def v_c(t):
if t < t_switch:
return V * (1 - math.exp(-t / (R1 * C)))
v0 = V * (1 - math.exp(-t_switch / (R1 * C)))
return v0 * math.exp(-(t - t_switch) / (R2 * C))
for t_ms in [0, 1, 2, 2.5, 3, 4]:
print(f"t = {t_ms} ms: v_C = {v_c(t_ms * 1e-3):.3f} V")Inductor circuits
The same procedure works with iL as the continuous variable. If a switch shorts a source out of an RL loop, iL keeps its value and decays through the remaining resistance with τ = L/Req. Take care when a switch opens the only path for inductor current. Then no Req exists for a finite τ, and a voltage spike results, as the later chapter on inductive switching explains.
Common errors
- Using vC(0⁻) for a resistor voltage or current. Only vC and iL are continuous. Other quantities can jump, so recompute them from vC(0⁺) or i_L(0⁺) in the new circuit.
- Assuming steady state when the interval was shorter than about 5τ. Evaluate the exponential at the actual switching time instead.
- Forgetting to reset the time origin, or forgetting that R_eq depends on the switch position.
Exercise
In the example, the capacitor reaches 4.323 V at 2 ms and then discharges through R₂ = 5 kΩ with C = 100 nF. What is v_C at t = 3 ms?
Show answer
τ₂ = 5 kΩ × 100 nF = 0.5 ms, and the elapsed time in the second interval is 1 ms, which is 2τ₂. v_C = 4.323·e^(−2) = 0.585 V.
Exercise
A resistor in series with the capacitor carries current just before the switch moves, and the capacitor then discharges through a different path. Does the current through the capacitor stay the same across the switching instant?
Show answer
No. Only the capacitor voltage is continuous. The capacitor current is i = C dv/dt, and it can jump. In the example it changes from a positive charging current to a negative discharging current.