diff --git a/keithley-2700-1062684/datron-4805-XANS1/README.md b/keithley-2700-1062684/datron-4805-XANS1/README.md new file mode 100644 index 0000000..ed8fd37 --- /dev/null +++ b/keithley-2700-1062684/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 | +|--------------------|-------------|--------------------|---------------------|--------------|---------------------|--------|------|----|------| +|keithley|2700|1062684|datron|4805|XANS1|0.0|/data/keithley-2700-1062684---datron-4805-XANS1---SWEEP-AZERO.jpg|SWEEP-AZERO|xans| diff --git a/keithley-2700-1062684/datron-4805-XANS1/data/INLV-2700DAT.py b/keithley-2700-1062684/datron-4805-XANS1/data/INLV-2700DAT.py new file mode 100644 index 0000000..8254b78 --- /dev/null +++ b/keithley-2700-1062684/datron-4805-XANS1/data/INLV-2700DAT.py @@ -0,0 +1,178 @@ +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(23) +# 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 K2700 +inst3.write("*RST") +inst3.write("SENS:VOLT:DC:RANG 10") +inst3.write("SENS:VOLT:DC:NPLC 50") +inst3.write("SYST:AZER:STAT ON") +inst3.query("READ?") +# Measurement functions +def readValue(instObj): + instObj.query("READ?") + value = "" + while value == "": + value = inst3.read() + value = value.split('V', 1)[0] + 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/keithley-2700-1062684/datron-4805-XANS1/data/keithley-2700-1062684---datron-4805-XANS1---SWEEP-AZERO.csv b/keithley-2700-1062684/datron-4805-XANS1/data/keithley-2700-1062684---datron-4805-XANS1---SWEEP-AZERO.csv new file mode 100644 index 0000000..7a9cb7e --- /dev/null +++ b/keithley-2700-1062684/datron-4805-XANS1/data/keithley-2700-1062684---datron-4805-XANS1---SWEEP-AZERO.csv @@ -0,0 +1,142 @@ +DateTime,Set Volts,Measured Volts,Env Pressure,Env Temperature,Env Humidity +14-02-24 15:30:28,-11.5,-11.5000153,62.99,22.04,1014.65 +14-02-24 15:30:36,-11.5,-11.5000162,62.96,21.72,1014.13 +14-02-24 15:30:44,-11.5,-11.5000162,62.96,22.05,1014.64 +14-02-24 15:31:53,-11.0,-11.0000153,63.01,22.05,1014.64 +14-02-24 15:32:01,-11.0,-11.0000153,63.03,22.05,1014.64 +14-02-24 15:32:09,-11.0,-11.0000143,63.06,22.06,1014.6 +14-02-24 15:33:18,-10.5,-10.5000153,63.06,22.08,1014.7 +14-02-24 15:33:26,-10.5,-10.5000153,63.06,22.09,1014.66 +14-02-24 15:33:34,-10.5,-10.5000162,63.02,21.23,1013.17 +14-02-24 15:34:43,-10.0,-10.0000153,63.1,21.78,1014.16 +14-02-24 15:34:52,-10.0,-10.0000143,63.15,22.09,1014.69 +14-02-24 15:35:00,-10.0,-10.0000143,63.16,22.1,1014.67 +14-02-24 15:36:09,-9.5,-9.50001431,63.38,22.04,1014.67 +14-02-24 15:36:17,-9.5,-9.50001335,63.34,21.98,1014.63 +14-02-24 15:36:25,-9.5,-9.50001431,63.13,21.93,1014.66 +14-02-24 15:37:34,-9.0,-9.00001335,63.31,21.83,1014.76 +14-02-24 15:37:42,-9.0,-9.00001335,63.43,21.84,1014.66 +14-02-24 15:37:50,-9.0,-9.0000124,63.46,21.85,1014.74 +14-02-24 15:38:59,-8.5,-8.50001144,63.03,21.11,1013.34 +14-02-24 15:39:07,-8.5,-8.50001049,63.05,21.42,1013.86 +14-02-24 15:39:15,-8.5,-8.50001049,63.02,21.93,1014.71 +14-02-24 15:40:25,-8.0,-8.00001049,62.95,22.0,1014.76 +14-02-24 15:40:33,-8.0,-8.00001144,62.96,21.99,1014.67 +14-02-24 15:40:41,-8.0,-8.00000954,62.96,21.99,1014.72 +14-02-24 15:41:50,-7.5,-7.5000124,62.96,22.03,1014.66 +14-02-24 15:41:58,-7.5,-7.50001144,62.98,22.01,1014.62 +14-02-24 15:42:06,-7.5,-7.50001049,62.93,22.04,1014.73 +14-02-24 15:43:15,-7.0,-7.00000954,62.86,21.33,1013.48 +14-02-24 15:43:23,-7.0,-7.00000954,62.89,22.05,1014.61 +14-02-24 15:43:31,-7.0,-7.00000906,62.92,22.05,1014.59 +14-02-24 15:44:40,-6.5,-6.50001192,63.21,22.04,1014.64 +14-02-24 15:44:48,-6.5,-6.50001001,63.22,21.88,1014.41 +14-02-24 15:44:56,-6.5,-6.50001001,63.24,22.05,1014.69 +14-02-24 15:46:05,-6.0,-6.00000954,63.31,21.67,1014.11 +14-02-24 15:46:14,-6.0,-6.00001001,63.33,22.03,1014.61 +14-02-24 15:46:22,-6.0,-6.00000954,63.33,22.04,1014.62 +14-02-24 15:47:31,-5.5,-5.50000811,63.34,22.03,1014.65 +14-02-24 15:47:39,-5.5,-5.50000715,63.38,21.68,1014.1 +14-02-24 15:47:47,-5.5,-5.50000858,63.36,22.01,1014.7 +14-02-24 15:48:56,-5.0,-5.00000763,63.52,21.72,1014.14 +14-02-24 15:49:04,-5.0,-5.00000763,63.53,21.54,1013.86 +14-02-24 15:49:12,-5.0,-5.00000763,63.56,21.73,1014.05 +14-02-24 15:50:21,-4.5,-4.50000715,63.55,22.03,1014.6 +14-02-24 15:50:29,-4.5,-4.50000811,63.57,22.04,1014.64 +14-02-24 15:50:37,-4.5,-4.50000811,63.51,21.75,1014.11 +14-02-24 15:51:46,-4.0,-4.00000429,63.69,22.01,1014.6 +14-02-24 15:51:55,-4.0,-4.00000429,63.55,20.12,1011.29 +14-02-24 15:52:03,-4.0,-4.00000429,63.66,22.03,1014.73 +14-02-24 15:53:12,-3.5,-3.5000031,63.59,20.51,1012.06 +14-02-24 15:53:20,-3.5,-3.50000358,63.77,22.05,1014.61 +14-02-24 15:53:28,-3.5,-3.50000334,63.66,22.04,1014.65 +14-02-24 15:54:37,-3.0,-3.00000072,63.71,22.07,1014.67 +14-02-24 15:54:45,-3.0,-2.99999976,63.67,21.1,1013.09 +14-02-24 15:54:53,-3.0,-3.00000191,63.74,22.06,1014.66 +14-02-24 15:56:02,-2.5,-2.49999809,63.82,21.56,1013.84 +14-02-24 15:56:10,-2.5,-2.49999857,63.79,20.93,1012.74 +14-02-24 15:56:18,-2.5,-2.49999857,63.87,22.07,1014.64 +14-02-24 15:57:27,-2.0,-1.99999952,63.84,22.04,1014.78 +14-02-24 15:57:36,-2.0,-1.99999845,63.87,22.04,1014.64 +14-02-24 15:57:44,-2.0,-1.99999881,63.84,22.03,1014.71 +14-02-24 15:58:53,-1.5,-1.4999969,63.83,21.69,1014.36 +14-02-24 15:59:01,-1.5,-1.49999654,63.74,21.91,1014.68 +14-02-24 15:59:09,-1.5,-1.49999642,63.83,21.91,1014.65 +14-02-24 16:00:18,-1.0,-0.999996185,63.6,21.8,1014.59 +14-02-24 16:00:26,-1.0,-0.999996066,63.53,21.27,1013.75 +14-02-24 16:00:34,-1.0,-0.999997199,63.59,21.82,1014.63 +14-02-24 16:01:43,-0.5,-0.499993712,63.38,21.91,1014.72 +14-02-24 16:01:51,-0.5,-0.499992907,63.35,21.92,1014.69 +14-02-24 16:01:59,-0.5,-0.499992728,63.27,21.93,1014.68 +14-02-24 16:03:08,0.0,3.09357165e-06,63.13,21.63,1014.01 +14-02-24 16:03:17,0.0,3.76589287e-06,63.12,22.0,1014.68 +14-02-24 16:03:25,0.0,4.21030836e-06,63.11,22.0,1014.6 +14-02-24 16:04:34,0.5,0.499994785,63.15,22.01,1014.7 +14-02-24 16:04:42,0.5,0.499994665,63.04,20.47,1012.01 +14-02-24 16:04:50,0.5,0.499994546,63.13,22.02,1014.65 +14-02-24 16:05:59,1.0,0.99999702,63.2,22.03,1014.71 +14-02-24 16:06:07,1.0,0.999996126,63.19,22.03,1014.73 +14-02-24 16:06:15,1.0,0.999996066,63.16,21.67,1014.08 +14-02-24 16:07:24,1.5,1.49999821,63.15,21.89,1014.43 +14-02-24 16:07:32,1.5,1.49999809,62.92,19.3,1010.32 +14-02-24 16:07:40,1.5,1.49999797,63.18,22.06,1014.71 +14-02-24 16:08:49,2.0,1.99999595,63.21,22.07,1014.65 +14-02-24 16:08:58,2.0,1.9999963,63.2,21.78,1014.18 +14-02-24 16:09:06,2.0,1.99999702,63.22,22.07,1014.64 +14-02-24 16:10:15,2.5,2.49999428,63.31,22.03,1014.61 +14-02-24 16:10:23,2.5,2.49999499,63.34,22.06,1014.68 +14-02-24 16:10:31,2.5,2.49999595,63.35,21.62,1013.97 +14-02-24 16:11:41,3.0,2.99999809,63.52,22.07,1014.78 +14-02-24 16:11:49,3.0,2.99999881,63.54,22.07,1014.73 +14-02-24 16:11:57,3.0,2.99999905,63.52,22.09,1014.7 +14-02-24 16:13:06,3.5,3.49999905,63.42,21.25,1013.22 +14-02-24 16:13:14,3.5,3.49999905,63.45,22.1,1014.68 +14-02-24 16:13:22,3.5,3.49999809,63.47,21.8,1014.22 +14-02-24 16:14:32,4.0,4.00000143,63.5,21.78,1014.07 +14-02-24 16:14:40,4.0,4.00000191,63.5,22.12,1014.7 +14-02-24 16:14:48,4.0,4.00000191,63.55,22.12,1014.71 +14-02-24 16:15:58,4.5,4.50000572,63.53,22.14,1014.71 +14-02-24 16:16:06,4.5,4.50000381,63.53,22.13,1014.75 +14-02-24 16:16:14,4.5,4.50000477,63.54,21.76,1014.12 +14-02-24 16:17:23,5.0,5.00000572,63.72,22.1,1014.75 +14-02-24 16:17:31,5.0,5.00000572,63.73,22.09,1014.66 +14-02-24 16:17:39,5.0,5.0000062,63.77,22.09,1014.69 +14-02-24 16:18:48,5.5,5.50000858,63.87,22.09,1014.7 +14-02-24 16:18:56,5.5,5.50000906,63.89,22.09,1014.7 +14-02-24 16:19:04,5.5,5.50000811,63.93,22.08,1014.64 +14-02-24 16:20:13,6.0,6.00000906,63.88,22.08,1014.69 +14-02-24 16:20:21,6.0,6.00000906,63.91,22.09,1014.65 +14-02-24 16:20:29,6.0,6.00000906,63.88,22.08,1014.71 +14-02-24 16:21:39,6.5,6.50001192,63.96,22.08,1014.7 +14-02-24 16:21:47,6.5,6.50001097,63.97,22.08,1014.71 +14-02-24 16:21:55,6.5,6.50001097,64.01,22.07,1014.65 +14-02-24 16:23:04,7.0,7.00001001,64.04,22.08,1014.63 +14-02-24 16:23:12,7.0,7.00000858,64.04,22.08,1014.67 +14-02-24 16:23:20,7.0,7.00000763,64.05,22.07,1014.72 +14-02-24 16:24:29,7.5,7.50001097,64.01,22.12,1014.68 +14-02-24 16:24:37,7.5,7.50001144,63.98,22.13,1014.75 +14-02-24 16:24:45,7.5,7.5000124,63.97,22.13,1014.77 +14-02-24 16:25:54,8.0,8.00001144,64.04,21.75,1014.24 +14-02-24 16:26:02,8.0,8.0000124,64.07,22.11,1014.68 +14-02-24 16:26:10,8.0,8.00001335,64.01,21.27,1013.31 +14-02-24 16:27:20,8.5,8.50001717,64.15,21.75,1014.11 +14-02-24 16:27:28,8.5,8.50001717,64.15,22.09,1014.73 +14-02-24 16:27:36,8.5,8.50001812,64.18,22.09,1014.7 +14-02-24 16:28:45,9.0,9.00002098,64.15,22.1,1014.75 +14-02-24 16:28:53,9.0,9.00002098,64.15,22.1,1014.67 +14-02-24 16:29:01,9.0,9.00002193,64.17,22.1,1014.73 +14-02-24 16:30:10,9.5,9.50002003,64.11,21.59,1013.78 +14-02-24 16:30:18,9.5,9.50002098,64.14,22.12,1014.68 +14-02-24 16:30:26,9.5,9.50002098,64.18,21.46,1013.62 +14-02-24 16:31:35,10.0,10.000021,64.32,22.11,1014.74 +14-02-24 16:31:43,10.0,10.00002,64.31,22.11,1014.66 +14-02-24 16:31:51,10.0,10.00002,64.36,22.1,1014.75 +14-02-24 16:33:01,10.5,10.5000229,64.39,22.1,1014.72 +14-02-24 16:33:09,10.5,10.5000229,64.43,22.09,1014.66 +14-02-24 16:33:17,10.5,10.5000229,64.39,22.11,1014.77 +14-02-24 16:34:26,11.0,11.0000229,64.25,22.12,1014.74 +14-02-24 16:34:34,11.0,11.0000257,64.31,21.79,1014.14 +14-02-24 16:34:42,11.0,11.0000248,64.35,22.12,1014.7 +14-02-24 16:35:51,11.5,11.5000238,64.52,22.13,1014.69 +14-02-24 16:35:59,11.5,11.5000229,64.44,22.12,1014.71 +14-02-24 16:36:07,11.5,11.5000229,64.46,22.13,1014.72 diff --git a/keithley-2700-1062684/datron-4805-XANS1/data/keithley-2700-1062684---datron-4805-XANS1---SWEEP-AZERO.jpg b/keithley-2700-1062684/datron-4805-XANS1/data/keithley-2700-1062684---datron-4805-XANS1---SWEEP-AZERO.jpg new file mode 100644 index 0000000..1b7eae7 Binary files /dev/null and b/keithley-2700-1062684/datron-4805-XANS1/data/keithley-2700-1062684---datron-4805-XANS1---SWEEP-AZERO.jpg differ