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


Python DateDataPullSocket.set_point_now方法代码示例

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


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

示例1: SocketSupervisor

# 需要导入模块: from PyExpLabSys.common.sockets import DateDataPullSocket [as 别名]
# 或者: from PyExpLabSys.common.sockets.DateDataPullSocket import set_point_now [as 别名]
class SocketSupervisor(threading.Thread):
    """ Supervisor will check that a list of ports are still open """
    def __init__(self):
        threading.Thread.__init__(self)
        self.quit = False
        self.ports = settings.ports
        self.setup = settings.setup
        self.pullsocket = DateDataPullSocket(self.setup + '-socket supervisor',
                                             [str(port) for port in self.ports],
                                             timeouts=len(self.ports)*[5])
        self.pullsocket.start()

    def run(self):
        """ Main loop """
        while not self.quit:
            for port in self.ports:
                time.sleep(1)
                sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                result = sock.connect_ex(('127.0.0.1', port))
                if result == 0:
                    self.pullsocket.set_point_now(str(port), True)
                    print(port, True)
                else:
                    self.pullsocket.set_point_now(str(port), False)
                    print(port, False)
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:27,代码来源:socket_supervisor.py

示例2: FlowControl

# 需要导入模块: from PyExpLabSys.common.sockets import DateDataPullSocket [as 别名]
# 或者: from PyExpLabSys.common.sockets.DateDataPullSocket import set_point_now [as 别名]
class FlowControl(threading.Thread):
    """ Keep updated values of the current flow """
    def __init__(self, mks_instance, mfcs, devices, name):
        threading.Thread.__init__(self)
        self.mfcs = mfcs
        self.mks = mks_instance
        self.pullsocket = DateDataPullSocket(name, devices, timeouts=3.0, port=9000)
        self.pullsocket.start()

        self.pushsocket = DataPushSocket(name, action='enqueue')
        self.pushsocket.start()

        self.livesocket = LiveSocket(name, devices)
        self.livesocket.start()
        self.running = True

    def run(self):
        while self.running:
            time.sleep(0.1)
            qsize = self.pushsocket.queue.qsize()
            while qsize > 0:
                element = self.pushsocket.queue.get()
                mfc = list(element.keys())[0]
                print(element[mfc])
                print('Queue: ' + str(qsize))
                self.mks.set_flow(element[mfc], self.mfcs[mfc])
                qsize = self.pushsocket.queue.qsize()

            for mfc in self.mfcs:
                print('!!!')
                flow = self.mks.read_flow(self.mfcs[mfc])
                print(mfc + ': ' + str(flow))
                self.pullsocket.set_point_now(mfc, flow)
                self.livesocket.set_point_now(mfc, flow)
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:36,代码来源:socket_server.py

示例3: main

# 需要导入模块: from PyExpLabSys.common.sockets import DateDataPullSocket [as 别名]
# 或者: from PyExpLabSys.common.sockets.DateDataPullSocket import set_point_now [as 别名]
def main():
    """ Main function """
    code_names = ['pvd309_temp_dca_cell', 'pvd309_temp_mai_cell']

    reader = TemperatureReader()
    reader.start()
    
    loggers = {}
    loggers[code_names[0]] = ValueLogger(reader, channel=1, comp_val = 0.5, comp_type = 'lin')
    loggers[code_names[0]].start()
    loggers[code_names[1]] = ValueLogger(reader, channel=2, comp_val = 0.5, comp_type = 'lin')
    loggers[code_names[1]].start()

    datasocket = DateDataPullSocket('pvd_309_temp', code_names, timeouts=[2.0] * 2, port=9001)
    datasocket.start()
    livesocket = LiveSocket('pvd_309_temperatures', code_names)
    livesocket.start()

    db_logger = ContinuousDataSaver(continuous_data_table='dateplots_pvd309',
                                    username=credentials.user,
                                    password=credentials.passwd,
                                    measurement_codenames=code_names)
    db_logger.start()
    time.sleep(5)
    while not reader.quit:
        time.sleep(0.25)
        for name in code_names:
            print(reader.ttl)
            value = loggers[name].read_value()
            datasocket.set_point_now(name, value)
            livesocket.set_point_now(name, value)
            if loggers[name].read_trigged():
                print(name + ': ' + str(value))
                db_logger.save_point_now(name, value)
                loggers[name].clear_trigged()
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:37,代码来源:datalogger.py

示例4: main

# 需要导入模块: from PyExpLabSys.common.sockets import DateDataPullSocket [as 别名]
# 或者: from PyExpLabSys.common.sockets.DateDataPullSocket import set_point_now [as 别名]
def main():
    """ Main function """
    tempreader = TemperatureReader()
    tempreader.daemon = True
    tempreader.start()

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

    db_logger = ContinuousDataSaver(continuous_data_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'])
    livesocket.start()

    db_logger.start()
    time.sleep(5)
    while True:
        time.sleep(0.25)
        value = temp_logger.read_value()
        socket.set_point_now('chemlab307_muffle_furnace', value)
        livesocket.set_point_now('chemlab307_muffle_furnace', value)
        if temp_logger.read_trigged():
            print(value)
            db_logger.save_point_now('chemlab307_muffle_furnace', value)
            temp_logger.clear_trigged()
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:35,代码来源:data_logger.py

示例5: main

# 需要导入模块: from PyExpLabSys.common.sockets import DateDataPullSocket [as 别名]
# 或者: from PyExpLabSys.common.sockets.DateDataPullSocket import set_point_now [as 别名]
def main():
    """ Main loop """
    mainpump = tp.TurboDriver(adress=1, port=settings.port)
    mainpump.start()

    tui = tp.CursesTui(mainpump)
    tui.daemon = True
    tui.start()

    reader = tp.TurboReader(mainpump)
    reader.daemon = True
    reader.start()

    time.sleep(10) # Allow reader to make meaningfull moving avarage

    codenames = [settings.table_prefix + '_turbo_speed',
                 settings.table_prefix + '_turbo_power',
                 settings.table_prefix + '_turbo_current',
                 settings.table_prefix + '_turbo_temp_motor',
                 settings.table_prefix + '_turbo_temp_bottom',
                 settings.table_prefix + '_turbo_temp_bearings',
                 settings.table_prefix + '_turbo_temp_electronics']
    loggers = {}

    loggers[codenames[0]] = tp.TurboLogger(reader, 'rotation_speed', maximumtime=600)
    loggers[codenames[1]] = tp.TurboLogger(reader, 'drive_power', maximumtime=600)
    loggers[codenames[2]] = tp.TurboLogger(reader, 'drive_current', maximumtime=600)
    loggers[codenames[3]] = tp.TurboLogger(reader, 'temp_motor', maximumtime=600)
    loggers[codenames[4]] = tp.TurboLogger(reader, 'temp_bottom', maximumtime=600)
    loggers[codenames[5]] = tp.TurboLogger(reader, 'temp_bearings', maximumtime=600)
    loggers[codenames[6]] = tp.TurboLogger(reader, 'temp_electronics', maximumtime=600)

    for name in codenames:
        loggers[name].daemon = True
        loggers[name].start()

    livesocket = LiveSocket(settings.name + '-turboreader', codenames)
    livesocket.start()

    socket = DateDataPullSocket(settings.name + '-turboreader', codenames,
                                timeouts=[1.0] * len(codenames), port=9000)
    socket.start()

    db_logger = ContinuousDataSaver(continuous_data_table=settings.table,
                                    username=settings.user,
                                    password=settings.passwd,
                                    measurement_codenames=codenames)
    db_logger.start()
    time.sleep(5)

    while mainpump.running:
        time.sleep(0.1)
        for name in codenames:
            value = loggers[name].read_value()
            socket.set_point_now(name, value) # Notice, this is the averaged value
            livesocket.set_point_now(name, value) # Notice, this is the averaged value
            if loggers[name].trigged:
                db_logger.save_point_now(name, value)
                loggers[name].trigged = False
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:61,代码来源:turbo_logger.py

示例6: MySocket

# 需要导入模块: from PyExpLabSys.common.sockets import DateDataPullSocket [as 别名]
# 或者: from PyExpLabSys.common.sockets.DateDataPullSocket import set_point_now [as 别名]
class MySocket(threading.Thread):
    """ Temperature reader """
    def __init__(self):
        threading.Thread.__init__(self)
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.sock.settimeout(2)
        self.quit = False
        sockname = 'tabs_all'
        self.codenames = socketinfo.INFO[sockname]['codenames']
        self.PullSocket = DateDataPullSocket(sockname, self.codenames, timeouts=[60.0]*len(self.codenames), port = socketinfo.INFO[sockname]['port'])
        self.PullSocket.start()
        self.data = {}
        for co in self.codenames:
            self.data[co] = None
        
    def run(self,):
        i = 0
        while not self.quit:
            try:
                #print(i)
                time.sleep(2)
                for name in self.codenames:
                    v = self.loggers[name].read_value()
                    v = self.data[name]
                    self.PullSocket.set_point_now(name, v)
            except (KeyboardInterrupt, SystemExit):
                pass
                #self.VC.stop()
                #report error and proceed
            i += 1
    def update_values(self,):
        """ Read the temperature from a external socket server"""
        for so in ['tabs_temperatures', 'tabs_setpoints', 'tabs_pids', 'tabs_valve', 'tabs_multiplexer']:
            try:
                info = socketinfo.INFO[so]
                host_port = (info['host'], info['port'])
                command = 'json_wn'
                self.sock.sendto(command, host_port)
                data = json.loads(self.sock.recv(2048))
                now = time.time()
                #print(data)
                for key, value in data.items():
                    try:
                        if abs(now - value[0]) > 3*60 or value[1] == 'OLD_DATA': # this is 3min change to 5s
                           self.data[key] = None
                        else:
                            self.data[key] = value[1]
                    except:
                        self.data[key] = None
            except socket.timeout:
                pass
        return self.data
    def stop(self):
        self.quit = True
        self.PullSocket.stop()
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:57,代码来源:mysocket.py

示例7: IonOpticsControl

# 需要导入模块: from PyExpLabSys.common.sockets import DateDataPullSocket [as 别名]
# 或者: from PyExpLabSys.common.sockets.DateDataPullSocket import set_point_now [as 别名]
class IonOpticsControl(threading.Thread):
    """ Main optics control """
    def __init__(self, port, name, lenses):
        threading.Thread.__init__(self)
        name = name + '_ion_optics'
        self.pullsocket = DateDataPullSocket(name, lenses, timeouts=20.0)
        self.pullsocket.start()
        self.pushsocket = DataPushSocket(name, action='enqueue')
        self.pushsocket.start()
        self.ion_optics = stahl_hv_400.StahlHV400(port)
        self.lenses = lenses
        self.set_voltages = {}
        self.actual_voltages = {}
        for lens in self.lenses:
            self.set_voltages[lens] = 0
            self.actual_voltages[lens] = 0
        self.status = {}
        self.status['channel_status'] = {}
        for i in range(1, len(self.lenses)+1):
            self.status['channel_status'][i] = False
        self.status['temperature'] = None
        self.status['output_error'] = None
        self.quit = False

    def run(self):
        current_lens = 1
        while not self.quit:
            self.status['temperature'] = self.ion_optics.read_temperature()
            if self.status['temperature'] > 50:
                for lens in self.lenses:
                    self.set_voltages[lens] = 0

            self.status['channel_status'] = self.ion_optics.check_channel_status()
            self.status['output_error'] = False in self.status['channel_status']

            actual_voltage = self.ion_optics.query_voltage(current_lens)
            self.actual_voltages[self.lenses[current_lens-1]] = actual_voltage
            self.pullsocket.set_point_now(self.lenses[current_lens-1], actual_voltage)

            if current_lens == len(self.lenses):
                current_lens = 1
            else:
                current_lens += 1

            qsize = self.pushsocket.queue.qsize()
            while qsize > 0:
                element = self.pushsocket.queue.get()
                lens = str(list(element.keys())[0])
                value = element[lens]
                self.set_voltages[lens] = value
                channel_number = self.lenses.index(lens) + 1
                self.ion_optics.set_voltage(channel_number, value)
                qsize = self.pushsocket.queue.qsize()
            time.sleep(0.1)
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:56,代码来源:ion_optics_controller.py

示例8: TemperatureLogger

# 需要导入模块: from PyExpLabSys.common.sockets import DateDataPullSocket [as 别名]
# 或者: from PyExpLabSys.common.sockets.DateDataPullSocket import set_point_now [as 别名]
class TemperatureLogger(object):

    def __init__(self):
        # Initialize omega driver
        LOGGER.info('Initialize omega d6400 driver')
        d6400_id = '/dev/serial/by-id/usb-FTDI_USB-RS485_Cable_FTWGRP0B-if00'\
            '-port0'
        self.d6400 = D6400.OmegaD6400(1, d6400_id)
        for channel in range(1, 8):
            LOGGER.info('Set range for channel {}'.format(channel))
            self.d6400.update_range_and_function(channel, action='tc',
                                                 fullrange='K')

        # Initialize socket
        name = 'Coupled reactor temperatures'
        self.codenames = {
            1: 'R1_temp',
            2: 'R1_sample_temp',
            3: 'R2_temp',
            4: 'R2_sample_temp',
            5: 'pro_inlet_temp',
            6: 'pro_d1_temp',
            7: 'pro_d2_temp',
            }
        codenames_list = [self.codenames[channel] for channel in range(1, 8)]
        self.socket = DateDataPullSocket(name, codenames_list, timeouts = 2.0)
        self.socket.start()

        # Measure initial values
        self.temperatures = {}
        for channel in range(1, 8):
            self.temperatures[channel] = self.d6400.read_value(channel)
            LOGGER.info('Get initial value {} for channel: {}'.format(
                    self.temperatures[channel], channel))
            self.socket.set_point_now(self.codenames[channel],
                                      self.temperatures[channel])

    def main(self):
        """Main meaurement loop"""
        while True:
            for channel in range(1, 8):
                self.temperatures[channel] = self.d6400.read_value(channel)
                LOGGER.info('Measured value {} for channel: {}'.format(
                        self.temperatures[channel], channel))
                self.socket.set_point_now(self.codenames[channel],
                                          self.temperatures[channel])
                

    def close(self):
        """Shut down the socket"""
        self.socket.stop()
        time.sleep(2)
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:54,代码来源:temperature_logger.py

示例9: main

# 需要导入模块: from PyExpLabSys.common.sockets import DateDataPullSocket [as 别名]
# 或者: from PyExpLabSys.common.sockets.DateDataPullSocket import set_point_now [as 别名]
def main():
    """ Main function """
    logging.basicConfig(filename="logger.txt", level=logging.ERROR)
    logging.basicConfig(level=logging.ERROR)

    qcm_port = ('/dev/serial/by-id/' +
                'usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0')
    qcm = inficon.InficonSQM160(qcm_port)
    reader = QcmReader(qcm)
    reader.daemon = True
    reader.start()

    codenames = ['volvo_qcm_frequency',
                 'volvo_qcm_crystal_life',
                 'volvo_qcm_thickness']
    loggers = {}
    loggers[codenames[0]] = ValueLogger(reader, comp_val=0.1, channel=0)
    loggers[codenames[0]].start()
    loggers[codenames[1]] = ValueLogger(reader, comp_val=0.01, channel=1)
    loggers[codenames[1]].start()
    loggers[codenames[2]] = ValueLogger(reader, comp_val=0.001, channel=2)
    loggers[codenames[2]].start()
    socket = DateDataPullSocket('Volvo QCM', codenames, port=9000,
                                timeouts=[5.0] * len(codenames))
    socket.start()

    livesocket = LiveSocket('Volvo data logger', codenames)
    livesocket.start()

    db_logger = ContinuousDataSaver(continuous_data_table='dateplots_volvo',
                                    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:
            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.save_point_now(name, value)
                loggers[name].clear_trigged()
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:49,代码来源:qcm_logger.py

示例10: main

# 需要导入模块: from PyExpLabSys.common.sockets import DateDataPullSocket [as 别名]
# 或者: from PyExpLabSys.common.sockets.DateDataPullSocket import set_point_now [as 别名]
def main():
    """ Main function """

    codenames = []
    for channel in settings.channels.values():
        channel['reader'] = SocketReaderClass(channel['host'], channel['port'],
                                              channel['command'])
        channel['reader'].start()
        channel['logger'] = ValueLogger(channel['reader'], comp_val=channel['comp_value'])
        channel['logger'].daemon = True
        channel['logger'].start()
        codenames.append(channel['codename'])

    try:
        port = settings.port_number
    except AttributeError:
        port = 9000
    pullsocket = DateDataPullSocket(settings.user + '-socket_logger',
                                    codenames, timeouts=5, port=port)
    pullsocket.start()

        
    db_logger = ContinuousDataSaver(continuous_data_table=settings.dateplot_table,
                                    username=settings.user,
                                    password=settings.passwd,
                                    measurement_codenames=codenames)
    db_logger.start()

    time.sleep(2)

    everything_ok = True
    while everything_ok:
        time.sleep(0.25)
        for channel in settings.channels.values():
            if not channel['reader'].isAlive():
                everything_ok = False
                # Report error here!!!
                # Consider to keep program running even in case of
                # socket failures
            value = channel['logger'].read_value()
            pullsocket.set_point_now(channel['codename'], value)
            if channel['logger'].read_trigged():
                print(value)
                db_logger.save_point_now(channel['codename'], value)
                channel['logger'].clear_trigged()
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:47,代码来源:socket_logger.py

示例11: main

# 需要导入模块: from PyExpLabSys.common.sockets import DateDataPullSocket [as 别名]
# 或者: from PyExpLabSys.common.sockets.DateDataPullSocket import set_point_now [as 别名]
def main():
    """ Main function """
    logging.basicConfig(filename="logger.txt", level=logging.ERROR)
    logging.basicConfig(level=logging.ERROR)

    port = '/dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller_D-if00-port'
    port = '/dev/ttyUSB0'
    codenames = ['xrd_pressure_turbo_gas_system', 'xrd_pressure_gas_system_wrg',
                 'xrd_pressure_mass_spec_wrg', 'xrd_pressure_gas_system_baratron']
    reader = PressureReader(port)
    reader.daemon = True
    reader.start()

    loggers = {}
    loggers[codenames[0]] = ValueLogger(reader, comp_val=0.02, comp_type='log', channel=1)
    loggers[codenames[1]] = ValueLogger(reader, comp_val=0.02, comp_type='log', channel=2)
    loggers[codenames[2]] = ValueLogger(reader, comp_val=0.02, comp_type='log', channel=3)
    loggers[codenames[3]] = ValueLogger(reader, comp_val=2, comp_type='lin', channel=4)

    for i in range(0, 4):
        loggers[codenames[i]].start()

    socket = DateDataPullSocket('XRD Pressure', codenames, timeouts=[2.0] * len(codenames))
    socket.start()
    live_socket = LiveSocket('XRD pressure', codenames, 2)
    live_socket.start()

    db_logger = ContinuousDataSaver(continuous_data_table='dateplots_xrd',
                                    username=credentials.user,
                                    password=credentials.passwd,
                                    measurement_codenames=codenames)
    db_logger.start()

    time.sleep(5)
    while True:
        time.sleep(0.25)
        for name in codenames:
            value = loggers[name].read_value()
            socket.set_point_now(name, value)
            live_socket.set_point_now(name, value)
            if loggers[name].read_trigged():
                print(name + ': ' + str(value))
                db_logger.save_point_now(name, value)
                loggers[name].clear_trigged()
开发者ID:jlopezBolt,项目名称:PyExpLabSys,代码行数:46,代码来源:data_logger.py

示例12: main

# 需要导入模块: from PyExpLabSys.common.sockets import DateDataPullSocket [as 别名]
# 或者: from PyExpLabSys.common.sockets.DateDataPullSocket import set_point_now [as 别名]
def main():
    """ Main function """
    logging.basicConfig(filename="logger.txt", level=logging.ERROR)
    logging.basicConfig(level=logging.ERROR)

    i2c_helper = ABEHelpers()
    bus = i2c_helper.get_smbus()
    adc_instance = DeltaSigma(bus, 0x68, 0x69, 18)

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

    codenames = ["cooling_water_hot", "cooling_water_cold"]
    loggers = {}
    for i in range(0, 2):
        loggers[codenames[i]] = ValueLogger(tempreader, comp_val=0.5, channel=i)
        loggers[codenames[i]].start()
    socket = DateDataPullSocket("hall_cooling_water_temp", codenames, timeouts=2.0)
    socket.start()

    live_socket = LiveSocket("hall_waterpressure", codenames)
    live_socket.start()

    db_logger = ContinuousDataSaver(
        continuous_data_table="dateplots_hall",
        username=credentials.user,
        password=credentials.passwd,
        measurement_codenames=codenames,
    )
    db_logger.start()

    time.sleep(5)

    while tempreader.is_alive():
        time.sleep(0.25)
        for name in codenames:
            value = loggers[name].read_value()
            socket.set_point_now(name, value)
            live_socket.set_point_now(name, value)
            if loggers[name].read_trigged():
                print(value)
                db_logger.save_point_now(name, value)
                loggers[name].clear_trigged()
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:46,代码来源:voltage_logger.py

示例13: FlowControl

# 需要导入模块: from PyExpLabSys.common.sockets import DateDataPullSocket [as 别名]
# 或者: from PyExpLabSys.common.sockets.DateDataPullSocket import set_point_now [as 别名]
class FlowControl(threading.Thread):
    """ Keep updated values of the current flow or pressure """
    def __init__(self, mfcs, name):
        threading.Thread.__init__(self)
        self.daemon = True
        self.mfcs = mfcs
        print(mfcs)
        devices = list(self.mfcs.keys())
        self.values = {}
        for device in devices:
            self.values[device] = None

        self.pullsocket = DateDataPullSocket(name + '_analog_control', devices,
                                             timeouts=[3.0] * len(devices))
        self.pullsocket.start()

        self.pushsocket = DataPushSocket(name + '_analog_pc_control', action='enqueue')
        self.pushsocket.start()

        self.livesocket = LiveSocket(name + '_analog_mfc_control', devices)
        self.livesocket.start()
        self.running = True

    def value(self, device):
        """ Return the current value of a device """
        return self.values[device]

    def run(self):
        while self.running:
            time.sleep(0.1)
            qsize = self.pushsocket.queue.qsize()
            while qsize > 0:
                print('queue-size: ' + str(qsize))
                element = self.pushsocket.queue.get()
                mfc = list(element.keys())[0]
                self.mfcs[mfc].set_flow(element[mfc])
                qsize = self.pushsocket.queue.qsize()

            for mfc in self.mfcs:
                flow = self.mfcs[mfc].read_flow()
                self.values[mfc] = flow
                print(flow)
                self.pullsocket.set_point_now(mfc, flow)
                self.livesocket.set_point_now(mfc, flow)
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:46,代码来源:analog_flow_control.py

示例14: Local

# 需要导入模块: from PyExpLabSys.common.sockets import DateDataPullSocket [as 别名]
# 或者: from PyExpLabSys.common.sockets.DateDataPullSocket import set_point_now [as 别名]
class Local(threading.Thread):
    """ This class will be automatically started by the mass-spec program
    it can be arbritrarily simply or complex and will provide a local udp-socket
    to be included in a meta-channel in the mass-spec, thus allowing integraion
    of local instruments """
    def __init__(self):
        threading.Thread.__init__(self)
        #self.daemon = True
        self.pullsocket = DateDataPullSocket('local MS socket',
                                             ['analog_in'], timeouts=2, port=9250)
        self.pullsocket.start()
        port = '/dev/serial/by-id/usb-FTDI_USB-RS485_Cable_FTWBEDQ3-if00-port0'
        self.omega = OmegaD6400(1, port=port)
        self.omega.update_range_and_function(2, action='voltage', fullrange='10')

    def run(self):
        while True:
            time.sleep(0.1)
            value = self.omega.read_value(2)
            self.pullsocket.set_point_now('analog_in', value)
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:22,代码来源:local_channels.py

示例15: PressureLogger

# 需要导入模块: from PyExpLabSys.common.sockets import DateDataPullSocket [as 别名]
# 或者: from PyExpLabSys.common.sockets.DateDataPullSocket import set_point_now [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


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