hmp4040
HMP4040 class for Rhode&Schwarz/Hameg HMP4040 4-output power supply.
Classes
|
SCPIInstrument implementation for Rhode&Schwarz/Hameg HMP4040 4-output power supply. |
HMP4040
- class icicle.hmp4040.HMP4040(*args, **kwargs)
Bases:
SCPIInstrument
SCPIInstrument implementation for Rhode&Schwarz/Hameg HMP4040 4-output power supply.
Has some strange behaviours - take care to note difference between activating individual outputs and “turning on” all outputs.
- __init__(resource='ASRL2::INSTR', sim=False, outputs=4)
- Parameters:
resource – VISA Resource address. See VISA docs for more info.
outputs – How many outputs this HMPx0x0-style device has. Defaults to 4.
- 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 the HMP4040.
- property status
- Returns:
Event Status Register value.
- Return type:
int
- property value
Performs measurement and returns value.
- Returns:
measured value.
- Return type:
float
- OUTPUTS = 4
- class PowerChannel(instrument, channel, measure_voltage, measure_current)
Bases:
PowerChannel
PowerChannel implementation for the HMP4040.
- property current
- Returns:
currently set channel current.
- Return type:
float
- 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/Output 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
- REGISTERS = {'EVENT_STATUS_REGISTER': 'Event Status Register', 'INSTRUMENT_STATUS_REGISTER': 'Channel Summary Status Register', 'QUESTIONABLE_STATUS_REGISTER': 'Questionable Status Register', 'STATUS_BYTE': 'Status Byte'}
- SETTINGS = {'CHANNEL_STATUS_REGISTER': {'QUERY': 'STAT:QUES:INST:ISUM{}:EVEN?', 'parser': <function numeric_int>, 'verifier': <function is_in.<locals>._is_in>}, 'CHANNEL_STATUS_REGISTER_ENABLE': {'QUERY': 'STAT:QUES:INST:ISUM{}:ENAB?', 'SET': 'STAT:QUES:INST:ISUM{}:ENAB {}', 'parser': <function numeric_int>, 'verifier': (<function is_in.<locals>._is_in>, <function is_integer.<locals>._is_integer>)}, 'CURRENT': {'QUERY': 'SOUR:CURR:LEV?', 'SET': 'SOUR:CURR:LEV {:.2f}', 'parser': <function numeric_float>, 'unit': 'A', 'verifier': <function is_numeric.<locals>._is_numeric>}, 'EVENT_STATUS_REGISTER': {'QUERY': '*ESR?', 'parser': <function numeric_int>}, 'EVENT_STATUS_REGISTER_ENABLE': {'QUERY': '*ESE?', 'SET': '*ESE {}', 'parser': <function numeric_int>, 'verifier': <function is_integer.<locals>._is_integer>}, 'IDENTIFIER': {'QUERY': '*IDN?'}, 'INSTRUMENT': {'QUERY': 'INST:NSEL?', 'SET': 'INST:NSEL {:d}', 'parser': <function numeric_int>, 'verifier': <function is_integer.<locals>._is_integer>}, 'INSTRUMENT_STATUS_REGISTER': {'QUERY': 'STAT:QUES:INST:EVEN?', 'parser': <function numeric_int>}, 'INSTRUMENT_STATUS_REGISTER_ENABLE': {'QUERY': 'STAT:QUES:INST:ENAB?', 'SET': 'STAT:QUES:INST:ENAB {}', 'parser': <function numeric_int>, 'verifier': <function is_integer.<locals>._is_integer>}, 'OUTPUT': {'QUERY': 'OUTP:STAT?', 'SET': 'OUTP:STAT {:d}', 'parser': <function numeric_bool>, 'verifier': <function truthy.<locals>._truthy>}, 'OUTPUT_CURRENT': {'QUERY': 'MEAS:CURR:DC?', 'parser': <function numeric_float>, 'unit': 'A'}, 'OUTPUT_GENERAL': {'QUERY': 'OUTP:GEN?', 'SET': 'OUTP:GEN {:d}', 'parser': <function numeric_bool>, 'verifier': <function truthy.<locals>._truthy>}, 'OUTPUT_SELECT': {'QUERY': 'OUTP:SEL?', 'SET': 'OUTP:SEL {:d}', 'parser': <function numeric_bool>, 'verifier': <function truthy.<locals>._truthy>}, 'OUTPUT_VOLTAGE': {'QUERY': 'MEAS:VOLT:DC?', 'parser': <function numeric_float>, 'unit': 'V'}, 'OVP': {'QUERY': 'VOLT:PROT:LEV?', 'SET': 'VOLT:PROT:LEV {:.2f}', 'parser': <function numeric_float>, 'unit': 'V', 'verifier': <function verifier_or.<locals>._verifier_or>}, 'OVP_CLEAR': {'SET': 'VOLT:PROT:CLE'}, 'OVP_TRIPPED': {'QUERY': 'VOLT:PROT:TRIP?', 'parser': <function numeric_bool>}, 'QUESTIONABLE_STATUS_REGISTER': {'QUERY': 'STAT:QUES:EVEN?', 'parser': <function numeric_int>}, 'QUESTIONABLE_STATUS_REGISTER_ENABLE': {'QUERY': 'STAT:QUES:ENAB?', 'SET': 'STAT:QUES:ENAB {}', 'parser': <function numeric_int>, 'verifier': <function is_integer.<locals>._is_integer>}, 'STATUS_BYTE': {'QUERY': '*STB?', 'parser': <function numeric_int>}, 'STATUS_BYTE_ENABLE': {'QUERY': '*SRE?', 'parser': <function numeric_int>}, 'SYSTEM_MODE': {'SET': ':SYST:{}', 'verifier': <function is_in.<locals>._is_in>}, 'VOLTAGE': {'QUERY': 'SOUR:VOLT:LEV?', 'SET': 'SOUR:VOLT:LEV {:.2f}', 'parser': <function numeric_float>, 'unit': 'V', 'verifier': <function is_numeric.<locals>._is_numeric>}}
Settings dictionary with all Set/Query SCPI combinations.
- SOURCE_REGISTERS = {'CHANNEL_STATUS_REGISTER': 'Channel Status Register'}
- SOURCE_TYPES = {'DC': 'DC Voltage (V)/Current (A)'}
- TIMEOUT = 10000
Ethernet link timeout.
- 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, **kwargs)
Turn on output.
- 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).
attempts – how many retries to give set command.
- Returns:
read-back value.
- 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)
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_print_header(measured_unit)
Returns the header for print-outs, when doing a sweep.
Helper function of instrument.sweep() @param: 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.