Skip to Content

← All functionalities

Fuse test benchRaspberry PLC 19RSCPII2CControl

Calibrating test current in a closed loop

Closed-loop current calibration is what separates a certified test from a guess: the power supply reports one current, but the standard cares about the current actually flowing through the device under test. This example reads the real current from a 60 mOhm shunt every 50 ms and nudges the SCPI setpoint in ±0.1 A steps until measurement and target converge, with a 5 s timeout. It is the routine that opens every run in a real fuse test bench deployment.

Why the supply's own reading is not enough

Cable resistance, connector aging and the supply's internal calibration all shift the delivered current away from the setpoint. At 220 A even a 1% error is 2.2 A — enough to invalidate a non-fusing test. Measuring at the shunt, right next to the fuse, removes every upstream error source from the equation.

A deliberately simple control law

No PID here: fixed ±0.1 A steps inside a 0.15 A dead band. With a stable supply and a 50 ms loop this converges in well under a second, cannot oscillate, and is trivial to certify. The 5 s timeout flags a stuck loop — usually a blown fuse or an open circuit — instead of hunting forever.

Where it fits in the test sequence

Calibration runs once at the start of each test, with the fuse already in its holder. The converged setpoint is then frozen for the whole PD, non-fusing or fusing sequence, and the report logs both the setpoint and the measured current so the traceability chain stays intact.

A snippet from the implementation

Straight from the example as deployed on the Raspberry PLC 19R — copy it freely:

def calibrate(supply, target_a):
    """Trim the setpoint until the shunt current matches the target.

    Returns (final_setpoint, measured_current, converged).
    """
    setpoint = target_a   # first approximation: setpoint = target
    supply.set_current(setpoint)
    t0 = time.time()

    while time.time() - t0 < TIMEOUT_S:
        measured = read_shunt_current()
        error = target_a - measured

        if abs(error) <= TOLERANCE_A:
            return setpoint, measured, True  # converged

        # Fixed 0.1 A correction steps in the direction of the error
        setpoint += STEP_A if error > 0 else -STEP_A
        setpoint = max(0.0, min(setpoint, 220.0))  # XG limits
        supply.set_current(setpoint)
        time.sleep(PERIOD_S)

    return setpoint, read_shunt_current(), False  # timed out without converging

The full example is a complete program — wiring header, setup and main loop — ready to adapt to your application.

Frequently asked questions

Why not use a PID controller?

Because the plant is almost static. The supply holds its output rock-steady, so a fixed-step corrector with a dead band converges fast and can never overshoot or oscillate, which matters more than speed in a certification bench.

What if the loop never converges?

The 5 s timeout returns a not-converged flag. The bench treats it as an abort condition, typically meaning the sample blew during ramp-up, a connection is open, or the supply hit its compliance limit.

How accurate is the shunt measurement chain?

A class 0.5 60 mOhm shunt read differentially by an ADS1015 at gain 16 resolves better than 0.1 A. A final 1.02 correction factor, obtained against a reference meter, absorbs the residual chain error.

Related functionalities