spikesafe-python API Overview | Compensation | Compensation.get_optimum_compensation(spikesafe_model_max_current_amps, set_current_amps, pulse_on_time_seconds=None, enable_logging=False)
Compensation.get_optimum_compensation(spikesafe_model_max_current_amps, set_current_amps, pulse_on_time_seconds=None, enable_logging=False)
Returns the optimum compensation for a given set current, and optionally a given pulse on time.
spikesafe_model_max_current_amps float
Maximum current of the SpikeSafe model
set_current_amps float
Current to be set on SpikeSafe
pulse_on_time_seconds float optional
Pulse On Time to be set on SpikeSafe
enable_logging bool optional
Enables logging (default is False)
LoadImpedance LoadImpedance
Load Impedance compensation value. This should be an instance of the LoadImpedance IntEnum from SpikeSafeEnums
RiseTime RiseTime
Rise Time compensation value. This should be an instance of the RiseTime IntEnum from SpikeSafeEnums
ValueError
If set_current_amps is greater than spikesafe_model_max_current_amps
This function assumes the set current is operating on the optimized current range. If operating on the high range with a set current normally programmed on the low range, the compensation values will not be optimal. See online specifications.
- Source Measure Unit Precision Pulsed Current Performance Series Specifications
- High Current Performance Series Precision Pulsed Current Source Measure Unit Specifications
- SpikeSafe™ Performance Series Precision Pulsed Current Source Specifications
If Load Impedance is returned as Medium or High, it is best practice to increase the Compliance Voltage setting by 5V to 30V. This helps the current amplifier to overcome inductance. If Compliance Voltage is not increased, then a Low Side Over Current or an Unstable Waveform error may occur.
If an Operating Mode is used to sweep through steps of currents where the compensation settings are the same across the sweep, such as Pulse Sweep or Multiple Pulse Burst, it is recommended use the optimum compensation settings targeting the Stop Current.
The following example demonstrates the spikesafe_python.Compensation.get_optimum_compensation() function. It determines the optimum compensation settings to use based off the SpikeSafe's set current setting, maximum settable current, and pulse on time.
# set Channel 1's Pulse On Time to 1ms and check for all events
pulse_on_time: float = 0.001
tcp_socket.send_scpi_command(f'SOUR1:PULS:TON {spikesafe_python.Precision.get_precise_time_command_argument(pulse_on_time)}')
spikesafe_python.ReadAllEvents.log_all_events(tcp_socket)
# set Channel 1's current to 100 mA and check for all events
set_current: float = 0.1
tcp_socket.send_scpi_command(f'SOUR1:CURR {spikesafe_python.Precision.get_precise_current_command_argument(set_current)}')
spikesafe_python.ReadAllEvents.log_all_events(tcp_socket)
# set Channel 1's compensation settings to their default values and check for all events
# For higher power loads or shorter pulses, these settings may have to be adjusted to obtain ideal pulse shape
tcp_socket.send_scpi_command('SOUR1:CURR? MAX')
spikesafe_model_max_current = float(tcp_socket.read_data())
load_impedance, rise_time = spikesafe_python.Compensation.get_optimum_compensation(spikesafe_model_max_current, set_current, pulse_on_time)
tcp_socket.send_scpi_command(f'SOUR1:PULS:CCOM {load_impedance}')
spikesafe_python.ReadAllEvents.log_all_events(tcp_socket)
tcp_socket.send_scpi_command(f'SOUR1:PULS:RCOM {rise_time}')
spikesafe_python.ReadAllEvents.log_all_events(tcp_socket)
/run_spikesafe_operating_modes/run_pulsed/RunPulsedMode.py
/making_integrated_voltage_measurements/measure_voltage_across_pulse/MeasureVoltageAcrossPulse.py