Import
Methods
The Net-based API provides methods that can either get or set values. When called without a value parameter, methods read and print the current value. When called with a value, they set it.| Method | Description |
|---|---|
mode(mode_type) | Set or read simulation mode (‘static’ or ‘dynamic’) |
set_mode_battery() | Initialize battery simulation mode |
soc(value) | Set or read state of charge (0-100%) |
voc(value) | Set or read open-circuit voltage |
voltage_full(value) | Set or read full charge voltage |
voltage_empty(value) | Set or read empty battery voltage |
capacity(value) | Set or read battery capacity (Ah) |
current_limit(value) | Set or read current limit (A) |
ovp(value) | Set or read over-voltage protection threshold |
ocp(value) | Set or read over-current protection threshold |
model(partnumber) | Set or read battery model |
enable() | Enable battery simulation output |
disable() | Disable battery simulation output |
clear_ovp() | Clear over-voltage protection fault |
clear_ocp() | Clear over-current protection fault |
print_state() | Print comprehensive battery state |
terminal_voltage() | Read terminal voltage (returns float) |
current() | Read current (returns float) |
esr() | Read ESR (returns float) |
Method Reference
Net.get(name, type=NetType.Battery)
Get a battery simulation net by name.
| Parameter | Type | Description |
|---|---|---|
name | str | Name of the battery net |
type | NetType | Must be NetType.Battery |
set_mode_battery()
Initialize the instrument for battery simulation mode.
mode(mode_type=None)
Set or read the battery simulation mode.
| Parameter | Type | Description |
|---|---|---|
mode_type | str or None | ’static’ or ‘dynamic’. If None, reads current mode. |
soc(value=None)
Set or read the state of charge.
| Parameter | Type | Description |
|---|---|---|
value | float or None | State of charge (0-100). If None, reads current value. |
voc(value=None)
Set or read the open-circuit voltage.
| Parameter | Type | Description |
|---|---|---|
value | float or None | Voltage in volts. If None, reads current value. |
voltage_full(value=None) / voltage_empty(value=None)
Set or read the full/empty battery voltages.
capacity(value=None)
Set or read the battery capacity.
current_limit(value=None)
Set or read the maximum charge/discharge current.
ovp(value=None) / ocp(value=None)
Set or read protection thresholds.
model(partnumber=None)
Set or read the battery model.
| Model Alias | Slot | Availability |
|---|---|---|
'discharge' | 0 | Always available (basic constant-voltage simulation) |
'18650', 'liion' | 1 | Requires pre-saved model |
'nimh' | 2 | Requires pre-saved model |
'nicd' | 3 | Requires pre-saved model |
'lead-acid' | 4 | Requires pre-saved model |
'discharge' for basic battery simulation that works on all instruments.
enable() / disable()
Enable or disable battery simulation output.
clear_ovp() / clear_ocp()
Clear protection faults.
print_state()
Print comprehensive battery simulator state.
terminal_voltage() / current() / esr()
Read measurements (return values, don’t print).
float - Measurement value
Examples
Basic Battery Simulation
Simulate Battery Discharge
With Protection Monitoring
Supported Hardware
| Manufacturer | Model | Features |
|---|---|---|
| Keithley | 2281S | Battery simulation, dynamic modeling |
Notes
- Call
set_mode_battery()before using other battery methods - Methods like
soc(),voc(), etc. can get or set values depending on whether a value is passed - Use
mode('static')for fixed parameters,mode('dynamic')for evolving behavior - Always call
disable()when finished terminal_voltage(),current(), andesr()return values (for use in code)state()prints values (for debugging)- Protection thresholds help prevent damage to your DUT

