diff --git a/hp-3458A-2823A14043/datron-4805-XANS1/README.md b/hp-3458A-2823A14043/datron-4805-XANS1/README.md new file mode 100644 index 0000000..5a307b6 --- /dev/null +++ b/hp-3458A-2823A14043/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|3458A|2823A14043|datron|4805|XANS1|0.0|/data/hp-3458A-2823A14043---datron-4805-XANS1---AZEROSWEEP.jpg|AZEROSWEEP|xans| diff --git a/hp-3458A-2823A14043/datron-4805-XANS1/data/INLV-3458ADat.py b/hp-3458A-2823A14043/datron-4805-XANS1/data/INLV-3458ADat.py new file mode 100644 index 0000000..055dcfd --- /dev/null +++ b/hp-3458A-2823A14043/datron-4805-XANS1/data/INLV-3458ADat.py @@ -0,0 +1,188 @@ +import GPIBPrologix +import bme280 +import smbus2 +from requests import post +import time + +## 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("RESET") +inst3.write("MEM OFF") +inst3.write("OFORMAT ASCII") +inst3.write("END ALWAYS") +inst3.write("TARM AUTO") +inst3.write("DCV 10") +inst3.write("NRDGS 1,AUTO") +inst3.write("NPLC 100") +inst3.write("NDIG 9") +inst3.write("AZERO ON") + +# Measurement functions +def readValue(instObj): + instObj.write("BEEP OFF") + print(instObj.read()) + value = "" + while value == "": + value = instObj.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 +setValue(inst2,-1) +inst3.write("BEEP") +readValue(inst3) + +## 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-3458A-2823A14043/datron-4805-XANS1/data/hp-3458A-2823A14043---datron-4805-XANS1---AZEROSWEEP.csv b/hp-3458A-2823A14043/datron-4805-XANS1/data/hp-3458A-2823A14043---datron-4805-XANS1---AZEROSWEEP.csv new file mode 100644 index 0000000..45b1792 --- /dev/null +++ b/hp-3458A-2823A14043/datron-4805-XANS1/data/hp-3458A-2823A14043---datron-4805-XANS1---AZEROSWEEP.csv @@ -0,0 +1,142 @@ +DateTime,Set Volts,Measured Volts,Env Pressure,Env Temperature,Env Humidity +09-05-24 22:55:46,-11.5,-11.4999911,58.68,22.79,1022.41 +09-05-24 22:55:54,-11.5,-11.49999128,58.68,22.79,1022.41 +09-05-24 22:56:03,-11.5,-11.499991,58.67,22.78,1022.37 +09-05-24 22:57:12,-11.0,-10.99999244,58.79,22.74,1022.43 +09-05-24 22:57:21,-11.0,-10.9999927,58.73,22.73,1022.42 +09-05-24 22:57:29,-11.0,-10.99999258,58.83,22.72,1022.43 +09-05-24 22:58:39,-10.5,-10.49999114,58.89,22.7,1022.46 +09-05-24 22:58:47,-10.5,-10.49999121,58.94,22.7,1022.37 +09-05-24 22:58:56,-10.5,-10.49999159,58.92,22.7,1022.38 +09-05-24 23:00:05,-10.0,-9.999992436,59.0,22.7,1022.46 +09-05-24 23:00:14,-10.0,-9.999992507,59.05,22.7,1022.41 +09-05-24 23:00:22,-10.0,-9.999991979,59.0,22.7,1022.41 +09-05-24 23:01:32,-9.5,-9.499990834,59.03,22.71,1022.39 +09-05-24 23:01:40,-9.5,-9.49999013,59.05,22.72,1022.38 +09-05-24 23:01:48,-9.5,-9.49999057,59.05,22.72,1022.41 +09-05-24 23:02:58,-9.0,-8.999991308,59.11,22.64,1022.25 +09-05-24 23:03:06,-9.0,-8.999991325,59.08,22.73,1022.42 +09-05-24 23:03:15,-9.0,-8.999991237,59.11,22.73,1022.39 +09-05-24 23:04:24,-8.5,-8.499989494,59.15,22.72,1022.43 +09-05-24 23:04:33,-8.5,-8.49999062,59.09,22.73,1022.42 +09-05-24 23:04:41,-8.5,-8.499990691,59.13,22.73,1022.42 +09-05-24 23:05:51,-8.0,-7.999991376,59.03,22.35,1021.71 +09-05-24 23:05:59,-8.0,-7.999991499,59.14,22.74,1022.44 +09-05-24 23:06:08,-8.0,-7.999991622,59.15,22.76,1022.41 +09-05-24 23:07:17,-7.5,-7.499990935,59.2,22.74,1022.46 +09-05-24 23:07:26,-7.5,-7.499990847,59.15,22.74,1022.47 +09-05-24 23:07:34,-7.5,-7.499990038,59.14,22.75,1022.37 +09-05-24 23:08:44,-7.0,-6.999991128,59.14,22.03,1021.15 +09-05-24 23:08:52,-7.0,-6.999991128,59.19,22.76,1022.4 +09-05-24 23:09:01,-7.0,-6.999991374,59.12,22.76,1022.44 +09-05-24 23:10:10,-6.5,-6.499991725,59.16,22.79,1022.44 +09-05-24 23:10:19,-6.5,-6.49999183,59.15,22.79,1022.44 +09-05-24 23:10:27,-6.5,-6.49999213,59.1,22.78,1022.42 +09-05-24 23:11:36,-6.0,-5.999990826,59.25,22.62,1022.15 +09-05-24 23:11:45,-6.0,-5.999991266,59.22,22.77,1022.46 +09-05-24 23:11:53,-6.0,-5.999991161,59.23,22.78,1022.48 +09-05-24 23:13:03,-5.5,-5.499992075,59.2,22.78,1022.48 +09-05-24 23:13:11,-5.5,-5.499991388,59.14,22.78,1022.4 +09-05-24 23:13:20,-5.5,-5.499991424,59.22,22.76,1022.42 +09-05-24 23:14:29,-5.0,-4.999990965,59.35,22.78,1022.42 +09-05-24 23:14:38,-5.0,-4.999991176,59.34,22.78,1022.37 +09-05-24 23:14:46,-5.0,-4.999991123,59.33,22.78,1022.4 +09-05-24 23:15:56,-4.5,-4.499991298,59.35,22.78,1022.4 +09-05-24 23:16:04,-4.5,-4.499991404,59.38,22.79,1022.44 +09-05-24 23:16:13,-4.5,-4.499991316,59.34,22.79,1022.44 +09-05-24 23:17:22,-4.0,-3.999991068,59.4,22.8,1022.38 +09-05-24 23:17:31,-4.0,-3.999990611,59.39,22.79,1022.36 +09-05-24 23:17:39,-4.0,-3.999990541,59.36,22.79,1022.39 +09-05-24 23:18:49,-3.5,-3.499992299,59.44,22.8,1022.44 +09-05-24 23:18:57,-3.5,-3.499991912,59.39,22.64,1022.17 +09-05-24 23:19:06,-3.5,-3.499992264,59.39,22.79,1022.45 +09-05-24 23:20:15,-3.0,-2.999991295,59.41,22.8,1022.4 +09-05-24 23:20:24,-3.0,-2.999991348,59.44,22.79,1022.42 +09-05-24 23:20:32,-3.0,-2.999991278,59.46,22.79,1022.45 +09-05-24 23:21:42,-2.5,-2.499991488,59.46,22.81,1022.42 +09-05-24 23:21:50,-2.5,-2.499991681,59.43,22.81,1022.38 +09-05-24 23:21:58,-2.5,-2.499991628,59.47,22.82,1022.41 +09-05-24 23:23:08,-2.0,-1.999991434,59.22,22.92,1022.42 +09-05-24 23:23:16,-2.0,-1.999991434,59.23,22.93,1022.39 +09-05-24 23:23:25,-2.0,-1.999991575,59.17,22.92,1022.38 +09-05-24 23:24:34,-1.5,-1.499992981,59.35,22.89,1022.45 +09-05-24 23:24:43,-1.5,-1.499992964,59.43,22.89,1022.43 +09-05-24 23:24:51,-1.5,-1.499992911,59.38,22.9,1022.41 +09-05-24 23:26:01,-1.0,-0.9999936139,59.43,22.88,1022.43 +09-05-24 23:26:09,-1.0,-0.9999936491,59.38,22.88,1022.42 +09-05-24 23:26:18,-1.0,-0.9999935259,59.42,22.88,1022.39 +09-05-24 23:27:27,-0.5,-0.4999928033,59.52,22.86,1022.35 +09-05-24 23:27:36,-0.5,-0.4999928913,59.47,22.85,1022.41 +09-05-24 23:27:44,-0.5,-0.4999930321,59.49,22.86,1022.35 +09-05-24 23:28:54,0.0,5.332328122e-06,59.45,22.87,1022.34 +09-05-24 23:29:02,0.0,5.561107876e-06,59.46,22.88,1022.36 +09-05-24 23:29:11,0.0,5.45551722e-06,59.43,22.88,1022.38 +09-05-24 23:30:20,0.5,0.4999960942,59.59,22.89,1022.42 +09-05-24 23:30:29,0.5,0.4999960766,59.61,22.9,1022.41 +09-05-24 23:30:37,0.5,0.4999958654,59.6,22.9,1022.4 +09-05-24 23:31:47,1.0,0.9999964648,59.61,22.89,1022.37 +09-05-24 23:31:55,1.0,0.9999963592,59.63,22.88,1022.33 +09-05-24 23:32:04,1.0,0.9999963416,59.65,22.88,1022.44 +09-05-24 23:33:13,1.5,1.4999949,59.59,22.88,1022.39 +09-05-24 23:33:21,1.5,1.499994988,59.54,22.73,1022.12 +09-05-24 23:33:30,1.5,1.499995023,59.57,22.88,1022.38 +09-05-24 23:34:39,2.0,1.999994566,59.65,22.89,1022.42 +09-05-24 23:34:48,2.0,1.999994514,59.6,22.88,1022.41 +09-05-24 23:34:56,2.0,1.999994461,59.63,22.87,1022.43 +09-05-24 23:36:06,2.5,2.499994708,59.64,22.64,1022.01 +09-05-24 23:36:14,2.5,2.499994638,59.71,22.86,1022.41 +09-05-24 23:36:23,2.5,2.499994655,59.73,22.68,1022.11 +09-05-24 23:37:32,3.0,2.999993917,59.77,22.84,1022.36 +09-05-24 23:37:41,3.0,2.999994093,59.84,22.86,1022.35 +09-05-24 23:37:49,3.0,2.999994058,59.84,22.86,1022.43 +09-05-24 23:38:59,3.5,3.499994569,59.66,22.9,1022.39 +09-05-24 23:39:07,3.5,3.49999471,59.72,22.9,1022.39 +09-05-24 23:39:16,3.5,3.499994464,59.72,22.89,1022.35 +09-05-24 23:40:25,4.0,3.999993268,59.8,22.91,1022.43 +09-05-24 23:40:34,4.0,3.999993409,59.78,22.89,1022.38 +09-05-24 23:40:42,4.0,3.999993919,59.85,22.9,1022.39 +09-05-24 23:41:51,4.5,4.499994096,59.8,22.89,1022.37 +09-05-24 23:42:00,4.5,4.499994431,59.82,22.88,1022.44 +09-05-24 23:42:08,4.5,4.499994624,59.87,22.89,1022.34 +09-05-24 23:43:18,5.0,4.999994291,59.77,22.33,1021.37 +09-05-24 23:43:26,5.0,4.999994274,59.82,22.91,1022.43 +09-05-24 23:43:35,5.0,4.999994291,59.84,22.92,1022.43 +09-05-24 23:44:44,5.5,5.499995242,59.81,22.92,1022.42 +09-05-24 23:44:53,5.5,5.499994732,59.71,22.9,1022.36 +09-05-24 23:45:01,5.5,5.499995084,59.86,22.9,1022.39 +09-05-24 23:46:11,6.0,5.999994117,59.88,22.91,1022.38 +09-05-24 23:46:19,6.0,5.99999424,59.87,22.9,1022.36 +09-05-24 23:46:28,6.0,5.999993976,59.82,22.54,1021.8 +09-05-24 23:47:37,6.5,6.499995262,59.93,22.88,1022.44 +09-05-24 23:47:46,6.5,6.499995086,59.96,22.88,1022.43 +09-05-24 23:47:54,6.5,6.499994981,60.02,22.87,1022.36 +09-05-24 23:49:04,7.0,6.999994084,59.99,22.47,1021.65 +09-05-24 23:49:12,7.0,6.999994348,59.99,22.9,1022.4 +09-05-24 23:49:21,7.0,6.999994454,60.0,22.9,1022.42 +09-05-24 23:50:30,7.5,7.499993821,59.96,22.75,1022.14 +09-05-24 23:50:39,7.5,7.49999412,60.0,22.92,1022.38 +09-05-24 23:50:47,7.5,7.499994349,59.94,22.92,1022.37 +09-05-24 23:51:57,8.0,7.999994825,59.75,22.67,1022.01 +09-05-24 23:52:05,8.0,7.999994808,59.92,22.9,1022.31 +09-05-24 23:52:13,8.0,7.999995265,60.02,22.9,1022.41 +09-05-24 23:53:23,8.5,8.499994263,60.01,22.92,1022.37 +09-05-24 23:53:31,8.5,8.499994492,59.83,22.04,1020.85 +09-05-24 23:53:40,8.5,8.499994492,59.93,22.9,1022.32 +09-05-24 23:54:49,9.0,8.999995197,60.04,22.71,1021.99 +09-05-24 23:54:58,9.0,8.999995443,60.04,22.92,1022.29 +09-05-24 23:55:06,9.0,8.999995461,60.05,22.93,1022.36 +09-05-24 23:56:16,9.5,9.499994318,60.08,22.93,1022.36 +09-05-24 23:56:24,9.5,9.499994248,60.01,22.75,1022.05 +09-05-24 23:56:33,9.5,9.499994952,60.03,22.94,1022.38 +09-05-24 23:57:42,10.0,9.999996079,59.98,22.93,1022.42 +09-05-24 23:57:51,10.0,9.999995938,60.04,22.93,1022.39 +09-05-24 23:57:59,10.0,9.999995639,60.02,22.69,1021.95 +09-05-24 23:59:09,10.5,10.49999576,60.17,22.92,1022.42 +09-05-24 23:59:17,10.5,10.49999594,60.02,22.92,1022.42 +09-05-24 23:59:26,10.5,10.49999576,60.15,22.92,1022.4 +10-05-24 00:00:35,11.0,10.99999723,60.11,22.93,1022.31 +10-05-24 00:00:44,11.0,10.99999733,60.15,22.94,1022.33 +10-05-24 00:00:52,11.0,10.99999772,60.14,22.94,1022.33 +10-05-24 00:02:02,11.5,11.49999749,60.07,22.95,1022.4 +10-05-24 00:02:10,11.5,11.49999775,60.07,22.95,1022.35 +10-05-24 00:02:18,11.5,11.49999705,60.07,22.95,1022.3 diff --git a/hp-3458A-2823A14043/datron-4805-XANS1/data/hp-3458A-2823A14043---datron-4805-XANS1---AZEROSWEEP.jpg b/hp-3458A-2823A14043/datron-4805-XANS1/data/hp-3458A-2823A14043---datron-4805-XANS1---AZEROSWEEP.jpg new file mode 100644 index 0000000..2950c97 Binary files /dev/null and b/hp-3458A-2823A14043/datron-4805-XANS1/data/hp-3458A-2823A14043---datron-4805-XANS1---AZEROSWEEP.jpg differ