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


Python loggers.ContinuousLogger类代码示例

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


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

示例1: main

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,代码行数:59,代码来源:data_logger.py

示例2: __init__

 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()
开发者ID:neilanderson,项目名称:PyExpLabSys,代码行数:34,代码来源:mytui.py

示例3: main

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,代码行数:46,代码来源:chiller_logger.py

示例4: main

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,代码行数:21,代码来源:temperature.py

示例5: main

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,代码行数:55,代码来源:monitor.py

示例6: __init__

    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()
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:52,代码来源:mypid.py

示例7: __init__

 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()
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:45,代码来源:mymultiplexer.py

示例8: __init__

    def __init__(self,):
        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.omega_temperature = TemperatureReader(self.codenames)
        self.omega_temperature.start()
        # omega_temperature.update_values()

        time.sleep(1.5)

        chlist = {
            "tabs_guard_temperature_inlet": 0,
            "tabs_floor_temperature_inlet": 1,
            "tabs_ceiling_temperature_inlet": 2,
            "tabs_cooling_temperature_inlet": 3,
        }
        self.loggers = {}
        for key in self.codenames:
            self.loggers[key] = ValueLogger(
                self.omega_temperature, 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()
        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()
开发者ID:neilanderson,项目名称:PyExpLabSys,代码行数:44,代码来源:mydatalogger.py

示例9: TemperatureLogger

        temp_loggers[i] = TemperatureLogger(tempreader, i + 1)
        temp_loggers[i].start()

    temp_codenames = ['vhp_T_reactor_inlet',
                      'vhp_T_reactor_outlet',
                      'vhp_T_reactor_top',
                      'vhp_T_mass_spec',
                      'vhp_T_gas_lines',
                      'vhp_T_purifying_reactor',
                      'vhp_T_furnace']

    socket = DateDataPullSocket('vhp', ['vhp_mass_spec_pressure'] + temp_codenames, timeouts=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0])
    socket.start()

    db_logger = ContinuousLogger(table='dateplots_vhp_setup',
                                 username=credentials.user,
                                 password=credentials.passwd,
                                 measurement_codenames=['vhp_mass_spec_pressure'] + temp_codenames)
    db_logger.start()
    time.sleep(5)
    while True:
        time.sleep(0.25)
        for i in range(0, 7):
            t = temp_loggers[i].read_value()
            socket.set_point_now(temp_codenames[i], t)
            if temp_loggers[i].trigged:
                print t
                db_logger.enqueue_point_now(temp_codenames[i], t)
                temp_loggers[i].trigged = False

        c = chamber_logger.read_pressure()
        socket.set_point_now('vhp_mass_spec_pressure', c)
开发者ID:neilanderson,项目名称:PyExpLabSys,代码行数:32,代码来源:data_logger.py

示例10: PcClass

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

pc_measurement = PcClass()
pc_measurement.start()

pressure_measurement = PiraniClass()
pressure_measurement.start()

time.sleep(2)

datasocket = DateDataSocket(['pirani', 'pc'], timeouts=[1.0, 1.0])
datasocket.start()

db_logger = ContinuousLogger(table='dateplots_stm312', username='stm312', password='stm312', measurement_codenames=['stm312_pirani', 'stm312_pc'])
db_logger.start()

while True:
    pirani = pressure_measurement.read_pressure()
    pc = pc_measurement.read_pressure()
    datasocket.set_point_now('pirani', pirani)
    datasocket.set_point_now('pc', pc)
    if pressure_measurement.trigged:
        print(pirani)
        db_logger.enqueue_point_now('stm312_pirani', pirani)
        pressure_measurement.trigged = False

    if pc_measurement.trigged:
        print(pc)
        db_logger.enqueue_point_now('stm312_pc', pc)
开发者ID:JNRiedel,项目名称:PyExpLabSys,代码行数:30,代码来源:data_logger.py

示例11: __init__

    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
开发者ID:neilanderson,项目名称:PyExpLabSys,代码行数:67,代码来源:monitor.py

示例12: GasAlarmMonitor

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,代码行数:101,代码来源:monitor.py

示例13: TemperatureReader


if __name__ == '__main__':
    logging.basicConfig(filename="logger.txt", level=logging.ERROR)
    logging.basicConfig(level=logging.ERROR)

    tempreader = TemperatureReader()
    tempreader.daemon = True
    tempreader.start()

    temp_logger = ValueLogger(tempreader, comp_val=1)
    #temp_logger = TemperatureLogger(tempreader)
    temp_logger.start()

    db_logger = ContinuousLogger(table='dateplots_chemlab307',
                                 username=credentials.user,
                                 password=credentials.passwd,
                                 measurement_codenames=['chemlab307_muffle_furnace'])

    socket = DateDataPullSocket('muffle_furnace',
                                ['chemlab307_muffle_furnace'],
                                timeouts=[1.0])
    socket.start()

    livesocket = LiveSocket('muffle_furnace', ['chemlab307_muffle_furnace'], 2)
    livesocket.start()

    db_logger.start()
    time.sleep(5)
    while True:
        time.sleep(0.25)
        t = temp_logger.read_value()
开发者ID:neilanderson,项目名称:PyExpLabSys,代码行数:30,代码来源:data_logger.py

示例14: LiveSocket

temp_bottom_logger.daemon = True
temp_bottom_logger.start()

temp_bearings_logger = tp.TurboLogger(reader, 'temp_bearings', maximumtime=600)
temp_bearings_logger.daemon = True
temp_bearings_logger.start()

temp_motor_logger = tp.TurboLogger(reader, 'temp_motor', maximumtime=600)
temp_motor_logger.daemon = True
temp_motor_logger.start()

# Todo: change port number
#livesocket = LiveSocket([chamber_turbo_speed', 'chamber_turbo_power'], 2)
#livesocket.start()

db_logger = ContinuousLogger(table='dateplots_mgw', username=credentials.user, password=credentials.passwd, measurement_codenames=['mgw_chamber_turbo_speed', 'mgw_chamber_turbo_power', 'mgw_chamber_turbo_temp_motor', 'mgw_chamber_turbo_temp_bottom', 'mgw_chamber_turbo_temp_bearings', 'mgw_chamber_turbo_temp_electronics', 'mgw_chamber_turbo_current'])
db_logger.start()
time.sleep(5)

while mainpump.running:
    ts = rotation_logger.read_value()
    power = power_logger.read_value()
    current = current_logger.read_value()
    temp_elec = temp_electronics_logger.read_value()
    temp_bottom = temp_bottom_logger.read_value()
    temp_bearings = temp_bearings_logger.read_value()
    temp_motor = temp_motor_logger.read_value()
    #livesocket.set_point_now('chamber_turbo_speed', ts)

    if rotation_logger.trigged:
        db_logger.enqueue_point_now('mgw_chamber_turbo_speed', ts)
开发者ID:JNRiedel,项目名称:PyExpLabSys,代码行数:31,代码来源:turbo.py

示例15: range

reader.daemon = True
reader.start()

codenames = ['sputterchamber_qcm_frequency', 
             'sputterchamber_qcm_qrystal_life', 
             'sputterchamber_qcm_thickness']
loggers = {}
for i in range(0, len(codenames)):
    loggers[codenames[i]] = ValueLogger(reader, comp_val = 0.25, channel = i)
    loggers[codenames[i]].start()
socket = DateDataPullSocket('Sputterchamber QCM',
                            codenames, port=9001, timeouts=[5.0] * len(codenames))
socket.start()

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

time.sleep(5)

while reader.isAlive():
    time.sleep(0.25)
    for name in codenames:
        v = loggers[name].read_value()
        socket.set_point_now(name, v)
        if loggers[name].read_trigged():
            print v
            db_logger.enqueue_point_now(name, v)
            loggers[name].clear_trigged()
开发者ID:neilanderson,项目名称:PyExpLabSys,代码行数:31,代码来源:qcm_logger.py


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