diff --git a/solartron-7061-201216/datron-4805-XANS1/README.md b/solartron-7061-201216/datron-4805-XANS1/README.md new file mode 100644 index 0000000..f4fa94f --- /dev/null +++ b/solartron-7061-201216/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 | +|--------------------|-------------|--------------------|---------------------|--------------|---------------------|--------|------|----|------| +|solartron|7061|201216|datron|4805|XANS1|0.0|/data/solartron-7061-201216---datron-4805-XANS1---SWEEP1.jpg|SWEEP1|xans| diff --git a/solartron-7061-201216/datron-4805-XANS1/data/INLV-SolDat.py b/solartron-7061-201216/datron-4805-XANS1/data/INLV-SolDat.py new file mode 100644 index 0000000..534fe11 --- /dev/null +++ b/solartron-7061-201216/datron-4805-XANS1/data/INLV-SolDat.py @@ -0,0 +1,187 @@ +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(16) +# 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 + +# Solartron S7061 +inst3.query("BEEp") +inst3.query("MODE VDc") +inst3.query("RANGE 10") +inst3.query("DIGits 7") +inst3.query("DRift OFf") + +# Measurement functions +def readValue(instObj): + instObj.query("TRIgger") + counter = 0 + a = instObj.read() + prevA = a + while(a == prevA and counter < 30): + a = instObj.read() + time.sleep(0.1) + counter = counter + 1 + instObj.query("DISplay []") + print(a) + b = a[14:18] + a = a[1:10] + value = a + 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", "8") + 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(30) +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(30) + 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"], 8) +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/solartron-7061-201216/datron-4805-XANS1/data/solartron-7061-201216---datron-4805-XANS1---SWEEP1.csv b/solartron-7061-201216/datron-4805-XANS1/data/solartron-7061-201216---datron-4805-XANS1---SWEEP1.csv new file mode 100644 index 0000000..2a643f3 --- /dev/null +++ b/solartron-7061-201216/datron-4805-XANS1/data/solartron-7061-201216---datron-4805-XANS1---SWEEP1.csv @@ -0,0 +1,142 @@ +DateTime,Set Volts,Measured Volts,Env Pressure,Env Temperature,Env Humidity +11-12-23 20:22:00,-11.5,11.50029,54.35,21.6,1006.17 +11-12-23 20:22:15,-11.5,11.50029,54.4,21.51,1006.01 +11-12-23 20:22:30,-11.5,11.500294,54.4,21.57,1006.11 +11-12-23 20:23:17,-11.0,11.00028,54.47,21.56,1006.09 +11-12-23 20:23:33,-11.0,11.000279,54.37,21.55,1006.08 +11-12-23 20:23:48,-11.0,11.000278,54.33,21.61,1006.17 +11-12-23 20:24:35,-10.5,10.500263,54.29,21.55,1006.0 +11-12-23 20:24:50,-10.5,10.500265,54.32,21.6,1006.17 +11-12-23 20:25:05,-10.5,10.500262,54.33,21.58,1006.16 +11-12-23 20:25:52,-10.0,10.000254,54.19,21.65,1006.08 +11-12-23 20:26:07,-10.0,10.000255,54.18,21.58,1005.97 +11-12-23 20:26:23,-10.0,10.000253,54.27,21.52,1005.98 +11-12-23 20:27:10,-9.5,9.500236,54.13,21.31,1005.51 +11-12-23 20:27:25,-9.5,9.500239,54.1,21.58,1006.02 +11-12-23 20:27:40,-9.5,9.500236,54.21,21.59,1006.14 +11-12-23 20:28:27,-9.0,9.000223,54.24,21.55,1006.05 +11-12-23 20:28:42,-9.0,9.000225,54.24,21.6,1006.11 +11-12-23 20:28:57,-9.0,9.000222,54.23,21.6,1006.16 +11-12-23 20:29:44,-8.5,8.500208,54.17,21.6,1006.09 +11-12-23 20:30:00,-8.5,8.500211,54.11,21.64,1006.09 +11-12-23 20:30:15,-8.5,8.50021,54.03,21.57,1005.98 +11-12-23 20:31:02,-8.0,8.000195,54.15,21.6,1006.11 +11-12-23 20:31:17,-8.0,8.000193,54.15,21.54,1006.01 +11-12-23 20:31:32,-8.0,8.000194,54.03,21.56,1005.99 +11-12-23 20:32:19,-7.5,7.500183,53.95,21.67,1006.14 +11-12-23 20:32:34,-7.5,7.500181,53.96,21.66,1006.15 +11-12-23 20:32:50,-7.5,7.500181,54.04,21.64,1006.12 +11-12-23 20:33:37,-7.0,7.000168,54.05,21.64,1006.15 +11-12-23 20:33:52,-7.0,7.000166,54.0,21.67,1006.14 +11-12-23 20:34:07,-7.0,7.000166,53.99,21.66,1006.1 +11-12-23 20:34:54,-6.5,6.500154,53.95,21.66,1006.16 +11-12-23 20:35:09,-6.5,6.500154,54.03,21.62,1006.09 +11-12-23 20:35:24,-6.5,6.500155,54.03,21.62,1006.14 +11-12-23 20:36:12,-6.0,6.000142,53.95,21.63,1006.11 +11-12-23 20:36:27,-6.0,6.000143,54.01,21.64,1006.12 +11-12-23 20:36:42,-6.0,6.000141,54.15,20.99,1005.17 +11-12-23 20:37:29,-5.5,5.500129,54.08,21.58,1006.08 +11-12-23 20:37:44,-5.5,5.500131,54.13,21.5,1005.97 +11-12-23 20:37:59,-5.5,5.50013,54.11,21.62,1006.16 +11-12-23 20:38:46,-5.0,5.000116,54.05,21.42,1005.76 +11-12-23 20:39:02,-5.0,5.000114,53.97,21.65,1006.14 +11-12-23 20:39:17,-5.0,5.000115,53.96,21.59,1006.02 +11-12-23 20:40:04,-4.5,4.500102,54.0,21.58,1006.02 +11-12-23 20:40:19,-4.5,4.500103,54.1,21.57,1006.09 +11-12-23 20:40:34,-4.5,4.500101,54.04,21.52,1005.98 +11-12-23 20:41:21,-4.0,4.000086,53.9,21.66,1006.13 +11-12-23 20:41:36,-4.0,4.000088,53.89,21.62,1006.08 +11-12-23 20:41:51,-4.0,4.000088,53.91,21.21,1005.47 +11-12-23 20:42:39,-3.5,3.500078,53.99,21.62,1006.14 +11-12-23 20:42:54,-3.5,3.500073,53.85,21.58,1006.02 +11-12-23 20:43:09,-3.5,3.500075,53.86,21.47,1005.79 +11-12-23 20:43:56,-3.0,3.000059,53.96,21.54,1006.01 +11-12-23 20:44:11,-3.0,3.000061,53.93,21.63,1006.1 +11-12-23 20:44:26,-3.0,3.000061,53.93,21.63,1006.05 +11-12-23 20:45:13,-2.5,2.500044,53.75,21.68,1006.12 +11-12-23 20:45:29,-2.5,2.500044,53.74,21.72,1006.12 +11-12-23 20:45:44,-2.5,2.500046,53.65,21.68,1006.03 +11-12-23 20:46:31,-2.0,2.000034,53.77,21.59,1006.07 +11-12-23 20:46:46,-2.0,2.000034,53.91,21.53,1005.94 +11-12-23 20:47:01,-2.0,2.000031,53.95,21.5,1006.0 +11-12-23 20:47:48,-1.5,1.500022,53.78,21.19,1005.34 +11-12-23 20:48:03,-1.5,1.50002,53.81,21.54,1005.97 +11-12-23 20:48:19,-1.5,1.500022,53.9,21.61,1006.1 +11-12-23 20:49:06,-1.0,1.000009,54.05,21.53,1006.13 +11-12-23 20:49:21,-1.0,1.000009,54.05,21.56,1006.17 +11-12-23 20:49:36,-1.0,1.000008,54.06,21.55,1006.16 +11-12-23 20:50:23,-0.5,0.499996,54.04,21.56,1006.18 +11-12-23 20:50:38,-0.5,0.499996,53.98,21.5,1006.05 +11-12-23 20:50:53,-0.5,0.499996,53.89,21.56,1006.12 +11-12-23 20:51:40,0.0,1.5e-05,53.8,21.58,1006.12 +11-12-23 20:51:56,0.0,1.6e-05,53.85,21.59,1006.15 +11-12-23 20:52:11,0.0,1.3e-05,53.85,21.61,1006.18 +11-12-23 20:52:58,0.5,0.500014,53.87,21.6,1006.17 +11-12-23 20:53:13,0.5,0.500013,53.73,21.66,1006.21 +11-12-23 20:53:28,0.5,0.500013,53.73,21.65,1006.09 +11-12-23 20:54:15,1.0,1.000026,53.59,21.69,1006.27 +11-12-23 20:54:30,1.0,1.000025,53.57,21.63,1006.08 +11-12-23 20:54:46,1.0,1.000023,53.6,21.68,1006.22 +11-12-23 20:55:33,1.5,1.500037,53.55,21.69,1006.19 +11-12-23 20:55:48,1.5,1.500037,53.55,21.69,1006.21 +11-12-23 20:56:03,1.5,1.500038,53.6,21.67,1006.18 +11-12-23 20:56:50,2.0,2.000049,53.67,21.63,1006.11 +11-12-23 20:57:05,2.0,2.000049,53.74,21.62,1006.17 +11-12-23 20:57:20,2.0,2.000049,53.74,21.63,1006.13 +11-12-23 20:58:07,2.5,2.500065,53.64,21.62,1006.17 +11-12-23 20:58:23,2.5,2.500065,53.55,21.62,1006.09 +11-12-23 20:58:38,2.5,2.500063,53.59,21.53,1005.99 +11-12-23 20:59:25,3.0,3.000076,53.7,21.52,1006.08 +11-12-23 20:59:40,3.0,3.000077,53.75,21.61,1006.1 +11-12-23 20:59:55,3.0,3.000076,53.71,21.62,1006.2 +11-12-23 21:00:42,3.5,3.500092,53.77,21.56,1006.26 +11-12-23 21:00:58,3.5,3.500091,53.8,21.5,1006.1 +11-12-23 21:01:13,3.5,3.50009,53.83,21.58,1006.24 +11-12-23 21:02:00,4.0,4.000104,53.65,21.63,1006.22 +11-12-23 21:02:15,4.0,4.000103,53.67,21.55,1006.08 +11-12-23 21:02:30,4.0,4.000105,53.79,20.04,1003.97 +11-12-23 21:03:17,4.5,4.500115,53.67,21.6,1006.27 +11-12-23 21:03:32,4.5,4.500117,53.68,21.61,1006.25 +11-12-23 21:03:48,4.5,4.500117,53.68,21.57,1006.11 +11-12-23 21:04:35,5.0,5.000129,53.65,21.54,1006.17 +11-12-23 21:04:50,5.0,5.000129,53.6,21.41,1005.9 +11-12-23 21:05:05,5.0,5.000128,53.62,21.63,1006.24 +11-12-23 21:05:52,5.5,5.500144,53.57,21.63,1006.24 +11-12-23 21:06:07,5.5,5.500144,53.63,21.54,1006.18 +11-12-23 21:06:22,5.5,5.500145,53.59,21.52,1006.12 +11-12-23 21:07:10,6.0,6.000154,53.64,21.6,1006.26 +11-12-23 21:07:25,6.0,6.000154,53.68,21.53,1006.15 +11-12-23 21:07:40,6.0,6.000156,53.61,21.61,1006.28 +11-12-23 21:08:27,6.5,6.500168,53.57,21.57,1006.19 +11-12-23 21:08:42,6.5,6.500167,53.48,21.45,1005.99 +11-12-23 21:08:57,6.5,6.500168,53.54,21.6,1006.3 +11-12-23 21:09:44,7.0,7.00018,53.62,21.51,1006.25 +11-12-23 21:10:00,7.0,7.000181,53.61,21.55,1006.24 +11-12-23 21:10:15,7.0,7.000181,53.72,21.53,1006.3 +11-12-23 21:11:02,7.5,7.500195,53.67,21.56,1006.34 +11-12-23 21:11:17,7.5,7.500194,53.68,21.48,1006.18 +11-12-23 21:11:32,7.5,7.500192,53.7,21.48,1006.1 +11-12-23 21:12:19,8.0,8.000208,53.76,21.51,1006.28 +11-12-23 21:12:34,8.0,8.000206,53.77,21.42,1006.16 +11-12-23 21:12:50,8.0,8.000206,53.71,21.49,1006.22 +11-12-23 21:13:37,8.5,8.500218,53.8,21.49,1006.34 +11-12-23 21:13:52,8.5,8.50022,53.88,21.47,1006.35 +11-12-23 21:14:07,8.5,8.500221,53.79,21.53,1006.34 +11-12-23 21:14:54,9.0,9.000236,53.65,21.54,1006.34 +11-12-23 21:15:09,9.0,9.000233,53.61,21.13,1005.59 +11-12-23 21:15:24,9.0,9.000236,53.57,20.26,1004.2 +11-12-23 21:16:12,9.5,9.500246,53.62,21.58,1006.36 +11-12-23 21:16:27,9.5,9.500247,53.49,21.6,1006.43 +11-12-23 21:16:42,9.5,9.500247,53.61,21.56,1006.37 +11-12-23 21:17:29,10.0,10.00026,53.39,21.56,1006.2 +11-12-23 21:17:44,10.0,10.000259,53.4,21.61,1006.42 +11-12-23 21:17:59,10.0,10.000259,53.38,21.61,1006.34 +11-12-23 21:18:46,10.5,10.500271,53.48,21.52,1006.25 +11-12-23 21:19:02,10.5,10.500272,53.47,21.59,1006.39 +11-12-23 21:19:17,10.5,10.500272,53.54,21.51,1006.29 +11-12-23 21:20:04,11.0,11.000287,53.56,21.53,1006.34 +11-12-23 21:20:19,11.0,11.000285,53.53,21.57,1006.36 +11-12-23 21:20:34,11.0,11.000288,53.57,21.47,1006.19 +11-12-23 21:21:21,11.5,11.500296,53.59,21.52,1006.31 +11-12-23 21:21:36,11.5,11.500297,53.69,21.5,1006.43 +11-12-23 21:21:52,11.5,11.500296,53.77,21.48,1006.31 diff --git a/solartron-7061-201216/datron-4805-XANS1/data/solartron-7061-201216---datron-4805-XANS1---SWEEP1.jpg b/solartron-7061-201216/datron-4805-XANS1/data/solartron-7061-201216---datron-4805-XANS1---SWEEP1.jpg new file mode 100644 index 0000000..1ccbce0 Binary files /dev/null and b/solartron-7061-201216/datron-4805-XANS1/data/solartron-7061-201216---datron-4805-XANS1---SWEEP1.jpg differ