Add INL Sweep advantest-R6581T-781T0050---datron-4805-XANS1---TEST3.csv
This commit is contained in:
parent
5c3d0272ae
commit
6fd36822bb
3
advantest-R6581T-781T0050/datron-4805-XANS1/README.md
Normal file
3
advantest-R6581T-781T0050/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 |
|
||||||
|
|--------------------|-------------|--------------------|---------------------|--------------|---------------------|--------|------|----|------|
|
||||||
|
|advantest|R6581T|781T0050|datron|4805|XANS1|0.0|/data/advantest-R6581T-781T0050---datron-4805-XANS1---TEST3.jpg|TEST3|xans|
|
||||||
175
advantest-R6581T-781T0050/datron-4805-XANS1/data/INLV-AdvDat.py
Normal file
175
advantest-R6581T-781T0050/datron-4805-XANS1/data/INLV-AdvDat.py
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
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("S0=") #LocalSense
|
||||||
|
inst2.query("M0.0069=") #6.9mV Out, sanity check
|
||||||
|
inst2.query("O1=") #OutputON
|
||||||
|
# Advantest R6581T
|
||||||
|
inst3.query("*RST")
|
||||||
|
inst3.query(":CONF:VOLT:DC")
|
||||||
|
inst3.query(":SENS:VOLT:NPLC 100")
|
||||||
|
inst3.query(":SENS:VOLT:DIG MAX")
|
||||||
|
inst3.query(":SENS:VOLT:RANG 10")
|
||||||
|
inst3.query(":ZERO:AUTO ON")
|
||||||
|
|
||||||
|
# Measurement functions
|
||||||
|
def readValue(instObj):
|
||||||
|
value = instObj.query("FETch?")
|
||||||
|
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(-12,0,0.5)
|
||||||
|
|
||||||
|
cntr = 0
|
||||||
|
d = datetime.datetime.now()
|
||||||
|
dlast = datetime.datetime.now()
|
||||||
|
## Collect data
|
||||||
|
time.sleep(60)
|
||||||
|
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(10)
|
||||||
|
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=False)
|
||||||
|
highOrderPolyFit = np.polyfit(df["Set Volts"], df["Set Volts"]-df["Measured Volts"], 35)
|
||||||
|
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.9,0.1,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,73 @@
|
|||||||
|
DateTime,Set Volts,Measured Volts,Env Pressure,Env Temperature,Env Humidity
|
||||||
|
10-12-23 22:57:37,-12.0,-11.9999804,61.2,19.11,999.41
|
||||||
|
10-12-23 22:57:42,-12.0,-11.9999816,61.16,19.1,999.45
|
||||||
|
10-12-23 22:57:47,-12.0,-11.9999831,61.11,19.09,999.34
|
||||||
|
10-12-23 22:58:03,-11.5,-11.4999845,61.13,19.08,999.42
|
||||||
|
10-12-23 22:58:09,-11.5,-11.4999847,61.13,19.1,999.4
|
||||||
|
10-12-23 22:58:14,-11.5,-11.4999853,61.07,19.08,999.34
|
||||||
|
10-12-23 22:58:30,-11.0,-10.9999868,61.08,19.08,999.4
|
||||||
|
10-12-23 22:58:35,-11.0,-10.9999867,61.08,19.1,999.5
|
||||||
|
10-12-23 22:58:40,-11.0,-10.999987,61.1,19.08,999.44
|
||||||
|
10-12-23 22:58:56,-10.5,-10.4999856,61.1,19.08,999.44
|
||||||
|
10-12-23 22:59:01,-10.5,-10.4999856,61.11,19.09,999.38
|
||||||
|
10-12-23 22:59:06,-10.5,-10.4999855,61.1,19.07,999.41
|
||||||
|
10-12-23 22:59:22,-10.0,-9.9999864,61.13,19.07,999.45
|
||||||
|
10-12-23 22:59:27,-10.0,-9.9999868,61.16,19.06,999.46
|
||||||
|
10-12-23 22:59:32,-10.0,-9.9999868,61.19,19.06,999.42
|
||||||
|
10-12-23 22:59:48,-9.5,-9.4999863,61.21,19.05,999.47
|
||||||
|
10-12-23 22:59:53,-9.5,-9.4999866,61.2,19.04,999.4
|
||||||
|
10-12-23 22:59:58,-9.5,-9.499986,61.22,19.04,999.43
|
||||||
|
10-12-23 23:00:14,-9.0,-8.9999869,61.24,19.04,999.38
|
||||||
|
10-12-23 23:00:19,-9.0,-8.9999866,61.22,19.04,999.4
|
||||||
|
10-12-23 23:00:24,-9.0,-8.9999867,61.22,19.04,999.41
|
||||||
|
10-12-23 23:00:40,-8.5,-8.4999857,61.31,19.03,999.38
|
||||||
|
10-12-23 23:00:45,-8.5,-8.4999861,61.3,19.04,999.44
|
||||||
|
10-12-23 23:00:50,-8.5,-8.4999857,61.28,19.04,999.41
|
||||||
|
10-12-23 23:01:06,-8.0,-7.999987,61.21,19.07,999.43
|
||||||
|
10-12-23 23:01:11,-8.0,-7.9999868,61.17,19.07,999.46
|
||||||
|
10-12-23 23:01:16,-8.0,-7.9999865,61.21,19.07,999.38
|
||||||
|
10-12-23 23:01:32,-7.5,-7.4999863,61.1,19.08,999.44
|
||||||
|
10-12-23 23:01:37,-7.5,-7.4999864,61.09,19.09,999.38
|
||||||
|
10-12-23 23:01:42,-7.5,-7.4999861,61.1,19.1,999.45
|
||||||
|
10-12-23 23:01:58,-7.0,-6.9999873,61.07,19.1,999.4
|
||||||
|
10-12-23 23:02:03,-7.0,-6.9999868,61.06,19.09,999.39
|
||||||
|
10-12-23 23:02:08,-7.0,-6.9999866,61.07,19.09,999.39
|
||||||
|
10-12-23 23:02:24,-6.5,-6.4999883,61.07,19.08,999.39
|
||||||
|
10-12-23 23:02:30,-6.5,-6.4999882,61.11,19.1,999.4
|
||||||
|
10-12-23 23:02:35,-6.5,-6.4999882,61.13,19.09,999.41
|
||||||
|
10-12-23 23:02:51,-6.0,-5.9999874,61.14,19.09,999.43
|
||||||
|
10-12-23 23:02:56,-6.0,-5.9999876,61.12,19.09,999.41
|
||||||
|
10-12-23 23:03:01,-6.0,-5.9999873,61.1,19.08,999.31
|
||||||
|
10-12-23 23:03:17,-5.5,-5.4999885,61.18,19.06,999.42
|
||||||
|
10-12-23 23:03:22,-5.5,-5.4999884,61.17,19.05,999.43
|
||||||
|
10-12-23 23:03:27,-5.5,-5.4999882,61.18,19.06,999.41
|
||||||
|
10-12-23 23:03:43,-5.0,-4.999988,61.16,19.06,999.42
|
||||||
|
10-12-23 23:03:48,-5.0,-4.9999878,61.15,19.06,999.44
|
||||||
|
10-12-23 23:03:53,-5.0,-4.9999878,61.19,19.07,999.45
|
||||||
|
10-12-23 23:04:09,-4.5,-4.499989,61.27,19.04,999.41
|
||||||
|
10-12-23 23:04:14,-4.5,-4.4999889,61.28,19.05,999.45
|
||||||
|
10-12-23 23:04:19,-4.5,-4.4999887,61.25,19.06,999.41
|
||||||
|
10-12-23 23:04:35,-4.0,-3.9999885,61.22,19.05,999.45
|
||||||
|
10-12-23 23:04:40,-4.0,-3.9999885,61.25,19.05,999.43
|
||||||
|
10-12-23 23:04:45,-4.0,-3.9999885,61.29,19.03,999.41
|
||||||
|
10-12-23 23:05:01,-3.5,-3.4999901,61.33,19.06,999.38
|
||||||
|
10-12-23 23:05:06,-3.5,-3.4999899,61.27,19.07,999.4
|
||||||
|
10-12-23 23:05:11,-3.5,-3.4999899,61.25,19.07,999.4
|
||||||
|
10-12-23 23:05:27,-3.0,-2.9999899,61.23,19.08,999.39
|
||||||
|
10-12-23 23:05:32,-3.0,-2.9999895,61.14,19.07,999.4
|
||||||
|
10-12-23 23:05:37,-3.0,-2.9999896,61.2,19.07,999.49
|
||||||
|
10-12-23 23:05:53,-2.5,-2.4999901,61.16,19.09,999.41
|
||||||
|
10-12-23 23:05:58,-2.5,-2.4999901,61.14,19.08,999.39
|
||||||
|
10-12-23 23:06:03,-2.5,-2.4999899,61.14,19.08,999.36
|
||||||
|
10-12-23 23:06:19,-2.0,-1.9999907,61.19,19.06,999.42
|
||||||
|
10-12-23 23:06:24,-2.0,-1.9999904,61.19,19.09,999.44
|
||||||
|
10-12-23 23:06:29,-2.0,-1.9999902,61.16,19.09,999.38
|
||||||
|
10-12-23 23:06:45,-1.5,-1.4999911,61.13,19.09,999.38
|
||||||
|
10-12-23 23:06:50,-1.5,-1.4999914,61.14,19.09,999.41
|
||||||
|
10-12-23 23:06:56,-1.5,-1.499991,61.12,19.1,999.46
|
||||||
|
10-12-23 23:07:12,-1.0,-0.9999921,61.1,19.1,999.42
|
||||||
|
10-12-23 23:07:17,-1.0,-0.9999921,61.11,19.08,999.39
|
||||||
|
10-12-23 23:07:22,-1.0,-0.9999921,61.13,19.07,999.41
|
||||||
|
10-12-23 23:07:38,-0.5,-0.4999912,61.16,19.06,999.36
|
||||||
|
10-12-23 23:07:43,-0.5,-0.499991,61.21,19.07,999.41
|
||||||
|
10-12-23 23:07:48,-0.5,-0.499991,61.17,19.07,999.43
|
||||||
|
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
Loading…
x
Reference in New Issue
Block a user