Rule engine linkage control method based on edge gateway
Through the edge gateway's rule engine linkage control method, it classifies and expands information processing, detects and prioritizes the execution of conflicting rules for IoT devices, solves the problem of rule conflicts between devices, and improves security and rule management efficiency.
Patent Information
- Application Number
- CN202410824771.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2024-10-11
AI Technical Summary
Rule conflicts between IoT devices lead to an unsafe environment, which is difficult to effectively detect and handle with existing technologies, leading to unexpected security issues.
The edge gateway-based rule engine linkage control method is adopted to avoid conflicts by classifying linkage rules, adding extended information, extracting key information, modeling conflict detection, detecting conflict types and executing high-priority rules first.
Accurately detect and handle rule conflicts between IoT devices, reducing security issues caused by conflicts, ensuring the security of the device environment, and improving the efficiency and accuracy of rule formulation and modification.
Smart Images

Figure CN118764236A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of smart home technology, and in particular to a rule engine linkage control method based on an edge gateway. Background Art
[0002] The rule engine module on the IoT platform provides data transmission and device linkage functions. Users can configure linkage rules to allow device data to be transmitted to other devices, thereby realizing device linkage. Or the data generated by different devices can be forwarded to the destination to complete tasks such as data storage and processing. Through the use of the rule engine, complex rules formulated by users can also be easily completed, which not only provides convenience for users but also greatly improves the operating efficiency of the system. When the device behavior (a value in the data reported by the device) or the system time meets the conditions set in the rules set by the user, the actions set by these rules will be triggered, such as triggering an alarm, sending a message, etc. These rules are called linkage rules. By formulating these linkage rules, the device can automatically perform the corresponding actions, which provides great convenience for users. On trigger platforms and IoT platforms, users usually specify rules in the form of "if the conditions are triggered, then perform specific actions". For example, in smart home scenarios, "if the weather is clear, then open the window", "when the temperature is below 10 degrees Celsius, then turn on the air conditioner and keep the temperature at 28 degrees Celsius". The surge in the number of rules will lead to more and more inevitable conflicts between IoT devices, which will further lead to more and more unexpected security issues. For example, multiple users will formulate different rules in the same platform according to their own situations to meet their needs. When two linkage rules happen to be executed in the same time period, making the execution actions of the device in opposite states, conflicts will occur. If such conflicts occur in some smart security scenarios, the environment around the device will be in an unsafe state. In serious cases, it may even threaten the lives of people in the scene. Summary of the invention
[0003] The present invention mainly solves the problem that rule conflicts are prone to occur in a rule engine as linkage rules increase, resulting in an unsafe environment around a device, and provides a rule engine linkage control method based on an edge gateway.
[0004] The above technical problem of the present invention is mainly solved by the following technical solution: a rule engine linkage control method based on edge gateway, comprising the following steps: Classify linkage rules in advance, classify rule conflict types, and establish extended information for linkage rules; Extract key information of linkage rules and establish rule screening database; Get the newly created linkage rules and filter the database according to the rules to detect conflicting requirements; Model the linkage rules while meeting the conflict requirements; Determine the conflict type of the newly created linkage rules, process the conflicting rules and output appropriate linkage rules.
[0005] The present invention is based on the rule screening method of environmental context, and redundant linkage rules are excluded by classifying linkage rules and adding extended information of types and execution areas. When judging the linkage rule conflict, the conflict detection method based on multivariate information modeling first extracts the key information in the linkage rule, and then screens out the linkage rules of the same type and execution area, and then models the information used for conflict detection, and then detects the opposite conflict of defined execution actions, condition coverage conflict, condition mutual exclusion conflict, rule loop conflict and environmental conflict through the conflict detection algorithm, and selects the appropriate linkage rule according to the priority to execute the scene action. The present invention can accurately detect the linkage rules with conflicts, and perform appropriate processing, avoid the conflict of rules between Internet of Things devices, thereby reducing the occurrence of unexpected security problems caused by conflicts, and ensuring the safety of the environment where the Internet of Things devices are located. The present invention classifies the conflict types in detail, and can output specific conflict types through the detection of conflicts, so that users can clearly understand the reasons for the conflicts, and users can avoid conflicting conditions or actions to formulate linkage rules, or can modify the conflict linkage rules in a targeted manner, thereby improving the efficiency and accuracy of formulating or modifying linkage rules.
[0006] As a preferred solution, the establishment of extended information for the linkage rule specifically includes: Add extended information to linkage rules, including priority, type, and execution area information; Priority is the priority level of linkage rule execution, type is the type after linkage rule classification, and execution area is the impact range of the device.
[0007] When formulating linkage rules, add extended information to the linkage rules. The extended information includes three parts: Priority: Set different priorities for different types of rules. The linkage rules of the type with the highest priority will be executed first. For example, the priority of the smart security type is set to 5, which means it has the highest priority. Add different priorities for different types of linkage rules. When a rule conflict occurs, the corresponding linkage rule will be executed according to the priority.
[0008] Type: According to the classification of linkage rules, they are divided into corresponding types and marked when linkage rules are established. Generally, linkage rules of the same type will conflict. By marking the linkage rule type, linkage rules that meet the requirements can be screened according to the type mark, which reduces the complexity of conflict detection and greatly improves the efficiency of detection.
[0009] The execution area divides an execution range for each device, that is, the range that the device can affect is its execution area. Under normal circumstances, only devices in the same area will conflict. For example, "A1 and A2 are two different smart buildings, so the devices in these two buildings do not affect each other." Another example is "There are 80 floors in the A1 building, and the equipment on each floor is responsible for the normal operation of the floor, so in this case, the equipment on different floors does not affect each other." The scope of the device can be further subdivided, for example, "There are different closed spaces on the 10th floor of A1, such as conference rooms, offices, cafeterias, etc., and the equipment in these different spaces does not affect each other." When performing conflict detection, you only need to detect the linkage rules with the same device execution area.
[0010] By establishing the extended information, in the candidate rule conflict detection, for the extended information analysis, only the rules of the same type and the same execution area need to be detected, thus reducing the complexity of the conflict detection.
[0011] As a preferred solution, the pre-classification of linkage rules specifically includes: The linkage rules are classified according to the functions and characteristics of smart devices, including smart security, environmental monitoring, brightness adjustment, audio and video control, and electrical control.
[0012] Before conflict type detection, this solution divides linkage rules into five categories according to the functions and characteristics of smart devices, namely: Smart security represents the safety protection within buildings. The corresponding linkage rules include, "When abnormal images appear in the monitoring, the alarm system will be activated", "When there is no one in the room and the doors and windows are open, a text message will be sent to the user to notify him", etc.
[0013] Environmental monitoring uses sensors of IoT devices to sense changes in the surrounding environment. The corresponding linkage rules include, "When the indoor temperature is greater than 30 degrees Celsius, automatically turn on the air conditioner to lower the temperature to 26 degrees Celsius", "When the air humidity is less than 20%, turn on the humidifier", etc.
[0014] Brightness adjustment is used to adjust the indoor light intensity. The corresponding linkage rules include "turn on the indoor lights when the indoor light is less than 20Lux", "automatically open the indoor curtains during the day", etc.
[0015] Audio and video control category, including control of LED display screens, speakers, etc. The corresponding linkage rules include, "turn on the LED display screen between 9:00-18:00", "automatically adjust the volume of the speakers when the decibel level reaches 70 or above", etc.
[0016] Electrical appliance control, including control of smart cleaning robots, smart refrigerators, etc. The corresponding linkage rules include, "automatically clean the indoor environment between 16:00-17:00", "automatically adjust the refrigerator to energy-saving mode between 00:00-8:00", etc.
[0017] By classifying linkage rules into the above five categories, when creating linkage rules, corresponding linkage rules are classified into corresponding types, which provides a basis for improving the efficiency of conflict detection for candidates.
[0018] As a preferred solution, the rule conflict types are classified in advance, specifically including: If two rules are executed in the same time period and the conflict occurs on the same executor, it is classified as a direct conflict. If two rules are executed in the same time period and the conflict occurs on different executors, it is classified as an indirect conflict. Direct conflicts are further divided into conflicts of opposite execution actions, conflicts of condition coverage, and conflicts of condition mutual exclusion; Indirect conflicts are further divided into environmental conflicts and rule-circular conflicts.
[0019] Before conflict detection, the conflicts generated by the linkage rules need to be classified, so that when conflict detection is performed later, corresponding conflict judgments can be made and the corresponding conflicts between the rules can be detected, so that users can know what type of conflict the newly created linkage rules generate, so as to facilitate subsequent users to modify the linkage rules and accurately eliminate the conflicts of the newly created linkage rules.
[0020] First, linkage rules are divided into direct conflicts and indirect conflicts. Direct conflicts are conflicts between two rules that are executed in the same time period and not by the same executor. Indirect conflicts are conflicts between two rules that are executed in the same time period and not by the same executor. Based on the characteristics of direct and indirect conflicts, direct conflicts are further subdivided into conflict of opposite execution actions, conflict of condition coverage, and conflict of condition mutual exclusion. Indirect conflicts are further subdivided into conflict of environment and conflict of rule loop.
[0021] Direct conflict 1. Execution of opposite actions conflicts If the actuators in two rules are executed in the same time period and the execution actions are opposite, then the two rules will have an opposite execution action conflict. For example, "Rule 1: Automatically lock the door from 23:00 to 6:00; Rule 2: Open the door when motion is detected near the door". From this example, we can see that if motion is detected around the door after 11pm, the door will perform the opposite action. In this case, the rules are said to have an opposite execution action conflict.
[0022] 2. Condition coverage conflict If the condition in Rule 1 is a superset of the condition in Rule 2, Rule 2 will be ignored and will not work. The two rules will have a conditional coverage conflict, which will affect the user experience of the user who formulated Rule 2. For example, "Rule 1: When the air humidity is greater than 50%, turn off the humidifier; Rule 2: When the air humidity is greater than 80%, turn off the humidifier". From the above example, we can see that when Rule 1 is triggered, Rule 2 will never be executed. In this case, the rules have a conditional coverage conflict.
[0023] 3. Conditional mutual exclusion conflict When the rule conditions are partially opposite and the actuators perform the same actions, a conditional mutual exclusion conflict will occur. For example, "Rule 1: When the indoor brightness is less than or equal to 60Lux, open the curtains; Rule 2: When the indoor brightness is greater than or equal to 60Lux, open the curtains." From the above example, we can see that user 1 defines the desired effect of the first rule to increase the brightness by opening the curtains when the indoor brightness is too low; and user 2 defines the desired effect of the second rule to open the curtains when the indoor brightness is greater than 60Lux, which means it is daylight. In this way, when the two rules appear together, the curtains will be kept open during this time period, resulting in a conditional mutual exclusion conflict, thereby reducing the user experience.
[0024] Indirect conflict 1. Environmental Conflict When the impact of a linkage rule on the environment leads to the execution of another rule, and the frozen rule is executed in a way that the user does not expect, it is an environmental conflict. For example, "Rule 1: When the humidity is greater than 60%, turn on the dehumidifier to reduce the humidity to below 30%; Rule 2: When the humidity is less than 29%, turn on the humidifier to increase the humidity to greater than 70%". From the above example, we can see that when Rule 1 and Rule 2 appear together, the dehumidifier and humidifier will always be in working state, which will lead to environmental conflicts and unnecessary waste of resources.
[0025] 2. Rule cycle conflict When two or more rules cause the actuator to work in a loop, a rule loop conflict will occur. For example, "Rule 1: When the humidifier is turned on, close the window; Rule 2: When the window is closed, turn on the humidifier." From the above example, we can see that when the two rules appear together, the following scenario will occur: "After the humidifier is turned on, the window is closed, and after the window is closed, the humidifier is turned on again." This will cause the two actuators to be in a loop working state all the time, resulting in unnecessary waste of resources. Another example is "Rule 1: When the projector is turned on, draw the curtains; Rule 2: When the curtains are drawn, turn off the lights; Rule 3: When the lights are turned off, turn on the projector." From the above example, we can see that the process of the loop conflict caused by more than two rules is roughly the same as the loop conflict caused by two rules.
[0026] As a preferred solution, the method of screening the database according to the rules to detect conflicting requirements includes the following process: The user creates a linkage rule and obtains the type of the newly created linkage rule and the extended execution area information; The linkage rules in the rule screening database are traversed to determine whether there is a linkage rule of the same type and execution area as the newly created linkage rule. If there is a linkage rule, it means that the conflict requirement is met, and the linkage rule is screened as the linkage rule to be detected for conflict.
[0027] This solution obtains the type and execution area content in the extended information to detect the conflict requirements of the newly created linkage rules, and compares and judges with the extended information of the linkage rules in the rule screening database. If there is a linkage rule with the same type and a known execution area, it is judged to meet the conflict requirements, and the linkage rule is screened out as the linkage rule to be detected in conflict. The rule screening database is traversed to screen out all linkage rules that meet the conflict requirements of the newly created linkage rules, and together they constitute a set of linkage rules to be detected in conflict, which are used for candidate conflict detection. In this process, not only the conflict requirements are detected, but also the linkage rules for conflict detection are screened. Since a lot of important information related to conflict detection is stored in the rule screening database, linkage rules of the same type and the same execution area are obtained by screening, which reduces the complexity of candidate conflict detection.
[0028] As a preferred solution, the newly created linkage rules and the linkage rules to be detected for conflict are extracted and modeled with content related to conflict detection. The model is named after the linkage rule ID and includes information on the execution time period, sensor, post-execution environment status, and actuator.
[0029] When a user formulates a new linkage rule, it needs to be processed because the form and content of the rule are too diverse. After extracting the key content in the linkage rule information, it will be stored in the corresponding rule screening database. However, the comparison and screening of the rule screening database only excludes linkage rules of different types and execution areas. There are also data that are not related to conflict detection. Therefore, the content related to conflict detection is modeled to prepare for subsequent conflict detection. After extracting the information related to conflict detection, a linkage rule can be modeled in the following form: Rule_ID={Date, Sensors, Envs, Actuators}, where Date refers to the time period for the linkage rule to be executed; Sensors refers to sensors, which can sense whether the surrounding environment meets the user-set conditions. There can be multiple sensors in a linkage rule, that is, there are multiple conditions in a linkage rule; Envs represents the environmental state of the actuator after execution; Actuators represents the actuator, there can be multiple actuators in a rule, that is, there can be multiple execution actions in a rule.
[0030] As a preferred solution, the conflict type judgment of the newly created linkage rule includes the following process: Traverse the linkage rules to be detected for conflict, and by comparing the information of the model, perform action opposite conflict, condition coverage conflict, condition mutual exclusion conflict, environment conflict, and rule loop conflict detection on the newly created linkage rules in turn. If one of the conflict conditions is met, output the corresponding conflict type.
[0031] The newly created linkage rule is linked with each pending conflict detection to detect each conflict type. When the conditions of one of the conflict types are met, it is determined that the newly created linkage rule has a corresponding conflict type with the pending conflict detection linkage rule and is output. Through the detected conflict type, the user can be reminded not to select conflicting conditions or actions when formulating or modifying linkage rules, which improves the accuracy of formulating or modifying linkage rules to avoid program processing errors, and also improves the efficiency of formulating or modifying linkage rules.
[0032] As a preferred solution, Determine whether the newly created linkage rule and the linkage rule to be detected for conflict are the same executor and in the same execution time period. If the conditions are met, Execute action opposite conflict detection: Determine whether the actuator actions are opposite, if so, output the opposite conflict of the execution actions; Conditional coverage conflict detection: Determine whether the newly created linkage rule sensor condition includes the linkage rule sensor condition to be detected conflictingly, or whether the linkage rule sensor condition to be detected conflictingly includes the newly created linkage rule sensor condition. If so, output the condition to cover the conflicting condition. Conditional mutual exclusion conflict detection: Determine whether the sensor condition of the newly created linkage rule is opposite to the sensor condition of the linkage rule to be detected in conflict. If so, output the condition mutually exclusive conflict; This solution describes the detection of opposite conflicts of execution actions of direct conflicts, condition coverage conflicts, and condition mutual exclusion conflicts, and analyzes and judges the information in the model established according to the linkage rules to determine the type of conflict.
[0033] As a preferred solution, Determine whether the newly created linkage rule and the linkage rule to be detected for conflict are different executors and whether they are in the same execution time period. If the conditions are met, Environmental Conflict Detection: Determine whether the newly created linkage rule environment is consistent with the sensor conditions of the linkage rule to be detected conflicting, and whether the linkage rule environment to be detected conflicting is consistent with the sensor conditions of the newly created linkage rule. If so, output the environment conflict; Rule loop conflict detection: Determine whether the action of the newly created linkage rule executor is consistent with the sensor condition of the linkage rule to be detected conflicting, and whether the action of the linkage rule executor to be detected conflicting is consistent with the sensor condition of the newly created linkage rule. If so, output the rule cycle conflict; Multiple rules loop conflict detection: Determine whether the action of the newly created linkage rule executor is consistent with the sensor condition of the pending conflict detection linkage rule, and whether the action of the pending conflict detection linkage rule executor is inconsistent with the sensor condition of the newly created linkage rule. If so, add the pending conflict detection linkage rule that meets the conditions to the queue as an intermediate linkage rule; Pop out the intermediate linkage rules one by one from the queue, traverse the remaining linkage rules to be detected conflictingly, and determine whether the action of the intermediate linkage rule executor is consistent with the sensor condition of the linkage rule to be detected conflictingly, and whether the action of the linkage rule executor to be detected conflictingly is consistent with the sensor condition of the newly created linkage rule. If so, output multiple rule circular conflicts.
[0034] This solution describes the detection of indirect conflicts, environmental conflicts and rule loop conflicts, where rule loop conflicts include two rule loop conflicts and more than two rule loop conflicts. Traverse the candidate conflict detection linkage rules, and detect each type of conflict with the newly created linkage rules, that is, perform action opposite conflict, condition coverage conflict, condition mutual exclusion conflict, environmental conflict, and rule loop conflict detection in turn. If the conditions of one of the conflict types are met, it is determined as the corresponding conflict. Generally, there is one conflict type, and it is also possible to detect the existence of multiple conflict types.
[0035] As a preferred solution, the processing of conflicting rules to output appropriate linkage rules specifically includes: The priority information of the newly created linkage rule and the linkage rule to be detected for conflict is obtained, and the linkage rule with the highest priority is output according to the priority comparison, and the linkage rule with the highest priority is executed first.
[0036] When a linkage rule conflict is detected, the conflicting linkage rules are processed according to priority, and the linkage rule with a higher priority is executed first.
[0037] Therefore, the advantages of the present invention are: it can accurately detect conflicting linkage rules and perform appropriate processing, thereby avoiding conflicts in rules between IoT devices, thereby reducing the occurrence of unexpected security issues caused by conflicts, and ensuring the safety of the environment in which IoT devices are located. The present invention classifies conflict types in detail, and can output specific conflict types through conflict detection, so that users can clearly understand the reasons for the conflicts. Users can avoid conflicting conditions or actions to formulate linkage rules, or can modify conflicting linkage rules in a targeted manner, thereby improving the efficiency and accuracy of formulating or modifying linkage rules. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 It is a schematic diagram of a process of the present invention. DETAILED DESCRIPTION
[0039] The technical solution of the present invention is further specifically described below through embodiments and in conjunction with the accompanying drawings.
[0040] Example: This embodiment provides a rule engine linkage control method based on an edge gateway, such as Figure 1 As shown, the following steps are included: S1. Classify linkage rules in advance and classify rule conflict types; S2. Establish extended information for linkage rules; S3. Extract key information of linkage rules and establish a rule screening database; S4. Obtain new linkage rules and filter the database according to the rules to detect conflict requirements; S5. Model the linkage rules when the conflict requirements are met; S6. Determine the conflict type of the newly created linkage rule, process the conflicting rules, and execute the appropriate linkage rule.
[0041] As a preferred solution of this embodiment, pre-classifying the linkage rules includes classifying the linkage rules according to the functions and characteristics of the smart devices, including smart security, environmental monitoring, brightness adjustment, audio and video control, and electrical control.
[0042] Before performing conflict detection, the linkage rules are divided into five categories according to the functions and characteristics of smart devices. These five categories basically cover all linkage rules, specifically: Smart security represents the safety protection within buildings. The corresponding linkage rules include, "When abnormal images appear in the monitoring, the alarm system will be activated", "When there is no one in the room and the doors and windows are open, a text message will be sent to the user to notify him", etc.
[0043] Environmental monitoring uses sensors of IoT devices to sense changes in the surrounding environment. The corresponding linkage rules include, "When the indoor temperature is greater than 30 degrees Celsius, automatically turn on the air conditioner to lower the temperature to 26 degrees Celsius", "When the air humidity is less than 20%, turn on the humidifier", etc.
[0044] Brightness adjustment is used to adjust the indoor light intensity. The corresponding linkage rules include "turn on the indoor lights when the indoor light is less than 20Lux", "automatically open the indoor curtains during the day", etc.
[0045] Audio and video control category, including control of LED display screens, speakers, etc. The corresponding linkage rules include, "turn on the LED display screen between 9:00-18:00", "automatically adjust the volume of the speakers when the decibel level reaches 70 or above", etc.
[0046] Electrical appliance control, including control of smart cleaning robots, smart refrigerators, etc. The corresponding linkage rules include, "automatically clean the indoor environment between 16:00-17:00", "automatically adjust the refrigerator to energy-saving mode between 00:00-8:00", etc.
[0047] By classifying the linkage rules into the above five categories, when creating linkage rules, the corresponding linkage rules are classified into corresponding types, which provides a basis for improving the efficiency of conflict detection for candidates.
[0048] As a preferred solution of this embodiment, the rule conflict types are classified in advance. By classifying the rule conflict types, the type of conflict between the linkage rules can be determined during the subsequent conflict detection, so that the user can clearly know what type of conflict the newly created linkage rule generates, which is convenient for the subsequent user to modify the linkage rule and accurately eliminate the conflict of the newly created linkage rule. The rule conflict type classification is performed in advance before the conflict detection. As another implementation method, it can also be performed after the linkage rule is modeled.
[0049] Based on the characteristics of linkage rules and the information used in modeling, linkage rules are divided into direct conflicts and indirect conflicts. Direct conflicts are conflicts between two rules that are executed in the same time period and occur on the same executor, and indirect conflicts are conflicts between two rules that are executed in the same time period and do not occur on the same executor. Based on the characteristics of direct conflicts and indirect conflicts, direct conflicts are further divided into conflicts of opposite execution actions, conflicts of condition coverage, and conflicts of condition mutual exclusion. Indirect conflicts are further divided into environmental conflicts and rule loop conflicts. The above conflicts are specifically expressed as follows: 1. Execution of opposite actions conflicts If the actuators in two rules are executed in the same time period and the execution actions are opposite, then the two rules will have an opposite execution action conflict. For example, "Rule 1: Automatically lock the door from 23:00 to 6:00; Rule 2: Open the door when motion is detected near the door". From this example, we can see that if motion is detected around the door after 11pm, the door will perform the opposite action. In this case, the rules are said to have an opposite execution action conflict.
[0050] 2. Condition coverage conflict If the condition in Rule 1 is a superset of the condition in Rule 2, Rule 2 will be ignored and will not work. The two rules will have a conditional coverage conflict, which will affect the user experience of the user who formulated Rule 2. For example, "Rule 1: When the air humidity is greater than 50%, turn off the humidifier; Rule 2: When the air humidity is greater than 80%, turn off the humidifier". From the above example, we can see that when Rule 1 is triggered, Rule 2 will never be executed. In this case, the rules have a conditional coverage conflict.
[0051] 3. Conditional mutual exclusion conflict When the rule conditions are partially opposite and the actuators perform the same actions, a conditional mutual exclusion conflict will occur. For example, "Rule 1: When the indoor brightness is less than or equal to 60Lux, open the curtains; Rule 2: When the indoor brightness is greater than or equal to 60Lux, open the curtains." From the above example, we can see that user 1 defines the desired effect of the first rule to increase the brightness by opening the curtains when the indoor brightness is too low; and user 2 defines the desired effect of the second rule to open the curtains when the indoor brightness is greater than 60Lux, which means it is daylight. In this way, when the two rules appear together, the curtains will be kept open during this time period, resulting in a conditional mutual exclusion conflict, thereby reducing the user experience.
[0052] 4. Environmental Conflict When the impact of a linkage rule on the environment leads to the execution of another rule, and the frozen rule is executed in a way that the user does not expect, it is an environmental conflict. For example, "Rule 1: When the humidity is greater than 60%, turn on the dehumidifier to reduce the humidity to below 30%; Rule 2: When the humidity is less than 29%, turn on the humidifier to increase the humidity to greater than 70%". From the above example, we can see that when Rule 1 and Rule 2 appear together, the dehumidifier and humidifier will always be in working state, which will lead to environmental conflicts and unnecessary waste of resources.
[0053] 5. Rule loop conflict When two or more rules cause the actuator to work in a loop, a rule loop conflict will occur, including two-rule loop conflict and multiple-rule loop conflict. For example, "Rule 1: When the humidifier is turned on, close the window; Rule 2: When the window is closed, turn on the humidifier." From the above example, it can be seen that when the two rules appear together, the following scenario will occur: "After the humidifier is turned on, the window is closed, and after the window is closed, the humidifier is turned on again." This will cause the two actuators to be in a loop working state all the time, resulting in unnecessary waste of resources. Another example is "Rule 1: When the projector is turned on, draw the curtains; Rule 2: When the curtains are drawn, turn off the lights; Rule 3: When the lights are turned off, turn on the projector." From the above example, it can be seen that the process of the loop conflict caused by more than two rules is roughly the same as the loop conflict caused by two rules.
[0054] As a preferred solution of this embodiment, extended information is established for the linkage rules. When formulating linkage rules, including existing linkage rules and newly created linkage rules, extended information needs to be added and automatically stored in the rule screening database. The extended information includes priority, type, and execution area information. The priority is the priority level of the linkage rule, the type is the type after the linkage rule is classified, and the execution area is the device impact range, which is as follows: Priority: Set different priorities for different types of rules. The linkage rules of the type with the highest priority will be executed first. For example, the priority of the smart security type is set to 5, which means it has the highest priority. Add different priorities for different types of linkage rules. When a rule conflict occurs, the corresponding linkage rule will be executed according to the priority.
[0055] Type: According to the classification of linkage rules, they are divided into corresponding types and marked when linkage rules are established. Generally, linkage rules of the same type will conflict. By marking the linkage rule type, linkage rules that meet the requirements can be screened according to the type mark, which reduces the complexity of conflict detection and greatly improves the efficiency of detection.
[0056] The execution area divides an execution range for each device, that is, the range that the device can affect is its execution area. Under normal circumstances, only devices in the same area will conflict. For example, "A1 and A2 are two different smart buildings, so the devices in these two buildings do not affect each other." Another example is "There are 80 floors in the A1 building, and the equipment on each floor is responsible for the normal operation of the floor, so in this case, the equipment on different floors does not affect each other." The scope of the device can be further subdivided, for example, "There are different closed spaces on the 10th floor of A1, such as conference rooms, offices, cafeterias, etc., and the equipment in these different spaces does not affect each other." When performing conflict detection, you only need to detect the linkage rules with the same device execution area.
[0057] By establishing extended information, in the screening of candidate rule conflicts, for extended information analysis, only rules of the same type and the same execution area need to be detected, which reduces the complexity of conflict detection.
[0058] As a preferred solution of this embodiment, key information of linkage rules is extracted and a rule screening database is established.
[0059] After the linkage rule is formulated, the corresponding Json format data is generated. The Json data contains the user ID of the linkage rule, the type of linkage rule, the priority of the linkage rule, the execution area of the linkage rule, the execution time of the linkage rule, sensor information, actuator information and other related content. Through the Json data format, all the configuration information in the linkage rule can be well recorded. However, in general, a lot of information that is not related to conflict detection is recorded in the Json data. It is necessary to extract the key information in the Json data and store it in the rule screening database to build a rule screening database. By extracting key information from the existing linkage rules, a lot of key information related to conflict detection is stored in the rule screening database. The rule screening database can help screen out linkage rules that meet the conflict requirements and reduce the complexity of subsequent conflict detection.
[0060] After creating a new linkage rule, the system adds extended information to the new linkage rule, extracts key information of the new linkage rule, and screens the database for conflict detection according to the rule to determine whether conflict detection is required. The specific process includes: According to the newly created linkage rule, obtain the newly created linkage rule type and execution area extension information; Traverse the linkage rules in the rule screening database to determine whether there is a linkage rule with the same type and execution area as the newly created linkage rule. If so, it means that the conflict requirements are met, and the linkage rule is screened as the linkage rule to be detected for conflict. If not, it means that the newly created linkage rule does not meet the conflict requirements, and the newly created linkage rule is stored in the rule screening database.
[0061] After creating a new linkage rule, it needs to be processed because the linkage rule form and content are too diverse. After extracting the key information in the linkage rule, it is placed in the rule screening database for conflict requirement detection, and linkage rules that are not of the same type and in the same execution area are excluded. However, there are still data in the linkage rule that are not related to conflict detection. It is necessary to model the content related to conflict detection to prepare for subsequent conflict detection, including modeling the newly created linkage rule and the linkage rule to be detected. The established model is named after the linkage rule ID. The model includes information about the execution time period, sensor, post-execution environment status, and actuator. The model is in the form of: Rule_ID={Date, Sensors, Envs, Actuators}.
[0062] Date refers to the time period when the linkage rule is executed; Sensors refers to sensors, which can sense whether the surrounding environment meets the user-set conditions. There can be multiple sensors in a linkage rule, that is, there are multiple conditions in a linkage rule; Envs represents the environmental state of the actuator after execution; Actuators represents actuators. There can be multiple actuators in a rule, that is, there can be multiple execution actions in a rule. Rule_ID is the ID information of an existing linkage rule in the rule screening database. A new linkage rule is named Rule1 or other characters.
[0063] As a preferred solution of this embodiment, the conflict type judgment of the newly created linkage rule includes the following process: Traverse the linkage rules to be detected for conflict, and by comparing the information of the model, perform action opposite conflict, condition coverage conflict, condition mutual exclusion conflict, environment conflict, and rule loop conflict detection on the newly created linkage rules in turn. If one of the conflict conditions is met, output the corresponding conflict type.
[0064] The specific process of action opposite conflict, condition coverage conflict, condition mutual exclusion conflict, environment conflict, and rule loop conflict detection is as follows: Determine whether the newly created linkage rule and the linkage rule to be detected for conflict are the same executor and in the same execution time period. If the conditions are met, Execute action opposite conflict detection: Determine whether the actuator actions are opposite, if so, output the opposite conflict of the execution actions; Conditional coverage conflict detection: Determine whether the newly created linkage rule sensor condition includes the linkage rule sensor condition to be detected conflictingly, or whether the linkage rule sensor condition to be detected conflictingly includes the newly created linkage rule sensor condition. If so, output the condition to cover the conflicting condition. Conditional mutual exclusion conflict detection: Determine whether the sensor condition of the newly created linkage rule is opposite to the sensor condition of the linkage rule to be detected in conflict. If so, output the condition mutually exclusive conflict; Determine whether the newly created linkage rule and the linkage rule to be detected for conflict are different executors and whether they are in the same execution time period. If the conditions are met, Environmental Conflict Detection: Determine whether the newly created linkage rule environment is consistent with the sensor conditions of the linkage rule to be detected conflicting, and whether the linkage rule environment to be detected conflicting is consistent with the sensor conditions of the newly created linkage rule. If so, output the environment conflict; Rule loop conflict detection: Determine whether the action of the newly created linkage rule executor is consistent with the sensor condition of the linkage rule to be detected conflicting, and whether the action of the linkage rule executor to be detected conflicting is consistent with the sensor condition of the newly created linkage rule. If so, output the rule cycle conflict; Multiple rules loop conflict detection: Determine whether the action of the newly created linkage rule executor is consistent with the sensor condition of the pending conflict detection linkage rule, and whether the action of the pending conflict detection linkage rule executor is inconsistent with the sensor condition of the newly created linkage rule. If so, add the pending conflict detection linkage rule that meets the conditions to the queue as an intermediate linkage rule; Pop out the intermediate linkage rules one by one from the queue, traverse the remaining linkage rules to be detected conflictingly, and determine whether the action of the intermediate linkage rule executor is consistent with the sensor condition of the linkage rule to be detected conflictingly, and whether the action of the linkage rule executor to be detected conflictingly is consistent with the sensor condition of the newly created linkage rule. If so, output multiple rule circular conflicts.
[0065] This embodiment designs the above-mentioned conflict detection algorithm to detect each conflict type of direct conflict and indirect conflict in turn. If the condition of one of the conflict types is met, it is determined to be a corresponding conflict. Generally, there is one conflict type, and there may be multiple conflict types. If none of the conditions of the conflict type are met, there is no conflict, and the newly created linkage rule is stored in the rule screening database.
[0066] The following code is used to specifically illustrate the conflict detection algorithm process, where Rule1 in the algorithm represents a newly created linkage rule, and Rule represents a rule that has been stored in the rule screening database. In addition, the algorithm defines that "0" represents the absence of this type of conflict, and "1" represents the presence of this type of conflict.
[0067] The variables in the algorithm are defined as follows: OEAC: indicates opposite conflict of execution actions; CCC: indicates condition coverage conflict; CMC: indicates conditional mutual exclusion conflict; EC: stands for Environmental Conflict; RLC: indicates rule loop conflict; MRLC: indicates multiple rules cyclic conflict; Linkage rule conflict detection algorithm function DETECTCONFLICT(Rule1,Rule) OEAC ← 0 / / No conflict in executing actions CCC ← 0 / / Unconditionally cover the conflict CMC ← 0 / / Unconditional mutual exclusion conflict EC ← 0 / / No environment conflict RLC ← 0 / / No regular cycle conflict MRLC ← 0 / / No multiple rules loop conflict for each Rule in Rule_DB do if Rule1.getActuator(id) = Rule[id].getActuator(id) and Rule1.getDate(time) ∩ Rule[id].getDate(time) ≠ ∅ then / / direct conflict if Rule1.getActuator(action) opposite Rule[id].getActuator(action)then OEAC ← 1 / / Opposite action conflict occurs if Rule1.getSensor(condition) contains Rule[id].getSensor(condition)or Rule[id].getSensor(condition) contains Rule1.getSensor(condition) then CCC ← 1 / / Conditional coverage conflict occurs if Rule1.getSensor(condition) opposite Rule[id].getSensor(condition)then CMC ← 1 / / Conditional mutual exclusion conflict occurs if Rule1.getActuator(id) ≠ Rule[id].getActuator(id) andRule1.getDate(time) ∩ Rule[id].getDate(time) ≠ ∅ then / / Indirect conflict if Rule1.getEnv(Snext) ∩ Rule[id].getSensor(condition) ≠ ∅ and Rule[id].getEnv(Snext) ∩ Rule1.getSensor(condition) ≠ ∅ then EC ← 1 / / Environment conflict occurs if Rule1.getActuator(action) = Rule[id].getSensor(condition) and Rule[id].getActuator(action) = Rule1.getSensor (condition) then RLC ← 1 / / Rule loop conflict occurs if Rule1.getActuator(action) = Rule[id].getSensor(condition) and Rule[id].getActuator(action) ≠ Rule1.getSensor(condition) then queue.add(rule) / / Add rules that meet the conditions to the queue While Queue is nonempty do queue.remove(rule) / / Pop the rule out of the queue for each Rule[not in Queue] in Rule_DB do if Rule[id].getActuator(action) = rule.getSensor(condition) and rule.getActuator(action) = Rule1.getSensor(condition) then MRLC ← 1 / / Multiple rules conflict in loops else queue.add(Rule[id]) / / Add the next rule to the queue return OEAC, CCC, CMC, EC, RLC, MRLC As a preferred solution of this embodiment, the conflicting rules are processed and appropriate linkage rules are executed, specifically including: obtaining priority information of the newly created linkage rules with conflicts and the linkage rules to be detected for conflicts, outputting the linkage rule with the highest priority based on priority comparison, and executing the linkage rule with priority.
[0068] The processing method for linkage rules of different priorities specifically includes the following processes: Set up a priority event queue and define the maximum length of the queue. Create an ascending heap using the heap sorting method. Take out the top events of the priority event queue one by one for processing, ensuring that the highest priority events are processed as quickly as possible.
[0069] At the same time, set up a common event queue and define the maximum length of the queue. Temporarily store cache data. If a large number of messages are reported in a short period of time, exceeding the total length of the priority event queue, the device event with the lowest priority (bottom of the stack) in the priority event queue will be inserted into the common event queue. When the priority event queue is free, the data in the common event queue will be inserted into the priority event queue again.
[0070] Considering the boundary value, if the priority event queue is full and the common event queue is full, it means that a large number of messages are reported in a short period of time and the duration is long, then the common event queue will be cleared and some data will be discarded.
[0071] In addition, by detecting the conflicting content of linkage rules, such as conflicts regarding time, after priority sorting, some linkage rules with lower priorities will be processed later. Then, conflicts in the execution area, especially direct conflicts in the operation of the same device, are only executed once, and redundant linkage rules are discarded. In addition, for conflicting linkage rules, users can make the desired modifications according to the detected conflict type to avoid conflicts. Finally, the linkage rules that have been processed and output are stored in the rule screening database.
[0072] The method of this embodiment is a rule screening method based on environmental context. Redundant linkage rules are excluded by classifying the linkage rules and adding extended information of types and execution areas. When judging the linkage rule conflicts, a conflict detection method based on multivariate information modeling is used. First, key information in the linkage rules is extracted, and then linkage rules of the same type and execution area are screened out. Then, the information used for conflict detection is modeled. After that, the conflict detection algorithm is used to detect the opposite conflicts of defined execution actions, condition coverage conflicts, condition mutual exclusion conflicts, rule loop conflicts and environmental conflicts. The appropriate linkage rules are selected according to the priority to execute the scene actions.
[0073] The present invention can accurately detect conflicting linkage rules and perform appropriate processing, thereby avoiding conflicts in rules between IoT devices, thereby reducing the occurrence of unexpected security issues caused by conflicts and ensuring the safety of the environment in which IoT devices are located. The present invention classifies conflict types in detail, and can output specific conflict types through conflict detection, so that users can clearly understand the reasons for the conflicts. Users can avoid conflicting conditions or actions to formulate linkage rules, or can modify conflicting linkage rules in a targeted manner, thereby improving the efficiency and accuracy of formulating or modifying linkage rules.
[0074] The specific embodiments described herein are merely examples of the spirit of the present invention. Those skilled in the art may make various modifications or additions to the specific embodiments described or replace them in similar ways, but they will not deviate from the spirit of the present invention or exceed the scope defined by the appended claims.
[0075] Although this article uses more terms such as linkage rules, rule screening database, opposite conflict of execution actions, condition coverage conflict, condition mutual exclusion conflict, etc., it does not exclude the possibility of using other terms. These terms are used only to more conveniently describe and explain the essence of the present invention; interpreting them as any additional restrictions is contrary to the spirit of the present invention.
Claims
1. A rule engine linkage control method based on edge gateway, Features: The following steps are involved: Classify linkage rules in advance, classify rule conflict types, and establish extended information for linkage rules; Extract key information of linkage rules and establish rule screening database; Get the newly created linkage rules and filter the database according to the rules to detect conflicting requirements; Model the linkage rules while meeting the conflict requirements; Determine the conflict type of the newly created linkage rules, handle the conflicting rules, and execute the appropriate linkage rules.
2. According to claim 1, a rule engine linkage control method based on edge gateway, Its characteristics are The extended information for establishing linkage rules specifically includes: Add extended information to linkage rules, including priority, type, and execution area information; Priority is the priority level of linkage rule execution, type is the type after linkage rule classification, and execution area is the impact range of the device.
3. According to claim 2, a rule engine linkage control method based on edge gateway, Its characteristics are The pre-classification of linkage rules specifically includes: The linkage rules are classified according to the functions and characteristics of smart devices, including smart security, environmental monitoring, brightness adjustment, audio and video control, and electrical control.
4. According to claim 2, a rule engine linkage control method based on edge gateway, Its characteristics are Classify rule conflict types in advance, including: If two rules are executed in the same time period and the conflict occurs on the same executor, it is classified as a direct conflict. If two rules are executed in the same time period and the conflict occurs on different executors, it is classified as an indirect conflict. Direct conflicts are further divided into conflicts of opposite execution actions, conflicts of condition coverage, and conflicts of condition mutual exclusion; Indirect conflicts are further divided into environmental conflicts and rule-circular conflicts.
5. According to claim 4, a rule engine linkage control method based on edge gateway, Its characteristics are The method of screening the database according to the rules to detect conflict requirements includes the following process: The user creates a linkage rule and obtains the type of the newly created linkage rule and the extended execution area information; The linkage rules in the rule screening database are traversed to determine whether there is a linkage rule of the same type and execution area as the newly created linkage rule. If there is a linkage rule, it means that the conflict requirement is met, and the linkage rule is screened as the linkage rule to be detected for conflict.
6. According to claim 5, a rule engine linkage control method based on edge gateway, Its characteristics are The newly created linkage rules and the linkage rules to be detected are extracted and modeled with content related to conflict detection. The model is named after the linkage rule ID and includes information about the execution time period, sensor, post-execution environment status, and actuator.
7. A rule engine linkage control method based on edge gateway according to claim 6, Its characteristics are The conflict type judgment of the newly created linkage rule includes the following process: Traverse the linkage rules to be detected for conflict, and by comparing the information of the model, perform action opposite conflict, condition coverage conflict, condition mutual exclusion conflict, environment conflict, and rule loop conflict detection on the newly created linkage rules in turn. If one of the conflict conditions is met, output the corresponding conflict type.
8. A rule engine linkage control method based on edge gateway according to claim 7, Its characteristics are: Determine whether the newly created linkage rule and the linkage rule to be detected for conflict are the same executor and in the same execution time period. If the conditions are met, Execute action opposite conflict detection: Determine whether the actuator actions are opposite, if so, output the opposite conflict of the execution actions; Conditional coverage conflict detection: Determine whether the newly created linkage rule sensor condition includes the linkage rule sensor condition to be detected conflictingly, or whether the linkage rule sensor condition to be detected conflictingly includes the newly created linkage rule sensor condition. If so, output the condition to cover the conflicting condition. Conditional mutual exclusion conflict detection: Determine whether the sensor conditions of the newly created linkage rule are opposite to the sensor conditions of the linkage rule to be detected in conflict. If so, output the mutually exclusive conflict conditions.
9. A rule engine linkage control method based on edge gateway according to claim 8, Its characteristics are: Determine whether the newly created linkage rule and the linkage rule to be detected for conflict are different executors and whether they are in the same execution time period. If the conditions are met, Environmental conflict detection: Determine whether the newly created linkage rule environment is consistent with the sensor conditions of the linkage rule to be detected conflicting, and whether the linkage rule environment to be detected conflicting is consistent with the sensor conditions of the newly created linkage rule. If so, output the environment conflict; Rule loop conflict detection: Determine whether the action of the newly created linkage rule executor is consistent with the sensor condition of the linkage rule to be detected conflicting, and whether the action of the linkage rule executor to be detected conflicting is consistent with the sensor condition of the newly created linkage rule. If so, output the rule cycle conflict; Multiple rules loop conflict detection: Determine whether the action of the newly created linkage rule executor is consistent with the sensor condition of the pending conflict detection linkage rule, and whether the action of the pending conflict detection linkage rule executor is inconsistent with the sensor condition of the newly created linkage rule. If so, add the pending conflict detection linkage rule that meets the conditions to the queue as an intermediate linkage rule; Pop out the intermediate linkage rules one by one from the queue, traverse the remaining linkage rules to be detected conflictingly, and determine whether the action of the intermediate linkage rule executor is consistent with the sensor condition of the linkage rule to be detected conflictingly, and whether the action of the linkage rule executor to be detected conflictingly is consistent with the sensor condition of the newly created linkage rule. If so, output multiple rule circular conflicts.
10. A rule engine linkage control method based on edge gateway according to any one of claims 2 to 8, Its characteristics are The processing of conflicting rules and executing appropriate linkage rules specifically includes: The priority information of the newly created linkage rule and the linkage rule to be detected for conflict is obtained, and the linkage rule with the highest priority is output according to the priority comparison, and the linkage rule with the highest priority is executed first.
Citation Information
Cited By
Intelligent equipment linkage configuration system and method
CN120386266A
