Skip to content

Latest commit

 

History

History
76 lines (57 loc) · 5.75 KB

File metadata and controls

76 lines (57 loc) · 5.75 KB

spikesafe-python API Overview | Compensation | Compensation.get_custom_compensation(spikesafe_model_max_current_amps, set_current_amps, device_type, custom_compensation_table, pulse_on_time_seconds=None, enable_logging=False)

Compensation.get_custom_compensation(spikesafe_model_max_current_amps, set_current_amps, device_type, custom_compensation_table, pulse_on_time_seconds=None, enable_logging=False)

Definition

Returns the custom compensation values for a given set_current_amps and device_type based on a custom_compensation_table, and optionally a given pulse on time.

Parameters

spikesafe_model_max_current_amps float
Maximum current of the SpikeSafe model

set_current_amps float
Current to be set on SpikeSafe

device_type string
Device type of the DUT

custom_compensation_table list([])
Custom compensation table to be used for compensation. This should be the result of calling the load_custom_compensation_table(file_path) function conforming to the custom_compensation_table_schema

pulse_on_time_seconds float optional
Pulse On Time to be set on SpikeSafe

enable_logging bool optional
Enables logging (default is False)

Returns

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

Raises

ValueError
If set_current_amps is greater than spikesafe_model_max_current_amps

Remarks

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.

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 custom compensation settings targeting the Stop Current.

Examples

The following example demonstrates the get_custom_compensation() function. It determines the custom 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 custom_compensation_table from /test_compensation_files/valid.json
custom_compensation_table = spikesafe_python.Compensation.load_custom_compensation_table(os.path.join(os.path.dirname(__file__), 'test_compensation_files', 'valid.json')
device_types = spikesafe_python.Compensation.load_custom_compensation_unique_device_types(custom_compensation_table)
load_impedance, rise_time = spikesafe_python.Compensation.get_custom_compensation(spikesafe_model_max_current, set_current, device_types[0], 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) 

Examples In Action