diff --git a/hp-34401A-3146A39685/datron-4805-XANS1/README.md b/hp-34401A-3146A39685/datron-4805-XANS1/README.md new file mode 100644 index 0000000..3af4eed --- /dev/null +++ b/hp-34401A-3146A39685/datron-4805-XANS1/README.md @@ -0,0 +1,3 @@ +| Meter Manufacturer | Meter Model | Meter SerialNumber | Source Manufacturer | Source Model | Source SerialNumber | MinMax | File | ID | User | +|--------------------|-------------|--------------------|---------------------|--------------|---------------------|--------|------|----|------| +|hp|34401A|3146A39685|datron|4805|XANS1|0.0|/data/hp-34401A-3146A39685---datron-4805-XANS1---SWEEP-AZERO-HIZ.jpg|SWEEP-AZERO-HIZ|xans| diff --git a/hp-34401A-3146A39685/datron-4805-XANS1/data/INLV-34401Dat.py b/hp-34401A-3146A39685/datron-4805-XANS1/data/INLV-34401Dat.py new file mode 100644 index 0000000..4c1d78d --- /dev/null +++ b/hp-34401A-3146A39685/datron-4805-XANS1/data/INLV-34401Dat.py @@ -0,0 +1,180 @@ +import GPIBPrologix +import bme280 +import smbus2 +from requests import post + +## Initialize GPIB adapter +GPIB = GPIBPrologix.ResourceManager("/dev/ttyACM0") +# Connect equipment +inst2 = GPIB.open_resource(30) +inst3 = GPIB.open_resource(22) +# Initialize BME280 temperature/humidity sensor +bus = smbus2.SMBus(1) +## Configure equipment +# BME280 temperature/humidity sensor +calibration_params = bme280.load_calibration_params(bus, 0x76) + +# Datron 4805 Calibrator +inst2.query("F0=") #DCV +inst2.query("R6=") #10/100K Range +inst2.query("S1=") #RemoteSense +inst2.query("M0.0069=") #6.9mV Out, sanity check +inst2.query("O1=") #OutputON +#Setup 34401A +inst3.write("*RST") +inst3.write("SYST:PRES") +inst3.write("*CLS") +inst3.write("CONF:VOLT:DC 10") +inst3.write("VOLT:DC:NPLC 100") +inst3.write("ZERO:AUTO ON") +inst3.write("INP:IMP:AUTO ON") +inst3.query("READ?") +# Measurement functions +def readValue(instObj): + instObj.query("READ?") + value = "" + while value == "": + value = inst3.read() + print(value) + return value +def setValue(instObj, inputVar): + instObj.query("M"+str(inputVar)+"=") + return inputVar +def getEnvironment(instObj, i2cbus): + value = instObj.sample(i2cbus, 0x76, calibration_params) + return value + +## Have gitpython pull in the repository +import os +import git +import shutil +username = input("Your 0xC6 git username: ") +password = input("Your 0xC6 git password: ") +remote = f"https://{username}:{password}@git.0xc6.com/xans/INL-Measurements.git" +if not os.path.exists(os.getcwd()+"/INL-Measurements"): + git.Repo.clone_from(remote, os.getcwd()+"/INL-Measurements/") +else: + shutil.rmtree(os.getcwd()+"/INL-Measurements/", ignore_errors=True) + git.Repo.clone_from(remote, os.getcwd()+"/INL-Measurements/") + +## Get needed info to properly label everything +MeterManufacturer = input("Meter Manufacturer: ").lower() +MeterModel = input("Meter Model: ").upper() +MeterSN = input("Meter SN: ").upper() +SourceManufacturer = input("Source Manufacturer: ").lower() +SourceModel = input("Source Model: ").upper() +SourceSN = input("Source SN: ").upper() +measid = input("Personally assigned measurement ID: ").upper() +shellyIp = input("If you use shelly for protection, enter the IP: ").upper() + +if shellyIp and os.system("ping -c 1 " + shellyIp): + print("shelly not found") + quit() +if shellyIp: + url = "{}://{}:{}/relay/0?turn=on".format("http", "192.168.0.101", "80") + post(url) + +## Create proper directory structure +basePath = os.getcwd() + "/INL-Measurements/" +dutname = MeterManufacturer+'-'+MeterModel+'-'+MeterSN +if not os.path.exists(basePath+dutname): + os.makedirs(basePath+dutname) +sourcename = SourceManufacturer+'-'+SourceModel+'-'+SourceSN +if not os.path.exists(basePath+dutname+'/'+sourcename): + os.makedirs(basePath+dutname+'/'+sourcename) +if not os.path.exists(basePath+dutname+'/'+sourcename+"/data/"): + os.makedirs(basePath+dutname+'/'+sourcename+"/data/") +basePath = basePath+dutname+'/'+sourcename +print(basePath+"/data/") + +import csv +import time +import datetime +import numpy as np +import pandas as pd +from math import sin +## Create logfile +logFileName = MeterManufacturer+'-'+MeterModel+'-'+MeterSN+'---'+SourceManufacturer+'-'+SourceModel+'-'+SourceSN+'---'+measid+'.csv' +with open(basePath+"/data/"+logFileName, 'a') as f: + writer = csv.writer(f) + writer.writerow(["DateTime","Set Volts","Measured Volts","Env Pressure","Env Temperature", "Env Humidity"]) +print(basePath+"/data/"+logFileName) + +sweep = np.arange(-11.5,12,0.5) + +cntr = 0 +d = datetime.datetime.now() +dlast = datetime.datetime.now() +## Collect data +time.sleep(3) +for x in sweep: + cntr = cntr + 1 + try: + #Set volt and let accimatize + setPoint = setValue(inst2,round(x,5)) + timebetween = (d-dlast) * (len(sweep)-cntr) + dlast = d + print(str(cntr)+'/'+str(len(sweep))+' Estimated Time Left: '+str(timebetween)) + time.sleep(60) + for i in range(3): + try: + time.sleep(5) + #Get DUT value + readout = readValue(inst3) + #Get envirnmental values + data = getEnvironment(bme280, bus) + #Write to file + d = datetime.datetime.now() + dx = d - datetime.timedelta(microseconds=d.microsecond) + fields=[dx.strftime("%d-%m-%y %H:%M:%S"),setPoint,float(readout),round(data.humidity,2),round(data.temperature,2),round(data.pressure,2)] + print(fields) + with open(basePath+"/data/"+logFileName, 'a') as f: + writer = csv.writer(f) + writer.writerow(fields) + if shellyIp and float(data.temperature) > 30 or float(data.temperature) < 16: + url = "{}://{}:{}/relay/0?turn=off".format("http", "192.168.0.101", "80") + post(url) + except Exception as e: + time.sleep(15) + i = i-1 + except Exception as e: + print(e) + time.sleep(1) + +## Calculate high order polynomial +df = pd.read_csv(basePath+"/data/"+logFileName) +df = df.groupby(["Set Volts"], as_index=False).mean(numeric_only=True) +highOrderPolyFit = np.polyfit(df["Set Volts"], df["Set Volts"]-df["Measured Volts"], 12) +trendPoly = np.poly1d(highOrderPolyFit) +## Make plot and save +import sys +from matplotlib import pyplot as plt +plt.plot(df["Set Volts"], df["Set Volts"]-df["Measured Volts"]) +polyIndex = np.arange(-11,11,0.01) +plt.plot(polyIndex, trendPoly(polyIndex)) +plt.xlabel('Source Voltage') +plt.ylabel('Delta Set/Meas') +plt.title ('INLV sweep '+ logFileName[:-4]) +plt.savefig(basePath+"/data/"+logFileName[:-4]+".jpg", bbox_inches='tight') + +minVal = trendPoly(polyIndex) +maxVal = trendPoly(polyIndex) +minVal = min(minVal) +maxVal = min(maxVal) +## Write away values to result overview +if not os.path.exists(basePath+'/README.md'): + with open(basePath+'/README.md', 'a') as f: + f.write("| Meter Manufacturer | Meter Model | Meter SerialNumber | Source Manufacturer | Source Model | Source SerialNumber | MinMax | File | ID | User |\n") + f.write("|--------------------|-------------|--------------------|---------------------|--------------|---------------------|--------|------|----|------|\n") + f.close() +with open(basePath+'/README.md', 'a') as f: + linkToImg = "/data/"+logFileName[:-4]+".jpg" + print("|"+MeterManufacturer+"|"+MeterModel+"|"+MeterSN+"|"+SourceManufacturer+"|"+SourceModel+"|"+SourceSN+"|"+str(round((maxVal-minVal),10))+"|"+linkToImg+"|"+measid+"|"+username+"|\n") + f.write("|"+MeterManufacturer+"|"+MeterModel+"|"+MeterSN+"|"+SourceManufacturer+"|"+SourceModel+"|"+SourceSN+"|"+str(round((maxVal-minVal),10))+"|"+linkToImg+"|"+measid+"|"+username+"|\n") + f.close() + shutil.copy(os.getcwd()+'/'+sys.argv[0],basePath+"/data/") + repo = git.Repo(os.getcwd() + "/INL-Measurements/") + repo.git.add(basePath) + repo.index.commit("Add INL Sweep "+ logFileName) + repo.remotes[0].push() + diff --git a/hp-34401A-3146A39685/datron-4805-XANS1/data/hp-34401A-3146A39685---datron-4805-XANS1---SWEEP-AZERO-HIZ.csv b/hp-34401A-3146A39685/datron-4805-XANS1/data/hp-34401A-3146A39685---datron-4805-XANS1---SWEEP-AZERO-HIZ.csv new file mode 100644 index 0000000..6bd724c --- /dev/null +++ b/hp-34401A-3146A39685/datron-4805-XANS1/data/hp-34401A-3146A39685---datron-4805-XANS1---SWEEP-AZERO-HIZ.csv @@ -0,0 +1,142 @@ +DateTime,Set Volts,Measured Volts,Env Pressure,Env Temperature,Env Humidity +13-02-24 21:08:51,-11.5,-11.500162,60.26,21.48,1013.41 +13-02-24 21:09:00,-11.5,-11.500163,60.3,21.79,1013.91 +13-02-24 21:09:09,-11.5,-11.500163,60.32,21.8,1013.85 +13-02-24 21:10:20,-11.0,-11.000157,60.52,21.8,1013.89 +13-02-24 21:10:29,-11.0,-11.000158,60.39,20.75,1012.12 +13-02-24 21:10:38,-11.0,-11.000158,60.42,21.82,1013.91 +13-02-24 21:11:49,-10.5,-10.500148,60.53,21.81,1013.89 +13-02-24 21:11:58,-10.5,-10.500149,60.56,21.82,1013.88 +13-02-24 21:12:07,-10.5,-10.500149,60.55,21.74,1013.71 +13-02-24 21:13:18,-10.0,-10.000143,60.54,21.21,1012.84 +13-02-24 21:13:27,-10.0,-10.000143,60.64,21.82,1013.88 +13-02-24 21:13:36,-10.0,-10.000143,60.64,21.83,1013.86 +13-02-24 21:14:47,-9.5,-9.5001346,60.76,21.8,1013.85 +13-02-24 21:14:56,-9.5,-9.5001346,60.82,21.8,1013.82 +13-02-24 21:15:05,-9.5,-9.5001369,60.88,21.8,1013.95 +13-02-24 21:16:16,-9.0,-9.0001302,60.83,21.83,1013.85 +13-02-24 21:16:25,-9.0,-9.0001289,60.86,21.81,1013.84 +13-02-24 21:16:35,-9.0,-9.0001306,60.85,21.8,1013.9 +13-02-24 21:17:46,-8.5,-8.5001205,61.06,21.81,1013.86 +13-02-24 21:17:55,-8.5,-8.5001192,61.05,21.84,1013.85 +13-02-24 21:18:04,-8.5,-8.5001201,61.07,21.83,1013.85 +13-02-24 21:19:15,-8.0,-8.0001141,60.95,21.84,1013.78 +13-02-24 21:19:24,-8.0,-8.0001148,60.94,21.84,1013.8 +13-02-24 21:19:33,-8.0,-8.0001144,60.94,21.09,1012.56 +13-02-24 21:20:44,-7.5,-7.5001059,61.11,21.87,1013.88 +13-02-24 21:20:53,-7.5,-7.5001059,60.92,18.5,1008.09 +13-02-24 21:21:02,-7.5,-7.5001055,61.16,21.87,1013.81 +13-02-24 21:22:13,-7.0,-7.0000982,61.14,21.87,1013.86 +13-02-24 21:22:22,-7.0,-7.0000984,61.14,21.88,1013.8 +13-02-24 21:22:31,-7.0,-7.0000983,61.14,21.89,1013.81 +13-02-24 21:23:42,-6.5,-6.5000912,61.16,21.91,1013.8 +13-02-24 21:23:51,-6.5,-6.5000913,61.18,21.9,1013.83 +13-02-24 21:24:00,-6.5,-6.5000914,61.1,21.24,1012.64 +13-02-24 21:25:11,-6.0,-6.0000836,61.37,21.89,1013.84 +13-02-24 21:25:20,-6.0,-6.0000835,61.27,21.89,1013.78 +13-02-24 21:25:29,-6.0,-6.0000832,61.34,21.89,1013.78 +13-02-24 21:26:40,-5.5,-5.5000785,61.48,21.89,1013.84 +13-02-24 21:26:50,-5.5,-5.5000769,61.51,21.9,1013.78 +13-02-24 21:26:59,-5.5,-5.5000783,61.5,21.91,1013.8 +13-02-24 21:28:10,-5.0,-5.0000678,61.31,20.64,1011.61 +13-02-24 21:28:19,-5.0,-5.0000673,61.5,21.9,1013.75 +13-02-24 21:28:28,-5.0,-5.0000667,61.53,21.9,1013.78 +13-02-24 21:29:39,-4.5,-4.5000615,61.54,21.87,1013.65 +13-02-24 21:29:48,-4.5,-4.5000623,61.5,21.91,1013.8 +13-02-24 21:29:57,-4.5,-4.5000618,61.51,21.92,1013.78 +13-02-24 21:31:08,-4.0,-4.0000537,61.62,21.93,1013.88 +13-02-24 21:31:17,-4.0,-4.0000531,61.59,20.69,1011.58 +13-02-24 21:31:26,-4.0,-4.0000532,61.67,21.92,1013.72 +13-02-24 21:32:37,-3.5,-3.5000482,61.63,21.62,1013.3 +13-02-24 21:32:46,-3.5,-3.5000482,61.63,21.2,1012.55 +13-02-24 21:32:55,-3.5,-3.5000467,61.7,21.93,1013.83 +13-02-24 21:34:06,-3.0,-3.0000403,61.68,21.95,1013.82 +13-02-24 21:34:15,-3.0,-3.0000404,61.71,21.95,1013.83 +13-02-24 21:34:25,-3.0,-3.0000403,61.7,21.68,1013.29 +13-02-24 21:35:36,-2.5,-2.5000325,61.73,21.97,1013.77 +13-02-24 21:35:45,-2.5,-2.5000337,61.75,21.98,1013.76 +13-02-24 21:35:54,-2.5,-2.5000316,61.77,21.96,1013.77 +13-02-24 21:37:05,-2.0,-2.0000266,61.58,21.97,1013.7 +13-02-24 21:37:14,-2.0,-2.0000249,61.63,21.98,1013.74 +13-02-24 21:37:23,-2.0,-2.000026,61.63,21.92,1013.65 +13-02-24 21:38:34,-1.5,-1.5000191,61.88,21.92,1013.79 +13-02-24 21:38:43,-1.5,-1.5000186,61.84,21.63,1013.29 +13-02-24 21:38:52,-1.5,-1.500019,61.9,21.93,1013.83 +13-02-24 21:40:03,-1.0,-1.0000125,61.83,21.95,1013.74 +13-02-24 21:40:12,-1.0,-1.0000122,61.77,21.03,1012.19 +13-02-24 21:40:21,-1.0,-1.0000134,61.81,21.95,1013.69 +13-02-24 21:41:32,-0.5,-0.5000035,61.8,21.44,1012.8 +13-02-24 21:41:41,-0.5,-0.5000029,61.9,21.97,1013.72 +13-02-24 21:41:50,-0.5,-0.5000032,61.94,21.97,1013.81 +13-02-24 21:43:01,0.0,3.2e-06,61.81,22.0,1013.77 +13-02-24 21:43:10,0.0,4.1e-06,61.85,22.01,1013.82 +13-02-24 21:43:20,0.0,3.2e-06,61.85,22.01,1013.79 +13-02-24 21:44:31,0.5,0.4999996,61.9,21.99,1013.73 +13-02-24 21:44:40,0.5,0.4999993,61.93,21.99,1013.73 +13-02-24 21:44:49,0.5,0.4999982,61.96,21.98,1013.77 +13-02-24 21:46:00,1.0,1.0000079,61.84,22.01,1013.71 +13-02-24 21:46:09,1.0,1.0000082,61.88,22.0,1013.69 +13-02-24 21:46:18,1.0,1.0000078,61.89,21.56,1013.05 +13-02-24 21:47:29,1.5,1.5000134,61.94,22.0,1013.75 +13-02-24 21:47:38,1.5,1.5000144,61.97,22.01,1013.71 +13-02-24 21:47:47,1.5,1.5000136,61.95,21.74,1013.24 +13-02-24 21:48:58,2.0,2.0000198,62.04,22.0,1013.75 +13-02-24 21:49:07,2.0,2.0000202,62.03,22.01,1013.77 +13-02-24 21:49:16,2.0,2.000021,62.09,22.01,1013.71 +13-02-24 21:50:27,2.5,2.5000276,62.05,22.05,1013.72 +13-02-24 21:50:36,2.5,2.5000279,62.01,21.7,1013.19 +13-02-24 21:50:45,2.5,2.5000284,62.02,22.02,1013.78 +13-02-24 21:51:56,3.0,3.0000341,62.1,21.77,1013.36 +13-02-24 21:52:05,3.0,3.000035,62.11,22.01,1013.76 +13-02-24 21:52:15,3.0,3.0000353,62.12,21.98,1013.8 +13-02-24 21:53:26,3.5,3.5000411,62.2,22.0,1013.69 +13-02-24 21:53:35,3.5,3.500042,62.22,22.01,1013.74 +13-02-24 21:53:44,3.5,3.5000419,62.21,22.03,1013.8 +13-02-24 21:54:55,4.0,4.0000481,62.12,21.32,1012.59 +13-02-24 21:55:04,4.0,4.0000493,62.17,22.08,1013.83 +13-02-24 21:55:13,4.0,4.0000487,62.18,22.08,1013.78 +13-02-24 21:56:24,4.5,4.5000546,62.14,22.04,1013.79 +13-02-24 21:56:33,4.5,4.500056,62.17,21.74,1013.26 +13-02-24 21:56:42,4.5,4.5000562,62.2,22.05,1013.78 +13-02-24 21:57:53,5.0,5.0000637,62.17,22.05,1013.79 +13-02-24 21:58:02,5.0,5.000063,62.15,22.04,1013.73 +13-02-24 21:58:11,5.0,5.0000626,62.25,22.03,1013.77 +13-02-24 21:59:22,5.5,5.5000718,62.22,22.04,1013.77 +13-02-24 21:59:31,5.5,5.5000698,62.24,21.68,1013.16 +13-02-24 21:59:40,5.5,5.5000713,62.23,22.04,1013.81 +13-02-24 22:00:51,6.0,6.000078,62.15,22.03,1013.78 +13-02-24 22:01:00,6.0,6.0000781,62.15,21.75,1013.28 +13-02-24 22:01:10,6.0,6.0000773,62.02,21.94,1013.6 +13-02-24 22:02:21,6.5,6.5000856,62.25,22.07,1013.74 +13-02-24 22:02:30,6.5,6.500085,62.21,22.07,1013.73 +13-02-24 22:02:39,6.5,6.5000847,62.16,22.06,1013.74 +13-02-24 22:03:50,7.0,7.0000936,62.32,22.08,1013.75 +13-02-24 22:03:59,7.0,7.0000924,62.3,22.08,1013.73 +13-02-24 22:04:08,7.0,7.0000925,62.3,22.09,1013.74 +13-02-24 22:05:19,7.5,7.5001003,62.17,22.09,1013.79 +13-02-24 22:05:28,7.5,7.5000998,62.26,22.07,1013.7 +13-02-24 22:05:37,7.5,7.5001009,62.24,22.07,1013.73 +13-02-24 22:06:48,8.0,8.000109,62.34,22.05,1013.81 +13-02-24 22:06:57,8.0,8.000109,62.4,22.06,1013.71 +13-02-24 22:07:06,8.0,8.0001083,62.4,22.08,1013.78 +13-02-24 22:08:17,8.5,8.5001158,62.32,22.07,1013.66 +13-02-24 22:08:26,8.5,8.500116,62.31,22.09,1013.72 +13-02-24 22:08:35,8.5,8.5001162,62.28,22.1,1013.68 +13-02-24 22:09:46,9.0,9.000125,62.37,22.12,1013.74 +13-02-24 22:09:55,9.0,9.0001246,62.28,22.11,1013.69 +13-02-24 22:10:05,9.0,9.0001246,62.17,21.32,1012.31 +13-02-24 22:11:16,9.5,9.5001316,62.22,22.11,1013.72 +13-02-24 22:11:25,9.5,9.5001321,62.32,22.09,1013.59 +13-02-24 22:11:34,9.5,9.5001319,62.26,20.83,1011.56 +13-02-24 22:12:45,10.0,10.000139,62.34,22.09,1013.69 +13-02-24 22:12:54,10.0,10.000141,62.25,22.07,1013.76 +13-02-24 22:13:03,10.0,10.00014,62.1,21.58,1012.82 +13-02-24 22:14:14,10.5,10.500144,62.15,22.16,1013.64 +13-02-24 22:14:23,10.5,10.500147,62.07,22.16,1013.73 +13-02-24 22:14:32,10.5,10.500147,62.08,22.18,1013.73 +13-02-24 22:15:43,11.0,11.000156,62.25,22.14,1013.61 +13-02-24 22:15:52,11.0,11.000157,62.23,22.14,1013.62 +13-02-24 22:16:01,11.0,11.000155,62.14,22.03,1013.4 +13-02-24 22:17:12,11.5,11.500164,62.36,22.11,1013.61 +13-02-24 22:17:21,11.5,11.500164,62.33,22.11,1013.59 +13-02-24 22:17:30,11.5,11.500164,62.34,22.1,1013.6 diff --git a/hp-34401A-3146A39685/datron-4805-XANS1/data/hp-34401A-3146A39685---datron-4805-XANS1---SWEEP-AZERO-HIZ.jpg b/hp-34401A-3146A39685/datron-4805-XANS1/data/hp-34401A-3146A39685---datron-4805-XANS1---SWEEP-AZERO-HIZ.jpg new file mode 100644 index 0000000..aea0f03 Binary files /dev/null and b/hp-34401A-3146A39685/datron-4805-XANS1/data/hp-34401A-3146A39685---datron-4805-XANS1---SWEEP-AZERO-HIZ.jpg differ