Smoothie图表实时高速数据

时间:2023-01-15 03:54:35

I've got a high-speed data output from a C++ script, an int is produced every 800 microseconds(~1.6kHz), I've played around with this running with websocketd to stream it live to a smoothie chart on a web server on the same machine. I've found the best way to make the chart as smooth as possible is to output an array of 100 datapoints to the websocket. Inside my smoothie javascript, it splits the array and then adds the data with arbitrarily spread X values between the last array and this array.

我从C ++脚本获得了一个高速数据输出,每隔800微秒(~1.6kHz)产生一个int,我已经玩过websocketd运行它来实时流式传输到Web服务器上的冰沙图表在同一台机器上。我发现使图表尽可能平滑的最佳方法是输出100个数据点的数组到websocket。在我的思慕雪javascript中,它分割数组,然后在最后一个数组和这个数组之间添加任意扩展X值的数据。

'
conn.onmessage = function(evt) {
    $("#log").text("Connected");
    var arrZ = evt.data.split(',');
    newTime = new Date().getTime();
    var timeInterval = (newTime - oldTime)*0.01
    for (i=0;i<100;i++){
        timeSeries.append(oldTime, arrZ[i]);
        oldTime += timeInterval;
        }
    oldTime = new Date().getTime();};

'

The data plot is not fantastic but works. Is there any other(faster) way - architecture wise - to get this data on to smoothiecharts? SmoothieCharts Charting high speed data
Smoothie图表实时高速数据
Thanks,

数据图并不是很棒,但很有效。有没有其他(更快)的方式 - 架构明智 - 将这些数据传输到smoothiecharts? SmoothieCharts绘制高速数据图表谢谢,

1 个解决方案

#1


0  

The problem is that underneath, you're using TCP/IP packets. And with just a few bits of data on every update, these packets aren't immediately full. Your OS has the reasonable expectation that waiting a bit will improve bandwidth, as it can send the same amount of raw data with fewer packet headers.

问题是在下面,你正在使用TCP / IP数据包。每次更新时只有几位数据,这些数据包不会立即满。您的操作系统有合理的期望,等待一点可以提高带宽,因为它可以用更少的数据包标头发送相同数量的原始数据。

However, this backfires for you. You care about latency, not data. The easiest solution is to stuff dummy data in your packets. Each value, once formatted and padded should be ~1500 bytes.

然而,这对你来说是适得其反。你关心延迟,而不是数据。最简单的解决方案是在数据包中填充虚拟数据。格式化和填充后的每个值应为~1500字节。

#1


0  

The problem is that underneath, you're using TCP/IP packets. And with just a few bits of data on every update, these packets aren't immediately full. Your OS has the reasonable expectation that waiting a bit will improve bandwidth, as it can send the same amount of raw data with fewer packet headers.

问题是在下面,你正在使用TCP / IP数据包。每次更新时只有几位数据,这些数据包不会立即满。您的操作系统有合理的期望,等待一点可以提高带宽,因为它可以用更少的数据包标头发送相同数量的原始数据。

However, this backfires for you. You care about latency, not data. The easiest solution is to stuff dummy data in your packets. Each value, once formatted and padded should be ~1500 bytes.

然而,这对你来说是适得其反。你关心延迟,而不是数据。最简单的解决方案是在数据包中填充虚拟数据。格式化和填充后的每个值应为~1500字节。