aboutsummaryrefslogtreecommitdiff
path: root/qolab/hardware/multimeter
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2023-06-19 17:05:59 -0400
committerEugeniy E. Mikhailov <evgmik@gmail.com>2023-06-19 17:05:59 -0400
commitbff055f21435c4df26484f0b7f3c44b7fd70da66 (patch)
treed00b14ea2be82a3226fc0bd5e7a19a70bbce5158 /qolab/hardware/multimeter
parentefbe347670505882bf7cf62049afe56be860de43 (diff)
downloadqolab-bff055f21435c4df26484f0b7f3c44b7fd70da66.tar.gz
qolab-bff055f21435c4df26484f0b7f3c44b7fd70da66.zip
added early draft of the multimeter class and some readings for hp_34401 multimeter
Diffstat (limited to 'qolab/hardware/multimeter')
-rw-r--r--qolab/hardware/multimeter/__init__.py30
-rw-r--r--qolab/hardware/multimeter/hp_34401.py28
2 files changed, 58 insertions, 0 deletions
diff --git a/qolab/hardware/multimeter/__init__.py b/qolab/hardware/multimeter/__init__.py
new file mode 100644
index 0000000..3c174f4
--- /dev/null
+++ b/qolab/hardware/multimeter/__init__.py
@@ -0,0 +1,30 @@
+from qolab.hardware.scpi import SCPIinstr
+from qolab.hardware.basic import BasicInstrument
+
+class Multimeter(BasicInstrument):
+ def __init__(self, *args, **kwds):
+ BasicInstrument.__init__(self, *args, **kwds)
+ self.config['Device type']='Multimeter'
+ self.config['FnamePrefix'] = 'Multimeter'
+ self.config['Device model'] = 'Generic Multimeter Without Hardware interface'
+ self.config['FnamePrefix'] = 'multimeter'
+ self.deviceProperties.update({})
+ # Minimal set of methods to be implemented.
+ pass
+
+class MultimeterSCPI(SCPIinstr, Multimeter):
+ """
+ Do not instantiate directly, use
+ rm = pyvisa.ResourceManager()
+ MultimeterSCPI(rm.open_resource('TCPIP::192.168.0.2::INSTR'))
+ """
+ pass
+ def __init__(self, resource, *args, **kwds):
+ SCPIinstr.__init__(self, resource)
+ Multimeter.__init__(self, *args, **kwds)
+ self.config['DeviceId'] = str.strip(self.idn)
+
+from .hp_34401 import HP_34401
+
+
+
diff --git a/qolab/hardware/multimeter/hp_34401.py b/qolab/hardware/multimeter/hp_34401.py
new file mode 100644
index 0000000..ad11614
--- /dev/null
+++ b/qolab/hardware/multimeter/hp_34401.py
@@ -0,0 +1,28 @@
+from qolab.hardware.basic import BasicInstrument
+from qolab.hardware.multimeter import MultimeterSCPI
+from qolab.hardware.scpi import SCPI_PROPERTY
+
+class HP_34401(MultimeterSCPI):
+ """ HP 34401 multimeter (same as Agilent) """
+ """
+ rm = pyvisa.ResourceManager()
+ instr=rm.open_resource('ASRL/dev/ttyUSB0::INSTR', baud_rate = 9600)
+ """
+ def __init__(self, resource, *args, baud_rate=9600, data_bits=8, parity=None, stop_bits=1, timeout=1, **kwds):
+ super().__init__(resource, *args, **kwds)
+ self.config['Device model']='hp 34401'
+ # self.resource.read_termination='\n'
+ self.deviceProperties.update({})
+
+ measurement = SCPI_PROPERTY(scpi_prfx='SYSTem:REMote\n read', ptype=float, doc='Report current measurement', no_setter=True)
+
+if __name__ == '__main__':
+ import pyvisa
+ print("testing")
+ rm = pyvisa.ResourceManager()
+ print(rm.list_resources())
+ instr=rm.open_resource('ASRL/dev/ttyUSB0::INSTR', baud_rate = 9600)
+ multimeter = HP_34401(instr)
+ print('------ Header start -------------')
+ print(str.join('\n', multimeter.getHeader()))
+ print('------ Header ends -------------')