· Zen HuiFer · Tutorial · 需要2 分钟阅读
Calculation Rules
Understand the calculation rules in the Go IoT development platform, master data calculation logic and core concepts, and improve the data processing capabilities of IoT projects.
The use of data in IoT projects is a very important link. In the Go IoT development platform, JavaScript is used to write calculation rules.
Core Concepts:
- Execution Cycle: Use cron expressions to describe the execution time of tasks.
- Lead Time: Move N seconds forward from the execution time.
- Script: Calculation program written in JavaScript.
- Script Parameters: The main content of the parameters used to form the script calculation is as follows.
- Parameter Name: The parameter name when passing into the script.
- MQTT Client ID: MQTT Client ID.
- Signal: The signal that exists under the MQTT Client ID.
- Aggregation Method: Average, Sum, Maximum, Minimum, Original, First, Last.
Data Calculation Logic:
- Through the execution time + lead time, the time query range of the data can be obtained: start time and end time.
- Through the MQTT client and signal, data content can be found in Influxdb.
- Through the aggregation method, the query result is obtained with Influxdb.
- The above content is put into the script execution to get the final processing result.
Data Link
- Startup Process
- Task Allocation Process
Storage
Currently, data storage uses Mongo for document storage.