# This Device Class is published under the terms of the MIT License. # Required Third Party Libraries, which are included in the Device Class # package for convenience purposes, may have a different license. You can # find those in the corresponding folders or contact the maintainer. # # MIT License # # Copyright (c) 2025 SweepMe! GmbH (sweep-me.net) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # SweepMe! driver # * Module: Logger # * Instrument: Solartron 70x1 import time from pysweepme.EmptyDeviceClass import EmptyDevice class Device(EmptyDevice): description = """
Driver for Solartron 70x1 series digital multimeters.
Channel scanner function of 7061 currently not implemented. Also "Output Fast" of 7061 is not implemented as its restrictions make a use in today's applications rather unlikely.
Selected combination of "Mode" and "Range" not checked for validity as this is model dependent.
""" def __init__(self): EmptyDevice.__init__(self) self.shortname = "SI70x1" self.port_manager = True self.port_types = ["GPIB"] # timeout value in seconds self.timeoutvalue = 60 self.port_properties = { "timeout": self.timeoutvalue, "delay": 0.05, } # this dictionary connects modes to commands. The modes will be displayed to the user in the field 'Mode' # The True Ohms Mode is a resistance measurement specifically for low resistances involving thermally induced voltages # The Reference Voltage Modes are for maintenance only and can be activated via uncommenting if required self.modes = { "Voltage DC": "MODE,VDC", "Voltage AC": "MODE,VAC", "Voltage VAC+VDC 7071/81": "MODE,VAC + VDC", "Voltage VDC+VAC 7071/81": "MODE,VDC + VAC", "Voltage VAC+DC 7071/81": "MODE,VAC + DC", "Voltage VDC+AC 7071/81": "MODE,VDC + AC", "Voltage AC+Filter 7071/81": "MODE,VAC + Filter", "Voltage VAC+VDC+Filter 7071/81": "MODE,VAC + VDC + Filter", "Voltage VDC+VAC+Filter 7071/81": "MODE,VDC + VAC + Filter", "Voltage VAC+DC+Filter 7071/81": "MODE,VAC + DC + Filter", "Voltage VDC+AC+Filter 7071/81": "MODE,VDC + AC + Filter", "Current DC 7061": "MODE,IDc", "Current AC 7061": "MODE,IAc", "Resistance": "MODE,KOHM", #abbreviated command is used for "True Resistance" because elaborate command is different for 7061 ("Trueohm") and 7071/7081 ("True ohms"), "True Ohm Resistance": "MODE,TR", "Temperature (7061 only)": "PROBE,Prt" # "0 V DC-Reference": "0vdc", # "10 V DC-Reference": "10vdc", } # this dictionary sets the unit of each mode self.mode_units = { "Voltage DC": "V", "Voltage AC": "V", "Voltage VAC+VDC 7071/81": "V", "Voltage VDC+VAC 7071/81": "V", "Voltage VAC+DC 7071/81": "V", "Voltage VDC+AC 7071/81": "V", "Voltage AC+Filter 7071/81": "V", "Voltage VAC+VDC+Filter 7071/81": "V", "Voltage VDC+VAC+Filter 7071/81": "V", "Voltage VAC+DC+Filter 7071/81": "V", "Voltage VDC+AC+Filter 7071/81": "V", "Current DC 7061": "A", "Current AC 7061": "A", "Resistance": "Ohm", "True Ohm Resistance": "Ohm", "Temperature (7061 only)": "deg" # "0 V DC-Reference": "V", # "10 V DC-Reference": "V", } # measuring range as dictionary # range "fixed" will fix the currently selected range when the initialisation is run self.ranges = { "Auto": "RANge,Auto", "0.1": "RANge,0.1", "1": "RANge,1", "10": "RANge,10", "100": "RANge,100", "1000": "RANge,1000", "10000": "RANge,10000", } # number of displayed digits as dictionary # 8 digits are only available on the Solartron 7081 # the alternative command "NInes" is used instead of the 7061-only command "DIGIts" for compatibility over all 70x1 instrument self.resolutions = { "8 Digits (7081)": "NInes,8", "7 Digits (7061/71)": "NInes,7", "6 Digits": "NInes,6", "5 Digits": "NInes,5", "4 Digits": "NInes,4", } # ONLY AVAILABLE FOR THE 7061 # 0.1s will yield 5 digits and is the fastest setting overall if not using burst mode # 0.2s is the fastest for 6 digits and resembles classic 10 PLC@50Hz # 2.0s is the fastest for 7 digits and resembles classic 100 PLC@50Hz # 20s resembles 1000 PLC@50Hz self.nplc_types = { "Default (set by # of Digits)": "ITime,Normal", "Fast, (7061 only, 0.1s)": "ITime,User=0000.1", "Normal, (7061 only, 0.2s)": "ITime,User=0000.2", "Slow, (7061 only, 2.0s)": "ITime,User=0002.0", "Very Slow, (7061 only, 20.0s)": "ITime,User=0020.0", } self.drifts = { "ON (every 15min)": "ON", "OFF": "OFF", "Each Measurement": "Now", } self.tempunits = { "Deg. C": "OUTPUT=DEGC", "Deg. F": "OUTPUT=DEGF", "Kelvin": "OUTPUT=K" } self.trueohmtemps = { "OFF": "MODE=NORMAL", "ON": "MODE=TRUEOHM", } def update_gui_parameters(self, parameters): # retrieve currently set "Mode", default to "Voltage DC" if unset due to first function run before GUI options are retrieved self.mode = parameters.get("Mode", "Voltage DC") new_parameters = { "Mode": list(self.modes.keys()) } # if Temperature measurement mode is selected, the additional options for the unit and probe type are added if self.mode == "Temperature (7061 only)": new_parameters.update({ # Temperature Unit will be used to overwrite placeholder "deg" set in __init__ "Temperature Unit": list(self.tempunits.keys()), "PRT Probe Resistance (Ohm)": float(100), "Trueohm Probe Res. Meas.": list(self.trueohmtemps.keys()) }) # adding additional parameters new_parameters.update({ "Resolution": list(self.resolutions.keys()), "Range": list(self.ranges.keys()), "NPLC (7061 only)": list(self.nplc_types.keys()), "Filter": ["OFF", "ON"], "Drift Correction": list(self.drifts.keys()), "Use stored NULL comp.": ["OFF", "ON"], "External Trigger (7061 only)": ["OFF", "ON"], "Ext. Trig. Edge": ["Pos", "Neg"], # debouncing mechanical trigger relays "Ext. Trig. Debounce": ["OFF", "ON"], "Display": ["ON","OFF"] }) return new_parameters def apply_gui_parameters(self, parameters): self.mode = parameters.get("Mode") if self.mode == "Temperature (7061 only)": self.tempunit = parameters.get("Temperature Unit") self.proberes = parameters.get("PRT Probe Resistance (Ohm)") self.trueohmtemp = parameters.get("Trueohm Probe Res. Meas.") self.resolution = parameters.get("Resolution") self.range = parameters.get("Range") self.nplc = parameters.get("NPLC (7061 only)") self.drift = parameters.get("Drift Correction") self.filter = parameters.get("Filter") self.nullcomp = parameters.get("Use stored NULL comp.") self.exttrig = parameters.get("External Trigger (7061 only)") self.exttrigedge = parameters.get("Ext. Trig. Edge") self.exttrigdebo = parameters.get("Ext. Trig. Debounce") self.display = parameters.get("Display") self.port_string = parameters.get("Port") # here, the variables and units are defined, based on the selection of the user # we have as many variables as channels are selected self.variables = [self.mode] # we add the channel name to each variable, e.g "Voltage DC" self.units = [self.mode_units[self.mode]] # True to plot data self.plottype = [True] # True to save data self.savetype = [True] def initialize(self): # GPIB communication setup as the first step is mandatory, at least for the 7071/7081 # We make use of the fact that these 7061 commands get ignored by the 7071/81 but not vice versa # first GPIB contact causes an initialization procedure to be run, so we give it a bit of time time.sleep(3) # 7061: set EOI as command delimiter for SCPI compatibility self.port.write("GPib,Delimit,Eoi") # 7061: make sure GPIB communication is activated self.port.write("GPib,Output,ON") # define new timeout value in milliseconds for the subsequent "try" procedure self.port.port.timeout = 1000 self.port.write("SRq?") # the try will succeed only if an 7061 is connected as the 7071/81 will still miss the GPIB setup commands # we therefore exclude the 7071/81 commands that would otherwise throw the error "BAD COMMAND" on its display try: srq=self.port.read() except: # an exception means no response from the instrument, which means it is not an 7061 but an 7071/81 # reset timeout value to the one defined in INIT, recalculated to milliseconds self.port.port.timeout = self.timeoutvalue * 1E03 # 7071/81: set EOI as command delimiter for SCPI compatibility self.port.write("DELImit,END") # 7071/81: make sure GPIB communication is activated self.port.write("OUTput,Gp-ib,ON") self.port.write("SRq?") srq=self.port.read() else: # in case the try suceeded, we could retrieve the srq string for further processing, so we just... # ...reset timeout value to the one defined in INIT, recalculated to milliseconds self.port.port.timeout = self.timeoutvalue * 1E03 # Model-ID identification procedure; utilizes the difference in response to the SRQ request # 7061: SRQ 0 # 7071/7081: SRQ ,Error = Off,User = Off,Output = Off,Ready = Off if "Error" in srq: self.model="7071/7081" # Some model dependend functional checks if self.exttrig == "ON": msg = "External trigger not available on 7071/7081" raise Exception(msg) if self.mode.startswith("Current"): msg = "Current measurement not available on 7071/7081" raise Exception(msg) if self.mode == "Temperature (7061 only)": msg = "Temperature measurement not available on 7071/7081" raise Exception(msg) else: self.model="7061" # Some model dependend functional checks if (self.mode.find("+")>0): msg = "Combined AC+DC measurements not available on 7061" raise Exception(msg) if self.resolution.startswith("8"): msg = "8-digit resolution not available on 7061" raise Exception(msg) print("Solartron", self.model, "identified on", self.port.port_properties["ID"]) ## Device Clear Command; similar to the initialize command but with some values being kept; refer to manual for details (Appendix A) and use if needed instead of INIT # self.port.write("DCl") ## Clears only the measurement results buffer; can also be used if needed instead of initializing the device. # self.port.write("History Clear") def configure(self): # Configuration starts with commands common to all instrument models, specific commands follow later # Switching off display if self.display == "OFF": # deactivate the update of the display with measurement results self.port.write("DISplay,OFF") # overwrite last display content with empty space so it appears "blank dark" if self.model == "7061": self.port.write("DISplay,[]") else: self.port.write("DISplay,\" \"") # sets output to scientific notation, allows to process the result as a float variable directly self.port.write("FOrmat,Engineering") # Mode if self.mode == "Temperature (7061 only)": self.port.write("%s,%s,R0(Ohm)=%s,%s" % (self.modes[self.mode],self.tempunits[self.tempunit],self.proberes,self.trueohmtemps[self.trueohmtemp])) else: self.port.write("%s" % self.modes[self.mode]) # Resolution self.port.write("%s" % self.resolutions[self.resolution]) # Range self.port.write("%s" % self.ranges[self.range]) # Model-specific commands, here those for the 7061 if self.model == "7061": # disable internal Auto-Trigger / "Track" in Solartron terms self.port.write("TRAck,OFF") # deactivate scanning channels as this is currently not supported self.port.write("SCan,OFF") # forces a numeric-output only without unit and channel descriptors self.port.write("LIterals OFF") # Filter self.port.write("FIlter %s" % self.filter) # NPLC Integration self.port.write("%s" % self.nplc_types[self.nplc]) # perform a single measurement uppon trigger self.port.write("ONTRigger Sample=1") # Model-specific commands, here those for the 7071 and 7081 else: # DIGital Filter self.port.write("DIG %s" % self.filter) # disable internal continuous Auto-Trigger and set to single trigger self.port.write("MEAsure,SIngle,ARM") # NULL offset compensation; value must have been stored in the instrument manually before use; # Do not activate the INITIALIZE option when using NULL as the value will be ereased otherwise self.port.write("NUll %s" % self.nullcomp) # Drift Correction if self.drift.startswith("ON"): self.port.write("DRift %s" % self.drifts[self.drift]) def unconfigure(self): # if display was set to be deactivated, re-activate the update of the display with measurement results if self.display == "OFF": self.port.write("DISplay,ON") # resets display output format to bootup default self.port.write("FOrmat,Dvm") # the 7061's display will remain dark if no new values are to be displayed, to we resume the continuous measurements if self.model == "7061": self.port.write("TRAck,ON") def measure(self): if self.drift.startswith("Each"): self.port.write("DRift %s" % self.drifts[self.drift]) # extend timeout for 8-digit measurement as this takes ~52s if self.resolution.startswith("8"): self.port.port.timeout = 60E3 if self.exttrig == "ON": # arm external trigger with chosen slope and debounce setting self.port.write("EXTtrig,Edge %s,Debounce %s" % (self.exttrigedge, self.exttrigdebo)) else: # perform internal trigger for a measurement self.port.write("TRIgger") # retrieves measurement data from the instrument; in case EXT TRIG is used, it will wait for the result until timeout self.data = float(self.port.read()) # set timeout back to default if self.resolution.startswith("8"): self.port.port.timeout = self.timeoutvalue * 1E3 # the 7061 is the only instrument of the 70x1 series that does current and it only does so in a 2000mA range, # which is why the result has to be converted from mA to A first if self.mode.startswith("Current")or self.mode.startswith("Resistance") == "7061": self.data = self.data/1e03 # all models output resistance in kOhm, so the result has to be converted from kOhm to Ohm first if self.mode.startswith("Resistance"): self.data = self.data*1e03 def call(self): return [float(self.data)]