CEAN NDT1471
4通道高压插件,输出范围:5.5 kV / 300µA,官网介绍详见这里
Python控制与监测
NDT1471的远程控制没有使用VISA标准,需要用户根据编程手册进行开发。这里截取了一部分

讯享网


设备配置
通过触摸屏将修改插件的IP地址,如192.168.10.22,使能remote模式

连接网线
通过ping测试连接
Python脚本
#encoding: utf-8 import traceback import socket import sys import numpy as np import glob import time debug = 0 def checkSaveFileName(basefname): fname = "%s.csv"%(basefname) i = 2 while len(glob.glob(fname)) > 0: fname = "%s_%g.csv"%(basefname, i) i = i + 1 if i != 2: print ("saved file %s"%fname) return fname def query(ndt1471, sendmsg): ndt1471.send(sendmsg.encode("utf-8")) recvmsg = str(ndt1471.recv(1024).decode("utf-8")) if debug: print(recvmsg) return recvmsg def main(): ndt1471_addr = ("192.168.10.22", 1470) module_address = 0 channel_num = 0 voltage_step = 100 # V voltage_max = 2000 # V voltage_ramp_up = 10 # V/s, from 1 to 500 voltage_ramp_down = 500 # V/s, from 1 to 500 current_limit = 10.0 # uA trip_time = 0.1 # s, Maximum time an "overcurrent" is allowed to last, 0.1~? wait_time = 1+voltage_step/voltage_ramp_up repeat = 10 if len(sys.argv) < 2: print ('input log file name') return 0 else: basefname = sys.argv[1] # check output file duplicate fname = checkSaveFileName('./'+basefname) ndt1471 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ndt1471.connect(ndt1471_addr) ndt1471.settimeout(3.0) # check msg = query(ndt1471, "$BD:%d,CMD:MON,CH:%d,PAR:STAT\r\n"%(module_address, channel_num)) # Example: "#BD:00,CMD:OK,VAL:00001" if msg.find("OK"): status = int(msg[msg.rindex(':')+1:]) # print(status) if status&0x400: print("Please turn the channel switch to HV EN/ON") return else: print("NDT1471 connection established") else: print("NDT1471 ERROR") ndt1471.close() return # config voltage = 0 query(ndt1471, "$BD:%d,CMD:SET,CH:%d,PAR:VSET,VAL:%d\r\n"%(module_address, channel_num, voltage)) query(ndt1471, "$BD:%d,CMD:SET,CH:%d,PAR:ISET,VAL:%.2f\r\n"%(module_address, channel_num, current_limit)) query(ndt1471, "$BD:%d,CMD:SET,CH:%d,PAR:RUP,VAL:%d\r\n"%(module_address, channel_num, voltage_ramp_up)) query(ndt1471, "$BD:%d,CMD:SET,CH:%d,PAR:RDW,VAL:%d\r\n"%(module_address, channel_num, voltage_ramp_down)) query(ndt1471, "$BD:%d,CMD:SET,CH:%d,PAR:MAXV,VAL:%d\r\n"%(module_address, channel_num, voltage_max)) query(ndt1471, "$BD:%d,CMD:SET,CH:%d,PAR:TRIP,VAL:%.1f\r\n"%(module_address, channel_num, trip_time)) query(ndt1471, "$BD:%d,CMD:SET,CH:%d,PAR:ON\r\n"%(module_address, channel_num)) alldata = [] i = 0 while (voltage <= voltage_max): query(ndt1471, "$BD:%d,CMD:SET,CH:%d,PAR:VSET,VAL:%d\r\n"%(module_address, channel_num, voltage)) time.sleep(wait_time) # delay msg = query(ndt1471, "$BD:%d,CMD:MON,CH:%d,PAR:STAT\r\n"%(module_address, channel_num)) # Example: "#BD:00,CMD:OK,VAL:00001" status = int(msg[msg.rindex(':')+1:]) while (status&2): # Channel is Ramping UP time.sleep(1) msg = query(ndt1471, "$BD:%d,CMD:MON,CH:%d,PAR:STAT\r\n"%(module_address, channel_num)) status = int(msg[msg.rindex(':')+1:]) # print(status) if status&1 != 1: print("Stop at %d V, status = 0x%X"%(voltage,status)) break j = 0 while (j<repeat): mon_voltage = [] mon_current = [] msg = query(ndt1471, "$BD:%d,CMD:MON,CH:%d,PAR:VMON\r\n"%(module_address, channel_num)) # Example: "#BD:00,CMD:OK,VAL:0197.7" mon_voltage.append(float(msg[msg.rindex(':')+1:])) # print(mon_voltage) msg = query(ndt1471, "$BD:%d,CMD:MON,CH:%d,PAR:IMON\r\n"%(module_address, channel_num)) # Example: "#BD:00,CMD:OK,VAL:000.000" mon_current.append(float(msg[msg.rindex(':')+1:])) # print(mon_current) time.sleep(0.5) # delay j += 1 mon_voltage_mean = np.mean(mon_voltage) mon_voltage_max = np.max(mon_voltage) mon_voltage_min = np.min(mon_voltage) mon_voltage_std = np.std(mon_voltage) mon_current_mean = np.mean(mon_current) mon_current_max = np.max(mon_current) mon_current_min = np.min(mon_current) mon_current_std = np.std(mon_current) print("Monitor: %f uA @ %f V"%(mon_current_mean, mon_voltage_mean)) alldata.append([i, status, mon_voltage_mean, mon_voltage_std, mon_voltage_max, mon_voltage_min, mon_current_mean, mon_current_std, mon_current_max, mon_current_min]) i += 1 voltage += voltage_step query(ndt1471, "$BD:%d,CMD:SET,CH:%d,PAR:VSET,VAL:0\r\n"%(module_address, channel_num)) query(ndt1471, "$BD:%d,CMD:SET,CH:%d,PAR:OFF\r\n"%(module_address, channel_num)) ndt1471.close() head = "Leakage Current Test, Data file made from NDT1471, Each point is recorded %d times, Created at %s UTC\n\ No., Status, Voltage/V, Voltage_std/V, Voltage_max/V, Voltage_min/V, Current/uA, Current_std/uA, Current_max/uA, Current_min/uA" %( repeat, time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))) # print(head) np.savetxt(fname, alldata, delimiter=',', header=head) try: main() except: traceback.print_exc()
讯享网
测试结果以逗号分隔符的方式保存为文本文件,可通过Excel分析。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/101064.html