pylab_ml.smu.rohde_schwarz.hmp4040.HMP4040
- class HMP4040(addr=None, interface=None, backend=None, identify=True, instName=None)[source]
Bases:
Rohde_SchwarzInterface to the Power-Measurement-Unit (SMU) HMP4040.
The HMP4040 can source and sink power in all four voltage/current quadrants and measure voltage and current precisely.
- Initialization arguments:
- Example: Initialization
>>> vdd = HMP4040(addr=24) # GPIB or USB address # Validate displayed message Id on device >>> vdd.init() # Connect and initialize instrument
- Example: Voltage source
>>> vdd.i_clamp = 0.01 # Current protection >>> vdd.voltage = 3.3 # Set output voltage >>> i = vdd.current # Measure (supply) current
- Example: Current source
>>> vdd.v_clamp = 5 # Voltage protection >>> vdd.current = 0.1 # Set output current_range >>> v = vdd.voltage # Measure voltage
- init()
connect and initialize
- local()
switch back to instrument control
- clear()
clear
- reset()
reset
- identify()
instrument message, reflect address & interface
- message("")
instrument message (“string”) or ()
- error_list()
list of instrument errors
- stair_sweep(start, stop, dstep, stime=0, typ='VIvirts-', stair='Lin', nplc=0.1, wait=False)[source]
sweep V or I, measure v,i,r at time t with state s, change by dstep, steptime stime, wait for response if dstep is None then stime is slopetime (>1ms) & nplc is min : 0.01
- get_values(typ='virts')[source]
get response of previous stair_sweep(), choosing result rows from previous request typ
- close()
terminate interface
- com_recover(bool)
detect & attempt to recover out of step communication (maybe after timeout)
- inst.write('*RST')
write direct to instrument
- ask=inst.query('
READ?’) write and read the answer
- Properties:
- voltage
get/set voltage
- current
get/set current
- measure
get voltage,current,resistance, set “vir” to get
- stair_step
set incremental ramp to target or (target,dstep) or (target,dstep,stime)
- stair_slope
set incremental ramp to target or (target,slopetime)
- nplc
set conversion accuracy (number of powerline cycles), [10.0 - 0.1 - 0.01]
- i_clamp
set current clamping and current measurement range
- v_clamp
set voltage clamping and voltage measurement range
- i_range
set current measurement range (and voltage clamping)
- v_range
set voltage measurement range (and current clamping)
- I_range
set current drive range
- V_range
set voltage drive range
- i_autorange
set current measurement autorange
- v_autorange
set voltage measurement autorange
- I_autorange
set current drive autorange
- V_autorange
set voltage drive autorange
- v_protection
set voltage protection limit
- onoff
get/set on state (True)
- id
get IDN string
- __init__(addr=None, interface=None, backend=None, identify=True, instName=None)[source]
Initialize the Rohde & Schwarz HMP4040 SMU.
- Parameters:
(int) (addr) – GPIB or USB address of the instrument.
(Interface) (interface) – Interface type (USB, GPIB, etc.).
(str) (instName) – Backend to use for communication.
(bool) (identify) – If True, identify the instrument during initialization.
(str) – Optional instrument name.
Methods
__init__([addr, interface, backend, ...])Initialize the Rohde & Schwarz HMP4040 SMU.
channel([ch])Set channel A, B, C & D.
clear()Clear error status.
close([force])Close connection to instrument.
com_recover([fix])Can lose coherency between read request and data, usually because of Timeout.
List of outstanding errors.
find_names() returns list of identifiers strings, lhs of = assignments
get_values([typ])Transfer last requested measurement sweep results.
help()Print the docstring of the instrument class.
identify([showInstName])Identify message.
init([identify])Connect to Keithley instrument and initialize.
local()Switch back to local instrument control.
message([message])Message display.
mfilter(input)mqtt_add(client, instrument[, liste, qos])Add the instrument to mqtt.
Remove the instrument from mqtt.
off()Switch output off.
on()Switch output on.
publish(topic, value)Publish topic as type='cmd' with payload=value.
publish_get(function_name, value)Publish function_name as type='get' with paylad=value.
publish_set(function_name, value)Publish function_name as type='set' with paylad=value.
" Query the output on/off state.
Query the output function, return 'DC_VOLTAGE', 'DC_CURRENT' or 'RESISTANCE' depending on the source function, or the source function name if it is not voltage or current.
reset()Reset and switch beep off.
Set the Setup instrument settings.
stair_sweep(start, stop, dstep[, stime, ...])Make a stair sweep from start to stop with step dstep and delay stime, measure according to typ.
Attributes
ABCDAutorange drive current on or off.
Set the current drive range (A).
Autorange drive voltage on or off.
Set the voltage drive range (V).
Get or Set channel A or B.
commandGet or set output current.
Autorange current measurement on or off.
Set the current clamping (A), will adjust current measurement range.
Set the current measurement range (A), will adjust current clamping.
Query IDN.
Return with instname or instname[ch] if it has channels.
interchoicesGet or set measure.
Set/get the number of measurement to be carried out in a loop.
mqtt_enablemqtt_listGetter for the mqtt_status.
Set the conversion number of power line cycles accuracy, for all converters.
Get or set output on/off state.
stair_slope to target or target,slope_time using previous stair_sweep() parameters.
stair_step to target or target,dstep or target,dstep,stime, using previous stair_sweep() parameters.
Autorange voltage measurement on or off.
Set the voltage clamping (V), will adjust voltage measurement range.
Set the voltage protection limit|default|min|max, get 4 value tuple.
Set the voltage measurement range, will adjust voltage clamping.
Get or set output voltage.
- property I_autorange
Autorange drive current on or off.
- property I_range
Set the current drive range (A).
- property V_autorange
Autorange drive voltage on or off.
- property V_range
Set the voltage drive range (V).
- property ch
Get or Set channel A or B.
- clear()
Clear error status.
- close(force=False)
Close connection to instrument.
- com_recover(fix=False)
Can lose coherency between read request and data, usually because of Timeout.
This routine can diagnose such loss of coherency and attempt to fix it, when fix=True
- Parameters:
fix (bool) – If True, attempt to fix the loss of coherency by consuming the next few lines of data, which should be the data that was expected from the previous read request.
- Returns:
True if coherency is restored, False otherwise.
- Return type:
bool
- property current
Get or set output current.
If the current is set the output is switched on immediately.
- error_list()
List of outstanding errors.
- Returns:
errorlist – list of outstanding errors, each tuple is (code, message)
- Return type:
list of tuples
- find_names()
find_names() returns list of identifiers strings, lhs of = assignments
- Returns:
obj_names – List of identifier strings
- Return type:
list of str
- get_values(typ='')[source]
Transfer last requested measurement sweep results.
- Parameters:
typ ('Vvirts-', 'Ivirts-' = Voltage / Current sourced, '-' changes direction.) – volts, amps, ohms, timestamp, status are sensed
- Return type:
List of measured values according to typ, with each value a list of the form [voltage, current, resistance, timestamp, status] depending on the flags in typ.
- help()
Print the docstring of the instrument class.
- property i_autorange
Autorange current measurement on or off.
- property i_clamp
Set the current clamping (A), will adjust current measurement range.
- property i_range
Set the current measurement range (A), will adjust current clamping.
- property id
Query IDN.
- identify(showInstName=False)
Identify message.
- init(identify=False)
Connect to Keithley instrument and initialize.
- property instName
Return with instname or instname[ch] if it has channels.
- json = <module 'json' from '/home/runner/miniconda3/envs/test/lib/python3.9/json/__init__.py'>
- local()
Switch back to local instrument control.
- property measure
Get or set measure.
Where the measurements are defined by “vir” flags (VOLTAGE,CURRENT,RESISTANCE)
- property measurecnt
Set/get the number of measurement to be carried out in a loop.
TODO: this function is not running yet, it is only a dummy
if the result == None than this function not implemented. The return value for the measurement is calculated togetheer with the mfilter setting.
- message(message=None)
Message display.
- mqtt_add(client, instrument, liste='#', qos=0)
Add the instrument to mqtt. Calling from base_instrument, after the instrument (device) has been create. Normally you have not to use this function, only base_instrument use it.
- Parameters:
client (mqtt_init) – The MQTT client instance to which the instrument should be added.
instrument (object) – The instrument to be added to the MQTT client.
liste (list or str) – A list of attributes for which MQTT messages should be sent. If set to “#”, all attributes will be included (default: “#”).
qos (int) – The Quality of Service level for MQTT messages (default: 0).
- Return type:
None
- mqtt_disconnect()
Remove the instrument from mqtt. Calling from base_instrument, if the instrument are closing. Normally you have not to use this function, only base_instrument use it.
- property mqtt_status
Getter for the mqtt_status.
- property nplc
Set the conversion number of power line cycles accuracy, for all converters.
For a plc of 1.0, conversion rate is 1/50s = 20ms. Accuracy max 10, min 0.
- Returns:
Number of power line cycles for conversion, between 0.01 and 10.
- Return type:
float
- property onoff
Get or set output on/off state. Setting onoff to True will switch on the output, False will switch it off.
- publish(topic, value)
Publish topic as type=’cmd’ with payload=value.
- Parameters:
topic (str) – The name of the topic to publish.
value (any) – The value to be published.
- Return type:
None
- publish_get(function_name, value)
Publish function_name as type=’get’ with paylad=value.
- Parameters:
function_name (str) – The name of the function to be published as a ‘get’ command.
value (any) – The value to be published as the payload of the ‘get’ command.
- Return type:
None
- publish_set(function_name, value)
Publish function_name as type=’set’ with paylad=value.
- Parameters:
function_name (str) – The name of the function to be published as a ‘set’ command.
value (any) – The value to be published as the payload of the ‘set’ command.
- Return type:
None
- query_onoff()[source]
“ Query the output on/off state. Returns True if output is on, False if output is off.
- query_output_function()[source]
Query the output function, return ‘DC_VOLTAGE’, ‘DC_CURRENT’ or ‘RESISTANCE’ depending on the source function, or the source function name if it is not voltage or current.
- Returns:
str
- Return type:
‘DC_VOLTAGE’, ‘DC_CURRENT’, ‘RESISTANCE’ or source function name
- reset()
Reset and switch beep off.
- property stair_slope
stair_slope to target or target,slope_time using previous stair_sweep() parameters.
- property stair_step
stair_step to target or target,dstep or target,dstep,stime, using previous stair_sweep() parameters.
- stair_sweep(start, stop, dstep, stime=0, typ='V', stair='Lin', wait=False)[source]
Make a stair sweep from start to stop with step dstep and delay stime, measure according to typ.
- Parameters:
typ ('Vvirts-', 'Ivirts-' = Voltage / Current sourced, '-' changes direction.) – volts, amps, ohms, timestamp, status are sensed
start (Start value in volts or amps, None implies incremental)
stop (Stop value in volts or amps)
dstep (Delta amplitude for Lin, Points to interpolate for Log, stime is slope time for None (>1ms))
stime (Delay between steps or slope time if dstep == None)
stair (('Lin','Log) = linear or log source)
- Return type:
List of measured values according to typ, with each value a list of the form [voltage, current, resistance, timestamp, status] depending on the flags in typ.
- property v_autorange
Autorange voltage measurement on or off.
- property v_clamp
Set the voltage clamping (V), will adjust voltage measurement range.
- property v_protection
Set the voltage protection limit|default|min|max, get 4 value tuple.
- property v_range
Set the voltage measurement range, will adjust voltage clamping.
- property voltage
Get or set output voltage.
If the voltage is set the output is switched on immediately.