0

我们正在与 Azure IoT Hub 合作,它将数据发送到 Azure TSI,并且我们正在利用 TSI Rest API 从中获取数据。

数据格式-

原始遥测看起来像 -

{"status":0, "timestamp":123456, plc_id:1}
{"status":0, "timestamp":123456, plc_id:1}
{"status":0, "timestamp":123456, plc_id:1}
{"status":0, "timestamp":123456, plc_id:1}
{"status":1, "timestamp":123456, plc_id:1}
{"status":1, "timestamp":123456, plc_id:1}
{"status":1, "timestamp":123456, plc_id:1}
{"status":1, "timestamp":123456, plc_id:1}
{"status":0, "timestamp":123456, plc_id:1}

例如,我在时间戳中使用了 123456。

我需要计算停机时间(最后一次出现 0 - 第一次出现 0),然后忽略状态 1,再次计算 1 后下一个 0 的停机时间。

我们只需要使用 TSI Rest API 来完成它。任何想法?

4

1 回答 1

1

TSI 查询引擎不提供事件之间的窗口计算。无法通过比较两个时间戳来计算停机时间。

TSI 仅支持使用聚合系列 API 基于时间间隔的窗口。您将需要使用 GetEvents API 检索原始事件并在客户端执行/应用您的自定义窗口计算。

于 2022-01-07T19:56:54.377 回答