def __init__(self, codenames):
     logging.info('TemperatureReader class started')
     threading.Thread.__init__(self)
     """self.SYSTEMS = {}
     for sy in ['tabs_guard', 'tabs_floor', 'tabs_ceiling', 'tabs_cooling', 'tabs_ice', 'tabs_room']:
         self.SYSTEMS[sy] = {'temperature_inlet': None, # float in C
                             'temperature_outlet': None, # float in C
                             'temperature_setpoint': None, # float in C
                             'temperature_control': None, # float in C
                             'valve_cooling': None, # float 0-1
                             'valve_heating': None, # float 0-1
                             'pid_value': None, # float -1-1
                             'water_flow': None} # float in l/min
                             """
     self.OldValue = {}
     self.OldValue['tabs_guard_temperature_control'] = None
     self.OldValue['tabs_room_temperature_control'] = None
     #self.OldValue['tabs_ceiling_temperature_inlet'] = None
     self.OldValue['tabs_cooling_temperature_inlet'] = None
     
     self.OffSet = {}
     self.OffSet['tabs_room_temperature_control'] = 27.0-34.8 # 0.62
     self.OffSet['tabs_guard_temperature_control'] = 23.5-28.3 #1.32
     #self.OffSet['tabs_ceiling_temperature_inlet'] = 0.30
     self.OffSet['tabs_cooling_temperature_inlet'] = 0 #-0.49
     
     self.OmegaCommAdd = {}
     self.OmegaCommAdd['tabs_guard_temperature_control'] = 1
     self.OmegaCommAdd['tabs_room_temperature_control'] = 1
     
     self.OmegaDict = {}
     self.OmegaDict['tabs_room_temperature_control'] = omega_CNi32.ISeries('/dev/serial/by-id/usb-FTDI_USB-RS485_Cable_FTWEA5HJ-if00-port0', 9600, comm_stnd='rs485', address = 1)
     self.OmegaDict['tabs_guard_temperature_control'] = omega_CNi32.ISeries('/dev/serial/by-id/usb-FTDI_USB-RS485_Cable_FTYIWHC9-if00-port0', 9600, comm_stnd='rs485', address = 1)
     self.OmegaDict['tabs_cooling_temperature_inlet'] = omega_CNi32.ISeries('/dev/serial/by-id/usb-OMEGA_ENGINEERING_12.34-if00', 9600, comm_stnd='rs232')
     
     self.SYSTEMS = {}
     for key in self.OmegaDict.keys():
         self.SYSTEMS[key] = None
         
     #self.temperatures = {'tabs_guard_temperature': None,
     #                     'tabs_floor_temperature': None,
     #                     'tabs_ceiling_temperature': None,
     #                     'tabs_cooling_temperature': None}
     self.quit = False
     self.ttl = 20
Exemple #2
0
 def __init__(self):
     cn7800_port = '/dev/serial/by-id/usb-FTDI_USB-RS485_Cable_FTY0VXC8-if00-port0'
     self.cn7800 = omega_cn7800.CN7800(cn7800_port)
     self.temp_dca = self.cn7800.read_temperature()
     cni_port = '/dev/serial/by-id/usb-FTDI_USB-RS485_Cable_FTY0EQZZ-if00-port0'
     self.cni = omega_cni.ISeries(cni_port, 9600, comm_stnd='rs485')
     self.temp_mai = self.cni.read_temperature(1)
     threading.Thread.__init__(self)
     self.quit = False
Exemple #3
0
        if self.ttl < 0:
            self.quit = True
        return (self.temperature)

    def run(self):
        while not self.quit:
            self.ttl = 20
            time.sleep(1)
            self.temperature = self.omega.read_temperature()


logging.basicConfig(filename="logger.txt", level=logging.ERROR)
logging.basicConfig(level=logging.ERROR)

port = 'usb-Prolific_Technology_Inc._USB-Serial_Controller_D-if00-port0'
ng_temp = omega_CNi32.ISeries('/dev/serial/by-id/' + port, 9600)

port = 'usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0'
old_temp = omegabus.OmegaBus('/dev/serial/by-id/' + port)

ng_measurement = NGTempReader(ng_temp)
ng_measurement.start()

old_measurement = OldTempReader(old_temp)
old_measurement.start()

time.sleep(2.5)

codenames = ['microreactorng_temp_sample', 'mr_sample_tc_temperature']
loggers = {}
loggers[codenames[0]] = ValueLogger(ng_measurement,
Exemple #4
0
                OCSsqlInsert(sql)


if __name__ == '__main__':
    quit = False
    pullsocket = DateDataPullSocket('stm312 hptemp',
                                    ['stm312_hp_temperature'],
                                    timeouts=[4.0])
    pullsocket.start()
    db_logger = ContinuousLogger(table='dateplots_stm312',
                                 username=credentials.user,
                                 password=credentials.passwd,
                                 measurement_codenames=['stm312_hpc_temperature'])
    db_logger.start()
    tc_reader = omega.ISeries('/dev/ttyUSB0',
                              9600,
                              comm_stnd='rs485')
    temperature_reader = Reader(tc_reader, pullsocket)
    temperature_reader.start()

    time.sleep(5)

    hp_saver = HighPressureTemperatureSaver(temperature_reader, db_logger)
    hp_saver.start()

    #stm_saver = STMTemperatureSaver(stm_reader)
    #stm_saver.start()

    ocs_saver = OCSTemperatureSaver(temperature_reader)
    ocs_saver.start()
    
Exemple #5
0
            self.values[self.codenames[1]] = temperature
            self.pullsocket.set_point_now(self.codenames[1], temperature)
            time.sleep(0.2)
        else:
            self.pullsocket.stop()

    def stop(self, ):
        self.quit = True


if __name__ == '__main__':
    # Drivers
    omega_port = '/dev/serial/by-id/usb-FTDI_USB-RS232_Cable_FTZ6JV6C-if00-port0'
    ngc2d_port = '/dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller_D-if00-port0'
    iongauge = NGC2D.NGC2D_comm(device=ngc2d_port)
    omega = omega_cni.ISeries(omega_port, 9600, comm_stnd='rs232')

    # Codenames
    codenames = ['omicron_nanobeam_pressure', 'omicron_nanobeam_temperature']
    pullsocket = DateDataPullSocket('nanobeam_state',
                                    codenames,
                                    timeouts=4,
                                    port=9000)
    reader = Reader(iongauge, omega, codenames, pullsocket)
    reader.daemon = True
    reader.start()
    print('Codenames used: {}'.format(codenames))

    # Criterium checker
    criterium_checker = LoggingCriteriumChecker(
        codenames=codenames,
def main():
    """ Main function """
    logging.basicConfig(filename="logger.txt", level=logging.ERROR)
    logging.basicConfig(level=logging.ERROR)

    port = 'usb-Prolific_Technology_Inc._USB-Serial_Controller_D-if00-port0'
    ng_temp = omega_CNi32.ISeries('/dev/serial/by-id/' + port, 9600)

    port = 'usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0'
    old_temp = omegabus.OmegaBus(device='/dev/serial/by-id/' + port, model='D5321', baud=9600)

    ng_measurement = NGTempReader(ng_temp)
    ng_measurement.start()

    old_measurement = OldTempReader(old_temp)
    old_measurement.start()

    time.sleep(2.5)

    codenames = ['microreactorng_temp_sample', 'mr_sample_tc_temperature']
    loggers = {}
    loggers[codenames[0]] = ValueLogger(ng_measurement, comp_val=0.4, comp_type='lin')
    loggers[codenames[0]].start()
    loggers[codenames[1]] = ValueLogger(old_measurement, comp_val=1.0, comp_type='lin')
    loggers[codenames[1]].start()

    try:
        micro = chr(0x03BC) # Python 3
    except ValueError:
        micro = unichr(0x03BC) # Python 2

    socket = DateDataPullSocket(micro + '-reactor NG temperature',
                                codenames, timeouts=5)
    socket.start()

    livesocket = LiveSocket(micro + '-reactors temperatures', codenames)
    livesocket.start()

    db_logger = {}
    db_logger[codenames[0]] = ContinuousDataSaver(
        continuous_data_table='dateplots_microreactorNG',
        username=credentials.user_new,
        password=credentials.passwd_new,
        measurement_codenames=codenames
    )

    db_logger[codenames[1]] = ContinuousDataSaver(
        continuous_data_table='dateplots_microreactor',
        username=credentials.user_old,
        password=credentials.passwd_old,
        measurement_codenames=codenames
    )

    db_logger[codenames[0]].start()
    db_logger[codenames[1]].start()

    while ng_measurement.isAlive():
        time.sleep(0.25)
        for name in codenames:
            value = loggers[name].read_value()
            socket.set_point_now(name, value)
            livesocket.set_point_now(name, value)
            if loggers[name].read_trigged():
                print(value)
                db_logger[name].save_point_now(name, value)
                loggers[name].clear_trigged()