当前位置: 首页>>代码示例>>Python>>正文


Python ContinuousLogger.start方法代码示例

本文整理汇总了Python中PyExpLabSys.common.loggers.ContinuousLogger.start方法的典型用法代码示例。如果您正苦于以下问题:Python ContinuousLogger.start方法的具体用法?Python ContinuousLogger.start怎么用?Python ContinuousLogger.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyExpLabSys.common.loggers.ContinuousLogger的用法示例。


在下文中一共展示了ContinuousLogger.start方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from PyExpLabSys.common.loggers import ContinuousLogger [as 别名]
# 或者: from PyExpLabSys.common.loggers.ContinuousLogger import start [as 别名]
def main():
    """ Main loop """
    il800 = intellemetrics_il800.IL800(
        "/dev/serial/by-id/" + "usb-Prolific_Technology_Inc." + "_USB-Serial_Controller_D-if00-port0"
    )
    sqm160 = inficon_sqm160.InficonSQM160("/dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0")

    qcm1 = QcmReader(il800)
    qcm1.start()

    qcm2 = QcmReader(sqm160)
    qcm2.start()

    time.sleep(2.5)

    codenames = [
        "pvd309_qcm1_rate",
        "pvd309_qcm1_thickness",
        "pvd309_qcm1_frequency",
        "pvd309_qcm2_rate",
        "pvd309_qcm2_thickness",
        "pvd309_qcm2_frequency",
    ]

    loggers = {}
    loggers[codenames[0]] = ValueLogger(qcm1, comp_val=0.01, comp_type="lin", channel=0)
    loggers[codenames[1]] = ValueLogger(qcm1, comp_val=0.1, comp_type="lin", channel=1)
    loggers[codenames[2]] = ValueLogger(qcm1, comp_val=1, comp_type="lin", channel=2)
    loggers[codenames[3]] = ValueLogger(qcm2, comp_val=0.3, comp_type="lin", channel=0)
    loggers[codenames[4]] = ValueLogger(qcm2, comp_val=0.1, comp_type="lin", channel=1)
    loggers[codenames[5]] = ValueLogger(qcm2, comp_val=1, comp_type="lin", channel=2)
    for name in codenames:
        loggers[name].daemon = True
        loggers[name].start()

    livesocket = LiveSocket("pvd309 qcm logger", codenames)
    livesocket.start()

    socket = DateDataPullSocket("pvd309 qcm", codenames, timeouts=[1.0] * len(codenames))
    socket.start()

    db_logger = ContinuousLogger(
        table="dateplots_pvd309",
        username=credentials.user,
        password=credentials.passwd,
        measurement_codenames=codenames,
    )
    db_logger.start()

    while qcm1.isAlive() and qcm2.isAlive():
        time.sleep(0.25)
        for name in codenames:
            value = loggers[name].read_value()
            livesocket.set_point_now(name, value)
            socket.set_point_now(name, value)
            if loggers[name].read_trigged():
                print(name + ": " + str(value))
                db_logger.enqueue_point_now(name, value)
                loggers[name].clear_trigged()
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:61,代码来源:data_logger.py

示例2: main

# 需要导入模块: from PyExpLabSys.common.loggers import ContinuousLogger [as 别名]
# 或者: from PyExpLabSys.common.loggers.ContinuousLogger import start [as 别名]
def main():
    """The main method for the pressure logger"""

    # Open communication to the pressure measurement unit
    tpg = TPG262(port='/dev/ttyUSB0', baudrate=9600)
    LOGGER.info('Initiated driver to TPG 262')

    # Get a continuous logger
    codenames = ['thetaprobe_pressure_loadlock', 'thetaprobe_pressure_uvgun']
    db_logger = ContinuousLogger(table='dateplots_thetaprobe',
                                 username=credentials.USERNAME,
                                 password=credentials.PASSWORD,
                                 measurement_codenames=codenames)
    db_logger.start()
    LOGGER.info('Initiated and started database logger')

    livesocket = LiveSocket(codenames, 0.2)
    livesocket.start()

    loadlock_last = {'value': 1E20, 'time': 0}
    uvgun_last = {'value': 1E20, 'time': 0}

    try:
        while True:
            # get the values: returns:
            # (value1, (status_code1, status_message1),
            # value2, (status_code2, status_message2))
            value_ll, code_ll, value_uv, code_uv = tpg.pressure_gauges()
            livesocket.set_point_now('thetaprobe_pressure_loadlock', value_ll)
            livesocket.set_point_now('thetaprobe_pressure_uvgun', value_uv)

            ### Load lock
            if code_ll[0] in [0, 1]:  # If measurement is OK or underranged
                if logging_criteria(value_ll, loadlock_last):
                    LOGGER.info('Add value {} for load lock'.format(value_ll))
                    now_ll = db_logger.enqueue_point_now(
                        'thetaprobe_pressure_loadlock',
                        value_ll)
                    loadlock_last['value'] = value_ll
                    loadlock_last['time'] = now_ll

            ### UV gun
            if code_uv[0] in [0, 1]:  # If measurement is OK or underranged
                if logging_criteria(value_uv, uvgun_last):
                    LOGGER.info('Add value {} for UV gun'.format(value_uv))
                    now_uv = db_logger.enqueue_point_now(
                        'thetaprobe_pressure_uvgun',
                        value_uv)
                    uvgun_last['value'] = value_uv
                    uvgun_last['time'] = now_uv
    except KeyboardInterrupt:
        LOGGER.info('Keyboard interrupt. Shutting down')
        db_logger.stop()
        livesocket.stop()
        LOGGER.info('Database logger stoppped. Exiting!')
开发者ID:JNRiedel,项目名称:PyExpLabSys,代码行数:57,代码来源:monitor.py

示例3: main

# 需要导入模块: from PyExpLabSys.common.loggers import ContinuousLogger [as 别名]
# 或者: from PyExpLabSys.common.loggers.ContinuousLogger import start [as 别名]
def main():
    """Main function"""
    chiller_port = '/dev/serial/by-id/'
    chiller_port += 'usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0'

    LOG.info('Using chiller port %s', chiller_port)
    reader = ChillerReader(chiller_port)
    reader.start()
    LOG.info('ChillerReader started')

    codenames = ['sputterchamber_chiller_temperature',
                 'sputterchamber_chiller_flow',
                 'sputterchamber_chiller_temperature_ambient',
                 'sputterchamber_chiller_pressure',
                 'sputterchamber_chiller_temperature_setpoint']
    LOG.debug('Using codenames %s', codenames)
    loggers = {}
    for i in range(0, len(codenames)):
        loggers[codenames[i]] = ValueLogger(reader, comp_val=0.1, channel=i)
        loggers[codenames[i]].start()

    live_socket_name = 'Sputterchamber chiller'
    live_socket = LiveSocket(live_socket_name, codenames, 2)
    live_socket.start()
    LOG.info('Live socket init and started with name "%s"', live_socket_name)

    db_table = 'dateplots_sputterchamber'
    db_logger = ContinuousLogger(table=db_table,
                                 username=credentials.user,
                                 password=credentials.passwd,
                                 measurement_codenames=codenames)
    db_logger.start()
    LOG.info('ContinuousLogger init and started on table "%s"', db_table)

    time.sleep(5)

    while reader.isAlive():
        time.sleep(0.25)
        for name in codenames:
            value = loggers[name].read_value()
            if not math.isnan(value):
                live_socket.set_point_now(name, value)
                if loggers[name].read_trigged():
                    LOG.debug('Log value %s for codename "%s"', value, name)
                    db_logger.enqueue_point_now(name, value)
                    loggers[name].clear_trigged()
开发者ID:jlopezBolt,项目名称:PyExpLabSys,代码行数:48,代码来源:chiller_logger.py

示例4: main

# 需要导入模块: from PyExpLabSys.common.loggers import ContinuousLogger [as 别名]
# 或者: from PyExpLabSys.common.loggers.ContinuousLogger import start [as 别名]
def main():
    LOGGER.info('main started')
    cni = CNi3244_C24(0)
    socket = DateDataSocket([SHORT_NAME], timeouts=1.0)
    socket.start()
    db_logger = ContinuousLogger(
        table='dateplots_tower', username='N/A', password='N/A',
        measurement_codenames=[NAME],
        dsn='servcinf'
    )
    db_logger.start()
    time.sleep(0.1)

    # Main part
    try:
        main_measure_loop(cni, socket, db_logger)
    except KeyboardInterrupt:
        LOGGER.info('Keyboard Interrupt. Shutting down!')
        db_logger.stop()
        cni.close()
        socket.stop()
开发者ID:JNRiedel,项目名称:PyExpLabSys,代码行数:23,代码来源:temperature.py

示例5: PressureLogger

# 需要导入模块: from PyExpLabSys.common.loggers import ContinuousLogger [as 别名]
# 或者: from PyExpLabSys.common.loggers.ContinuousLogger import start [as 别名]
    loggers = {}
    loggers['pvd309_main_chamber_ig'] = PressureLogger(pressurereader, 3)
    loggers['pvd309_main_chamber_pirani'] = PressureLogger(pressurereader, 2)
    loggers['pvd309_load_lock_pirani'] = PressureLogger(pressurereader, 5)

    for codename in pressure_codenames:
        loggers[codename].start()

    socket = DateDataPullSocket('pvd309', pressure_codenames, timeouts=[5.0, 5.0, 5.0])
    socket.start()

    db_logger = ContinuousLogger(table='dateplots_pvd309',
                                 username=credentials.user,
                                 password=credentials.passwd,
                                 measurement_codenames=pressure_codenames)
    db_logger.start()

    time.sleep(3)

    while True:
        time.sleep(0.25)
        for codename in pressure_codenames:
            p = loggers[codename].read_pressure()
            socket.set_point_now(codename, p)
            if loggers[codename].trigged:
                print p
                db_logger.enqueue_point_now(codename, p)
                loggers[codename].trigged = False


开发者ID:rkisensee,项目名称:PyExpLabSys,代码行数:30,代码来源:data_logger.py

示例6: MainTui

# 需要导入模块: from PyExpLabSys.common.loggers import ContinuousLogger [as 别名]
# 或者: from PyExpLabSys.common.loggers.ContinuousLogger import start [as 别名]
class MainTui(threading.Thread):
    """ Temperature reader """
    def __init__(self,):
        threading.Thread.__init__(self)
        #from mytui import CursesTui
        self.quit = False
        self.codenames = ['tabs_guard_temperature_setpoint',
                     'tabs_floor_temperature_setpoint',
                     'tabs_ceiling_temperature_setpoint',
                     'tabs_cooling_temperature_setpoint',
                     ]
        sockname = 'tabs_setpoints'
        self.PullSocket = DateDataPullSocket(sockname, self.codenames, timeouts=[60.0]*len(self.codenames), port = socketinfo.INFO[sockname]['port'])
        self.PullSocket.start()
        
        self.TUI = CursesTui(self.codenames)
        self.TUI.start()
        #time.sleep(5)
        
        chlist = {'tabs_guard_temperature_setpoint': 0,
                  'tabs_floor_temperature_setpoint': 1,
                  'tabs_ceiling_temperature_setpoint': 2,
                  'tabs_cooling_temperature_setpoint': 3}
        self.loggers = {}
        for key in self.codenames:
            self.loggers[key] = ValueLogger(self.TUI, comp_val = 0.2, maximumtime=60,
                                            comp_type = 'lin', channel = chlist[key])
            self.loggers[key].start()
        #livesocket = LiveSocket('tabs_temperature_logger', codenames, 2)
        #livesocket.start()
        
        
        
        self.db_logger = ContinuousLogger(table='dateplots_tabs', username=credentials.user, password=credentials.passwd, measurement_codenames=self.codenames)
        #print('Hostname of db logger: ' + db_logger.host)
        self.db_logger.start()
    
    def run(self):
        i = 0
        while not self.quit:
            #print(i)
            if self.TUI.isAlive():
                pass
            else:
                print('TUI has shutdown')
                self.quit = True
            try:
                #print(i)
                time.sleep(2)
                for name in self.codenames:
                    v = self.loggers[name].read_value()
                    #print('Status: ', name , v)
                    #livesocket.set_point_now(name, v)
                    self.PullSocket.set_point_now(name, v)
                    if self.loggers[name].read_trigged():
                        #if __name__ == '__main__':
                        #    print('Log: ', i, name, v)
                        #print('Log: ', name, v)
                        self.db_logger.enqueue_point_now(name, v)
                        self.loggers[name].clear_trigged()
            except:
                print('run error')
                pass
                #self.TUI.stop()
                #report error and proceed
            i += 1
        self.stop()
        
    def stop(self):
        self.quit = True
        self.TUI.stop()
        self.PullSocket.stop()
        self.db_logger.stop()
        for key in self.codenames:
            self.loggers[key].status['quit'] = True
开发者ID:neilanderson,项目名称:PyExpLabSys,代码行数:77,代码来源:mytui.py

示例7: MainPID

# 需要导入模块: from PyExpLabSys.common.loggers import ContinuousLogger [as 别名]
# 或者: from PyExpLabSys.common.loggers.ContinuousLogger import start [as 别名]
class MainPID(threading.Thread):
    """ pid controller """
    def __init__(self,):
        logging.info('MainPID class started')
        threading.Thread.__init__(self)
        #from datalogger import TemperatureReader
        self.quit = False
        self.codenames = ['tabs_guard_pid_value',
                 'tabs_floor_pid_value',
                 'tabs_ceiling_pid_value',
                 'tabs_cooling_pid_value',
                 
                 'tabs_guard_valve_heating',
                 'tabs_floor_valve_heating',
                 'tabs_ceiling_valve_heating',
                 
                 'tabs_guard_valve_cooling',
                 'tabs_floor_valve_cooling',
                 'tabs_ceiling_valve_cooling',
                 'tabs_cooling_valve_cooling',
                 ]
        sockname = 'tabs_pids'
        self.PullSocket = DateDataPullSocket(sockname, self.codenames, timeouts=[60.0]*len(self.codenames), port = socketinfo.INFO[sockname]['port'])
        self.PullSocket.start()
    
        self.PTC = PidTemperatureControl(self.codenames)
        self.PTC.daemon = True
        self.PTC.start()
        #time.sleep(5)
    
        chlist = {'tabs_guard_pid_value': 0,
                  'tabs_floor_pid_value': 1,
                  'tabs_ceiling_pid_value': 2,
                  'tabs_cooling_pid_value': 3,
                  
                  'tabs_guard_valve_heating': 4,
                  'tabs_floor_valve_heating': 5,
                  'tabs_ceiling_valve_heating': 6,
                  
                  'tabs_guard_valve_cooling': 7,
                  'tabs_floor_valve_cooling': 8,
                  'tabs_ceiling_valve_cooling': 9,
                  'tabs_cooling_valve_cooling': 10}
        self.loggers = {}
        for key in self.codenames:
            self.loggers[key] = ValueLogger(self.PTC, comp_val = 0.10, maximumtime=60,
                                        comp_type = 'lin', channel = chlist[key])
            self.loggers[key].start()
        #livesocket = LiveSocket('tabs_temperature_logger', codenames, 2)
        #livesocket.start()

    
        self.db_logger = ContinuousLogger(table='dateplots_tabs', username=credentials.user, password=credentials.passwd, measurement_codenames=self.codenames)
        self.db_logger.start()

    def run(self,):
        i = 0
        while not self.quit and self.PTC.isAlive():
            try:
                #print(i)
                time.sleep(1)
                for name in self.codenames:
                    v = self.loggers[name].read_value()
                    #print('Status: ', name , v)
                    #livesocket.set_point_now(name, v)
                    self.PullSocket.set_point_now(name, v)
                    if self.loggers[name].read_trigged():
                        if __name__ == '__main__':
                            print('Log: ', i, name, v)
                        #print(i, name, v)
                        self.db_logger.enqueue_point_now(name, v)
                        self.loggers[name].clear_trigged()
            except (KeyboardInterrupt, SystemExit):
                self.quit = True
                pass
                #self.PTC.stop()
                #report error and proceed
            i += 1
        self.stop()

    def stop(self):
        self.quit = True
        self.PTC.stop()
        self.PullSocket.stop()
        self.db_logger.stop()
        for key in self.codenames:
            self.loggers[key].status['quit'] = True
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:89,代码来源:mypid.py

示例8: GasAlarmMonitor

# 需要导入模块: from PyExpLabSys.common.loggers import ContinuousLogger [as 别名]
# 或者: from PyExpLabSys.common.loggers.ContinuousLogger import start [as 别名]
class GasAlarmMonitor(object):
    """Class that monitors the gas alarm the building 307"""

    def __init__(self):
        # Start logger
        codenames = ['B307_gasalarm_CO_051', 'B307_gasalarm_H2_051',
                     'B307_gasalarm_CO_055', 'B307_gasalarm_H2_055',
                     'B307_gasalarm_CO_059', 'B307_gasalarm_H2_059',
                     'B307_gasalarm_CO_061', 'B307_gasalarm_H2_061',
                     'B307_gasalarm_CO_42-43', 'B307_gasalarm_H2_2sal',
                     'B307_gasalarm_CO_932', 'B307_gasalarm_H2_932']
        self.db_logger = ContinuousLogger(table='dateplots_b307gasalarm',
                                          username=credentials.USERNAME,
                                          password=credentials.PASSWORD,
                                          measurement_codenames=codenames)
        self.db_logger.start()
        LOGGER.info('Logger started')

        # Each value is measured about every 5 sec, so sane interval about 2
        self.live_socket = LiveSocket(name='gas_alarm_307_live',
                                      codenames=codenames,
                                      sane_interval=2.0)
        self.live_socket.start()
        LOGGER.info('Live socket started')

        # Start driver
        self.vortex = Vortex('/dev/ttyUSB0', 1)
        LOGGER.info('Vortex driver opened')

        # Init database connection
        self.db_connection = MySQLdb.connect(
            host='servcinf', user=credentials.USERNAME,
            passwd=credentials.PASSWORD, db='cinfdata')
        self.db_cursor = self.db_connection.cursor()

        # Initiate static information. All information about the except for
        # the list of their numbers are placed in dicts because the numbering
        # starts at 1.
        # Detector numbers: [1, 2, 3, ..., 12]
        self.detector_numbers = \
            range(1, self.vortex.get_number_installed_detectors() + 1)
        self.detector_info = \
            {detector_num: self.vortex.detector_configuration(detector_num)
             for detector_num in self.detector_numbers}
        # trip_levels are the differences that are required to force a log
        # The levels are set to 2 * the communication resolution
        # (1000 values / full range)
        self.trip_levels = {detector_num: info.range * 2.0 / 1000.0 for
                            detector_num, info in self.detector_info.items()}

        # Initiate last measured values and their corresponding times
        self.detector_levels_last_values = \
            {detector_num: - (10 ** 9)
             for detector_num in self.detector_numbers}
        self.detector_levels_last_times = \
            {detector_num: 0 for detector_num in self.detector_numbers}
        self.detector_status_last_values = \
            {detector_num: {'inhibit': False, 'status': ['OK'],
                            'codename': self.detector_info[detector_num].identity}
             for detector_num in self.detector_numbers}
        self.detector_status_last_times = \
            {detector_num: 0 for detector_num in self.detector_numbers}

        # Initiate variables for system power status
        self.central_power_status_last_value = 'OK'
        self.central_power_status_last_time = - (10 ** 9)

        # Initiate variables for system status
        self.central_status_last_value = ['All OK']
        self.central_status_last_time = 0

    def close(self):
        """Close the logger and the connection to the Vortex"""
        self.db_logger.stop()
        LOGGER.info('Logger stopped')
        self.live_socket.stop()
        LOGGER.info('Live socket stopped')
        self.vortex.close()
        LOGGER.info('Vortex driver closed')

    @staticmethod
    def identity_to_codename(identity):
        """Convert the identity the sensor returns to the codename used in the
        database
        """
        identity = identity.replace(' ', '_').replace('/', '-')
        return 'B307_gasalarm_{}'.format(identity)

    def main(self):
        """Main monitoring and logging loop"""
        # Each iteration takes about 5 sec
        while True:
            # Log detectors
            for detector_num in self.detector_numbers:
                self.log_detector(detector_num)

            # Log Vortex unit status (force log every 24 hours)
            self.log_central_unit()

    def log_detector(self, detector_num):
#.........这里部分代码省略.........
开发者ID:neilanderson,项目名称:PyExpLabSys,代码行数:103,代码来源:monitor.py

示例9: print

# 需要导入模块: from PyExpLabSys.common.loggers import ContinuousLogger [as 别名]
# 或者: from PyExpLabSys.common.loggers.ContinuousLogger import start [as 别名]
        print(pc)
        #db_logger.enqueue_point_now('stm312_pc', pc)
        pc_measurement.trigged = False
    time.sleep(0.5)
"""

Pullsocket = DateDataPullSocket('stm312 hpc pressure control', ['pressure', 'setpoint'])
Pushsocket = DataPushSocket('stm312 hpc pressure control', action='store_last')


if __name__ == '__main__':
    print('program start')
    Pullsocket.start()
    Pushsocket.start()
    #socket.start()
    db_logger_stm312.start()
    #db_logger_ocs.start()
    time.sleep(1)

    pc = PcClass()
    pc.add_socket_server(Pullsocket,Pushsocket)
    pc.add_logger(db_logger_stm312)
    pirani = PiraniClass()
    pirani.add_logger(db_logger_stm312)

    baratron = Baratron()
    #baratron.deamon = True
    baratron.start
    time.sleep(2)
    
    pc.start()
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:33,代码来源:data_logger.py

示例10: MainDatalogger

# 需要导入模块: from PyExpLabSys.common.loggers import ContinuousLogger [as 别名]
# 或者: from PyExpLabSys.common.loggers.ContinuousLogger import start [as 别名]
class MainDatalogger(threading.Thread):
    """ Temperature reader """

    def __init__(self,):
        logging.info("MainDatalogger class started")
        threading.Thread.__init__(self)
        # from datalogger import TemperatureReader
        self.quit = False
        self.codenames = [
            "tabs_guard_temperature_inlet",
            "tabs_floor_temperature_inlet",
            "tabs_ceiling_temperature_inlet",
            "tabs_cooling_temperature_inlet",
        ]
        self.MC302 = WaterTemperatureReader()
        self.MC302.start()
        self.codenames = ["tabs_cooling_temperature_inlet"]
        self.omega_temperature = TemperatureReader(["tabs_cooling_temperature_inlet"])
        self.omega_temperature.daemon = True
        self.omega_temperature.start()
        # omega_temperature.update_values()

        time.sleep(1.5)

        chlist = {
            "tabs_guard_temperature_control": 0,
            "tabs_room_temperature_control": 1,
            #'tabs_ceiling_temperature_inlet': 2,
            "tabs_cooling_temperature_inlet": 3,
        }
        self.loggers = {}
        for key in chlist.keys():
            self.loggers[key] = ValueLogger(
                self.omega_temperature, comp_val=0.2, maximumtime=300, comp_type="lin", channel=chlist[key]
            )
            self.loggers[key].start()
        chlist = {
            "tabs_guard_temperature_inlet": 0,
            "tabs_guard_temperature_outlet": 1,
            "tabs_guard_temperature_delta": 2,
            "tabs_floor_temperature_inlet": 3,
            "tabs_floor_temperature_outlet": 4,
            "tabs_floor_temperature_delta": 5,
            "tabs_ceiling_temperature_inlet": 6,
            "tabs_ceiling_temperature_outlet": 7,
            "tabs_ceiling_temperature_delta": 8,
            "tabs_guard_water_flow": 9,
            "tabs_floor_water_flow": 10,
            "tabs_ceiling_water_flow": 11,
        }
        for key in chlist.keys():
            self.loggers[key] = ValueLogger(
                self.MC302, comp_val=0.2, maximumtime=300, comp_type="lin", channel=chlist[key]
            )
            self.loggers[key].start()
        self.codenames = self.loggers.keys()
        # livesocket = LiveSocket('tabs_temperature_logger', codenames, 2)
        # livesocket.start()
        sockname = "tabs_temperatures"
        self.PullSocket = DateDataPullSocket(
            sockname, self.codenames, timeouts=[60.0] * len(self.codenames), port=socketinfo.INFO[sockname]["port"]
        )
        self.PullSocket.start()

        self.db_logger = ContinuousLogger(
            table="dateplots_tabs",
            username=credentials.user,
            password=credentials.passwd,
            measurement_codenames=self.codenames,
        )
        self.db_logger.start()

    def run(self,):
        i = 0
        while not self.quit and self.omega_temperature.isAlive():
            try:
                # print(i)
                time.sleep(1)
                for name in self.loggers.keys():
                    v = self.loggers[name].read_value()
                    # livesocket.set_point_now(name, v)
                    if v != None and v != 0:
                        self.PullSocket.set_point_now(name, v)
                        if self.loggers[name].read_trigged():
                            if __name__ == "__main__":
                                print("Log: ", i, name, v)
                            self.db_logger.enqueue_point_now(name, v)
                            self.loggers[name].clear_trigged()
                        else:
                            if __name__ == "__main__":
                                print("STA: ", i, name, v)
            except (KeyboardInterrupt, SystemExit):
                pass
                # self.omega_temperature.close()
                # report error and proceed
            i += 1
        self.stop()

    def stop(self):
        self.quit = True
#.........这里部分代码省略.........
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:103,代码来源:mydatalogger.py

示例11: FlowControl

# 需要导入模块: from PyExpLabSys.common.loggers import ContinuousLogger [as 别名]
# 或者: from PyExpLabSys.common.loggers.ContinuousLogger import start [as 别名]
fc = FlowControl(MFCs, Datasocket, Pushsocket, Livesocket)
fc.start()

Logger = ValueLogger(fc, comp_val=1, comp_type='log', low_comp=0.0001, channel=1)
Logger.start()

Sniffer_Logger = ValueLogger(fc, comp_val=1, comp_type='log', low_comp=0.0001, channel=2)
Sniffer_Logger.start()


db_logger = ContinuousLogger(table='dateplots_microreactor',
                             username=credentials.user,
                             password=credentials.passwd,
                             measurement_codenames=['mr_reactor_pressure'])
db_logger.start()

db_logger_sniffer = ContinuousLogger(table='dateplots_sniffer',
                                     username=credentials_sniffer.user,
                                     password=credentials_sniffer.passwd,
                                     measurement_codenames=['sniffer_chip_pressure'])
db_logger_sniffer.start()
time.sleep(5)
while True:
    time.sleep(0.25)
    v = Logger.read_value()
    if Logger.read_trigged():
        print v
        db_logger.enqueue_point_now('mr_reactor_pressure', v)
        Logger.clear_trigged()
开发者ID:jlopezBolt,项目名称:PyExpLabSys,代码行数:31,代码来源:socket_server.py

示例12: MainMultilogger

# 需要导入模块: from PyExpLabSys.common.loggers import ContinuousLogger [as 别名]
# 或者: from PyExpLabSys.common.loggers.ContinuousLogger import start [as 别名]
class MainMultilogger(threading.Thread):
    """ Temperature reader """
    def __init__(self,):
        logging.info('MainMultilogger class started')
        threading.Thread.__init__(self)
        #from datalogger import TemperatureReader
        self.quit = False
        self.codenames = Setting_channel_list.keys()
        """['tabs_ceiling_temperature_delta',
                          'tabs_ceiling_temperature_deltaref',
                          'tabs_floor_temperature_delta',
                          'tabs_floor_temperature_deltaref',
                          'tabs_room_temperature_aircenter010',
                          'tabs_room_temperature_aircenter060',
                          'tabs_room_temperature_aircenter110',
                          'tabs_room_temperature_aircenter170',
                          'tabs_room_temperature_aircenter355',
                          'tabs_guard_temperature_airfloor',
                          'tabs_guard_temperature_airceiling',
                          'tabs_guard_temperature_airwallsouth',
                          'tabs_guard_temperature_airwallnorth',
                          'tabs_guard_temperature_airwalleast',
                          'tabs_guard_temperature_airwallwest',
                          
                          ]"""
        self.multiplex_reader = MultiplexReader(self.codenames)
        self.multiplex_reader.daemon = True
        self.multiplex_reader.start()
        #omega_temperature.update_values()
        
        time.sleep(3.5)
        
        chlist = Setting_channel_list
        self.loggers = {}
        for key in self.codenames:
            self.loggers[key] = ValueLogger(self.multiplex_reader, comp_val = 0.5, maximumtime=300,
                                            comp_type = 'lin', channel = chlist[key])
            self.loggers[key].start()
        
        #livesocket = LiveSocket('tabs_temperature_logger', codenames, 2)
        #livesocket.start()
        sockname = 'tabs_multiplexer'
        self.PullSocket = DateDataPullSocket(sockname, self.codenames, timeouts=[60.0]*len(self.codenames), port = socketinfo.INFO[sockname]['port'])
        self.PullSocket.start()
        
        self.db_logger = ContinuousLogger(table='dateplots_tabs', username=credentials.user, password=credentials.passwd, measurement_codenames=self.codenames)
        self.db_logger.start()
    
    def run(self,):
        i = 0
        while not self.quit and self.multiplex_reader.isAlive():
            try:
                #print(i)
                time.sleep(1)
                for name in self.codenames:
                    v = self.loggers[name].read_value()
                    #livesocket.set_point_now(name, v)
                    self.PullSocket.set_point_now(name, v)
                    #print(i, name, v)
                    if self.loggers[name].read_trigged() and abs(v) < 9.9E+5 and v != None:
                        if __name__ == '__main__':
                            print('Log: ', i, name, v)
                        #print(name, v)
                        self.db_logger.enqueue_point_now(name, v)
                        self.loggers[name].clear_trigged()
            except (KeyboardInterrupt, SystemExit):
                self.quit = True
                pass
                #self.omega_temperature.close()
                #report error and proceed
            i += 1
        self.stop()
        
    def stop(self):
        self.quit = True
        self.multiplex_reader.stop()
        self.PullSocket.stop()
        self.db_logger.stop()        
        for key in self.codenames:
            self.loggers[key].status['quit'] = True
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:82,代码来源:mymultiplexer.py


注:本文中的PyExpLabSys.common.loggers.ContinuousLogger.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。