71 lines
1.8 KiB
Python
71 lines
1.8 KiB
Python
from ModuleTestBox import ModuleTestBox
|
|
import sys, time, numpy as np, pyvisa, serial.tools.list_ports
|
|
from pymeasure.instruments.keithley import KeithleyDMM6500
|
|
import matplotlib.pyplot as plt
|
|
from time import sleep
|
|
import pandas as pd
|
|
|
|
hints=["VID:PID=CAFE:4001"]
|
|
|
|
# ---------- Gerätesuche -------------------------------------------------------
|
|
rm = pyvisa.ResourceManager()
|
|
|
|
def find_visa(hint: str) -> str:
|
|
for res in rm.list_resources():
|
|
if hint.lower() in res.lower():
|
|
return res
|
|
raise RuntimeError(f'VISA-Resource "{hint}" nicht gefunden')
|
|
|
|
channel = []
|
|
ref = []
|
|
dmmcurrent = []
|
|
ch = 2
|
|
count = range(18, 901, 9)
|
|
|
|
with ModuleTestBox(hints=hints, verbose=True) as hvp, KeithleyDMM6500(find_visa(hint='0x05E6::0x6500')) as dmm:
|
|
hvp.SelectChannel(ch)
|
|
hvp.Bias_Enable(1)
|
|
|
|
R = 1223.6841 #load resistance in Ohm
|
|
|
|
dmm.measure_current(max_current=0.001)
|
|
dmm.current_nplc = 12
|
|
|
|
sleep(2)
|
|
|
|
for u in count:
|
|
hvp.Bias_SetV(u/1000)
|
|
|
|
sleep(0.1)
|
|
ref.append(u*0.9092396440596435 + 0)
|
|
dmmcur = dmm.current
|
|
while dmmcur > 1:
|
|
dmmcur = dmm.current
|
|
dmmcurrent.append(dmmcur * 1e6)
|
|
current = hvp.Bias_GetI() * 1e6
|
|
channel.append(current)
|
|
|
|
# print(channel)
|
|
|
|
hvp.Bias_SetV(0)
|
|
hvp.Bias_Enable(0)
|
|
|
|
data = pd.DataFrame({
|
|
'v': count,
|
|
'i_hv': channel,
|
|
'i_dmm': dmmcurrent,
|
|
'i_ref': ref
|
|
})
|
|
data.to_excel('data_biasTEST.xlsx', index=False)
|
|
|
|
plt.figure()
|
|
plt.title('BiasingBox current measurements')
|
|
plt.ylabel('current [uA]')
|
|
plt.xlabel('measurements')
|
|
plt.grid()
|
|
plt.plot(channel, label=f'CH{ch}', marker='o', markersize=2)
|
|
# plt.plot(ref, label=f'ref', marker='o', markersize=2)
|
|
plt.plot(dmmcurrent, label=f'dmm', marker='o', markersize=2)
|
|
plt.legend()
|
|
|
|
plt.show() |