Add INL Sweep solartron-7081-001128---datron-4805-XANS1---SWEEP4.csv
This commit is contained in:
parent
c418c1419a
commit
c509fa2a00
3
solartron-7081-001128/datron-4805-XANS1/README.md
Normal file
3
solartron-7081-001128/datron-4805-XANS1/README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
| Meter Manufacturer | Meter Model | Meter SerialNumber | Source Manufacturer | Source Model | Source SerialNumber | MinMax | File | ID | User |
|
||||||
|
|--------------------|-------------|--------------------|---------------------|--------------|---------------------|--------|------|----|------|
|
||||||
|
|solartron|7081|001128|datron|4805|XANS1|0.0|/data/solartron-7081-001128---datron-4805-XANS1---SWEEP4.jpg|SWEEP4|xans|
|
||||||
184
solartron-7081-001128/datron-4805-XANS1/data/INLV-Sol2Dat.py
Normal file
184
solartron-7081-001128/datron-4805-XANS1/data/INLV-Sol2Dat.py
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
import time
|
||||||
|
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(18)
|
||||||
|
# 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 S7081
|
||||||
|
time.sleep(3)
|
||||||
|
inst3.write("DR=OFF")
|
||||||
|
inst3.write("MOD=VDC:RAN=10:NI=8") # 10V, 8.5 digits
|
||||||
|
inst3.write("DELI=END") # Delimeter set to END
|
||||||
|
inst3.write("OUTPUT,GP-IB,ON") # Sets output via GPIB
|
||||||
|
inst3.write("HISTORY,CLEAR")
|
||||||
|
|
||||||
|
#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.write("MEAS=SI")
|
||||||
|
time.sleep(65)
|
||||||
|
value = instObj.read()
|
||||||
|
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 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(50)
|
||||||
|
for i in range(2):
|
||||||
|
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()
|
||||||
|
|
||||||
@ -0,0 +1,95 @@
|
|||||||
|
DateTime,Set Volts,Measured Volts,Env Pressure,Env Temperature,Env Humidity
|
||||||
|
18-12-23 07:31:29,-11.5,-11.5003509,54.27,22.17,1031.21
|
||||||
|
18-12-23 07:32:40,-11.5,-11.5003513,54.36,22.12,1031.2
|
||||||
|
18-12-23 07:34:42,-11.0,-11.0003377,54.53,22.07,1031.13
|
||||||
|
18-12-23 07:35:54,-11.0,-11.0003379,54.59,22.07,1031.24
|
||||||
|
18-12-23 07:37:56,-10.5,-10.5003206,54.69,22.04,1031.2
|
||||||
|
18-12-23 07:39:07,-10.5,-10.50032,54.73,22.03,1031.23
|
||||||
|
18-12-23 07:41:09,-10.0,-10.0003052,54.77,21.99,1031.26
|
||||||
|
18-12-23 07:42:20,-10.0,-10.0003053,54.82,21.98,1031.2
|
||||||
|
18-12-23 07:44:22,-9.5,-9.50029,54.75,22.01,1031.2
|
||||||
|
18-12-23 07:45:33,-9.5,-9.5002904,54.87,21.97,1031.18
|
||||||
|
18-12-23 07:47:35,-9.0,-9.0002745,54.98,21.92,1031.25
|
||||||
|
18-12-23 07:48:46,-9.0,-9.0002751,54.99,21.9,1031.25
|
||||||
|
18-12-23 07:50:48,-8.5,-8.5002578,54.98,21.89,1031.26
|
||||||
|
18-12-23 07:51:59,-8.5,-8.5002582,55.03,21.89,1031.31
|
||||||
|
18-12-23 07:54:02,-8.0,-8.0002428,55.12,21.86,1031.31
|
||||||
|
18-12-23 07:55:13,-8.0,-8.0002428,55.25,21.81,1031.37
|
||||||
|
18-12-23 07:57:15,-7.5,-7.5002272,54.98,21.83,1031.29
|
||||||
|
18-12-23 07:58:26,-7.5,-7.5002273,55.11,21.79,1031.35
|
||||||
|
18-12-23 08:00:28,-7.0,-7.000212,55.22,21.75,1031.34
|
||||||
|
18-12-23 08:01:39,-7.0,-7.0002115,55.27,21.77,1031.31
|
||||||
|
18-12-23 08:03:41,-6.5,-6.5001959,55.37,21.75,1031.41
|
||||||
|
18-12-23 08:04:52,-6.5,-6.5001959,55.51,21.69,1031.42
|
||||||
|
18-12-23 08:06:54,-6.0,-6.0001804,55.68,21.65,1031.38
|
||||||
|
18-12-23 08:08:06,-6.0,-6.0001797,55.66,21.65,1031.33
|
||||||
|
18-12-23 08:10:08,-5.5,-5.5001652,55.55,21.57,1031.35
|
||||||
|
18-12-23 08:11:19,-5.5,-5.5001654,55.9,21.47,1031.45
|
||||||
|
18-12-23 08:13:21,-5.0,-5.0001495,56.08,21.42,1031.38
|
||||||
|
18-12-23 08:14:32,-5.0,-5.0001491,56.14,21.38,1031.31
|
||||||
|
18-12-23 08:16:34,-4.5,-4.5001333,55.95,21.44,1031.39
|
||||||
|
18-12-23 08:17:45,-4.5,-4.5001344,55.97,21.45,1031.44
|
||||||
|
18-12-23 08:19:47,-4.0,-4.0001176,55.86,21.49,1031.34
|
||||||
|
18-12-23 08:20:58,-4.0,-4.0001178,55.83,21.43,1031.3
|
||||||
|
18-12-23 08:23:00,-3.5,-3.5001034,56.05,21.36,1031.31
|
||||||
|
18-12-23 08:24:12,-3.5,-3.5001033,56.07,21.32,1031.27
|
||||||
|
18-12-23 08:26:14,-3.0,-3.0000874,56.27,21.25,1031.31
|
||||||
|
18-12-23 08:27:25,-3.0,-3.0000866,56.25,21.25,1031.32
|
||||||
|
18-12-23 08:29:27,-2.5,-2.5000722,56.42,21.24,1031.26
|
||||||
|
18-12-23 08:30:38,-2.5,-2.5000718,56.19,21.28,1031.24
|
||||||
|
18-12-23 08:32:40,-2.0,-2.0000564,56.37,21.22,1031.22
|
||||||
|
18-12-23 08:33:51,-2.0,-2.0000558,56.5,21.21,1031.25
|
||||||
|
18-12-23 08:35:53,-1.5,-1.5000416,56.51,21.2,1031.29
|
||||||
|
18-12-23 08:37:04,-1.5,-1.5000419,56.53,21.24,1031.23
|
||||||
|
18-12-23 08:39:06,-1.0,-1.000027,56.6,21.19,1031.25
|
||||||
|
18-12-23 08:40:18,-1.0,-1.0000267,56.26,21.23,1031.21
|
||||||
|
18-12-23 08:42:20,-0.5,-0.5000118,56.2,21.32,1031.23
|
||||||
|
18-12-23 08:43:31,-0.5,-0.5000117,56.24,21.27,1031.28
|
||||||
|
18-12-23 08:45:33,0.0,2.9e-06,56.66,21.18,1031.26
|
||||||
|
18-12-23 08:46:44,0.0,3.2e-06,56.87,21.19,1031.31
|
||||||
|
18-12-23 08:48:46,0.5,0.5000084,56.41,21.06,1031.25
|
||||||
|
18-12-23 08:49:57,0.5,0.5000089,56.58,20.97,1031.17
|
||||||
|
18-12-23 08:51:59,1.0,1.0000247,57.06,20.85,1031.2
|
||||||
|
18-12-23 08:53:10,1.0,1.0000249,57.46,20.86,1031.2
|
||||||
|
18-12-23 08:55:12,1.5,1.5000394,57.64,20.87,1031.1
|
||||||
|
18-12-23 08:56:24,1.5,1.5000388,57.43,20.98,1031.08
|
||||||
|
18-12-23 08:58:26,2.0,2.000055,57.21,21.0,1031.08
|
||||||
|
18-12-23 08:59:37,2.0,2.0000543,57.32,20.97,1031.08
|
||||||
|
18-12-23 09:01:39,2.5,2.5000702,57.56,20.88,1031.12
|
||||||
|
18-12-23 09:02:50,2.5,2.500071,57.67,20.94,1031.01
|
||||||
|
18-12-23 09:04:52,3.0,3.0000869,57.41,20.97,1031.01
|
||||||
|
18-12-23 09:06:03,3.0,3.0000871,57.28,21.01,1030.98
|
||||||
|
18-12-23 09:08:05,3.5,3.5001018,57.06,21.04,1030.92
|
||||||
|
18-12-23 09:09:16,3.5,3.5001021,57.18,21.05,1030.88
|
||||||
|
18-12-23 09:11:18,4.0,4.0001174,57.13,21.08,1030.94
|
||||||
|
18-12-23 09:12:29,4.0,4.0001168,57.0,21.12,1030.87
|
||||||
|
18-12-23 09:14:32,4.5,4.5001331,56.8,21.23,1030.82
|
||||||
|
18-12-23 09:15:43,4.5,4.5001328,56.63,21.28,1030.73
|
||||||
|
18-12-23 09:17:45,5.0,5.0001484,56.4,21.34,1030.77
|
||||||
|
18-12-23 09:18:56,5.0,5.0001492,56.21,21.42,1030.76
|
||||||
|
18-12-23 09:20:58,5.5,5.500165,56.25,21.42,1030.77
|
||||||
|
18-12-23 09:22:09,5.5,5.5001647,56.21,21.44,1030.81
|
||||||
|
18-12-23 09:24:11,6.0,6.0001794,56.13,21.51,1030.82
|
||||||
|
18-12-23 09:25:22,6.0,6.000179,56.17,21.49,1030.86
|
||||||
|
18-12-23 09:27:24,6.5,6.5001963,56.14,21.56,1030.89
|
||||||
|
18-12-23 09:28:35,6.5,6.5001957,56.08,21.56,1030.79
|
||||||
|
18-12-23 09:30:38,7.0,7.0002107,56.14,21.6,1030.91
|
||||||
|
18-12-23 09:31:49,7.0,7.000211,55.85,21.7,1030.87
|
||||||
|
18-12-23 09:33:51,7.5,7.5002257,55.84,21.42,1030.37
|
||||||
|
18-12-23 09:35:02,7.5,7.5002262,55.9,21.7,1030.82
|
||||||
|
18-12-23 09:37:04,8.0,8.0002418,55.9,21.76,1030.84
|
||||||
|
18-12-23 09:38:15,8.0,8.0002421,55.8,21.8,1030.86
|
||||||
|
18-12-23 09:40:17,8.5,8.5002572,55.71,21.82,1030.84
|
||||||
|
18-12-23 09:41:28,8.5,8.5002559,55.8,21.78,1030.85
|
||||||
|
18-12-23 09:43:30,9.0,9.000273,56.0,21.71,1030.87
|
||||||
|
18-12-23 09:44:41,9.0,9.0002729,55.96,21.72,1030.83
|
||||||
|
18-12-23 09:46:44,9.5,9.5002888,56.04,21.7,1030.84
|
||||||
|
18-12-23 09:47:55,9.5,9.500288,56.06,21.68,1030.9
|
||||||
|
18-12-23 09:49:57,10.0,10.0003036,56.07,21.68,1030.87
|
||||||
|
18-12-23 09:51:08,10.0,10.0003035,56.12,21.67,1030.93
|
||||||
|
18-12-23 09:53:10,10.5,10.5003176,56.04,21.71,1031.0
|
||||||
|
18-12-23 09:54:21,10.5,10.5003179,56.02,21.69,1030.99
|
||||||
|
18-12-23 09:56:23,11.0,11.0003344,56.12,21.65,1030.92
|
||||||
|
18-12-23 09:57:34,11.0,11.0003353,56.12,21.66,1030.93
|
||||||
|
18-12-23 09:59:36,11.5,11.5003495,56.09,21.68,1030.87
|
||||||
|
18-12-23 10:00:48,11.5,11.500349,56.14,21.64,1030.8
|
||||||
|
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
Loading…
x
Reference in New Issue
Block a user