· Zen HuiFer · Tutorial  · 2 min read

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.

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:

  1. Execution Cycle: Use cron expressions to describe the execution time of tasks.
  2. Lead Time: Move N seconds forward from the execution time.
  3. Script: Calculation program written in JavaScript.
  4. 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:

  1. Through the execution time + lead time, the time query range of the data can be obtained: start time and end time.
  2. Through the MQTT client and signal, data content can be found in Influxdb.
  3. Through the aggregation method, the query result is obtained with Influxdb.
  4. The above content is put into the script execution to get the final processing result.
  • Startup Process

Redis后台服务用户Redis后台服务用户启动计算任务放入Zset数据集合中

  • Task Allocation Process

Redis监听器rabbit后台服务(定时)Redis监听器rabbit后台服务(定时)检查执行时间是否小于当前时间,小于则放入消息队列监听任务执行任务重写下一个执行时间

Storage

Currently, data storage uses Mongo for document storage.

Back to Blog

Related Posts

View All Posts »
MQTT Client Management Solution

MQTT Client Management Solution

This article details the solution for designing and managing a large number of MQTT clients in IoT projects, including constraints, solution design, load balancing, and failover, helping developers optimize system performance and ensure stable operation.

Data Alarm Design

Data Alarm Design

This article details the design scheme of data alarms in IoT projects, including temperature monitoring alarms, equipment performance degradation alarms, and multi-device linkage alarms, helping developers better understand and apply data alarm technology.

Data Flow Link

Data Flow Link

Understand the core data structure and installation method of the data flow link in the Go IoT development platform, and optimize the data processing flow of IoT projects.

Basic Knowledge of IoT

Basic Knowledge of IoT

This chapter summarizes the basic knowledge of IoT, covering the definition of IoT, the three-layer architecture model of IoT, and its applications in smart homes, industry, agriculture, healthcare, and other fields.