示例#1
0
def startup(sensors_groups, host='localhost', port=65000):
    """

    """
    server = []
    client = []

    samples_per_channel = 100

    devices = extract_devices(sensors_groups)
    channels = extract_channels(sensors_groups)

    DaqPkgRingBuffer.configure(samples_per_channel, 0.0)
    DaqDictRingBuffer.configure(samples_per_channel * 10, 0)

    # server daq configurations
    for name in channels:
        DaqPkgRingBuffer.bind(name, channels[name])

    for name in devices:
        server.append(DaqRegister(devices[name]))

    server.append(DaqServer(host, port))

    # client analyzer configurations
    for name in channels:
        DaqDictRingBuffer.bind(name, channels[name])
        client.append(
            DaqAnalyzer('localhost', 65000, channels['ceramic'], name))

    client.append(DaqPlotter(samples_per_channel=samples_per_channel * 10))

    asyncore.loop()
示例#2
0
def startup(sensors_groups, host='localhost', port=65000):
    """

    """
    server = []

    devices = extract_devices(sensors_groups)
    channels = extract_channels(sensors_groups)
    DaqPkgRingBuffer.configure(100, 0.0)

    for name in channels:
        DaqPkgRingBuffer.bind(name, channels[name])

    for name in devices:
        server.append(DaqRegister(devices[name]))

    server.append(DaqServer(host, port))

    asyncore.loop(0.5)
示例#3
0
def startup(sensors_groups, host='localhost', port=65000):
    """

    """
    server = []

    devices = extract_devices(sensors_groups)
    channels = extract_channels(sensors_groups)
    DaqPkgRingBuffer.configure(100, 0.0)

    for name in channels:
        DaqPkgRingBuffer.bind(name, channels[name])

    for name in devices:
        server.append(DaqRegister(devices[name]))

    server.append(DaqServer(host, port))

    asyncore.loop(0.5)
示例#4
0
def startup(sensors_groups):
    """

    """
    server = []
    client = []

    # total samples per channel
    samples_per_channel = 15000
    # samples per channel per each read access
    samples_per_channel_read = 1000
    # quantity of package of data to be buffered
    packages_per_channel = 1

    devices = extract_devices(sensors_groups)
    channels = extract_channels(sensors_groups)
    tree_channels = defaultdict(dict)

    DaqPkgRingBuffer.configure(packages_per_channel, 0.0)
    DaqDictRingBuffer.configure(max_samples_per_channel=samples_per_channel *
                                2,
                                nothing_value=0,
                                overwritten_exception=False)

    # server daq configurations
    for name in channels:
        DaqPkgRingBuffer.bind(name, channels[name])

    for name in devices:
        server.append(DaqRegister(devices[name], samples_per_channel_read))

    # client analyzer configurations
    for name in channels:
        tree_channels[name] = dict([(ch, None) for ch in channels[name]])
        DaqDictRingBuffer.bind(name, channels[name])

        client.append(
            DaqAnalyzer(channels=channels[name],
                        daq_name=name,
                        server=DaqServer.listening(channels[name], name)))
    """
    # View all signals ring buffer
    chart = DaqPlotter(samples_per_channel=samples_per_channel*2)
    client.append(chart)
    """

    # View only segmented signals
    chart = DaqAsyncPlotter(samples_per_channel=samples_per_channel,
                            tree_channels=tree_channels)
    client.append(chart)

    def callback_process(data):
        # call the weigh method
        weight = Weigh.calculate(data)
        # call the save method
        #
        # call chart method
        chart.send(data)

    # Segmentation Module
    for name in channels:
        client.append(
            SegmentedByTrigger(buffer_name=name,
                               channels=channels[name],
                               trigger=sensors_groups[name]['trigger'],
                               chunk=samples_per_channel,
                               ring_buffer=DaqDictRingBuffer,
                               callback=callback_process))
    loop(routines=server + client, wait=0.00000001)
示例#5
0
    import sys
    import platform

    # internal
    sys.path.append('../../')
    from arch.socket_arch.util import extract_devices
    from gui.plotter.async_chart import DaqMultiPlotter

    if platform.system() == 'Linux':
        sys.path.append('/var/www/mswim/')
    else:
        sys.path.append('c:/mswim/')

    from mswim.settings import DEVICES

    device = extract_devices(DEVICES)['Dev5']
    device2 = extract_devices(DEVICES)['Dev4']
    daq_chunk = 1000

    DaqMultiPlotter.configure(daq_chunk, ['Dev5', 'Dev4'])

    def internal_callback1(interval, data):
        DaqMultiPlotter.send_data({'Dev5': data})

    def internal_callback2(interval, data):
        DaqMultiPlotter.send_data({'Dev4': data})
        DaqMultiPlotter.show()

    callback_task = CallbackTask(
        physical_channels=device['analog'],
        digital_physical_channels=device['digital'],