A power stage arrives with its loop still open. Write the bench that finds its closed-loop output impedance from return ratios. It must pass three stages and fail four.
Circuit context: A power stage for a sensor supply with its loop still open: a controlled source, a series resistor and a sense amplifier, with the control and the returned signal on pins. Write the bench that predicts a closed loop's output impedance before the loop can be closed.
A team buys power stages for a sensor supply. In the product, a controller closes each stage's loop by wiring its ret pin to its ctl pin. The controller is not ready, so no one can put a test source on the closed loop.
The subcircuit stage in the netlist below is one such stage. Inside it, a controlled source drives the output through a series resistor. The pin ctl is that source's control. The pin ret carries the signal the stage returns.
Your bench must decide whether the closed loop will meet the output impedance spec. It may drive ctl, read ret, and open, short or drive the out pin.
The grader swaps each design it tests into your stage block and runs your bench. This design and two hidden good designs must get pass = 1. Four hidden faulty designs must not. The stages sense their output in different ways.
What the Grader Measures
Your bench, with each of these designs swapped into stage; it must print pass = 1 on the good ones and not on the faulty ones.
| Requirement your bench checks | Limit |
|---|---|
| Closed-loop output impedance |Z_out| at 100 kHz (ret wired to ctl) | ≤ 100 Ω |
| Design | Your verdict must be |
|---|---|
| The power stage in your netlist (senses before a 75 Ω series resistor) | PASS |
| A stage that senses the output pin itself | PASS |
| A stage that senses before a 48 Ω resistor and carries a 2 kΩ load | PASS |
| 4 hidden faulty designs | FAIL |
Full specification
| Quantity | Limit | Where |
|---|---|---|
| Closed-loop output impedance |Zout| at the out pin | ≤ 100 Ω | at 100 kHz, with ret wired to ctl |
let pass = ... * 1 if the design meets the spec, 0 if not
print pass
The return ratio of the controlled source is T = −v(ret)/v(ctl). Measure it with ctl driven and no other source on.
The good designs are at least 5 % under the limit and the faulty ones at least 4.8 % over it. Your result must be that accurate.
A design for which your bench prints no verdict, or whose run stops with an error, counts as FAIL. The designs are linear models, so no model library is needed.
Examples
Example 1
The Stage in the Netlist- Setup
AC at 100 kHz, three connections of the stage
- Measured
|Z_0| = 9152.9 Ω T_short = 3.722 T_open = 454.6 |Z_out| = 94.87 Ω pass = 1
This stage senses the node before its 75 Ω resistor. The loop still works with the pin shorted, so T_short is not zero. Dividing Z_0 by 1 + T_open alone gives 20.1 Ω, which is far too low.
Example 2
A Stage That Senses Its Output Pin- Setup
the same bench
- Measured
|Z_0| = 6688.7 Ω T_short = 0 T_open = 71.52 |Z_out| = 92.23 Ω pass = 1
A short at the pin holds the sensed voltage at zero, so nothing returns. Here the simple rule Z_0/(1 + T) is the whole answer.
Example 3
A Stage with a Filter in Its Return Path- Setup
the same bench
- Measured
|Z_0| = 381.8 Ω T_open = 2.995 at −78.7° |1 + T_open| = 3.339 |Z_out| = 114.4 Ω pass = 0
The filter turns T by −78.7° at 100 kHz. Then |1 + T| is 3.339 and not 3.995. A bench that adds 1 to the magnitude of T reads 95.6 Ω and passes a faulty stage.
Constraints and Contract
- Keep exactly one .subckt stage ctl ret out ... .ends block. The grader replaces it with each design it tests, so changes inside it are not graded.
- The bench sees the design only through its three pins: no nodes or devices inside x instances, no show or altermod.
- You may place several copies of stage in one netlist.
- No copy may have its ret and ctl pins joined, by a wire or through any element. The loop stays open: such a bench is refused.
- Print the verdict as pass. Any value of at least 0.5 counts as PASS.
Hints
Hint 1
Blackman's formula needs three things at the out pin. Each one is a different connection of the same stage.
Hint 2
A stage does not say where it senses. Shorting the out pin stops some loops and leaves others working.
Hint 3
At 100 kHz a return ratio can lag. v(ret)/v(ctl) is a complex vector, and 1 + T must be added before any magnitude is taken.
Hint 4
meas reads a real vector. Build the complex result first, then take mag() of it.
What the grader checks: The grader runs your bench on this stage, two hidden good ones and four hidden faulty ones. It compares your printed verdict with the right one for each design. It grades the decisions, not the numbers you print. Engine: ngspice 42 (libngspice0 42+ds-3build1), measured 2026-11-12 with tools/spice-judge.mjs. The designs are linear models at one operating point; the bench does not test large signals, stability or other frequencies.
Run simulates your netlist as written, with your own analyses and measurements. Submit sends it to the grader, which keeps only your bench and makes 7 ngspice runs, one per design. The numbers come from ngspice and the SKY130 models the site pins; they prove the measured cases, not every condition a chip meets.
See all 1 steps and the final capstone