Import
There are two ways to control power supplies:Methods
| Method | Description |
|---|---|
set_voltage() | Set output voltage |
set_current() | Set output current limit |
voltage() | Read measured voltage |
current() | Read measured current |
power() | Read measured power |
enable() | Enable power output |
disable() | Disable power output |
set_ovp() | Set over-voltage protection threshold |
set_ocp() | Set over-current protection threshold |
get_ovp_limit() | Get over-voltage protection limit |
get_ocp_limit() | Get over-current protection limit |
is_ovp() | Check if OVP fault is active |
is_ocp() | Check if OCP fault is active |
clear_ovp() | Clear over-voltage protection fault |
clear_ocp() | Clear over-current protection fault |
Method Reference
Net.get(name, type=NetType.PowerSupply)
Get a power supply net by name.
| Parameter | Type | Description |
|---|---|---|
name | str | Name of the power supply net |
type | NetType | Must be NetType.PowerSupply |
set_voltage(value)
Set the output voltage.
| Parameter | Type | Description |
|---|---|---|
value | float | Target voltage in volts |
set_current(value)
Set the output current limit.
| Parameter | Type | Description |
|---|---|---|
value | float | Current limit in amps |
voltage()
Read the measured output voltage.
float - Measured voltage in volts
current()
Read the measured output current.
float - Measured current in amps
power()
Read the measured output power.
float - Measured power in watts
enable()
Enable the power output.
disable()
Disable the power output.
set_ovp(limit)
Set over-voltage protection threshold.
| Parameter | Type | Description |
|---|---|---|
limit | float | OVP threshold in volts |
set_ocp(limit)
Set over-current protection threshold.
| Parameter | Type | Description |
|---|---|---|
limit | float | OCP threshold in amps |
get_ovp_limit()
Get the configured OVP limit.
float - OVP threshold in volts
get_ocp_limit()
Get the configured OCP limit.
float - OCP threshold in amps
is_ovp()
Check if an over-voltage fault is active.
bool - True if OVP fault is active
is_ocp()
Check if an over-current fault is active.
bool - True if OCP fault is active
clear_ovp()
Clear over-voltage protection fault.
clear_ocp()
Clear over-current protection fault.
Examples
Basic Power Control
With Protection Thresholds
Monitor Power Consumption
Supported Hardware
| Manufacturer | Model Series | Features |
|---|---|---|
| Rigol | DP800 series | Multi-channel, OVP/OCP |
| Keithley | 2200/2280 series | High precision |
| Keysight | E36200 series | Multi-channel |
| Keysight | E36300 series | Multi-channel, high power |
| EA | PSI series | Two-quadrant operation |
Module-Level Functions
For simple scripts, you can use module-level functions that take net names directly:voltage(net_name, value=None, ocp=None, ovp=None)
Set or read voltage for a power supply net.
| Parameter | Type | Description |
|---|---|---|
net_name | str | Name of the power supply net |
value | float | Voltage to set (V). If None, reads and prints current voltage |
ocp | float | Optional over-current protection limit (A) |
ovp | float | Optional over-voltage protection limit (V) |
current(net_name, value=None, ocp=None, ovp=None)
Set or read current limit for a power supply net.
| Parameter | Type | Description |
|---|---|---|
net_name | str | Name of the power supply net |
value | float | Current limit to set (A). If None, reads and prints current |
ocp | float | Optional over-current protection limit (A) |
ovp | float | Optional over-voltage protection limit (V) |
enable(net_name) / disable(net_name)
Enable or disable a power supply net.
state(net_name)
Print comprehensive state for a power supply net.
set_mode(net_name)
Set the instrument mode to DC power supply (for multi-function instruments).
clear_ocp(net_name) / clear_ovp(net_name)
Clear over-current or over-voltage protection faults.
Module Functions vs Net API
voltage(), current(), power()) and protection status queries (is_ocp(), is_ovp()).
Notes
- Net must be configured as
NetType.PowerSupply - Call
enable()to turn on the output after setting voltage/current - Always call
disable()when finished - Protection faults may automatically disable output
- Use
clear_ovp()orclear_ocp()after addressing fault conditions - Voltage and current limits depend on hardware capabilities
- Module-level functions are simpler but provide less functionality than the Net API

