Set voltage and current, arm protection trips, and read a supply’s complete state in
one instrument transaction.
Handle
Methods
Types
SupplyState
Every field is Option because the box returns a full-shaped record even when an
individual read fails, and because not every supply reports every quantity.
Method Reference
set_voltage(volts: f64) -> Result<()>
Set the output voltage setpoint.
A value above the instrument’s hardware limit is refused by the box before it
reaches the instrument, as Error::Box with a message naming the limit —
Voltage 999.0V exceeds hardware limit 60.0V.
set_current(amps: f64) -> Result<()>
Set the current limit. Reaching it is what moves a supply from CV into CC mode.
enable() -> Result<()> and disable() -> Result<()>
Turn the output on or off.
Call disable() in teardown. A supply left enabled stays enabled after your test
process exits, and the next test starts with the DUT already powered.
set_ovp(volts: f64) -> Result<()> and set_ocp(amps: f64) -> Result<()>
Set and enable the protection trip. These are not just threshold writes.
clear_ovp() -> Result<()> and clear_ocp() -> Result<()>
Clear a trip that has fired. Until cleared, the output stays down.
state() -> Result<SupplyState>
Read everything in one instrument transaction.
There are no individual getters. state() is the read path, and gathering
everything at once means the fields describe one moment rather than several.
Examples
Power up, verify, tear down
Assert the DUT stays inside its current budget
Supported Hardware
Notes
- A measurement can be
None while the output is off. A Keithley 2281S reports
voltage, current and power as None with the output disabled and real
numbers once enabled; a Rigol DP821 reports zeros in both states. This is why the
fields are Option — treat None as “not measured”, not as zero.
state() returning Ok does not mean the instrument answered. When the box
cannot reach the hardware service, you get a fully-shaped SupplyState with every
measurement None and error set to a string explaining why. Check error before
trusting a field.
- Safety limits cap setpoints, not trips. With a
max_voltage ceiling configured
on the net, set_voltage() above it is refused, but set_ovp() above it is
accepted and applied. See Client and Box.
- Supply and battery nets can point at the same physical instrument. The box
serializes them under one per-instrument lock, so they cannot interleave, but they
do share the instrument’s mode.