【发布时间】:2021-12-01 17:44:29
【问题描述】:
我们正在使用 Orion Context 代理,现在与 QuantumLeap 和 CrateDB 结合使用。我们对 QuantumLeap 不太熟悉,需要帮助解决一些我们觉得很奇怪的问题。
在上下文代理中,我们有数据实体:
{
"id": "SC-5C0272FFFE8C206C",
"type": "StreetlightControlCabinet",
"activePowerR": {
"type": "Number",
"value": 0.7456,
"metadata": {
"timestamp": {
"type": "DateTime",
"value": "2021-12-01T16:33:13.00Z"
}
}
},
"activePowerS": {
"type": "Number",
"value": 0.5747,
"metadata": {
"timestamp": {
"type": "DateTime",
"value": "2021-12-01T16:33:13.00Z"
}
}
},
"activePowerT": {
"type": "Number",
"value": 0.4297,
"metadata": {
"timestamp": {
"type": "DateTime",
"value": "2021-12-01T16:33:13.00Z"
}
}
},
.......
}
所有三个属性都有数字值,并且来自“IoT 代理 MQTT/JSON”。
Quantum Leap 已订阅 Context Broker:
{
"description": "QL - StreetlightControlCabinet",
"subject": {
"entities": [
{
"idPattern": ".*",
"type": "StreetlightControlCabinet"
}
],
"condition": {
"attrs": [
"activePowerR",
"activePowerS",
"activePowerT",
...
]
}
},
"notification": {
"http": {
"url": "http://quantumleap:8668/v2/notify"
},
"metadata": ["dateCreated", "dateModified", "timestamp"],
"attrs": [
"activePowerR",
"activePowerS",
"activePowerT",
.....
]
}
}
QuantumLeap (V0.5) 仅当序列中的第一个值是小数(如 0.7456)时才创建具有浮点值类型的 CrateDB 数据序列。
如果 serie 中的第一个值可以在不丢失精度的情况下转换为整数(如 0、1.0、2.0 等),QuantumLeap 将在 CrateDB 中创建具有整数基类型的数据系列。 因此,所有后续传入的数据都将在数据库中截断为整数。
所以这很奇怪,因为在 QuantumLeap 源中我们发现“数字”属性类型应该始终映射到 CrateDB 中的“浮点”数据类型。
任何人都可以解释问题可能是什么?
【问题讨论】:
标签: fiware fiware-orion