tti
TTI class for TTI MX100TP-style low voltage power supplies.
Classes
|
SCPIInstrument implementation for TTI MX180TP or similar low voltage power supply. |
TTI
- class icicle.tti.TTI(*args, **kwargs)
Bases:
SCPIInstrument
SCPIInstrument implementation for TTI MX180TP or similar low voltage power supply.
- __init__(resource='ASRL3::INSTR', outputs=3, sim=False)
- Parameters:
resource – VISA Resource address. See VISA docs for more info.
outputs – How many outputs this TTI power supply has.
- BAUD_RATE = 9600
- COM_RESET = '*RST; STATUS:PRESET; *CLS'
Instrument Reset SCPI command.
- MEASURE_COMMAND_MAP = {'CURR:DC': 'OUTPUT_CURRENT', 'VOLT:DC': 'OUTPUT_VOLTAGE'}
- MEASURE_TYPES = {'CURR:DC': 'Output DC Current (A)', 'VOLT:DC': 'Output DC Voltage (V)'}
- class MeasureChannel(instrument, channel, measure_type, unit='')
Bases:
MeasureChannel
MeasureChannel implementation for TTI.
- property status
- Returns:
Event Status Register value.
- Return type:
int
- property value
Performs measurement and returns value.
- Returns:
measured value.
- Return type:
float
- OUTPUTS = 3
- class PowerChannel(instrument, channel, measure_voltage, measure_current)
Bases:
PowerChannel
PowerChannel implementation for TTI.
- property current
- Returns:
currently set channel current.
- Return type:
float
- property current_limit
- Returns:
currently set channel current limit.
- Return type:
float
- property current_trip
- Returns:
whether current limit has been tripped on this channel.
- Return type:
bool
- reset_current_trip()
Attempts to reset current trip condition.
- Returns:
success/failure of operation.
- Return type:
bool
- reset_voltage_trip()
Attempts to reset voltage trip condition.
- Returns:
success/failure of operation.
- Return type:
bool
- property state
- Returns:
whether this power channel is on or off (True/False).
- Return type:
bool
- property status
- Returns:
Channel Status Register value.
- Return type:
int
- property voltage
- Returns:
currently set channel voltage.
- Return type:
float
- property voltage_limit
- Returns:
currently set channel voltage limit.
- Return type:
float
- property voltage_trip
- Returns:
whether voltage limit has been tripped on this channel.
- Return type:
bool
- SETTINGS = {'CHANNEL_STATUS_REGISTER': {'QUERY': 'LSR{}?', 'parser': <function numeric_int>, 'verifier': <function is_integer.<locals>._is_integer>}, 'CURRENT1': {'QUERY': 'I1?', 'SET': 'I1 {}', 'parser': <function strip_float.<locals>._strip_float>, 'unit': 'A', 'verifier': <function is_numeric.<locals>._is_numeric>}, 'CURRENT2': {'QUERY': 'I2?', 'SET': 'I2 {}', 'parser': <function strip_float.<locals>._strip_float>, 'unit': 'A', 'verifier': <function is_numeric.<locals>._is_numeric>}, 'CURRENT3': {'QUERY': 'I3?', 'SET': 'I3 {}', 'parser': <function strip_float.<locals>._strip_float>, 'unit': 'A', 'verifier': <function is_numeric.<locals>._is_numeric>}, 'CURRENT_STEP1': {'QUERY': 'DELTAI1?', 'SET': 'DELTAI1 {}', 'parser': <function strip_float.<locals>._strip_float>, 'unit': 'A', 'verifier': <function is_numeric.<locals>._is_numeric>}, 'CURRENT_STEP2': {'QUERY': 'DELTAI2?', 'SET': 'DELTAI2 {}', 'parser': <function strip_float.<locals>._strip_float>, 'unit': 'A', 'verifier': <function is_numeric.<locals>._is_numeric>}, 'CURRENT_STEP3': {'QUERY': 'DELTAI3?', 'SET': 'DELTAI3 {}', 'parser': <function strip_float.<locals>._strip_float>, 'unit': 'A', 'verifier': <function is_numeric.<locals>._is_numeric>}, 'DAMPING1': {'SET': 'DAMPING1 {}', 'verifier': <function is_in.<locals>._is_in>}, 'DAMPING2': {'SET': 'DAMPING2 {}', 'verifier': <function is_in.<locals>._is_in>}, 'DAMPING3': {'SET': 'DAMPING3 {}', 'verifier': <function is_in.<locals>._is_in>}, 'DECREMENT_CURRENT1': {'SET': 'DECI1'}, 'DECREMENT_CURRENT2': {'SET': 'DECI2'}, 'DECREMENT_CURRENT3': {'SET': 'DECI3'}, 'DECREMENT_VOLTAGE1': {'SET': 'DECV1'}, 'DECREMENT_VOLTAGE2': {'SET': 'DECV2'}, 'DECREMENT_VOLTAGE3': {'SET': 'DECV3'}, 'EVENT_STATUS_REGISTER': {'QUERY': '*ESR?', 'parser': <function numeric_int>}, 'IDENTIFIER': {'QUERY': '*IDN?'}, 'INCREMENT_CURRENT1': {'SET': 'INCI1'}, 'INCREMENT_CURRENT2': {'SET': 'INCI1'}, 'INCREMENT_CURRENT3': {'SET': 'INCI1'}, 'INCREMENT_VOLTAGE1': {'SET': 'INCV1'}, 'INCREMENT_VOLTAGE2': {'SET': 'INCV1'}, 'INCREMENT_VOLTAGE3': {'SET': 'INCV1'}, 'LOCAL': {'SET': 'LOCAL'}, 'OCP1': {'QUERY': 'OCP1?', 'SET': 'OCP1 {}', 'parser': <function float_or_strings.<locals>._float_or_strings>, 'unit': 'A', 'verifier': <function verifier_or.<locals>._verifier_or>}, 'OCP2': {'QUERY': 'OCP2?', 'SET': 'OCP2 {}', 'parser': <function float_or_strings.<locals>._float_or_strings>, 'unit': 'A', 'verifier': <function verifier_or.<locals>._verifier_or>}, 'OCP3': {'QUERY': 'OCP3?', 'SET': 'OCP3 {}', 'parser': <function float_or_strings.<locals>._float_or_strings>, 'unit': 'A', 'verifier': <function verifier_or.<locals>._verifier_or>}, 'OCP_TRIPPED1': {'QUERY': 'LSR1?', 'parser': <function bitfield_bool.<locals>._bitfield_bool>}, 'OCP_TRIPPED2': {'QUERY': 'LSR2?', 'parser': <function bitfield_bool.<locals>._bitfield_bool>}, 'OCP_TRIPPED3': {'QUERY': 'LSR3?', 'parser': <function bitfield_bool.<locals>._bitfield_bool>}, 'OUTPUT1': {'QUERY': 'OP1?', 'SET': 'OP1 {}', 'parser': <function numeric_bool>, 'verifier': <function truthy.<locals>._truthy>}, 'OUTPUT2': {'QUERY': 'OP2?', 'SET': 'OP2 {}', 'parser': <function numeric_bool>, 'verifier': <function truthy.<locals>._truthy>}, 'OUTPUT3': {'QUERY': 'OP3?', 'SET': 'OP3 {}', 'parser': <function numeric_bool>, 'verifier': <function truthy.<locals>._truthy>}, 'OUTPUTALL': {'SET': 'OPALL {}', 'verifier': <function truthy.<locals>._truthy>}, 'OUTPUT_CURRENT1': {'QUERY': 'I1O?', 'parser': <function strip_float.<locals>._strip_float>, 'unit': 'A'}, 'OUTPUT_CURRENT2': {'QUERY': 'I2O?', 'parser': <function strip_float.<locals>._strip_float>, 'unit': 'A'}, 'OUTPUT_CURRENT3': {'QUERY': 'I3O?', 'parser': <function strip_float.<locals>._strip_float>, 'unit': 'A'}, 'OUTPUT_VOLTAGE1': {'QUERY': 'V1O?', 'parser': <function strip_float.<locals>._strip_float>, 'unit': 'V'}, 'OUTPUT_VOLTAGE2': {'QUERY': 'V2O?', 'parser': <function strip_float.<locals>._strip_float>, 'unit': 'V'}, 'OUTPUT_VOLTAGE3': {'QUERY': 'V3O?', 'parser': <function strip_float.<locals>._strip_float>, 'unit': 'V'}, 'OVP1': {'QUERY': 'OVP1?', 'SET': 'OVP1 {}', 'parser': <function float_or_strings.<locals>._float_or_strings>, 'unit': 'V', 'verifier': <function verifier_or.<locals>._verifier_or>}, 'OVP2': {'QUERY': 'OVP2?', 'SET': 'OVP2 {}', 'parser': <function float_or_strings.<locals>._float_or_strings>, 'unit': 'V', 'verifier': <function verifier_or.<locals>._verifier_or>}, 'OVP3': {'QUERY': 'OVP3?', 'SET': 'OVP3 {}', 'parser': <function float_or_strings.<locals>._float_or_strings>, 'unit': 'V', 'verifier': <function verifier_or.<locals>._verifier_or>}, 'OVP_TRIPPED1': {'QUERY': 'LSR1?', 'parser': <function bitfield_bool.<locals>._bitfield_bool>}, 'OVP_TRIPPED2': {'QUERY': 'LSR2?', 'parser': <function bitfield_bool.<locals>._bitfield_bool>}, 'OVP_TRIPPED3': {'QUERY': 'LSR3?', 'parser': <function bitfield_bool.<locals>._bitfield_bool>}, 'STATUS_BYTE': {'QUERY': '*STB?', 'parser': <function numeric_int>}, 'SYSTEM_MODE': {'QUERY': 'IFLOCK?', 'SET': '{}', 'parser': <function int_map.<locals>.int_map_>, 'verifier': <function map_to.<locals>._is_in>}, 'TRIP_CLEAR1': {'QUERY': 'LSR1?'}, 'TRIP_CLEAR2': {'QUERY': 'LSR2?'}, 'TRIP_CLEAR3': {'QUERY': 'LSR3?'}, 'VOLTAGE1': {'QUERY': 'V1?', 'SET': 'V1 {}', 'parser': <function strip_float.<locals>._strip_float>, 'unit': 'V', 'verifier': <function is_numeric.<locals>._is_numeric>}, 'VOLTAGE2': {'QUERY': 'V2?', 'SET': 'V2 {}', 'parser': <function strip_float.<locals>._strip_float>, 'unit': 'V', 'verifier': <function is_numeric.<locals>._is_numeric>}, 'VOLTAGE3': {'QUERY': 'V3?', 'SET': 'V3 {}', 'parser': <function strip_float.<locals>._strip_float>, 'unit': 'V', 'verifier': <function is_numeric.<locals>._is_numeric>}, 'VOLTAGE_STEP1': {'QUERY': 'DELTAV1?', 'SET': 'DELTAV1 {}', 'parser': <function strip_float.<locals>._strip_float>, 'unit': 'V', 'verifier': <function is_numeric.<locals>._is_numeric>}, 'VOLTAGE_STEP2': {'QUERY': 'DELTAV2?', 'SET': 'DELTAV2 {}', 'parser': <function strip_float.<locals>._strip_float>, 'unit': 'V', 'verifier': <function is_numeric.<locals>._is_numeric>}, 'VOLTAGE_STEP3': {'QUERY': 'DELTAV3?', 'SET': 'DELTAV3 {}', 'parser': <function strip_float.<locals>._strip_float>, 'unit': 'V', 'verifier': <function is_numeric.<locals>._is_numeric>}, 'VRANGE1': {'QUERY': 'VRANGE1?', 'SET': 'VRANGE1 {}', 'parser': <function numeric_int>, 'verifier': <function is_in.<locals>._is_in>}, 'VRANGE2': {'QUERY': 'VRANGE2?', 'SET': 'VRANGE2 {}', 'parser': <function numeric_int>, 'verifier': <function is_in.<locals>._is_in>}, 'VRANGE3': {'QUERY': 'VRANGE3?', 'SET': 'VRANGE3 {}', 'parser': <function numeric_int>, 'verifier': <function is_in.<locals>._is_in>}}
Settings dictionary with all Set/Query SCPI combinations.
- SOURCE_TYPES = {'DC': 'DC Voltage (V)/Current (A)'}
- TIMEOUT = 10000
Serial link timeout (ms).
- measure(channel)
Measure output voltage, current.
- Parameters:
channel – output to be measured.
no_lock – override acquire_lock (e.g. if lock already taken by function that measure-call is nested within).
- Returns:
tuple (voltage, current).
- monitor_step(channel)
Helper function for monitoring/logging especially for dirigent.
- off(channel, **kwargs)
Turn off output.
- Parameters:
channel – output to be turned off.
no_lock – override acquire_lock (e.g. if lock already taken by function that off-call is nested within).
attempts – how many retries to give set command.
- Returns:
read-back value.
- on(channel)
Turn on output. For some reason needs an explicit check/retry loop since this sometimes fails?
- Parameters:
channel – output to be turned on.
no_lock – override acquire_lock (e.g. if lock already taken by function that on-call is nested within).
- Returns:
read-back value.
- property outputs
- Returns:
Iterator over all outputs (i.e. numbers 1, 2, …)
- publish(client, line, channel='ALL', topic=None)
Publish data line (from Monitoring) to MQTT.
TODO: don’t reparse line here; instead pass/access raw data?
- Parameters:
client – MQTTClient object to publish with.
line – MonitoringLogger line to publish.
channel – which channel the data has been measured for. May be ‘ALL’.
- query_channel(setting, channel, **kwargs)
Query setting on instrument for output channel.
- Parameters:
setting – key in class dictionary SETTINGS.
channel – output to set this setting on.
no_lock – override acquire_lock (e.g. if lock already taken by function that query_channel-call is nested within).
attempts – how many retries to give set command.
- Returns:
data returned by device for given query.
- set_channel(setting, channel, *value, **kwargs)
Set setting on instrument to value for output channel, and read-back using equivalent query().
- Parameters:
setting – key in class dictionary SETTINGS.
channel – channel to set this setting on.
value – target value for setting.
no_lock – override acquire_lock (e.g. if lock already taken by function that set_channel-call is nested within).
attempts – how many retries to give set command.
- Returns:
read-back value if query() available, else whether number of bytes written during set() meets expectation
- status(channel, **kwargs)
Check status of output.
- Parameters:
channel – output to be turned on.
no_lock – override acquire_lock (e.g. if lock already taken by function that status-call is nested within).
attempts – how many retries to give set command.
- Returns:
status of output.
- sweep(target_setting, channel, target_value, delay=1, step_size=None, n_steps=None, measure=False, set_function=None, set_args=None, measure_function=None, measure_args=None, query_args=None, log_function=None, power_cycle_each_step=False, **kwargs)
Sweep target_setting on a given channel.
- Parameters:
target_setting – name of setting that set() call should target.
channel – output to perform sweep on.
target_value – value of setting to sweep to (from current).
delay – delay between sweep steps (in seconds)
step_size – step size between sweep steps
n_steps – number of steps to perform (alternative to step_size - specify one but not both)
set_function – function to use for set() call. Defaults to self.set
set_args – additional keyword arguments to pass to set()
measure – whether to measure at each step of sweep.
measure_function – function to use for measure() call. Defaults to self.measure
measure_args – additional keyword arguments to pass to measure()
query_args – additional keyword arguments to pass to query() at each step.
power_cycle_each_step – set callback function to _power_cycle with correct arguments.
execute_each_step – accepts a callback function (no arguments) to be executed at each step of the sweep.
- Returns:
final parameter value[, measure data]
- sweep_print_header(measured_unit)
Returns the header for print-outs, when doing a sweep.
Helper function of instrument.sweep()
- Parameters:
measured_unit – Maybe required, as it is not necessarily the tti, that performs the measurement.
- validate_channel(channel, raise_exception=True)
Check if an output exists on this device.
- Parameters:
channel – Channel number to validate as an output.