Import
There are two ways to control electronic loads:Net API Methods
The Net-based API provides methods that can either get or set values. When called without a value parameter, methods read and return the current value. When called with a value, they set it.| Method | Description |
|---|---|
mode(mode_type) | Set or read operation mode (CC/CV/CR/CW) |
current(value) | Set or read constant current (A) |
voltage(value) | Set or read constant voltage (V) |
resistance(value) | Set or read constant resistance (ohms) |
power(value) | Set or read constant power (W) |
enable() | Enable electronic load input |
disable() | Disable electronic load input |
state() | Print comprehensive state |
measured_voltage() | Read measured voltage (returns float) |
measured_current() | Read measured current (returns float) |
measured_power() | Read measured power (returns float) |
Method Reference
Net.get(name, type=NetType.ELoad)
Get an electronic load net by name.
| Parameter | Type | Description |
|---|---|---|
name | str | Name of the electronic load net |
type | NetType | Must be NetType.ELoad |
mode(mode_type=None)
Set or read the operation mode.
| Parameter | Type | Description |
|---|---|---|
mode_type | str or None | ’CC’, ‘CV’, ‘CR’, or ‘CW’/‘CP’. If None, reads current mode. |
mode_type is None
current(value=None)
Set or read the constant current setting.
| Parameter | Type | Description |
|---|---|---|
value | float or None | Current in amps. If None, reads current setting. |
value is None
voltage(value=None)
Set or read the constant voltage setting.
resistance(value=None)
Set or read the constant resistance setting.
power(value=None)
Set or read the constant power setting.
enable() / disable()
Enable or disable the electronic load input.
state()
Print comprehensive electronic load state.
measured_voltage() / measured_current() / measured_power()
Read actual measured values (return floats, for use in code).
float - Measured value
Load Modes
| Mode | Code | Description |
|---|---|---|
| Constant Current | CC | Sinks a fixed current regardless of voltage |
| Constant Voltage | CV | Maintains a fixed voltage across the load |
| Constant Resistance | CR | Behaves as a fixed resistance |
| Constant Power | CW or CP | Dissipates a fixed power |
Examples
Constant Current Test
Battery Discharge Test
Power Efficiency Test
Supported Hardware
| Manufacturer | Model | Features |
|---|---|---|
| Rigol | DL3000 series | CC/CV/CR/CP modes |
Module-Level Functions
For simple scripts, you can use module-level functions that take net names directly:Constant Current Mode
Constant Voltage Mode
Constant Resistance Mode
Constant Power Mode
Module Functions Reference
| Function | Description |
|---|---|
set_constant_current(net_name, current) | Set CC mode with specified current (A) |
get_constant_current(net_name) | Get CC mode current setting |
set_constant_voltage(net_name, voltage) | Set CV mode with specified voltage (V) |
get_constant_voltage(net_name) | Get CV mode voltage setting |
set_constant_resistance(net_name, resistance) | Set CR mode with specified resistance (ohms) |
get_constant_resistance(net_name) | Get CR mode resistance setting |
set_constant_power(net_name, power) | Set CP mode with specified power (W) |
get_constant_power(net_name) | Get CP mode power setting |
Notes
- Use
mode()to set the operation mode before setting the corresponding value - Methods like
current(),voltage(),resistance(),power()can get or set values measured_voltage(),measured_current(),measured_power()return actual measurementsstate()prints state (for debugging), measurement methods return values (for code)- Always call
enable()to start sinking current - Always call
disable()when finished - Module-level functions are simpler for quick mode changes

