|
| 1 | +# [spikesafe-python API Overview](/spikesafe_python_lib_docs/README.md) | [Compensation](/spikesafe_python_lib_docs/Compensation/README.md) | get_custom_compensation(spikesafe_model_max_current_amps, set_current_amps, device_type, custom_compensation_table, pulse_on_time_seconds=None) |
| 2 | + |
| 3 | +## get_custom_compensation(spikesafe_model_max_current_amps, set_current_amps, device_type, custom_compensation_table, pulse_on_time_seconds=None) |
| 4 | + |
| 5 | +### Definition |
| 6 | +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. |
| 7 | + |
| 8 | +### Parameters |
| 9 | +spikesafe_model_max_current_amps [float](https://docs.python.org/3/library/functions.html#float) |
| 10 | +Maximum current of the SpikeSafe model |
| 11 | + |
| 12 | +set_current_amps [float](https://docs.python.org/3/library/functions.html#float) |
| 13 | +Current to be set on SpikeSafe |
| 14 | + |
| 15 | +device_type [string](https://docs.python.org/3/library/string.html) |
| 16 | +Device type of the DUT |
| 17 | + |
| 18 | +custom_compensation_table [list([])](https://docs.python.org/3/library/stdtypes.html#list) |
| 19 | +Custom compensation table to be used for compensation. This should be the result of calling the [load_custom_compensation_table(file_path)](/spikesafe_python_lib_docs/Compensation/load_custom_compensation_table/README.md) function conforming to the [custom_compensation_table_schema](/spikesafe_python_lib_docs/Compensation/custom_compensation_table_schema/README.md) |
| 20 | + |
| 21 | +pulse_on_time_seconds [float](https://docs.python.org/3/library/functions.html#float) [optional](https://docs.python.org/3/library/typing.html#typing.Optional) |
| 22 | +Pulse On Time to be set on SpikeSafe |
| 23 | + |
| 24 | +### Returns |
| 25 | +LoadImpedance [LoadImpedance](/spikesafe_python_lib_docs/SpikeSafeEnums/LoadImpedance/README.md) |
| 26 | +Load Impedance compensation value. This should be an instance of the LoadImpedance [IntEnum](https://docs.python.org/3/library/enum.html#enum.IntEnum) from SpikeSafeEnums |
| 27 | + |
| 28 | +RiseTime [RiseTime](/spikesafe_python_lib_docs/SpikeSafeEnums/RiseTime/README.md) |
| 29 | +Rise Time compensation value. This should be an instance of the RiseTime [IntEnum](https://docs.python.org/3/library/enum.html#enum.IntEnum) from SpikeSafeEnums |
| 30 | + |
| 31 | +### Raises |
| 32 | +[ValueError](https://docs.python.org/3/library/exceptions.html#ValueError) |
| 33 | +If set_current_amps is greater than spikesafe_model_max_current_amps |
| 34 | + |
| 35 | +### Remarks |
| 36 | +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. |
| 37 | +- [Source Measure Unit Precision Pulsed Current Performance Series Specifications](https://www.vektrex.com/downloads/vektrex-spikesafe-smu-specifications.pdf) |
| 38 | +- [High Current Performance Series Precision Pulsed Current Source Measure Unit Specifications](https://www.vektrex.com/downloads/High-Current-SpikeSafe-Performance-Series-Precision-Pulsed-Source-Measure-Unit-Specifications.pdf) |
| 39 | +- [SpikeSafe™ Performance Series Precision Pulsed Current Source Specifications](https://www.vektrex.com/downloads/vektrex-spikesafe-performance-series-precision-pulsed-current-source-specifications.pdf) |
| 40 | + |
| 41 | +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. |
| 42 | + |
| 43 | +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. |
| 44 | + |
| 45 | +### Examples |
| 46 | +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. |
| 47 | +``` |
| 48 | +# set Channel 1's Pulse On Time to 1ms and check for all events |
| 49 | +pulse_on_time = 0.001 |
| 50 | +tcp_socket.send_scpi_command(f'SOUR1:PULS:TON {get_precise_time_command_argument(pulse_on_time)}') |
| 51 | +log_all_events(tcp_socket) |
| 52 | +
|
| 53 | +# set Channel 1's current to 100 mA and check for all events |
| 54 | +set_current = 0.1 |
| 55 | +tcp_socket.send_scpi_command(f'SOUR1:CURR {get_precise_current_command_argument(set_current)}') |
| 56 | +log_all_events(tcp_socket) |
| 57 | +
|
| 58 | +# set Channel 1's compensation settings to their default values and check for all events |
| 59 | +# For higher power loads or shorter pulses, these settings may have to be adjusted to obtain ideal pulse shape |
| 60 | +tcp_socket.send_scpi_command('SOUR1:CURR? MAX') |
| 61 | +spikesafe_model_max_current = float(tcp_socket.read_data()) |
| 62 | +
|
| 63 | +# load custom_compensation_table from /test_compensation_files/valid.json |
| 64 | +custom_compensation_table = load_custom_compensation_table(os.path.join(os.path.dirname(__file__), 'test_compensation_files', 'valid.json') |
| 65 | +device_types = load_custom_compensation_unique_device_types(custom_compensation_table) |
| 66 | +load_impedance, rise_time = get_custom_compensation(spikesafe_model_max_current, set_current, device_types[0], pulse_on_time) |
| 67 | +tcp_socket.send_scpi_command(f'SOUR1:PULS:CCOM {load_impedance}') |
| 68 | +log_all_events(tcp_socket) |
| 69 | +tcp_socket.send_scpi_command(f'SOUR1:PULS:RCOM {rise_time}') |
| 70 | +log_all_events(tcp_socket) |
| 71 | +``` |
| 72 | + |
| 73 | +### Examples In Action |
0 commit comments