Загрузил(а) файлы в 'Project'

This commit is contained in:
Дмитрий Пунов 2022-11-21 09:42:10 +03:00
parent d16cc57b7c
commit 6b00e74b42
2 changed files with 73 additions and 0 deletions

31
Project/ammeter.py Normal file
View File

@ -0,0 +1,31 @@
import check_connection
import serial
class B7_78():
def __init__(self, device_ID):
self.ID = device_ID
self.folder = check_connection.get_device_folder_tty(self.ID)
self.instr = serial.Serial(
self.folder, timeout=1, inter_byte_timeout=1)
self.instr.write(b'SYST:REM\n')
self.instr.write(b'SYST:REM\n')
print('init')
def getCurrentDC(self):
self.instr.write(b'MEAS:CURR:DC?\n')
return float(self.instr.read(100).decode().rstrip())
def getVoltageDC(self):
self.instr.write(b'MEAS:VOLT:DC?\n')
return float(self.instr.read(100).decode().rstrip())
def getCurrentAC(self):
self.instr.write(b'MEAS:CURR:AC?\n')
return float(self.instr.read(100).decode().rstrip())
def getVoltageAC(self):
self.instr.write(b'MEAS:VOLT:AC?\n')
return float(self.instr.read(100).decode().rstrip())

42
Project/voltmeter.py Normal file
View File

@ -0,0 +1,42 @@
class AKIP():
def __init__(self, device_ID):
self.ID = device_ID
self.folder = '/dev/usbtmc0'
print('init')
def getVoltageDC(self):
self.instr = open(self.folder, 'w')
self.instr.write('MEAS:VOLT:DC?\n')
self.instr.flush()
self.instr = open(self.folder, 'r')
data = self.instr.readline()
self.instr.close()
return float(data)
def getCurrentDC(self):
self.instr = open(self.folder, 'w')
self.instr.write('MEAS:AMP:DC?\n')
self.instr.flush()
self.instr = open(self.folder, 'r')
data = self.instr.readline()
self.instr.close()
return float(data)
def getVoltageAC(self):
self.instr = open(self.folder, 'w')
self.instr.write('MEAS:VOLT:AC?\n')
self.instr.flush()
self.instr = open(self.folder, 'r')
data = self.instr.readline()
self.instr.close()
return float(data)
def getCurrentAC(self):
self.instr = open(self.folder, 'w')
self.instr.write('MEAS:AMP:AC?\n')
self.instr.flush()
self.instr = open(self.folder, 'r')
data = self.instr.readline()
self.instr.close()
return float(data)