import logging import threading class temps: """ Provides the DICS interface to the Pico Technology TC-08 temperature loggers used by DAZLE. """ def __init__(self, tc08s, channels, name): """ Arguments: tc08s: A string containing a comma seperated list of the names of the tc-08s. channels: A string containing a comma seperated list of the names of the channels. name: A identification string used for logging purposes. """ self.name = str(name) self.logger = logging.getLogger(self.name) class tc08: """ Object representing a TC-08 temperature logger. """ def __init__(self, portname, channels, name): """ portname: The serial port that the TC-08 is connected to. channels: List of temps.channel objects connect to this TC-08. """ class channel: """ Object representing an individual thermocouple connected to a TC-08 """ def __init__(self, channel_num, type, max_temp, min_temp, name): """ Arguments: channel_num: The channel number (1-8) on the TC-08 that the thermocouple is connected to. type: Thermocouple type as a single character string (eg 'J') units: Units used for temperature limits and ordinary output, 'C' or 'K'. max_temp: Maximum acceptable temperature (units from units argument). min_temp: Minimum acceptable temperature (units from units argument). name: Identifying string. """ self.name = str(name) self.logger = logging.getLogger(name) self.channel_num = int(channel_num) if self.channel_num > 8 or self.channel_num < 1: self.logger.critical('Illegal channel number (%i)!' % \ self.channel_num) if not isinstance(type, str) or len(type) != 1: self.logger.critical(\ 'Illegal thermocouple type (%s), assuming T!' % type) self.type = 'T' else: self.type = type if not isinstance(units, str) or len(units) != 1: self.logger.critical(\ 'Illegal units (%s), assuming C!' % units) self.units = 'C' else: self.units = units self.max_temp = float(max_temp) self.min_temp = float(min_temp)