Package dics :: Module temps
[hide private]
[frames] | no frames]

Source Code for Module dics.temps

 1  import logging 
 2  import threading 
 3   
4 -class temps:
5 """ 6 Provides the DICS interface to the Pico Technology TC-08 temperature 7 loggers used by DAZLE. 8 """
9 - def __init__(self, tc08s, channels, name):
10 """ 11 Arguments: 12 13 tc08s: A string containing a comma seperated list of the names of 14 the tc-08s. 15 channels: A string containing a comma seperated list of the names 16 of the channels. 17 name: A identification string used for logging purposes. 18 """ 19 self.name = str(name) 20 self.logger = logging.getLogger(self.name)
21 22
23 -class tc08:
24 """ 25 Object representing a TC-08 temperature logger. 26 """
27 - def __init__(self, portname, channels, name):
28 """ 29 portname: The serial port that the TC-08 is connected to. 30 channels: List of temps.channel objects connect to this TC-08. 31 """
32
33 -class channel:
34 """ 35 Object representing an individual thermocouple connected to a TC-08 36 """
37 - def __init__(self, channel_num, type, max_temp, min_temp, name):
38 """ 39 Arguments: 40 41 channel_num: The channel number (1-8) on the TC-08 that the 42 thermocouple is connected to. 43 type: Thermocouple type as a single character string (eg 'J') 44 units: Units used for temperature limits and ordinary output, 45 'C' or 'K'. 46 max_temp: Maximum acceptable temperature (units from units 47 argument). 48 min_temp: Minimum acceptable temperature (units from units 49 argument). 50 name: Identifying string. 51 """ 52 self.name = str(name) 53 self.logger = logging.getLogger(name) 54 self.channel_num = int(channel_num) 55 56 if self.channel_num > 8 or self.channel_num < 1: 57 self.logger.critical('Illegal channel number (%i)!' % \ 58 self.channel_num) 59 60 if not isinstance(type, str) or len(type) != 1: 61 self.logger.critical(\ 62 'Illegal thermocouple type (%s), assuming T!' % type) 63 self.type = 'T' 64 else: 65 self.type = type 66 67 if not isinstance(units, str) or len(units) != 1: 68 self.logger.critical(\ 69 'Illegal units (%s), assuming C!' % units) 70 self.units = 'C' 71 else: 72 self.units = units 73 74 self.max_temp = float(max_temp) 75 self.min_temp = float(min_temp)
76