A rule engine for an internet of things system and a configuration method and system thereof

CN121166747BActive Publication Date: 2026-11-03INSPUR YUNZHOU (SHANDONG) IND INTERNET CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202511078321.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-01
Publication Date
2026-11-03
Estimated Expiration
2045-08-01

AI Technical Summary

Technical Problem

In IoT systems, the underlying variables of devices from different manufacturers are inconsistent, resulting in different semantic expressions of rules. This makes it difficult to achieve unified identification of device status or behavior. Furthermore, traditional rule engines suffer from problems such as severe coupling between variables and rules, increased number of rules, high management difficulty, and the impact of rule threshold adjustments on business continuity.

Method used

This paper provides a rule engine for IoT systems and its configuration method. By creating general judgment conditions for the data attribute variables of sensing devices in IoT systems, the device variables and rules are decoupled, the rules of the rule engine are configured, and a rule threshold modification module is provided to achieve fine-grained adaptation and hot updating of rule thresholds.

Benefits of technology

It decouples device variables from rules, solves the problem of inconsistent underlying variables of devices from different manufacturers, improves the convenience of modifying rule thresholds, ensures business continuity, and does not affect the 24/7 continuous operation of the IoT system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121166747B_ABST
    Figure CN121166747B_ABST
Patent Text Reader

Abstract

The present application relates to the field of Internet of Things, and in particular to a rule engine for Internet of Things system and a configuration method and system thereof, comprising: creating a judgment condition for a data attribute variable of a sensing device in the Internet of Things system; the judgment condition is a general condition capable of acting on data attribute variables of multiple sensing devices in the Internet of Things system; and different rules are configured by using the created judgment condition according to business requirements of the Internet of Things system. The present application can realize decoupling of device variables and rules, which is helpful to solve the problem that different manufacturers' device bottom variables are inconsistent, resulting in different rule semantic expression modes and difficulty in realizing unified identification of device states or behaviors, and is also helpful to increase the convenience of rule threshold modification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of the Internet of Things (IoT), and specifically to a rule engine for IoT systems, its configuration method, and system. Background Technology

[0002] Device data collection via IoT is essential in IoT systems across industries such as manufacturing, agriculture, and healthcare. Monitoring the status and behavior of devices is a fundamental requirement for industry-wide IoT informatization. Monitoring the status or behavior of an IoT device requires specific rules for identification.

[0003] However, current rule-based judgments for IoT devices still have shortcomings. For example, the underlying variables of devices from different manufacturers are inconsistent, resulting in different semantic expressions of rules and making it difficult to achieve unified identification of device status or behavior. This not only increases the difficulty of system integration but also raises the cost of later maintenance. Furthermore, for devices from the same manufacturer, rule thresholds may differ under different operating environments, but existing rules are usually coupled with the underlying variables of the devices, requiring a significant amount of time and effort to adjust the differing rule thresholds.

[0004] Furthermore, traditional rule engines have significant drawbacks. First, variables and rules are heavily coupled. To fine-tune thresholds within rules, it's often necessary to create and specify separate rules for each variable, increasing the number of rules and management complexity. Second, most rule engines pre-configure rules during program initialization. Subsequent changes to rule thresholds require a service restart, severely impacting business continuity for industries requiring 24 / 7 operation. Summary of the Invention

[0005] To address the above shortcomings, this invention provides a rule engine and its configuration method and system for Internet of Things (IoT) systems, thereby solving at least one of the aforementioned problems.

[0006] In a first aspect, the present invention provides a rule engine configuration method for an Internet of Things (IoT) system, the method comprising: S1. Create judgment conditions for the data attribute variables of sensing devices in the Internet of Things (IoT) system; the judgment conditions are general conditions that can be applied to the data attribute variables of multiple sensing devices in the IoT system. S2. Based on the business requirements of the IoT system, configure different rules using the created judgment conditions.

[0007] Furthermore, the method also includes: Configure the data attribute variables of each sensing device in the IoT system and the corresponding rules and judgment conditions within those rules, according to the business requirements of the IoT system.

[0008] Secondly, this invention provides a rule engine configuration system for Internet of Things (IoT) systems, the system comprising: The first unit is used for users to create judgment conditions for the data attribute variables of sensing devices in the Internet of Things (IoT) system; the judgment conditions are general conditions that can be applied to the data attribute variables of multiple sensing devices in the IoT system. The second unit is used to configure different rules based on the established judgment conditions according to the business needs of the IoT system.

[0009] Furthermore, the system also includes: The third unit is used by users to configure the data attribute variables of each sensing device in the IoT system and the corresponding rules and judgment conditions within the configured rules, according to the business needs of the IoT system.

[0010] Thirdly, the present invention provides a rule engine for Internet of Things (IoT) systems, the rule engine including a first configuration module; The first configuration module, as described above, is the rule engine configuration system used to configure the rules of the rule engine.

[0011] Furthermore, the rules engine also includes a second configuration module; The second configuration module is used by users to configure the data attribute variables of each sensing device in the IoT system and the corresponding rules and judgment conditions within the configured rules, according to the business needs of the IoT system.

[0012] Furthermore, the rules engine also includes a caching module; The caching module is used to cache the rules configured in the first configuration module.

[0013] Furthermore, the rule engine also includes a data acquisition module and several rule execution environments configured one-to-one for each rule of the first configuration module; The data acquisition module is used to connect with the sensing devices of the Internet of Things (IoT) system to collect the values ​​of the data attribute variables of the sensing devices in the IoT system in real time, and send the collected values ​​of each data attribute variable to the corresponding rule execution environment in real time according to the correspondence between the data attribute variables of the sensing devices in the IoT system and the rules configured by the second configuration module. The rule execution environment is used to receive the values ​​of data attribute variables sent by the data acquisition module in real time, and based on the correspondence between the data attribute variables of the sensing devices in the IoT system configured by the second configuration module and the judgment conditions in the rules, it determines in real time whether the values ​​of the received data attribute variables meet the corresponding rules. If the rules are met, a trigger signal is issued; if the rules are not met, no action is taken.

[0014] Furthermore, each cached rule is equipped with a flag bit; the flag bit has two states: true and false. True indicates that the rule is in the process of data processing, and false indicates that the rule is not in the process of data processing. The initial state of the flag bit is false. The rule engine also includes a rule threshold modification module; The rule threshold modification module includes a submission unit and a processing unit; The submission unit is used by users to submit the target rule execution environment and the target rule; the target rule execution environment is the execution environment of the rule whose rule threshold needs to be modified, and the target rule is the corresponding rule after the rule threshold is modified; The processing unit is used to receive the target rule execution environment and target rule submitted by the submission unit, and after receiving the submitted target rule execution environment and target rule, it checks whether the corresponding cached rule is in the process of data processing: if not, it immediately updates the corresponding cached rule with the received target rule; if so, it caches the target rule. Each time the rule execution environment receives the value of a data attribute variable sent by the data acquisition module, it checks whether the flag of the corresponding cached rule is true. If not, it modifies the flag of the corresponding cached rule to true and checks whether the value of the received data attribute variable satisfies the corresponding rule. If yes, it modifies the flag of the corresponding cached rule to false, updates the cached rule to the corresponding target rule, and then checks whether the value of the received data attribute variable satisfies the updated rule.

[0015] Furthermore, the system receives the values ​​of data attribute variables sent by the data acquisition module in real time, and, based on the correspondence between the data attribute variables of sensing devices in the IoT system configured by the second configuration module and the judgment conditions within the rules, determines in real time whether the values ​​of the received data attribute variables satisfy their corresponding rules, including: Each time the value of the data attribute variable sent by the data acquisition module is received, the following steps L1, L2 and L3 are executed; Step L1: Substitute the value of the currently received data attribute variable into the rule for conditional judgment to obtain the result of the current conditional judgment; Step L2: Determine if a time window exists. When it is determined that no time window exists: if the current condition judgment result is true, then a time window is created with the time when the value of the data attribute variable sent by the data acquisition module is received as the window start time; if the current condition judgment result is false, then the judgment rule is not satisfied. When determining the existence of a time window: if the current condition judgment result is that the rule is true, then it is determined whether the end time of the time window has been reached. If it has been reached, then the rule is determined to be satisfied. If it has not been reached, then no action is taken. If the current condition judgment result is that the rule is not true, then the time window is controlled to disappear, and the rule is determined to be unsatisfactory. Step L3: Determine if a count window currently exists; When it is determined that there is no current count window, if the current condition judgment result is true, a new count window is created, and the total number of consecutive occurrences of the condition judgment result being true under the current count window is recorded as 1; if the current condition judgment result is false, the judgment rule is not satisfied. When determining the current occurrence window, if the current condition judgment result is true, the total number of consecutive occurrences with true condition judgment results under the current occurrence window is incremented by 1. Then, it is determined whether the total number of occurrences after incrementing by 1 reaches the occurrence window threshold. If it does, the occurrence window is controlled to disappear, and the rule is determined to be satisfied. If it does not, no action is taken. If the current condition judgment result is false, the occurrence window is controlled to disappear, and the rule is determined to be unsatisfactory.

[0016] As can be seen from the above technical solutions, the present invention has the following advantages: This invention enables the creation of a single, universal condition for the data attribute variables of sensing devices in an IoT system. Then, using this single universal condition, corresponding rules are configured according to the business requirements of the IoT system, thus decoupling device variables from rules. This solves the problem of inconsistent underlying variables across different manufacturers' devices, leading to varying rule semantic expressions and making it difficult to achieve unified identification of device states or behaviors. It also increases the ease of modifying rule thresholds to some extent.

[0017] This invention is equipped with a rule threshold modification module. When it is necessary to finely adapt the rule threshold, there is no need to spend a lot of time and effort to adjust the rule thresholds that are different. There is no need to create rules for the corresponding variables separately and specify the thresholds of the same manufacturer's equipment in different operating environments. You only need to submit the rule with the modified threshold and the rule execution environment corresponding to the rule to achieve fine-tuning of the rule threshold.

[0018] The rule threshold modification module of this invention, upon receiving the submitted target rule execution environment and target rule, checks whether the corresponding cached rule is in the process of data processing. If the corresponding cached rule is not in the process of data processing, it immediately updates the corresponding cached rule with the received target rule. If the corresponding cached rule is in the process of data processing, it only caches the target rule. This allows the rule execution environment to update the corresponding cached rule with the target rule the next time it receives the value of the data attribute variable sent by the data acquisition module and the rule's flag is true. Then, it determines whether the value of the received data attribute variable satisfies the updated rule, thereby achieving hot modification of the rule without restarting the service. This helps to increase the continuity of services that need to run continuously 24 / 7. Attached Figure Description

[0019] To more clearly illustrate the technical solution of the present invention, the accompanying drawings used in the description will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a schematic flowchart of a rule engine configuration method according to an embodiment of the present invention.

[0021] Figure 2 This is a schematic block diagram of a rule engine configuration system according to an embodiment of the present invention.

[0022] Figure 3 This is a schematic structural block diagram of a rule engine provided in an embodiment of the present invention. Detailed Implementation

[0023] The following describes in detail the rule engine for IoT systems, its configuration methods, and the specific execution steps of the system. Specific details, such as particular system structures and technologies, are presented for illustrative purposes rather than limiting, to provide a thorough understanding of the embodiments of the present invention. However, those skilled in the art will understand that the present invention can also be implemented in other embodiments without these specific details.

[0024] It should be understood that, when used in this specification, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or collections thereof. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0025] The terms "one embodiment" or "some embodiments" used in this invention mean that one or more embodiments of the invention include the specific features, structures, or characteristics described in that embodiment. Therefore, phrases such as "in some embodiments" or "in other embodiments" appearing in different parts of the invention do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized.

[0026] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0027] Figure 1 This is a schematic flowchart illustrating a rule engine configuration method for an Internet of Things (IoT) system, provided as an embodiment of the present invention. Figure 1 The executing entity can be a rule engine configuration system for Internet of Things (IoT) systems. The rule engine configuration method for IoT systems provided in this embodiment is executed by a computer device; correspondingly, the rule engine configuration system for IoT systems runs on the computer device.

[0028] Please refer to Figure 1 The rule engine configuration method includes the following steps S1 to S2.

[0029] Step S1: Create judgment conditions for the data attribute variables of sensing devices in the Internet of Things (IoT) system; the judgment conditions are general conditions that can be applied to the data attribute variables of multiple sensing devices in the IoT system. Step S2: Configure different rules based on the business requirements of the IoT system and the created judgment conditions.

[0030] When in use, judgment conditions can be created in advance for the data attribute variables of sensing devices in the IoT system. Then, according to the business needs of the IoT system, different rules can be configured using the created judgment conditions.

[0031] In one embodiment, the rule engine configuration method further includes: Configure the data attribute variables of each sensing device in the IoT system and the corresponding rules and judgment conditions within those rules, according to the business requirements of the IoT system.

[0032] To facilitate understanding of the present invention, the rule engine configuration method provided by the present invention will be further described below based on the principle of the rule engine configuration method of the present invention.

[0033] Specifically, the rule engine configuration method includes: Step 101: Create a condition (Condition) for the data attribute variables of sensing devices in the Internet of Things (IoT) system.

[0034] Condition is the smallest logical unit for rule execution, used to define a single judgment condition.

[0035] For example, the created conditional expression statement can include five types: threshold, deviation, range, no change, and impulse.

[0036] In practice, those skilled in the art can create corresponding conditional expression statements (Condition) for the data attribute variables of sensing devices in the Internet of Things system, based on actual needs.

[0037] This embodiment allows for independent maintenance of each conditional expression statement (Condition).

[0038] The variable in the conditional statement does not have to be the actual name or address of the device variable; it can be an alias.

[0039] This condition is a general condition that can be applied to multiple device variables.

[0040] For example, in an IoT system, there are three sensing devices: temperature sensor 1, temperature sensor 2, and humidity sensor 3. The conditional expression statement for temperature sensor 1, temperature sensor 2, and humidity sensor 3 is: Temperature1>10℃, Temperature2>10℃, and Humidity3>80%. Temperature1, Temperature2, and Humidity3 are the data attribute variables of temperature sensor 1, temperature sensor 2, and humidity sensor 3. After processing Temperature1>10℃, Temperature2>10℃, and Humidity3>80% in step 102, we can obtain two judgment conditions: T>10℃ and H>80%. T and H are general variables, where T represents temperature and H represents humidity.

[0041] The method in this embodiment helps decouple variable data push from subsequent configuration rules, thus making it easier to apply to more business scenarios.

[0042] Step 102: Using the created judgment conditions, configure the rules according to the business requirements of the IoT system to obtain several different rules.

[0043] In practice, the rules obtained in step 103 can be rules composed of a single judgment condition, or rules formed by combining multiple judgment conditions in an AND or OR relationship, depending on the business requirements of the IoT system.

[0044] The variables in the rule (CEPRule) obtained in step 102 use aliases and can receive data from any device variable, thereby achieving decoupling between variables and rules.

[0045] Optionally, in a specific implementation, step 101 involves creating judgment conditions for the data attribute variables of sensing devices in the IoT system, which may specifically include: Step 1010: Create a single judgment condition for each data attribute variable of each sensing device in the Internet of Things system; Step 1011: Modify the data attribute variables in each individual judgment condition to different general variables to obtain individual judgment conditions in which each data attribute variable is modified to a different general variable, and denote them as the first condition; Step 1012: Divide all the first conditions into groups other than the variables to obtain several groups, which are called transition groups; Step 1013: For each transition group, if there is only one first condition in the group, then the group is recorded as the target group. If there are multiple first conditions in the group, then any one first condition in the group is retained and the other first conditions are deleted to obtain a transition group containing only one first condition, which is recorded as the target group. Step 1014: Gather the first conditions within each target group to obtain the judgment conditions created for the data attribute variables of sensing devices in the Internet of Things system.

[0046] Understandably, there may be one or more first conditions in a transitional group. When there are multiple first conditions, all first conditions within the group are the same except for the variables.

[0047] like Figure 2 As shown, this embodiment provides a rule engine configuration system for Internet of Things (IoT) systems, which includes: The first unit 201 is used for users to create judgment conditions for the data attribute variables of sensing devices in the Internet of Things system; the judgment conditions are general conditions that can be applied to the data attribute variables of multiple sensing devices in the Internet of Things system. Unit 202 is used to configure different rules based on the established judgment conditions according to the business needs of the Internet of Things system.

[0048] In one embodiment, the rules engine configuration system for IoT systems also includes a third unit.

[0049] In this embodiment, the third unit is used to allow users to configure the correspondence between the data attribute variables of each sensing device in the Internet of Things system and the configured rules, as well as the judgment conditions within the configured rules, according to the business requirements of the Internet of Things system.

[0050] Understandably, the above configuration, based on the business requirements of the IoT system, establishes the correspondence between the data attribute variables of each sensing device in the IoT system and the configured rules, as well as the judgment conditions within those rules. In other words, it configures the rules corresponding to the data attribute variables of the sensing devices in the IoT system, and configures the judgment conditions corresponding to the data attribute variables of the sensing devices in the IoT system within their configured rules, based on the business requirements of the IoT system.

[0051] like Figure 3 As shown, this embodiment provides a rule engine for Internet of Things (IoT) systems, which includes a first configuration module.

[0052] The first configuration module adopts the rule engine configuration system for IoT systems described in any of the above embodiments. The first configuration module is used to configure the rules of the rule engine.

[0053] In some other embodiments, the rules engine also includes a second configuration module.

[0054] The second configuration module is used by users to configure the data attribute variables of each sensing device in the IoT system and the corresponding rules and judgment conditions within the configured rules, according to the business needs of the IoT system.

[0055] In some other embodiments, the rules engine also includes a caching module.

[0056] The caching module is used to cache the rules configured in the first configuration module.

[0057] In other embodiments, the rule engine also includes a data acquisition module and several rule execution environments configured one-to-one for each rule of the first configuration module.

[0058] The data acquisition module is used to connect with the sensing devices of the Internet of Things (IoT) system to collect the values ​​of the data attribute variables of the sensing devices in the IoT system in real time, and send the collected values ​​of each data attribute variable to the corresponding rule execution environment in real time, according to the correspondence between the data attribute variables of the sensing devices in the IoT system and the rules configured by the second configuration module.

[0059] In practical use, the input end of the data acquisition module is first connected to the output end of the sensing device in the IoT system. The sensing device in the IoT system transmits its sensing information to the data acquisition module. The data acquisition module receives the sensing information from the sensing device, collects the values ​​of the data attribute variables of each sensing device, and then, according to the correspondence between the data attribute variables of the sensing devices and the rules configured by the second configuration module, sends the collected data attribute variables of each sensing device to their respective rule execution environment.

[0060] For example, given rules A and B, the values ​​of data attribute variables of sensing device 1 and sensing device 2, and the configured data attribute variables of sensing device 1 correspond to rule A, and the configured data attribute variables of sensing device 2 correspond to rule B, the data acquisition module will send the values ​​of the data attribute variables of sensing device 1 to the rule execution environment corresponding to rule A, and send the values ​​of the data attribute variables of sensing device 2 to the rule execution environment corresponding to rule B.

[0061] In this embodiment, the rule engine sets up several rule execution environments one-to-one for each rule configured by the first configuration module. That is, each rule configured by the first configuration module is configured with a separate rule execution environment, and each rule configured by the first configuration module corresponds one-to-one with a rule execution environment. The number of rule execution environments is equal to the number of rules configured by the first configuration module.

[0062] In this embodiment, each rule corresponds to a rule execution environment (i.e., each rule has a rule execution environment), and each rule execution environment corresponds to a rule.

[0063] The rule execution environment in this embodiment is used to receive the values ​​of data attribute variables sent by the data acquisition module in real time, and to determine in real time whether the values ​​of the received data attribute variables meet the corresponding rules based on the correspondence between the data attribute variables of the sensing devices in the Internet of Things system configured by the second configuration module and the judgment conditions in the rules. If the rules are met, a trigger signal is issued; if the rules are not met, no processing is performed.

[0064] In one illustrative embodiment of the present invention, each cached rule in the rule engine is equipped with a flag bit. The flag bit has two states: true and false. A true state indicates that the rule is in the process of data processing, while a false state indicates that the rule is not in the process of data processing. The initial state of the flag bit is false.

[0065] Understandably, in the rule engine of this embodiment, each cached rule is equipped with a flag bit. The flag bit has two states: true and false, and the initial state is false.

[0066] In one embodiment, the rule engine also includes a rule threshold modification module.

[0067] The rule threshold modification module includes a submission unit and a processing unit.

[0068] The aforementioned submission unit is used by users to submit the target rule execution environment and target rules.

[0069] The target rule execution environment is the execution environment of the rule whose threshold needs to be modified.

[0070] The target rule is the corresponding rule after the rule threshold is modified.

[0071] For example, suppose there is a rule M whose rule threshold needs to be modified. Then the rule execution environment of rule M is the target rule execution environment (correspondingly, the rule corresponding to the target rule execution environment is rule M), and the rule M after the rule threshold is modified is the target rule.

[0072] The aforementioned processing unit is used to receive the target rule execution environment and target rule submitted by the submission unit, and after receiving the submitted target rule execution environment and target rule, it checks whether the corresponding cached rule is in the process of data processing: if not, it immediately updates the corresponding cached rule with the received target rule; if so, it caches the target rule.

[0073] Each time a target rule is cached, if a corresponding target rule exists from the previous cache, the target rule to be cached now will overwrite the corresponding target rule from the previous cache.

[0074] In practice, the rule execution environment records in real time whether the corresponding cached rule is in the process of data processing.

[0075] The aforementioned processing unit can send a request to the target rule execution environment to query whether the rule corresponding to the target rule execution environment is in the process of data processing, thereby achieving the purpose of checking whether the corresponding cached rule is in the process of data processing.

[0076] Optionally, each time the rule execution environment receives the value of the data attribute variable sent by the data acquisition module, it determines whether the flag bit of the corresponding cached rule is true. If not, it modifies the flag bit of the corresponding cached rule to true and determines whether the value of the received data attribute variable satisfies the corresponding cached rule. If yes, it modifies the flag bit of the corresponding cached rule to false, updates the cached rule to the corresponding target rule, and then determines whether the value of the received data attribute variable satisfies the updated rule.

[0077] The process of determining whether the values ​​of received data attribute variables satisfy their corresponding rules includes: First, substitute the value of the received data attribute variable into its corresponding rule, and then determine whether the corresponding rule is satisfied.

[0078] The rule engine in this embodiment can realize hot updates of rules. The update is completed by recognizing the flag status of the rule. When the flag status is true, the update waits. When the flag status changes from true back to false, the update is performed. This does not affect the data processing of the rule, and the change does not require downtime.

[0079] Optionally, in a specific implementation, the above-mentioned submission unit may also use a hot update interface (such as an HTTP API) to receive the target rule and atomically replace the corresponding rule in the cache.

[0080] In some embodiments, the values ​​of data attribute variables sent by the data acquisition module are received in real time, and based on the correspondence between the data attribute variables of sensing devices in the IoT system and the judgment conditions within the rules configured by the second configuration module, it is determined in real time whether the values ​​of the received data attribute variables satisfy their corresponding rules, including: Each time the value of the data attribute variable sent by the data acquisition module is received, the following steps L1, L2 and L3 are executed; Step L1: Substitute the value of the currently received data attribute variable into the rule for conditional judgment to obtain the result of the current conditional judgment; Step L2: Determine if a time window exists. When it is determined that no time window exists: if the current condition judgment result is true, then a time window is created with the time when the value of the data attribute variable sent by the data acquisition module is received as the window start time; if the current condition judgment result is false, then the judgment rule is not satisfied. When determining the existence of a time window: if the current condition judgment result is that the rule is true, then it is determined whether the end time of the time window has been reached. If it has been reached, then the rule is determined to be satisfied. If it has not been reached, then no action is taken. If the current condition judgment result is that the rule is not true, then the time window is controlled to disappear, and the rule is determined to be unsatisfactory. Step L3: Determine if a count window currently exists; When it is determined that there is no current count window, if the current condition judgment result is true, a new count window is created, and the total number of consecutive occurrences of the condition judgment result being true under the current count window is recorded as 1; if the current condition judgment result is false, the judgment rule is not satisfied. When determining the current occurrence window, if the current condition judgment result is true, the total number of consecutive occurrences with true condition judgment results under the current occurrence window is incremented by 1. Then, it is determined whether the total number of occurrences after incrementing by 1 reaches the occurrence window threshold. If it does, the occurrence window is controlled to disappear, and the rule is determined to be satisfied. If it does not, no action is taken. If the current condition judgment result is false, the occurrence window is controlled to disappear, and the rule is determined to be unsatisfactory.

[0081] The rule engine in this embodiment helps to handle data mutation and jitter issues to some extent.

[0082] Furthermore, in practical implementation, a listener can be added to each rule execution environment. After determining that a rule is satisfied, the rule execution environment sends the judgment result and variable data (encapsulated in a trigger signal) to the listener, which then handles subsequent business logic, including rule execution (such as alarms) and logging. This helps to decouple trigger judgment from business processing, thus ensuring that the rule judgment of variables is not affected even in millisecond-level scenarios.

[0083] When a rule needs to be deactivated, its execution environment can be destroyed to release resources. Listeners associated with that execution environment will also be destroyed. During destruction, it is first determined whether the current business logic has been completed. If the listener's business logic is complete, the corresponding listener will then be destroyed.

[0084] For the same or similar parts among the various embodiments in this specification, please refer to each other.

[0085] This invention supports mixed logic of single-variable or multi-variable rules, and decouples variable data push from rules.

[0086] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A rule engine for Internet of Things (IoT) systems, characterized in that, The rules engine includes a first configuration module; The first configuration module uses the system to configure the rules of the rule engine; The system includes: The first unit is used for users to create judgment conditions for the data attribute variables of sensing devices in the Internet of Things (IoT) system; the judgment conditions are general conditions that can be applied to the data attribute variables of multiple sensing devices in the IoT system. The second unit is used to configure different rules based on the established judgment conditions according to the business needs of the Internet of Things system. The third unit is used by users to configure the data attribute variables of each sensing device in the IoT system and the corresponding rules and judgment conditions within the configured rules according to the business needs of the IoT system. The rules engine also includes a second configuration module; The second configuration module is used by users to configure the data attribute variables of each sensing device in the IoT system and the corresponding rules and judgment conditions within the configured rules according to the business needs of the IoT system. The rules engine also includes a caching module; The caching module is used to cache the rules configured in the first configuration module; The rule engine also includes a data acquisition module and several rule execution environments configured one-to-one for each rule in the first configuration module; The data acquisition module is used to connect with the sensing devices of the Internet of Things (IoT) system to collect the values ​​of the data attribute variables of the sensing devices in the IoT system in real time, and send the collected values ​​of each data attribute variable to the corresponding rule execution environment in real time according to the correspondence between the data attribute variables of the sensing devices in the IoT system and the rules configured by the second configuration module. The rule execution environment is used to receive the values ​​of data attribute variables sent by the data acquisition module in real time, and to determine whether the values ​​of the received data attribute variables meet the corresponding rules in real time based on the correspondence between the data attribute variables of the sensing devices in the Internet of Things system configured by the second configuration module and the judgment conditions in the rules. If the rules are met, a trigger signal is issued; if the rules are not met, no action is taken. Each cached rule is equipped with a flag bit; the flag bit has two states: true and false. True indicates that the rule is in the process of data processing, and false indicates that the rule is not in the process of data processing. The initial state of the flag bit is false. The rule engine also includes a rule threshold modification module; The rule threshold modification module includes a submission unit and a processing unit; The submission unit is used by users to submit the target rule execution environment and the target rule; the target rule execution environment is the execution environment of the rule whose rule threshold needs to be modified, and the target rule is the corresponding rule after the rule threshold is modified; The processing unit is used to receive the target rule execution environment and target rule submitted by the submission unit, and after receiving the submitted target rule execution environment and target rule, it checks whether the corresponding cached rule is in the process of data processing: if not, it immediately updates the corresponding cached rule with the received target rule; if so, it caches the target rule. Each time the rule execution environment receives the value of a data attribute variable sent by the data acquisition module, it checks whether the flag of the corresponding cached rule is true. If not, it modifies the flag of the corresponding cached rule to true and checks whether the value of the received data attribute variable satisfies the corresponding rule. If yes, it modifies the flag of the corresponding cached rule to false, updates the cached rule to the corresponding target rule, and then checks whether the value of the received data attribute variable satisfies the updated rule.

2. The rule engine according to claim 1, characterized in that, The system receives the values ​​of data attribute variables sent by the data acquisition module in real time, and, based on the correspondence between the data attribute variables of sensing devices in the IoT system configured by the second configuration module and the judgment conditions within the rules, determines in real time whether the values ​​of the received data attribute variables satisfy their corresponding rules, including: Each time the value of the data attribute variable sent by the data acquisition module is received, the following steps L1, L2 and L3 are executed; Step L1: Substitute the value of the currently received data attribute variable into the rule for conditional judgment to obtain the result of the current conditional judgment; Step L2: Determine if a time window exists. When it is determined that no time window exists: if the current condition judgment result is true, then a time window is created with the time when the value of the data attribute variable sent by the data acquisition module is received as the window start time; if the current condition judgment result is false, then the judgment rule is not satisfied. When determining the existence of a time window: if the current condition judgment result is that the rule is true, then it is determined whether the end time of the time window has been reached. If it has been reached, then the rule is determined to be satisfied. If it has not been reached, then no action is taken. If the current condition judgment result is that the rule is not true, then the time window is controlled to disappear, and the rule is determined to be unsatisfactory. Step L3: Determine if a count window currently exists; When it is determined that there is no current count window, if the current condition judgment result is true, a new count window is created, and the total number of consecutive occurrences of the condition judgment result being true under the current count window is recorded as 1; if the current condition judgment result is false, the judgment rule is not satisfied. When determining the current occurrence window, if the current condition judgment result is true, the total number of consecutive occurrences with true condition judgment results under the current occurrence window is incremented by 1. Then, it is determined whether the total number of occurrences after incrementing by 1 reaches the occurrence window threshold. If it does, the occurrence window is controlled to disappear, and the rule is determined to be satisfied. If it does not, no action is taken. If the current condition judgment result is false, the occurrence window is controlled to disappear, and the rule is determined to be unsatisfactory.

Citation Information

Patent Citations

  • Rule instance execution method and device based on Internet of Things intelligent device, and medium

    CN111338712A

  • Terminal control method and device based on Internet of Things rule engine, equipment and medium

    CN113918361A

  • Workflow engine algorithm based on event triggering

    CN118377519A