A method, device, computer equipment and storage medium for dynamically updating rules
By implementing the dynamic update method of rules at the edge of the smart rod system and dynamically adjusting the priority of rule policies, the problem of static solidification of rule engines in the existing technology is solved, the dynamic nature and execution efficiency of rule policies are improved, and resource consumption is reduced .
Patent Information
- Application Number
- CN202211007803.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-22
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2042-08-22
AI Technical Summary
The rules engine of the existing smart pole system in the smart park is statically solidified and cannot be updated dynamically, resulting in changes in rules that can only be modified manually and cannot be adjusted dynamically based on reference.
By implementing the dynamic update method of rules at the edge, receiving the rule policies transmitted by the server, using a polling algorithm to read the rule information in the rule library cyclically, selecting the policy according to the priority of the rule information, monitoring the operation process of the execution device, and statistical execution Situation and trigger source data, dynamically update rule policy priorities, and generate new rule policy.
It realizes dynamic update of rule priorities based on rule activity, reduces human intervention, improves the dynamicity and efficiency of rule policies, ensures that each rule policy is executed when conditions are met, and reduces resource consumption.
Smart Images

Figure CN115378810B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of intelligent systems, and in particular to a method, apparatus, computer device and storage medium for dynamically updating rules. Background Art
[0002] The existing rule engines of the smart pole system in the smart park, whether in the cloud or on the edge, are statically fixed in the execution device and can only be modified manually. The rule engine information includes the device service that calls the disposal rule for rule execution, the priority of rule execution, and the execution time period of the rule.
[0003] Therefore, the existing rule engine configuration has at least the following defects: all rule engines are statically stored in the execution device in a manually configured manner; static rule information is modified in a subjective manner and cannot be dynamically changed according to a reference basis; the basis for changing the rules can only be changed manually through the rule execution log. Summary of the invention
[0004] Based on this, it is necessary to provide a rule dynamic update method, device, computer equipment and storage medium to address the above technical problems, so as to dynamically update the execution priority of the rules by counting the rule activity within a predetermined time, and generate new association rules, and then reschedule and execute according to the updated rules.
[0005] A rule dynamic update method is applied to an edge end, the edge end is connected to a service end, and the edge end is used to control the operation of at least one execution device on a smart pole; the rule dynamic update method includes:
[0006] Receive multiple rule policies transmitted by the server, and store the rule policies and corresponding rule information in a rule library;
[0007] A polling algorithm is used to cyclically read the rule information in the rule base, select a rule strategy according to the priority in the rule information, and control the execution of the device according to the selected rule strategy;
[0008] Monitor the operation process of the execution device and record the execution process information of the selected rule strategy during execution;
[0009] Collect statistics on the execution process information within a predetermined period to obtain the execution status of each selected rule strategy and the statistical data of the trigger source;
[0010] After obtaining the activity of each rule strategy in the rule base according to the statistical data, dynamically update the priority of the rule strategy in the rule information according to the activity of each rule strategy;
[0011] Generate new rule strategies based on the statistical data of the trigger source and write them into the rule base.
[0012] In one embodiment, the steps of selecting a rule policy according to a priority in the rule information, and controlling the execution of the device according to the selected rule policy include:
[0013] For the same execution device, when more than two rule policies are met within a predetermined period, a rule policy with a higher priority is selected according to the priority of the rule policies to control the operation of the execution device.
[0014] In one of the embodiments, a rule policy is selected according to the priority in the rule information, and the steps of controlling the execution device operation according to the selected rule policy include: when more than two rule policies need to call the same device service resources at the same time, a rule policy with a higher priority is selected to call the device service resources to control the execution device operation.
[0015] In one of the embodiments, the execution process information includes: the start and end time, timestamp, execution start status, execution result status, device GIS location and priority of the selected rule policy when it is executed.
[0016] In one embodiment, the step of collecting statistics on the execution process information within a predetermined period to obtain the execution status of each selected rule strategy and the statistical data of the trigger source includes:
[0017] According to the execution start status and execution result status in the execution process information, statistical data of execution status within a predetermined period, including complete execution and interrupted execution, are obtained to determine the activity of each rule strategy within the predetermined period; and
[0018] Compare the execution process information with the rule information in the rule base to obtain the trigger source of the selected rule policy.
[0019] In one embodiment, the step of increasing or decreasing the priority of a rule policy includes:
[0020] Obtain the activity of each rule strategy in the rule base within a predetermined period;
[0021] For two or more rule policies that control the operation of the same execution device;
[0022] When the activity of the rule policy with a lower priority is higher than that of the rule policy with a higher priority, the priority of the rule policy with a higher activity is increased and becomes higher than the original rule policy with a higher priority.
[0023] When the activity of the rule policy with a low priority is lower than that of the rule policy with a high priority, the priority of the rule policy with a low priority is adjusted to the lowest or deleted.
[0024] In one embodiment, the step of generating a new rule strategy based on the statistical data of the trigger source includes:
[0025] Get the statistical data of the selected rule policy executed according to the trigger source;
[0026] When the statistical data of the trigger rule strategy execution exceeds the preset threshold within the predetermined period, the trigger linkage disposal rule strategy is dynamically generated and written into the rule base.
[0027] A rule dynamic updating device, comprising: a rule receiving module, a rule engine module, a rule monitoring module, a data statistics module, a rule updating module and a rule generating module;
[0028] The rule receiving module is used to receive multiple rule policies transmitted by the server, and store the rule policies and corresponding rule information in the rule library;
[0029] The rule engine module is used to read the rule information in the rule base cyclically using a polling algorithm, select a rule strategy according to the priority in the rule information, and control the execution of the device according to the selected rule strategy;
[0030] The rule monitoring module is used to monitor the operation process of the execution device and record the execution process information of the selected rule policy during execution;
[0031] The data statistics module is used to collect statistics on the execution process information within a predetermined period to obtain the execution status of each selected rule strategy and the statistical data of the trigger source;
[0032] The rule update module is used to obtain the activity of each rule strategy in the rule base according to the statistical data, and dynamically update the priority of the rule strategy in the rule information according to the activity of each rule strategy;
[0033] The rule generation module is used to generate new rule strategies based on the statistical data of the trigger source and write them into the rule base.
[0034] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0035] Receive multiple rule policies transmitted by the server, and store the rule policies and corresponding rule information in the rule base;
[0036] A polling algorithm is used to cyclically read the rule information in the rule base, select a rule strategy according to the priority in the rule information, and control the execution of the device according to the selected rule strategy;
[0037] Monitor the operation process of the execution device and record the execution process information of the selected rule strategy during execution;
[0038] Collect statistics on the execution process information within a predetermined period to obtain the execution status of each selected rule strategy and the statistical data of the trigger source;
[0039] After obtaining the activity of each rule strategy in the rule base according to the statistical data, the priority of the rule strategy in the rule information in the rule base is dynamically updated according to the activity of each rule strategy;
[0040] Generate new rule strategies based on the statistical data of the trigger source and write them into the rule base.
[0041] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0042] Receive multiple rule policies transmitted by the server, and store the rule policies and corresponding rule information in the rule base;
[0043] A polling algorithm is used to cyclically read the rule information in the rule base, select a rule strategy according to the priority in the rule information, and control the execution of the device according to the selected rule strategy;
[0044] Monitor the operation process of the execution device and record the execution process information of the selected rule strategy during execution;
[0045] Collect statistics on the execution process information within a predetermined period to obtain the execution status of each selected rule strategy and the statistical data of the trigger source;
[0046] After obtaining the activity of each rule strategy in the rule base according to the statistical data, the priority of the rule strategy in the rule information is dynamically updated according to the activity of each rule strategy;
[0047] Generate new rule strategies based on the statistical data of the trigger source and write them into the rule base.
[0048] The above rule dynamic update method, device, computer equipment and storage medium have the following beneficial effects:
[0049] By receiving the rule policies transmitted by the server, the server can obtain the unified deployment control of all execution devices on the smart poles, thereby reducing the workload. It only needs to perform unified deployment on the server to obtain the initial rule policies of the corresponding execution devices.
[0050] By storing rule information in the rule base and storing it in a fixed format, it is convenient to store, modify and call various rule strategies.
[0051] By using a polling algorithm to cyclically read the rule information in the rule base, the omission of rule strategies is reduced, and the control is evenly distributed so that each rule strategy can be executed when the triggering conditions are met. And a priority is set for each rule strategy. When two rule strategies conflict during execution, the rule strategy with a higher priority can be conveniently called first. For the rule strategy with a lower priority within the effective time, the execution of the rule strategy with a lower priority can be terminated or suspended.
[0052] By monitoring the execution device, it is convenient to record the rule strategies used by the execution device during operation and the execution process information corresponding to the rule strategies, thereby facilitating the activity statistics of various rule strategies before dynamic rule updates.
[0053] Since the execution process information within a predetermined period is statistically analyzed, different statistical data can be obtained for different time periods, and different modification and updating strategies can be adopted.
[0054] Due to the use of statistical data on the activity of rule strategies within a preset period, the priority of various rule strategies is modified and updated to increase or decrease the priority according to the different activities, thereby facilitating the control of the operation of the execution equipment and reducing unnecessary analysis and judgment. For example, rule strategies with low activity and low priority can have their priority adjusted to the lowest, or the rule strategies can be deleted due to the dynamic update rules of the present application, thereby reducing resource consumption. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 An application environment diagram of a method for dynamically updating rules in an embodiment;
[0056] Figure 2 A schematic diagram of a flow chart of a method for dynamically updating rules in one embodiment;
[0057] Figure 3 FIG. 4 is a structural block diagram of a rule dynamic updating device in an embodiment. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0059] like Figure 1As shown, an embodiment of the present application provides a method for dynamically updating rules, which is applied to the edge end. The edge end is applied to a smart pole system. The smart pole system includes a client 10, a server 20, and a plurality of edge ends 30. The edge end 30 is connected to the server 20, and each edge end 30 is used to control the operation of at least one execution device on the smart pole. The client 10 is connected to the server. The client 10 can be a desktop computer, a laptop computer, a tablet computer, a smart phone, or other electronic device that can implement a network connection, which is not limited here. A network connection is established between the server 20 and the edge end 30, and a network connection can be established by using 2G / 3G / 4G / 5G, WIFI, etc., which is used to uniformly deploy the initial rule policies that may be required for the smart pole to the edge end 30 of each smart pole.
[0060] Further explanation, since different execution devices with different requirements are deployed on smart poles at different locations, if the rules and policies required by the corresponding execution devices are deployed for each smart pole, it will consume a lot of manpower and material resources. Therefore, in the early stage of operation, the server 20 is directly used to uniformly deploy the rules and policies, that is, a number of rules and policies for different execution devices are first established on the server 20 through the client 10, and then all edge terminals 30 are uniformly deployed through the server 20, so that the rules and policies received by the edge terminals 30 on the smart poles at any location from the server 20 are consistent. In addition, regardless of whether there is a corresponding execution device on the smart pole, the rules and policies received from the server 20 correspond to all possible types of execution devices.
[0061] The execution device in this embodiment may include but is not limited to at least one of smart lights, information release screens, sound columns, cameras, sensors, smart door locks, and smart air switches. For the above-mentioned execution devices, the rule strategies in this embodiment may include but are not limited to: lighting control timing strategy, information release timing strategy, sound column broadcast timing strategy, camera recognition linkage disposal strategy, temperature sensor threshold linkage strategy, smart door lock opening and closing linkage strategy, and smart air switch energy consumption statistics linkage strategy.
[0062] In one embodiment, if Figure 2 As shown, an embodiment of the present application provides a method for dynamically updating rules including the following steps.
[0063] Step S100, receiving multiple rule policies transmitted by the server, and storing the rule policies and corresponding rule information in a rule base;
[0064] Step S200, using a polling algorithm to cyclically read the rule information in the rule base, selecting a rule strategy according to the priority in the rule information, and controlling the execution device to run according to the selected rule strategy;
[0065] Step S300, monitoring the operation process of the execution device and recording the execution process information of the selected rule policy during execution;
[0066] Step S400, collecting statistics on the execution process information within a predetermined period to obtain the execution status of each selected rule strategy and the statistical data of the trigger source;
[0067] Step S500, after obtaining the activity of each rule strategy in the rule base according to the statistical data, dynamically update the priority of the rule strategy in the rule information according to the activity of each rule strategy;
[0068] Step S600: Generate a new rule strategy based on the statistical data of the trigger source and write it into the rule base.
[0069] In step S100, multiple rule policies transmitted by the server are received, and the rule policies and corresponding rule information are stored in a rule base.
[0070] In one embodiment, the rule information corresponding to the rule policy is stored in the rule base according to the predetermined RDF format. RDF format is the abbreviation of Resource Description Framework, which is a language used to express information about resources on the World Wide Web, and is used to express metadata about Web resources, such as the available schedule of Web pages.
[0071] In one embodiment, the rule strategy may include: lighting control timing strategy, information release timing strategy, sound column broadcast timing strategy, camera recognition linkage disposal strategy, temperature sensor threshold linkage strategy, smart door lock opening and closing linkage strategy, smart air switch energy consumption statistics linkage strategy, that is, the execution equipment on the smart pole may include one or more of smart lights, information release screens, sound columns, cameras, sensors, smart door locks, and smart air switches.
[0072] In step S200, a polling algorithm is used to cyclically read rule information in the rule base, a rule strategy is selected according to the priority in the rule information, and the operation of the execution device is controlled according to the selected rule strategy.
[0073] In one embodiment, the rule information includes not only the control instruction corresponding to the rule strategy, but also the priority of the rule strategy. The rule information of the rule strategy for controlling the smart light is shown in Table 1 below:
[0074] Rule Policy Name Trigger source Execution strategy Priority GIS Location Lighting control timing strategy Control instructions Start from 18:00 to 21:00 Level 1 Coordinates [a, b, c] Lighting sound control strategy Sound Sensor 3 minutes Level 2 Coordinates [a, b, c]
[0075] Table 1
[0076] Different rule policies for different execution devices, when involving the same device service resources, or different rule policies for the same execution device, are executed according to the priority configuration. For example, different rule policies for controlling a certain execution device include policy 1 and policy 2, and policy 1 has a higher priority than policy 2. When both meet the conditions for controlling the operation of the execution device, policy 1 is used first to control the operation of the execution device.
[0077] Furthermore, the polling algorithm in this embodiment indicates that the CPU at the edge end periodically issues inquiries, and inquires each rule strategy in sequence to determine whether the startup conditions for the execution device operation are currently met. If so, the execution device operation is controlled according to the rule strategy, otherwise, the next rule strategy is continued to be queried, and then the execution device on the smart pole is controlled repeatedly.
[0078] To avoid using two rule policies at the same time for the same execution device.
[0079] In one embodiment, the rule policy is selected according to the priority in the rule information, and the steps of controlling the operation of the execution device according to the selected rule policy include: for the same execution device, within a predetermined period, when more than two rule policies are met, a rule policy with a higher priority is selected according to the priority of the rule policy to control the operation of the execution device.
[0080] In one embodiment, the step of selecting a rule policy according to the priority in the rule information and controlling the execution device operation according to the selected rule policy also includes: when more than two rule policies need to call the same device service resources at the same time, selecting the rule policy with a higher priority to call the device service resources to control the execution device operation.
[0081] In step S300, the operation process of the execution device is monitored, and the execution process information of the selected rule policy is recorded.
[0082] In the process of using the rule strategy to control the operation of the execution device, the edge end of this embodiment also monitors the running execution device, obtains the rule strategy adopted by the execution device during the operation, and records the start and end time, timestamp, execution start state, execution result state, device GIS location and priority of the rule strategy during the execution process. That is, the execution process information includes: the start and end time, timestamp, execution start state, execution result state, device GIS location and priority of the selected rule strategy when it is executed.
[0083] Among them, the start and end time represent the start time node and end time node of the rule policy; the timestamp represents the time period for the execution of the current rule policy, which may be the complete execution of the rule policy or the incomplete execution of the rule policy; the execution start state represents the state of the execution device before using the rule policy, which may be running using another rule policy or may not have started running yet; the execution result state represents whether the rule policy is completely executed or not; the priority corresponds to the priority in the rule information of the rule policy in the rule base.
[0084] In step S400, statistics are collected on the execution process information within a predetermined period to obtain the execution status of each selected rule strategy and the statistical data of the trigger source.
[0085] In one example, the execution process information includes the start and end time, timestamp, execution start status, execution result status, device GIS location and priority of each rule strategy during the execution process. For example, the following table 2 shows a lighting control execution process information.
[0086] Start and end time Timestamp Execution start state Execution result status Equipment GIS location Priority 18:00;21:00 18:00-21:00 Smart light activated Full Execution Coordinates [a, b, c] Level 1 17:58;18:00 17:58-18:00 Smart light off Interrupted Coordinates [a, b, c] Level 2
[0087] Table 2
[0088] The execution process information can be used to understand the execution status of the selected rule policy, such as complete execution and interrupted execution. Interrupted execution means that the execution is interrupted by a high-priority rule policy during the execution process. Complete execution means that the start and end time and timestamp are consistent with the preset rule information. An example of the execution process being interrupted by a high-priority rule policy is as follows:
[0089] The priority of the light control timing strategy is level 1, and its time is 18:00-21:00; the priority of the lamp voice control strategy is level 2, and its triggering reason is that the light value is lower than the preset light threshold, and there is the sound of pedestrians passing by, and it lasts until three minutes after the pedestrians pass by. At 17:58, due to the light and the sound of pedestrians walking, the smart light is triggered to start, and until 18:00, there is still the sound of pedestrians walking. Between 17:58 and 18:00, the smart light is controlled by the lamp voice control strategy. After 18:00, the smart light is controlled by the light control timing strategy. At this time, it can be known that the lamp voice control strategy is interrupted by the light control timing strategy during execution. Then, when analyzing the light control timing strategy and the lamp voice control strategy, the numerical value is expressed as follows: the activity value when the rule strategy execution conditions are met is 1, the activity value of complete execution is 1, and the activity value of the interrupted execution process is 0.5. By analogy, the activity of the rule strategy pre-stored in the rule library within the predetermined period can be obtained.
[0090] In another example, the execution process information of each selected rule strategy is compared and analyzed through the rule library to obtain the trigger source of the selected rule strategy. The trigger source in this embodiment can be a sudden event detected by the sensor. For example, the manhole cover position sensor is used to detect the flip angle of the manhole cover. When the flip angle is less than 15 degrees, it means that the current manhole cover is in a low-risk state; when the manhole cover flips at 15-30 degrees, it means that the current manhole cover is in a medium-risk state; when the manhole cover flips above 30 degrees, it means that the current manhole cover is in a high-risk state. If it is detected that the manhole cover is in a medium-to-high-risk state, it is necessary to remind through the information release screen. Therefore, for the event of issuing an announcement reminder on the information release screen, the trigger source is obtained as the flip angle of the manhole cover is at a medium-to-high risk, and then the trigger source of the announcement reminder issued by the information release screen is counted, that is, the event of the manhole cover flipping at a medium-to-high risk is counted.
[0091] Further explanation: In this embodiment, the dynamic update of the rule strategy does not use all historical data, but selects the closest time period, which is conducive to the control adjustment of the smart pole according to the current environment. For example, the dark time periods in winter and summer are different, and the start-up control of the smart light may require the control of the outdoor light intensity. Therefore, the statistical data within the closest cycle time can be selected to adjust the current rule strategy.
[0092] In this embodiment, the step of collecting statistics on the execution process information within a predetermined period to obtain the execution status of each selected rule strategy and the statistical data of the trigger source includes:
[0093] According to the execution start status and execution result status in the execution process information, obtain the statistical data of the execution status within the predetermined period, including the complete execution and the interrupted execution, so as to determine the activity of each rule strategy within the predetermined period; and
[0094] Compare the execution process information with the rule information in the rule base to obtain the trigger source of the selected rule policy.
[0095] Further explanation: when the execution of a rule policy is interrupted during the execution process, it is equivalent to the control or call of the same execution device, and there are at least two associated rule policies, and the priority of the rule policy executed previously is lower than the priority of the later rule policy. When the rule policy with a low priority executed previously controls the operation of the execution device, the rule policy with a high priority later also satisfies the control of the execution device. At this time, the rule policy with a high priority interrupts the execution status of the rule policy with a low priority, that is, the execution process of the rule policy with a low priority previously is interrupted, and the rule policy with a high priority later will be fully executed to control the execution device when there is no rule policy with a higher priority to satisfy it. Therefore, the execution start state of the rule policy with a low priority previously can be none, or a rule policy with a lower priority before that, and the execution result state in the execution situation can be interrupted execution or incomplete execution. The execution start state of the rule policy with a high priority later can be the rule policy with a low priority previously controls the operation of the execution device, and the execution result state can be complete execution or interrupted by a subsequent rule policy with a higher priority.
[0096] When the execution device in this embodiment is controlled by the rule strategy, it has a trigger source, such as a preset timing control instruction, a light and voice control instruction, and a light instruction. For example, the light instruction is used to control the start of the smart light, and the smart light starts according to the light. Then the trigger source can be the light detected by the light sensor. For another example, the light and voice control instruction is used to control the start of the smart light, and the smart light starts according to the light and voice control. Then the trigger source can be the light detected by the light sensor and the sound signal detected by the voice control sensor. However, there is no trigger source in the execution process information. In this embodiment, the execution process information is compared with the rule library to obtain the trigger source of the selected rule strategy, that is, the start condition of the smart lamp.
[0097] In step S500, after obtaining the activity of each rule strategy in the rule base according to the statistical data, the priority of the rule strategy in the rule information is dynamically updated according to the activity of each rule strategy. The activity of each rule strategy in the rule base of the current smart pole within a predetermined period is obtained according to the statistical data, including the number of complete executions and interrupted executions of each rule strategy.
[0098] In one embodiment, the steps of increasing or decreasing the priority of a rule policy include:
[0099] The activity of each rule strategy in the rule library within a predetermined period is obtained; for more than two rule strategies that control the operation of the same execution device, when the activity of a rule strategy with a low priority is higher than that of a rule strategy with a high priority, the priority of the rule strategy with a high activity is increased and made higher than the original rule strategy with a high priority, so as to reduce the control switching of the execution device, thereby reducing power consumption and enabling each smart pole to have a control strategy suitable for the current position; when the activity of a rule strategy with a low priority is lower than that of a rule strategy with a high priority, the priority of the rule strategy with a low priority is adjusted to the lowest or deleted, so as to reduce the consumption of device resources.
[0100] In step S500, a new rule strategy is generated based on the statistical data of the trigger source and written into the rule base. The activity of each rule strategy in the rule base of the current smart pole within a predetermined period is obtained based on the statistical data, including the number of times each rule strategy is triggered and started.
[0101] In one embodiment, the step of generating a new rule strategy based on the statistical data of the trigger source includes:
[0102] Obtain the statistical data of the selected rule strategy triggered by the trigger source. When the statistical data of the trigger rule strategy execution exceeds the preset threshold within the predetermined period, dynamically generate the trigger linkage disposal rule strategy and write it into the rule library.
[0103] In addition, the steps of the rule dynamic update method in this embodiment also include: transmitting the dynamically updated rule information to the server, so that the server deploys the rule information of the corresponding rule strategy according to the smart poles of the same application scenario. That is, according to the activity of the rule strategy and the GIS location information, the corresponding rule strategy is configured for the smart poles of the same type of GIS location information.
[0104] In one embodiment, Figure 3 As shown, a rule dynamic updating device is provided, comprising: a rule receiving module 100, a rule engine module 200, a rule monitoring module 300, a data statistics module 400, a rule updating module 500, and a rule generating module 600. Among them:
[0105] The rule receiving module 100 is used to receive multiple rule policies transmitted by the server, and store the rule policies and corresponding rule information in a rule base.
[0106] The rule engine module 200 is used to cyclically read the rule information in the rule base using a polling algorithm, select a rule strategy according to the priority in the rule information, and control the execution device operation according to the selected rule strategy.
[0107] The rule monitoring module 300 is used to monitor the operation process of the execution device and record the execution process information of the selected rule policy during execution.
[0108] The data statistics module 400 is used to collect statistics on the execution process information within a predetermined period to obtain the execution status of each selected rule strategy and the statistical data of the trigger source.
[0109] The rule updating module 500 is used to obtain the activity of each rule strategy in the rule base according to the statistical data, and then dynamically update the priority of the rule strategy in the rule information according to the activity of each rule strategy.
[0110] The rule generation module 600 is used to generate a new rule strategy according to the statistical data of the trigger source and write it into the rule base.
[0111] For the specific definition of the rule dynamic updating device, please refer to the definition of the rule dynamic updating method above, which will not be repeated here. Each module in the above-mentioned rule dynamic updating device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0112] In one embodiment, a computer device is provided, which may be a server. The computer device includes a processor, a memory, a network interface, and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store rule information data of a rule policy. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a method for dynamically updating rules is implemented.
[0113] In one embodiment, a computer device is provided, which may be a terminal, and includes a processor, a memory, a network interface, a display screen, and an input device connected through a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for dynamically updating rules is implemented. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a key, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0114] Those skilled in the art will appreciate that the structure given in this embodiment does not constitute a limitation on the computer device to which the present application solution is applied, and the specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0115] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0116] Receive multiple rule policies transmitted by the server, and store the rule policies and corresponding rule information in the rule base;
[0117] A polling algorithm is used to cyclically read the rule information in the rule base, select a rule strategy according to the priority in the rule information, and control the execution of the device according to the selected rule strategy;
[0118] Monitor the operation process of the execution device and record the execution process information of the selected rule strategy during execution;
[0119] Collect statistics on the execution process information within a predetermined period to obtain the execution status of each selected rule strategy and the statistical data of the trigger source;
[0120] After obtaining the activity of each rule strategy in the rule base according to the statistical data, the priority of the rule strategy in the rule information is dynamically updated according to the activity of each rule strategy, and a new rule strategy is generated according to the statistical data of the trigger source and written into the rule base.
[0121] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0122] Receive multiple rule policies transmitted by the server, and store the rule policies and corresponding rule information in the rule base;
[0123] A polling algorithm is used to cyclically read the rule information in the rule base, select a rule strategy according to the priority in the rule information, and control the execution of the device according to the selected rule strategy;
[0124] Monitor the operation process of the execution device and record the execution process information of the selected rule strategy during execution;
[0125] Collect statistics on the execution process information within a predetermined period to obtain the execution status of each selected rule strategy and the statistical data of the trigger source;
[0126] After obtaining the activity of each rule strategy in the rule base according to the statistical data, the priority of the rule strategy in the rule information is dynamically updated according to the activity of each rule strategy;
[0127] Generate new rule strategies based on the statistical data of the trigger source and write them into the rule base.
[0128] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0129] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0130] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A rule dynamic update method, applied to an edge end, wherein the edge end is used to control the operation of at least one execution device on a smart pole; characterized in that: The rule dynamic updating method comprises: Receive multiple rule policies transmitted by the server, and store the rule policies and corresponding rule information in a rule library; The rule information in the rule base is cyclically read using a polling algorithm, the rule strategy is selected according to the priority in the rule information, and the execution device is controlled to run according to the selected rule strategy; Monitor the operation process of the execution device and record the execution process information of the selected rule policy during execution; Collecting statistics on the execution process information within a predetermined period to obtain the execution status of each of the selected rule strategies and the statistical data of the trigger source; After obtaining the activity of each rule strategy in the rule base according to the statistical data, dynamically updating the priority of the rule strategy in the rule information according to the activity of each rule strategy; Generate a new rule strategy based on the statistical data of the trigger source and write it into the rule base; The step of collecting statistics on the execution process information within a predetermined period to obtain the execution status of each of the selected rule strategies and the statistical data of the trigger source includes: According to the execution start state and the execution result state in the execution process information, obtaining statistical data of the execution status within a predetermined period, including complete execution and interrupted execution, to determine the activity of each rule strategy within the predetermined period; and Compare the execution process information with the rule information in the rule base to obtain the trigger source of the selected rule policy; The dynamically updating the priority of the rule strategy in the rule information according to the activity of each rule strategy includes: Obtaining the activity of each rule strategy in the rule base within a predetermined period; For two or more rule policies controlling the operation of the same execution device, When the activity of the rule policy with a low priority is higher than the activity of the rule policy with a high priority, the priority of the rule policy with a high activity is increased and made higher than the original rule policy with a high priority; When the activity of the rule policy with a low priority is lower than the activity of the rule policy with a high priority, the priority of the rule policy with a low priority is adjusted to the lowest or deleted.
2. The rule dynamic updating method according to claim 1, characterized in that: The steps of selecting the rule policy according to the priority in the rule information and controlling the operation of the execution device according to the selected rule policy include: For the same execution device, within a predetermined period, when more than two rule policies are satisfied, the rule policy with a higher priority is selected according to the priorities of the rule policies to control the operation of the execution device.
3. The rule dynamic updating method according to claim 1, characterized in that: The steps of selecting the rule policy according to the priority in the rule information and controlling the operation of the execution device according to the selected rule policy include: When two or more rule policies need to call the same device service resource at the same time, the rule policy with a higher priority is selected to call the device service resource to control the operation of the execution device.
4. The rule dynamic updating method according to claim 1, characterized in that: The execution process information includes: the start and end time, timestamp, execution start status, execution result status, device GIS location and priority of the selected rule policy when it is executed.
5. The rule dynamic updating method according to claim 1, characterized in that: The step of generating a new rule strategy according to the statistical data of the trigger source includes: Obtaining statistical data of the selected rule policy being executed according to the trigger source; When the statistical data of the trigger source triggering the execution of the rule strategy exceeds a preset threshold within a predetermined period, a trigger linkage disposal rule strategy is dynamically generated and written into the rule base.
6. A rule dynamic updating device, characterized in that: The device comprises: A rule receiving module, used to receive multiple rule policies transmitted by the server, and store the rule policies and corresponding rule information in a rule base; A rule engine module, configured to cyclically read the rule information in the rule base using a polling algorithm, select the rule strategy according to the priority in the rule information, and control the execution device operation according to the selected rule strategy; A rule monitoring module, used to monitor the operation process of the execution device and record the execution process information of the selected rule policy during execution; A data statistics module is used to collect statistics on the execution process information within a predetermined period to obtain the execution status of each of the selected rule strategies and the statistical data of the trigger source; A rule updating module, configured to dynamically update the priority of the rule strategy in the rule information according to the activity of each rule strategy in the rule base after obtaining the activity of each rule strategy in the rule base according to the statistical data; A rule generation module, used to generate a new rule strategy according to the statistical data of the trigger source and write it into the rule base; When the data statistics module collects statistics on the execution process information within a predetermined period to obtain the execution status of each of the selected rule strategies and the statistical data of the trigger source, the statistical data of the execution status including the complete execution and the interrupted execution within the predetermined period are obtained according to the execution start state and the execution result state in the execution process information to determine the activity of each of the rule strategies within the predetermined period, and the execution process information is compared with the rule information in the rule base to obtain the trigger source of the selected rule strategy; When the rule update module dynamically updates the priority of the rule policies in the rule information according to the activity of each rule policy, it obtains the activity of each rule policy in the rule base within a predetermined period. For two or more rule policies that control the operation of the same execution device, when the activity of the rule policy with a low priority is higher than the activity of the rule policy with a high priority, the priority of the rule policy with the high activity is increased and made higher than the original rule policy with the high priority. When the activity of the rule policy with a low priority is lower than the activity of the rule policy with a high priority, the priority of the rule policy with the low priority is adjusted to the lowest or deleted.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
