GPIB DMM + Calibrator automation - Page 1
Forum section: electronics / general

author: quarks
author_rank: Frequent Contributor
timestamp: July 02, 2018, 01:40:13 pm
content: Hello all,right now I am experimenting with GPIB automation with python scripts (from member "e61_phil").So far I managed to get most of my DMMs and also my Fluke 5450A working.The next step is to automate my Datron/Wavetek 4808 calibrator.In Keysight Connection Expert the 4808 is marked as connected.But right now I cannot get the 4808 to respond to any command codes (see att. code overview)Does anyone have a working python script running with a Datron/Wavetek calibrator and can share a test file or give a hint?

author: TiN
author_rank: Super Contributor
timestamp: July 02, 2018, 04:32:47 pm
content: Show me yours, and i will show you mine.I'm working on python SW to run calibrations, and it also supports 4808, however it's not ready for prime time, and designed to run on linux-gpib environment.One thing that comes to mind - do you have terminations set correctly for 4808? Not forget "=" symbol after command end?Also It's rather picky on proper formatting, you can't pass too much resolution for values, or it will drop the commands.Short example of what works for me:Code:def w4808_function(cmd):if (cmd == "DCV"):intf.write ("F0=")elif (cmd == "ACV"):intf.write ("F1=")elif (cmd == "DCI"):intf.write ("F2=")elif (cmd == "ACI"):intf.write ("F3=")elif (cmd == "RES"):intf.write ("F4=")def w4808_out_set(cmd):intf.write ("M%s=" % cmd)

author: quarks
author_rank: Frequent Contributor
timestamp: July 02, 2018, 07:51:51 pm
content: Hello TiN,thanks a lot for your reply.I had used the termination, in python and also directly in "Keysight Interactive IO".So far no luck.With your code I get IndentationError (see att.).Unfortunately I am a newbie in Python and do not know what to try next.

author: AG7CK
author_rank: Regular Contributor
timestamp: July 02, 2018, 11:31:17 pm
content: This seems to be an error in line 33 because of the indentation ("tab"-space) from line 20 to line 33 (the lines inbetween are commented out).In python indentation has rules - you cannot in general add spaces in front of a line. I would clean up code/comments and spacing first.

author: TiN
author_rank: Super Contributor
timestamp: July 03, 2018, 12:21:17 am
content: Yep, python does not like extra spaces, unlike C/C++.You need def block start same as rest of cost, at beginning of the line.

author: e61_phil
author_rank: Frequent Contributor
timestamp: July 03, 2018, 11:15:01 am
content: If the format is sensitive, one could use the format() method of a string object to create a proper string from a float.@Tin: Do you have some generic Python software for calibration? I have lots of scripts for different measurements but nothing generic.That's sometimes a bit ugly if one would like to run the same calibration with different instruments. Perhaps one should define some classes with a standard interface for DMMs and so on?

author: TiN
author_rank: Super Contributor
timestamp: July 03, 2018, 11:54:15 am
content: What you mean by "generic"? So far I wrote about this:Code:** Main logic[+] - astd_ac.py[+] - cal.py - Calibration report logic / data parser[+] - cal_ac.py - Calibration report logic / data parser 4920/5790 only[+] - dut.py - DUT glue logic module[+] - dut_ac.py - AVMS glue logic module[+] - main.py[+] - markup.py[+] - meow.py[+] - mfc.py - MFC source logic / glue[+] - mfc_5700.py - 5700A specific hacks[+] - mfc_sec.py - Secondary MFC source logic / glue[+] - siggen.py[+] - std.py - Manual standards logic / glue** Interface HAL[+] - if_bme280.py - BME280[+] - if_debug.py - Simulation IF[+] - if_gpib.py - linux-gpib IF** Device support[+] - d1281.py - Wavetek/Datron 1281[+] - f5450a.py - Fluke 5450A[+] - f5700a.py - Fluke 5700A[+] - f5720a.py - Fluke 5720A[+] - f5790a.py - Fluke 5790A[+] - hp34401a.py - HPAK 34401A[+] - hp3457a.py - HPAK 3457A[+] - hp3458a.py - HPAK 3458A[+] - k2000calv2.py - K2000[+] - k2001.py - K2001[+] - k2002.py - K2002[+] - k2182.py - K2182[+] - k2182a.py - K2182A[+] - r6581t.py - R6581T[+] - t9823.py - Time 9823[+] - w4808.py - Wavetek 4808[+] - w4920.py - Wavetek 4920 + mV opt[+] - w4920m.py - Wavetek 4920M + WBV opt[+] - test.pyAbout 1420kb of code so far, 732 changesets in repository (and still lots of things broken/patched thru).First commit August 1, 2016

author: e61_phil
author_rank: Frequent Contributor
timestamp: July 03, 2018, 11:57:19 am
content: How do you configure which type of DUT you're measuring? And how do you define the calibration points?Have you worked out something which runs with multiple DMMs without changing a lot?

author: ManateeMafia
author_rank: Frequent Contributor
timestamp: July 03, 2018, 11:58:27 am
content: What's the meow.py? Is that a secret ppm adjustment tool?

author: TiN
author_rank: Super Contributor
timestamp: July 03, 2018, 12:14:56 pm
content: Meow.py makes everything rain cats.e61_phil, i use config file to set operation mode. Calibration points hardcoded into DUT procedure. I have three main procedures for every device/DUT: performance test, user calibration, manufacturer calibration.Once procedure is ready, then I couple program logic and DUT procedure thru glue code. Unsupported stuff on either side (source or DUT) is dropped automagikally.For starters I take calibration points from service manual for DUT and expand them to more points as I desire.Code:; This is calkit configuration file; For options please refer to documentationif_debug = false ; (if true run all code w/o talking to real hardware)no_delays = false ; (don't use delays in code to run during debug)env_sensor = bme280 ; none or bme280 or f1620 - Environment sensorverbose = true ; verbose outputs in terminalinterface = gpib ; (use linux-gpib bidning to run)alienated = true ; don't stop for user inputslab_location = xdevs_hq ; (lab location id, available are xdevs_hq, xdevs_usfl, xdevs_idtw)logfilenm = results/imc5700_4920m_test1.htmlreport_filenm = results/imc5700_4920m_test1.htmlraw_data_filelog = results/imc5700_4920m_test1.logtestmode = full ; fast - run only RES,DCV, normal - run RES,DCV,DCZ,ACVA,DCI, full - run everything, dconlyall_test_disable = false ; Run bogus data if trueenabled_dcz = true ;(DC Zero test active)enabled_dcv = true ;(FS/-FS DC Voltage test active)enabled_dclin = true ;(DC Linearity test active)enabled_dci = true ;(DCI test active)enabled_acz = false ;(AC Zero test active)enabled_acva = true ;(AC Analog test active)enabled_acvs = true ;(AC Sync test active)enabled_aci = true ;(ACI test active)enabled_rez = true ;(Resistance zero test active)enabled_res = true ;(Resistance 4W test active)enabled_res1g = true ;(1G Resistance test active)enabled_res2w = false ;(Resistance 2W test active)enabled_freq = false ;(Frequency test active)enabled_period = false ;(Period test active)run_selftest = true ;true to Run self-diag tests before perf-test)run_acal = true ;true to Run 3458 ACAL before perf-test)run_zcal_mfc = true ;true to Run 5700 Zero CAL before perf-test)cal_spec = 24h ; (24h or 90d or 180d or 1y or 2y)confidence = 0.95 ; 95% (+guardbanding)dut_gpib_addr = 19 ; GPIB Addressdut = w4920m ; DUT device typesecure_password = 0 ; DUT security passworddut_terminal_side = 1 ; 1 - front, 0 - reardut_serno = XXXmfc_gpib_addr = 1 ; GPIB Addressmfc = f5700 ; (MFC type)mfcs = none ; (MFC type)mfc_acal = true ;(Run Calcheck + reports prior to DUT perf-test)After everything runs (typical running time for DUT is 6-15 hours, if no manual operations like cable swap or 1Gohm resistor test) pretty HTML page generated with all data for review.Example data.3458A3458B3458B other labK20024920MAll test points are checked to relative 24-hour specification at K=1, not 1 year. If DUT pass this spec, then there is nothing to worry about. Enough to say, it takes weeks of runtime/tweaking to make any single DUT to produce "all green" report. Even then often "green" reports are just not happening.

author: quarks
author_rank: Frequent Contributor
timestamp: July 05, 2018, 09:42:17 am
content: here a short update, my tested 4808 has a bad IEEE488 connector, which I need to replace.Therefore I was searching for a female IEEE-488 connector in straight pin print version (like see att.)Unfortunately these plugs seem to be hard to find in Germany.Does anyone know a source?As I have another 4808, I tested my initial GPIB commands with successW4808.write("F0=") # DCVW4808.write("R6=") # Range 10W4808.write("A1=") # Full Range +W4808.write("M+10=") # +10VW4808.write("O1=") # Output OnW4808.write("O0=") # Output Offalso a combined string works fineW4808.write("R6F0M+10O1=")

author: quarks
author_rank: Frequent Contributor
timestamp: July 05, 2018, 01:37:41 pm
content: I just tested Advantest R6581 commandsin Python I tried:R6581.write("DCV")R6581.write("R5") #Range 10VR6581.write("AZ1") #Autozero AZ0=off / AZ1=onR6581.write("RE8") #Resolution 8.5 digitand all worked fine.Does anyone know the command for readout?

author: e61_phil
author_rank: Frequent Contributor
timestamp: July 05, 2018, 02:05:43 pm
content: Did you try a simple R6581.read() ?

author: quarks
author_rank: Frequent Contributor
timestamp: July 05, 2018, 02:56:27 pm
content: I triedfloat(R6581.read())andfloat(R6581.query("RDG?"))without luck

author: TiN
author_rank: Super Contributor
timestamp: July 05, 2018, 03:25:12 pm
content: Quote from: quarks on July 05, 2018, 02:56:27 pmWhy RDG? 6581 is SCPI-talkative.Quote from: Calkit code

author: quarks
author_rank: Frequent Contributor
timestamp: July 05, 2018, 04:09:49 pm
content: Hello TiN,I just tried what was working with my other gear, because I did not find the syntax in the japanese "CommandMatrix_R6581.pdf" I have.In my (not working) Python test script it looks like this:´data = [datetime.datetime.today(), value, float(F8508A.query("RDG?")), float(hp3458A1.read()), float(R6581.read())]unfortunately I do not know what command / syntax to use to get a R6581 readingR6581 is set to"CONFIGURE GPIB""LANGUAGE""ADVANTEST"

author: e61_phil
author_rank: Frequent Contributor
timestamp: July 05, 2018, 09:04:33 pm
content: Quote from: TiN on July 03, 2018, 11:54:15 amI was thinking about a couple of classes. One for every type of DMM and all with the same interface. This way one could simply change the instantiation line and use another class and the rest of the script don't care about the instrument used.Such a DMM class should implement methods like these:get_reading()get_type()set_range()set_function()...Perhaps one will not need this for calibration, but most of the scripts I use are not only for calibration. Sometimes one would use a couple of DMMs for an experiment and this time it would be nice if one can use all instruments the same way.One could also implement methods which will return lists of calibration points, specifications and so on.

author: z01z
author_rank: Regular Contributor
timestamp: July 06, 2018, 08:05:30 am
content: Quote from: quarks on July 05, 2018, 04:09:49 pmTwo different GPIB command set is supported by the 6581, what TiN described is in the other, "SCPI".I cannot really help you with the ADC format, I opted for other as it looked easier to understand, e.g.:self.inst.write("*RST")self.inst.write("*CLS")self.inst.write("FORM ASCII")self.inst.write("CONF:VOLT:DC")self.inst.write("VOLT:DC:RANG:AUTO ON")self.inst.write("VOLT:DC:NPLC 50")self.inst.write("VOLT:DC:DIG 8")self.inst.write("ARM:SOUR IMM")self.inst.write("TRIG:SOUR IMM")self.inst.write("ZERO:AUTO ON")self.inst.write("INIT:CONT ON")self.inst.write("VOLT:DC:PROT ON")There are also a lot of examples in chapter 9.12 in the manual, for both command sets. The title can be translated by google, so can have an idea what the program is doing.

author: quarks
author_rank: Frequent Contributor
timestamp: July 06, 2018, 10:33:01 am
content: Hello z01z,thanks a lot.I changed to "SCPI" and your commands are working.The R6581 readout is working after I changed R6581 "DATA-FORMAT" from "REAL64" to "ASCII""Keysight Interactive IO" gives the following:* Connected to: GPIB0::8::INSTR-> READ?<- +00.0000060E+00,OFFBut in Python I still getValueError: could not convert string to float: '+00.0000060E+00,OFF\r\n'Any idea?

author: AG7CK
author_rank: Regular Contributor
timestamp: July 06, 2018, 11:24:17 am
content: Only the first 15 characters of your string is a number - the rest is some handshake / termination stuff.If you have STRING_FROM_READING = '+00.0000060E+00,OFF\r\n'then you can use STRING_FROM_READING[1:16] which is (16-1)=15 long and begins at position 1. Hence it returns '+00.0000060E+00'.Search "python string slicing".

author: z01z
author_rank: Regular Contributor
timestamp: July 06, 2018, 11:37:02 am
content: The problem according to the error printout is that not a single float is returned but two values, which cannot be converted to a float.The question is, do you need the additional fields or not?Courtesy of google translate (ch 9.4.1 in manual):Output data • Element setting is effective when the data output format is ASCII. When each setting item is set to ON, the following items are attached to the measured value.However, items turned OFF will not be attached to measured values.A lot of things can be returned:DCV+1000. 0000E-03, PAS, OFF, 01CH, NUL, SMO, SCL, 1994/12/31 00:00If only the measurement value is needed, turn everything else off (":FORM:ELEM NONE").Sorry for that, seems like I've copied the commands from an older script and discovered the need for this command later.

author: e61_phil
author_rank: Frequent Contributor
timestamp: July 06, 2018, 11:59:47 am
content: Quote from: AG7CK on July 06, 2018, 11:24:17 amI wouldn't slice the + awayIf the length of extra stuff behind the measurement isn't clear, one could also split the string at "," and use only the part before the first ,float(inst.query("READ?").split(","))

author: quarks
author_rank: Frequent Contributor
timestamp: July 06, 2018, 12:00:13 pm
content: many thanks for all the helpfloat(R6581.query("READ?")[:-6])fixed the readout problem

author: TiN
author_rank: Super Contributor
timestamp: July 06, 2018, 12:12:11 pm
content: quarksThat's wrong way to do it. Disable the extra stuffs using FORM command:Quote from: CalkitSCPI is common GPIB-language today.

author: quarks
author_rank: Frequent Contributor
timestamp: July 20, 2018, 09:52:17 am
content: GPIB is working stable with my calibrator and all my DMMsI do have old Datron/Wavetek "Portocal" calibration software, but unfortunately it can only be used for calibration with a dongle (which I do not have and most likely will never get one).Now I wonder if the "Portocal" software could still be heplfull?Could it be possible to extract usefull calibration procedures and port them to Phyton?Does anyone have experience/hints/ideas/suggestions?

author: Zucca
author_rank: Unknown
timestamp: July 20, 2018, 10:16:10 am
content: Upload it here:https://doc.xdevs.com/contact/and let the world "digest" it.

author: TiN
author_rank: Super Contributor
timestamp: July 20, 2018, 11:39:23 am
content: quarksI could take a look on that, as I never heard about Portocal before. I ported quite a few Fluke MET/CAL procedures (mostly for 3458 & Keithleys) to python, it's straight forward once sequence is check.I'm thinking to make lite calibration python app, that will load pre-determined GPIB listing and just "playback" it on the equipment, saving the result with test points and measurements into file.It would be rather simple thing, which I could share publicly.

author: eurofox
author_rank: Unknown
timestamp: July 20, 2018, 12:43:24 pm
content: Quote from: TiN on July 03, 2018, 12:14:56 pmrain cats or cats in the rain

author: quarks
author_rank: Frequent Contributor
timestamp: July 20, 2018, 01:01:57 pm
content: Quote from: TiN on July 20, 2018, 11:39:23 amHello TiN,att. is a short info about Portocal.It is similar to Fluke MET/CAL, but died when Fluke took over Wavetek (Datron).