From 0def8f52e7a9cbc95b05916c6e646ac758a53970 Mon Sep 17 00:00:00 2001 From: Oksana Shliakhtun Date: Mon, 26 Aug 2024 14:23:21 +0200 Subject: [PATCH] Comments Change-Id: Ie7fe10f704aec62c19cae0bab16d43d55d911a36 --- frappy_psi/HP.py | 20 ++++++++++++++++++-- frappy_psi/bridge.py | 6 ++++++ frappy_psi/haake.py | 2 +- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/frappy_psi/HP.py b/frappy_psi/HP.py index 2477456..2ed89e0 100644 --- a/frappy_psi/HP.py +++ b/frappy_psi/HP.py @@ -17,11 +17,18 @@ # # Module authors: Oksana Shliakhtun # ***************************************************************************** +"""Hewlett-Packard HP34401A Multimeter (not finished)""" + import re from frappy.core import HasIO, Readable, Parameter, FloatRange, EnumType, StatusType, IDLE, ERROR, WARN def string_to_value(value): + """ + Converting the value to float, removing the units, converting the prefix into the number. + :param value: value + :return: float value without units + """ value_with_unit = re.compile(r'(\d+)([pnumkMG]?)') value, pfx = value_with_unit.match(value).groups() pfx_dict = {'p': 1e-12, 'n': 1e-9, 'u': 1e-6, 'm': 1e-3, 'k': 1e3, 'M': 1e6, 'G': 1e9} @@ -117,6 +124,11 @@ class Voltage(HP34401A, Readable): acdc = None def write_mode(self, mode): + """ + Set the mode - AC or DC + :param mode: AC/DC + :return: + """ if mode == 1: self.comm(f'configure:voltage:AC {self.range}, {self.resolution}') else: @@ -125,7 +137,11 @@ class Voltage(HP34401A, Readable): return self.comm(f'function?') def read_value(self): - self.comm(f'measure:voltage:') + """ + Makes a AC/DC voltage measurement. + :return: AC/DC value + """ + return self.comm(f'measure:voltage:{self.acdc}?') def write_autorange_acdc(self, function): full_function = f'{function}:{self.acdc}' @@ -156,7 +172,7 @@ class Current(HP34401A, Readable, Voltage): def read_range_current(self): return self.read_range(f'current:{self.acdc}') - def write_autrange_current(self): + def write_autorange_current(self): return self.write_autorange_acdc('current') def write_range_current(self, range): diff --git a/frappy_psi/bridge.py b/frappy_psi/bridge.py index 69ab076..7dedb27 100644 --- a/frappy_psi/bridge.py +++ b/frappy_psi/bridge.py @@ -126,6 +126,12 @@ class Resistance(Base, Readable): self.write_irange(self.irange - 1) def read_status(self): + """ + Both the mainframe (SR900) and the module (SR921) have the same commands for the status, + here implemented commands are made for module status, not the frame! + + :return: status type and message + """ esr = int(self.communicate('*esr?')) # standart event status byte ovsr = int(self.communicate('ovsr?')) # overload status cesr = int(self.communicate('cesr?')) # communication error status diff --git a/frappy_psi/haake.py b/frappy_psi/haake.py index 1f032c8..b69af08 100644 --- a/frappy_psi/haake.py +++ b/frappy_psi/haake.py @@ -150,7 +150,7 @@ class TemperatureLoop(HasIO, HasConvergence, Drivable): @Command def clear_errors(self): - """ Reset after error""" + """ Reset after error. Otherwise the status will not be updated""" if self.read_status()[0] == ERROR: try: self.communicate('ER')