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 Reference
Net.get(name, type=NetType.Battery)
Get a battery simulation net by name.
Returns: Battery simulation Net instance
set_mode_battery()
Initialize the instrument for battery simulation mode.
mode(mode_type=None)
Set or read the battery simulation mode.
soc(value=None)
Set or read the state of charge.
voc(value=None)
Set or read the open-circuit voltage.
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. Must be greater than 0. The instrument may clamp the value to its supported range and will print a warning if the applied value differs.
current_limit(value=None)
Set or read the maximum charge/discharge current. Range: 0.001 A to 6.0 A (Keithley 2281S).
ovp(value=None) / ocp(value=None)
Set or read protection thresholds.
model(partnumber=None)
Set or read the battery model.
Note: If a slot is empty, you’ll get an error suggesting to use ‘discharge’ or save a model via the instrument front panel. Use
'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
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 soc()values are rounded to the nearest integer before being sent to the instrument- 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)print_state()prints values (for debugging)- Protection thresholds help prevent damage to your DUT
- Keithley 2281S limits: 0-20 V output, 0.001-6.0 A current, capacity must be > 0
- OVP range: 0-60 V; OCP range: 0.001-6.0 A

