Added documentation

Change-Id: Id6e26a4c28fe080a55099cd54d0fa85c15946657
This commit is contained in:
Oksana Shliakhtun
2024-08-19 17:21:40 +02:00
parent 5f1e37a99e
commit b63dca3b4e
3 changed files with 84 additions and 2 deletions

View File

@ -15,6 +15,8 @@
#
# Module authors: Oksana Shliakhtun <oksana.shliakhtun@psi.ch>
# *****************************************************************************
"""Thermo Haake Phoenix P1 Bath Circulator"""
import re
import time
from frappy.core import StringIO, HasIO, Parameter, FloatRange, BoolType, \
@ -24,6 +26,11 @@ from frappy.errors import CommunicationFailedError
def convert(string):
"""
Converts reply to a number
:param string: reply from the command
:return: number
"""
number = re.sub(r'[^0-9.-]', '', string)
return float(number)
@ -56,11 +63,21 @@ class TemperatureLoop(HasIO, HasConvergence, Drivable):
]
def get_values_status(self):
"""
Supplementary command for the operating status method.
Removes the extra symbol and converts each status value into integer.
:return: array of integers
"""
reply = self.communicate('B')
string = reply.rstrip('$')
return [int(val) for val in string]
def read_status(self): # control_active update
"""
Operating status.
:return: statu type and message
"""
values_str = self.get_values_status()
self.read_control_active()
@ -73,6 +90,10 @@ class TemperatureLoop(HasIO, HasConvergence, Drivable):
return IDLE, ''
def read_value(self):
"""
F1 - internal temperature, F2 - external temperature
:return: float temperature value
"""
if self.mode == 1:
value = self.communicate('F1')
else:
@ -80,6 +101,11 @@ class TemperatureLoop(HasIO, HasConvergence, Drivable):
return convert(value)
def write_control_active(self, value):
"""
Turning on/off the heating, pump and regulation
:param value: 0 is OFF, 1 is ON
:return:
"""
if value is True:
self.communicate('GO') # heating and pump run
self.communicate('W SR') # regulation
@ -100,6 +126,11 @@ class TemperatureLoop(HasIO, HasConvergence, Drivable):
return convert(string)
def write_target(self, target):
"""
Selecting Celsius, setting the target
:param target: target
:return: target
"""
self.write_control_active(True)
self.read_status()
self.communicate('W TE C')
@ -107,6 +138,11 @@ class TemperatureLoop(HasIO, HasConvergence, Drivable):
return target
def write_mode(self, mode):
"""
Switching to internal or external control
:param mode: internal/external
:return: selected mode
"""
if mode == 1:
self.communicate('W IN')
self.communicate('W EX')