32 lines
926 B
Python
32 lines
926 B
Python
|
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())
|
||
|
|