Sub topic 11
Circuits with Switches and Multiple Switching Events
This chapter assumes you know the general first-order solution from the previous chapter: x(t) = x(∞) + [x(0⁺) − x(∞)] e^(−t/τ). It also assumes you can find a Thevenin resistance. Here you will apply that formula to circuits where switches change the topology, including circuits that switch more than once.
Why switches need a procedure
A switch changes the circuit. After it moves, the storage element sees a different resistance and a different source, so the circuit has a new final value and often a new time constant. The capacitor voltage or inductor current carries over from the old circuit, but nearly everything else can jump.
Treat each interval between switching events as its own circuit. Each interval has its own equation, and the intervals are linked only by continuity.
The four-step method
For each switching event at time t₀:
- Find the state just before the event. Use the previous interval's solution evaluated at t₀⁻. If the circuit sat for a long time, use DC steady state: capacitors are open and inductors are shorts.
- Carry the state across. Capacitor voltage and inductor current are continuous, so vC(t₀⁺) = vC(t₀⁻) and iL(t₀⁺) = iL(t₀⁻).
- Analyze the new circuit. Find the final value x(∞) with the storage element replaced by its DC model. Find τ using the Thevenin resistance seen by the element, with the switch in its new position.
- Write the solution with a shifted time. Use x(t) = x(∞) + [x(t₀⁺) − x(∞)] e^(−(t−t₀)/τ) for t ≥ t₀.
Replacement models at the instant of switching
At t₀⁺ you can replace each storage element with a source that holds its carried-over value. This lets you solve the other voltages and currents with ordinary resistive analysis.
| Element | State at t₀⁺ | Replace with |
|---|---|---|
| Capacitor | v_C = 0 | Short circuit |
| Capacitor | v_C = V₀ | Voltage source V₀ |
| Inductor | i_L = 0 | Open circuit |
| Inductor | i_L = I₀ | Current source I₀ |
At t = ∞ use the DC models instead: the capacitor is open and the inductor is a short.
Worked example 1: an RC circuit with two events
A 10 V source charges a 1 µF capacitor through R₁ = 2 kΩ. The capacitor starts at 0 V. The switch closes at t = 0. At t = 3 ms the switch moves, disconnecting the source and connecting the capacitor to ground through R₂ = 1 kΩ.
Interval 1 (0 ≤ t < 3 ms). Here vC(0⁺) = 0, vC(∞) = 10 V, and τ₁ = R₁C = 2 ms. So v_C(t) = 10(1 − e^(−t/2 ms)).
At t = 3 ms: v_C = 10(1 − e^(−1.5)) = 10(1 − 0.2231) ≈ 7.769 V.
Interval 2 (t ≥ 3 ms). The capacitor starts at 7.769 V and the final value is 0 V. Only R₂ remains in the loop, so τ₂ = R₂C = 1 ms. Then v_C(t) = 7.769 e^(−(t−3 ms)/1 ms).
At t = 5 ms: v_C = 7.769 e^(−2) ≈ 1.051 V.
Compare the capacitor current across the event. Just before the switch moves, i = (10 − 7.769)/2 kΩ ≈ +1.12 mA, charging the capacitor. Just after, i = −7.769 V/1 kΩ ≈ −7.77 mA, discharging it. The voltage is continuous, but the current jumps.
Worked example 2: a switch that changes tau
A 10 V source drives R₁ = 10 Ω and R₂ = 40 Ω in series with an inductor L = 50 mH. A switch across R₂ is open for a long time. It closes at t = 0 and reopens at t = 10 ms.
Before t = 0. The circuit is in DC steady state and the inductor is a short, so i_L = 10/(10 + 40) = 0.2 A.
Interval 1 (0 ≤ t < 10 ms). The closed switch shorts R₂. The current starts at 0.2 A and heads toward 10/10 = 1 A. The resistance seen by the inductor is 10 Ω, so τ₁ = 50 mH/10 Ω = 5 ms. Then i_L(t) = 1 − 0.8 e^(−t/5 ms).
At t = 10 ms: i_L = 1 − 0.8 e^(−2) ≈ 0.892 A.
Interval 2 (t ≥ 10 ms). With R₂ back in the loop, the final value returns to 0.2 A. The resistance is now 50 Ω, so τ₂ = 50 mH/50 Ω = 1 ms. The current starts at 0.892 A, so i_L(t) = 0.2 + 0.692 e^(−(t−10 ms)/1 ms).
The current falls toward 0.2 A five times faster than it rose toward 1 A, because τ is set by the resistance in each interval.
Automating the bookkeeping
For many events, a small function removes the arithmetic errors. Each segment is stored as (start time, final value, τ). The function carries the state from one segment into the next.
import math
def transient(x0, segments, t):
"""First-order response with several switching events.
x0 -- state at t = 0 (capacitor voltage or inductor current)
segments -- list of (start_time, x_final, tau), sorted by start_time,
the first start_time being 0
t -- time at which to evaluate the response (t >= 0)
"""
x = x0
for k, (t0, x_inf, tau) in enumerate(segments):
t_next = segments[k + 1][0] if k + 1 < len(segments) else float("inf")
if t < t_next:
return x_inf + (x - x_inf) * math.exp(-(t - t0) / tau)
# Carry the state to the next switching event.
x = x_inf + (x - x_inf) * math.exp(-(t_next - t0) / tau)
# Worked example 2: i_L starts at 0.2 A.
segments = [(0.0, 1.0, 5e-3), (10e-3, 0.2, 1e-3)]
for t_ms in (0, 5, 10, 11, 15):
i = transient(0.2, segments, t_ms * 1e-3)
print(f"t = {t_ms:2d} ms: i_L = {i:.3f} A")The output is 0.200, 0.706, 0.892, 0.454, and 0.205 A at the five times. The values at 10 ms and just after it agree, which confirms continuity.
Common mistakes
- Using t instead of t − t₀. The exponent restarts at each switching event. Forgetting the shift gives a wrong, often discontinuous, curve.
- Using the wrong initial value. The initial value of the second interval is the first interval's solution evaluated at t₀, not its final value. Using x(∞) is correct only if the circuit had about five time constants to settle.
- Reusing the old τ. Recompute the Thevenin resistance for the new switch position. A switch can add resistors, remove them, or disconnect the source.
- Mixing up t₀⁻ and t₀⁺ quantities. Find the state at t₀⁻, then solve the new circuit for everything else.
- Ignoring a floating element. If a switch leaves a capacitor connected to nothing, no current flows, no resistance is present, and the voltage stays constant. Check for a path before writing an exponential.
Break-before-make and make-before-break
A single-pole double-throw switch moves between two positions. A break-before-make switch briefly disconnects both. During that gap a capacitor holds its voltage, but an inductor has no path, which is the spike problem above. A make-before-break switch connects the new path before releasing the old one. For ideal analysis, treat the switch as moving instantly, and note which type a real circuit uses.
Checking your answer
Use these quick tests after solving.
- Continuity: evaluate both intervals at t₀. The capacitor voltage or inductor current must match.
- Direction: each interval should move toward its own final value without crossing it.
- Speed: a larger resistance with a capacitor, or a smaller resistance with an inductor, means a slower interval.
- Limits: at t = ∞ the answer should equal the DC solution of the last switch position.
Exercise
A capacitor C = 2 µF is at 6 V. At t = 0 a switch connects it to a 12 V source through R = 3 kΩ. Find v_C(t) and its value at t = 6 ms.
Show answer
Here vC(0⁺) = 6 V, vC(∞) = 12 V, and τ = RC = 3 kΩ × 2 µF = 6 ms. So vC(t) = 12 − 6 e^(−t/6 ms). At t = 6 ms (one time constant), vC = 12 − 6 e^(−1) = 12 − 2.207 ≈ 9.79 V.
Exercise
An inductor L = 10 mH carries 2 A in a loop with a 5 Ω resistor, driven by a source. At t = 0 a switch removes the source and leaves the inductor and resistor in a closed loop. Find i_L(t), and find its value at t = 4 ms.
Show answer
Here iL(0⁺) = 2 A (continuity), iL(∞) = 0 A, and τ = L/R = 10 mH/5 Ω = 2 ms. So iL(t) = 2 e^(−t/2 ms) A. At t = 4 ms (two time constants), iL = 2 e^(−2) ≈ 0.271 A.
Exercise
In worked example 1, the switch moves at t = 3 ms. Suppose it moved at t = 10 ms instead. Roughly what would v_C be just before it moves, and how would the second interval change?
Show answer
After 10 ms the capacitor has had 5 time constants (τ₁ = 2 ms), so vC ≈ 10(1 − e^(−5)) ≈ 9.93 V, essentially the full 10 V. The second interval keeps τ₂ = 1 ms but starts from about 9.93 V, so vC(t) ≈ 9.93 e^(−(t−10 ms)/1 ms).