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 can clamp
the value to its supported range. It prints a warning when the applied value
differs from the requested value.
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, the call raises an error. The error tells you to use
'discharge', or to save a model first from the instrument front panel or with
define_model() below. Use 'discharge' for basic battery simulation that works
on all instruments.
model_catalog()
List the battery models available on the instrument. Returns a list covering the
numbered memory slots plus any firmware built-in models. Read-only — assembling the
catalog does not change instrument state.
read_model(slot)
Read a saved model’s curve points out of a memory slot. Returns a dict. Read-only —
exporting a model does not change which model is active.
model_catalog().
define_model(slot, voc, resistance)
Write a custom battery model into a memory slot, creating or overwriting it. A model is
two curves indexed by state of charge: voc (non-decreasing) and resistance.
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

