Multi-rule and strategy engine system applied to embedded terminal and implementation method

By designing a multi-rule and policy engine system on an embedded terminal, the problem that the existing technology cannot perform production operations in a networkless environment is solved, independent operation of equipment and distributed processing of services are realized, and the system's response speed and resource utilization efficiency are improved.

CN119759323AActive Publication Date: 2025-04-04重庆玖奇科技有限公司
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202411927292.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-04-04
Estimated Expiration
2044-12-25

AI Technical Summary

Technical Problem

The prior art is highly dependent on the network environment, unable to perform production operations in a networkless environment, and it is difficult to efficiently run multiple complex services and logic rules on embedded devices.

Method used

A multi-rule and policy engine system is designed, including server interaction module, engine core module, business demand pool, terminal interaction module, event-driven module and data storage module. It can run independently on an embedded terminal, supports the execution and management of multiple rules and policies, and realizes distributed processing and management of services.

Benefits of technology

It realizes the continuous production operation of equipment in a networkless environment, reduces data transmission delay and bandwidth consumption, improves the system response speed and accuracy, and reduces resource consumption and system instability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119759323A_ABST
    Figure CN119759323A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of software development, and discloses a multi-rule and strategy engine system applied to an embedded terminal, which comprises a server interaction module used for performing data exchange with other systems in a network environment and preprocessing received data; the engine core module is a core component for driving the whole system to operate and comprises an inference engine, a state machine, a compiler, a matcher, an actuator and an interpreter; the business demand pool is used for storing and managing current business demands to be processed and coordinating the whole business process; the event driving module is used for judging operation of a trigger engine according to data acquired by the acquisition peripheral; the terminal interaction module is used for being connected with local equipment to realize data input and output; the data storage module is used for locally storing data required during engine operation; the technical problems that the prior art highly depends on a network environment and production operation cannot be carried out in a network-free environment are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software development, and in particular to a multi-rule and policy engine system applied to an embedded terminal and an implementation method thereof. Background Art

[0002] With the widespread application of embedded devices in the fields of Internet of Things (IoT), automation control, big data, digital metaverse, etc., these devices have become a key component of modern intelligent systems. However, embedded devices are limited by their hardware resources, such as processing power, storage space, and power supply, making it a huge challenge to efficiently run multiple complex businesses and logic rules on these devices.

[0003] Traditional rule engines, although very powerful in terms of functionality, are often bulky and resource-intensive. These rule engines usually run on upper-level platforms and rely on centralized middle-end management, which leads to a significant increase in resource costs. More importantly, this centralized management method requires that devices must always be connected to the network environment. Once the network environment is unstable or the device is disconnected from the network, the rule engine will not be able to directly guide the terminal to perform production operations, which is unacceptable for many embedded applications that rely on real-time response and local decision-making. Summary of the invention

[0004] The present invention is intended to provide a multi-rule policy engine system and implementation method for embedded terminals to solve the technical problem that the prior art is highly dependent on the network environment and cannot perform production operations in a networkless environment.

[0005] To achieve the above object, the present invention adopts the following technical solution: a multi-rule and policy engine system applied to an embedded terminal, comprising:

[0006] The server interaction module is used to exchange data with other systems in a network environment and pre-process the received data;

[0007] The core module of the engine includes an inference engine, a state machine, a compiler, a matcher, an interpreter, and an executor. The inference engine performs logical reasoning according to preset rules to coordinate the operation of the core modules of the engine. The state machine tracks and manages the state changes of each module in the system, and feeds back the response status of each module to the inference engine to assist the work of the inference engine.

[0008] The compiler converts the expression of rules or policies from text description or data format into an intermediate expression. The matcher is responsible for matching business requirements with rules or policies when an event occurs. The interpreter reads the intermediate representation generated by the compiler and interprets and executes each item one by one. The executor executes the underlying tasks passed by the interpreter, and the terminal interface controls the operation of external devices. The executor is also used to feedback the execution results, and the interpreter further adjusts and optimizes according to the execution results fed back by the executor.

[0009] Business demand pool, used to store and manage current pending business demands and coordinate overall business processes;

[0010] The terminal interaction module is used to provide an interface to connect external devices, realize the collection and input of external device operation data and the output of instructions to control the operation of external devices;

[0011] The event-driven module is used to determine whether the input data of the terminal interaction module triggers an event. When an event is triggered, the event information is passed to the engine core module;

[0012] The data storage module is used for the data required for the local storage engine runtime, including the basic rule library for storing rule data, the basic policy library for storing policy data, the archive library for storing archive data, and the task library for storing task data; and the application database for storing data received by the event-driven module and the terminal interaction module.

[0013] The principles and advantages of this solution are: selecting an embedded real-time RTOS or time-sharing Linux operating system as the kernel, using a lightweight engine, consisting of an engine core module, a business demand pool, an event-driven module, a terminal interaction module, and a data storage module, so that the system can run independently on an embedded terminal without relying on a central server, while supporting the execution and management of multiple rules and policies, and realizing distributed processing and management of business.

[0014] The system uses the data storage module to store rules and policy data (including basic rule base, basic policy base, etc.) locally on the embedded terminal, and uses the database to segment the terminal's remote control, remote signaling, tuning, and telemetry data of external sensors or third-party devices and format and store them in a database. When the network environment is unstable or the device is disconnected from the network, the engine core module can directly read the rules and policies from the local storage, perform logical reasoning and execution, thereby ensuring the continuity of production operations.

[0015] The system directly executes complex business logic on the embedded terminal through the engine core module. This avoids data transmission delays and bandwidth consumption, because data can be processed without being transmitted on the network, and reduces network resource occupation and bandwidth consumption. And the real-time feedback mechanism ensures that the system can respond quickly to external changes. The executor feeds back the execution results to the interpreter in real time, and the interpreter can immediately adjust and optimize the strategy or rules based on these results, thereby improving the response speed and accuracy of the entire system. This closed-loop operation mode reduces system instability and performance degradation caused by delays or errors. Real-time feedback and optimization help reduce unnecessary resource consumption. For example, when the executor finds that a task is no longer needed, it can immediately feedback to the interpreter, and the interpreter can stop the execution of the task accordingly, thereby saving processor time and energy. Through closed-loop operation, the system can manage its resources more effectively and ensure that they are used in the most reasonable way.

[0016] The system adopts a modular design, so that each component can be updated and maintained independently. This facilitates the update of rules and policies according to business needs, as well as the expansion and optimization of business logic and easy integration with other systems or devices, thus supporting a wider range of application scenarios and business needs.

[0017] The embedded terminal autonomously executes rules and policies through the engine core module, which enables the device to achieve autonomous management and improves the stability and reliability of the system. When a specific event is detected, the module triggers the engine core module to run the corresponding rules and policies. The engine core module performs logical reasoning and execution based on the data and rules / policies provided by the event-driven module to achieve real-time data processing and response, which ensures the system's rapid response capability in complex environments.

[0018] Preferably, as an improvement, it also includes a resource management module for managing the system itself or hardware resources according to the resource management strategy; including LOG management for recording system logs, memory management for managing the system's memory resources, external memory management for managing resources on external storage devices, on-chip resource management for managing on-chip resources on embedded terminals, and off-chip extended resource management for managing extended external resources.

[0019] The beneficial effect of this improvement is that the resource management module can reasonably allocate and release system resources, ensuring that the rule engine runs stably under limited memory and computing resources. Through effective resource management strategies, problems such as resource competition and leakage can be avoided, and the stability and reliability of the system can be improved.

[0020] Preferably, as an improvement, the server interaction module includes a service input unit, a service output unit and a processing unit; the service input unit receives archive data, task data, rule data and policy data sent by the central server, and the service output unit sends the terminal execution status, current terminal status and other session information to the central server; the processing unit processes the received data and converts it into a rule object model and a policy object model.

[0021] The beneficial effect of this improvement is that through the refined module design, the data from the central server can be processed more effectively and converted into rule object models and policy object models that can be recognized by the system. The separation of service input and service output units makes the reception and transmission of data clearer and more efficient, and improves the communication efficiency of the system.

[0022] Preferably, as an improvement, the event-driven module includes an event-driven interface and an event driver; the event-driven interface builds an interface support according to the business demand pool, and the terminal interaction module connects the sensors of the external device to collect monitoring data in real time, and the event driver passes the relevant monitoring data to the engine core module when the monitoring data meets the event triggering conditions.

[0023] The beneficial effect of this improvement is that the system can respond to changes in monitoring data of external devices in real time, improving the real-time performance and response speed of the system. The event-driven mechanism only passes data to the engine core module when the trigger conditions are met, avoiding unnecessary resource consumption.

[0024] Preferably, as an improvement, the business demand pool triggers the engine core module according to the business demand, and stores the new data received by the event-driven module in the data storage module, and when the business demand changes, the data transmitted in the business demand pool is updated in time.

[0025] The beneficial effect of this improvement is that by dynamically updating the data in the business demand pool, it can be ensured that the system always uses the latest business demand data for reasoning and decision-making. The dynamic update mechanism of the business demand pool enables the system to adapt to changes in business needs more flexibly.

[0026] Preferably, as an improvement, the inference engine obtains new data or instructions through chain reasoning, and applies rules to derive results; the state machine is used to track and manage the state transitions and state behaviors of the system, and works in conjunction with the inference engine.

[0027] The beneficial effect of this improvement is that the state machine and the inference machine work together to manage the state of the system. The inference machine is responsible for inferring the current state of the system based on rules and events, while the state machine is responsible for executing corresponding actions or transitioning to a new state based on the current state and transition conditions. The state machine can also pass state transition information to the actuator so that the actuator can execute the corresponding action.

[0028] Also disclosed is a method for implementing a multi-rule and policy engine applied to an embedded terminal, using the above engine system, including:

[0029] S1: The server interaction module receives business requirements from the central server, processes these business requirements and stores them in the local data storage module; the business requirement pool transmits business requirement related data to the engine core module according to the changes in business requirements;

[0030] S2: The engine core module receives data or instructions, compiles and matches them in combination with the stored rule object model and policy object model, and passes the matching results to the interpreter, which interprets and executes the intermediate expression instructions one by one, and passes the underlying tasks to the executor for further execution. The executor controls the operation of external devices through the terminal interaction module and feeds back the execution results of the external devices to the interpreter. The interpreter further adjusts and optimizes according to the execution results fed back by the executor, and the server interaction module outputs the execution status;

[0031] S3: The terminal interaction module connects to the sensor of the external device through the terminal input interface, collects the operation data of the external device in real time, and passes the collected data to the event-driven module. When the event-driven module determines that the current collected data meets the event triggering condition, it passes the relevant monitoring data that meets the event triggering condition to the engine core module. The inference engine and the state machine call the business demand pool according to the rule requirements to pass the relevant business data in the data storage module, perform reasoning and decision-making, and execute corresponding actions or instructions according to the results of reasoning and decision-making;

[0032] S4: The resource management module manages each resource according to the resource management strategy and releases unnecessary resources.

[0033] The beneficial effects of this improvement are: through this method, business needs can be automatically received locally, data can be processed, and corresponding actions and instructions can be executed, thereby improving the system's level of automated management. Each embedded terminal can independently execute rules and policies and manage its own data and status; multiple embedded terminals can form a cluster to jointly undertake the execution of business logic and data processing tasks, thereby improving the system's computing power and enabling the system to handle more complex business scenarios and data volumes.

[0034] Preferably, as an improvement, in step S3, after the engine core module is triggered by the event-driven module, the inference machine and the state machine call the business demand pool according to the data and instructions to transfer the relevant business data in the data storage module, perform reasoning and decision-making, and the system updates the corresponding status information or data storage according to the execution results.

[0035] The beneficial effects of this improvement are: by calling the data in the business demand pool for reasoning and decision-making, the accuracy and consistency of the data can be ensured; the system can dynamically update status information or data storage according to the execution results, improving the flexibility and adaptability of the system.

[0036] Preferably, as an improvement, in step S4, the resource management module manages system logs, memory resources, external storage resources, on-chip resources and off-chip expansion resources.

[0037] The beneficial effect of this improvement is that the resource management module can comprehensively manage various resources of the system, ensure the reasonable allocation and effective utilization of resources. Through effective resource management, the reliability and stability of the system can be improved, and problems such as resource competition and leakage can be avoided. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 4 is a system framework diagram of an embodiment of the present invention.

[0039] Figure 2 The figure is a flow chart of a method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0040] The following is further described in detail through specific implementation methods:

[0041] Example

[0042] Basically as attached Figure 1 As shown, a multi-rule and policy engine system and implementation method applied to embedded terminals select an embedded real-time RTOS or Linux time-sharing operating system as the kernel of the engine system to meet business needs. The multi-rule and policy engine system applied to embedded terminals includes: a server interaction module, an event-driven module, a terminal interaction module, an engine core module, a data storage module, a business demand pool and a resource management module.

[0043] The server interaction module is used to exchange data with other systems in a network environment; the server interaction module includes a service input unit, a service output unit and a processing unit.

[0044] The service input unit is used to receive archive data, task data, rule data and policy data sent by the central server, and transmit the input data to the processing unit for processing. Archive data is static, historical information used to describe the basic attributes and historical records of an entity, which contains the necessary configuration information required by external devices; task data is dynamic information related to specific tasks or operations, usually including task requests, execution status, results, etc.; rule data is used to define instructions or logic for guiding the terminal system to perform operations according to specific conditions, which contains the configuration information of rules and policies for the business needs of the terminal during runtime; policy data is user-defined, higher-level logic or plan, usually containing multiple rules and logics, used to achieve complex business goals.

[0045] The service output unit is used to send the terminal execution status, current terminal status and other session information to the central server. The terminal execution status is the specific performance and data of the terminal when performing a specific task or operation, such as task completion, execution time, error log, etc.; the current terminal status is the real-time status information of the terminal, such as online / offline status, resource usage, network status, etc.; other session information is the data related to the user and terminal session, such as session ID, user information, session activity record, etc.

[0046] The processing unit is used to parse, clean, organize, convert, encrypt and other processes the received archival data and task data, and convert the rule data and policy data into rule object models and policy object models, that is, scale expressions and policy expressions, so that the system can handle complex rule policy logic in a consistent and predictable manner, and the object model can be continuously iterated and updated; the processing unit then further processes, verifies, optimizes and integrates the rule object model and policy object model with the business logic.

[0047] The terminal interaction module is used to connect the terminal local device to realize data input and output. The terminal interaction module includes a terminal input unit for external device operation data collection and a terminal output unit for controlling the operation of external devices; the terminal input unit includes a soft event interface API and a hard drive interface, and the hard drive interface includes an analog input interface AI, an analog output interface AO, a digital input interface DI, a digital output interface DO and other interfaces for connecting peripherals.

[0048] The event-driven module is used to determine whether the input data of the terminal interaction module triggers an event. When the event is triggered, the event information is passed to the engine core module; the event-driven module includes an event-driven interface and an event driver; the event-driven interface builds interface support based on the business demand pool, and the terminal interaction module connects the sensors of external devices to collect monitoring data in real time. When the monitoring data meets the event triggering conditions, the event driver passes the relevant monitoring data to the engine core module.

[0049] The data storage module is used to store the data required for the operation of the engine core module, including the basic rule library for storing rule data, the basic policy library for storing policy data, the application database for storing data received by the event-driven module and the terminal interaction module, the task library for storing task data, and the archive library for storing archive data.

[0050] The business demand pool is used to store and manage the current pending business needs and coordinate the overall business process; the business demand pool collects, organizes and manages business needs, which include various rules, policies, tasks, archives or data processing requirements. The business demand pool is also responsible for implementing and coordinating the overall business process between the functional modules to ensure the correct flow of data between the modules, the reasonable processing order and the smooth progress of collaborative work. The business demand pool triggers the engine core module according to business needs. The business demand pool is used to store new data received by the event-driven module or the terminal interaction module in the data storage module. When the business needs change, the data transmitted in the business demand pool is updated in time to ensure the accuracy and reliability of the system.

[0051] The core module of the engine is used to handle changes in business requirements and to add, delete, check, and modify the rules and policies of the current pending tasks. The core module of the engine includes the inference engine, state machine, compiler, matcher, executor, and interpreter; the inference engine is used to coordinate the compilation, matching, interpretation, and execution of rules and policies according to business requirements, and is responsible for basic business logic reasoning, and implements chain reasoning through forward reasoning, reverse reasoning, etc. to obtain new data or instructions; the inference engine obtains results through forward reasoning, and traces the purpose through reverse reasoning, so as to apply rules and obtain results. The state machine is used to track and manage the state transitions and state behaviors of the system.

[0052] The state machine works with the inference engine to manage the state of the system. The inference engine is responsible for inferring the current state of the system based on rules and events, while the state machine is responsible for executing corresponding actions or transitioning to a new state based on the current state and transition conditions. The state machine can also pass state transition information to the actuator so that it can perform corresponding actions.

[0053] The compiler converts the expression of the rule or policy from text description or data format into an intermediate expression. The matcher is responsible for matching the business requirements with the rules or policies when an event occurs. The interpreter reads the intermediate representation generated by the compiler and interprets and executes it one by one. The executor executes the underlying tasks passed by the interpreter, and the terminal interface controls the operation of external devices. The executor is also used to feedback the execution results, and the interpreter further adjusts and optimizes according to the execution results fed back by the executor.

[0054] The compiler, matcher, interpreter, and executor of the engine core module are as follows:

[0055] The compiler is used to parse rules and strategies from text descriptions or data format states into more efficient or easy-to-execute intermediate expressions to improve the efficiency of matching and execution, and pass the compilation results to the matcher. The compiler has powerful syntax parsing capabilities and can understand rule expressions in different formats. Using lexical analysis and syntax analysis techniques, the rules are decomposed into basic elements such as operators and operands, and then the corresponding execution logic tree is constructed.

[0056] Syntax analysis during rule parsing: This article uses syntax analysis tools or algorithms to perform syntax analysis on rules. For text-based rules, a syntax description method similar to Backus-Naur Form (BNF) is used to decompose the rules into a series of syntax units. For example, taking "if sensor_data>threshold then execute_action" as an example, syntax analysis can decompose it into the keyword "if", the comparison expression "sensor_data>threshold" and the action expression "execute_action".

[0057] Semantic understanding process: Based on grammatical analysis, further understand the semantics of the rules. Combined with the functions and data structures of the interpreter part of the embedded terminal. For example, for the "execute_action" part, it is necessary to clarify which hardware device or software module this action is aimed at, what are the parameters of the operation, etc. Through semantic understanding, the rules are converted into internal representations that can be directly executed by the policy execution module, such as function calls or instruction sequences.

[0058] The matcher is used to match business requirements with the rules in the basic rule base or the strategies in the basic strategy base, and pass the matching results to the inference engine. Specifically, after receiving the correct information from the compiler, the matcher matches the current core task with the existing rule and strategy base, first identifies the operation type, records it according to the operation type, and after processing, sends the result to the inference engine, which further controls the transmission of the processing result of the matcher to the interpreter.

[0059] The inference engine transmits it to the interpreter for reading and interpretation and execution one by one. The interpreter performs the lowest level of execution, such as the execution tasks that interact with specific hardware or software modules. The executor is used to execute the actions and instructions generated by the inference engine or state machine according to the rules and strategies, such as the low-level tasks passed by the interpreter; the executor performs the corresponding operations in sequence according to the parsed rule logic. During the execution process, it is necessary to obtain necessary resources, such as device handles, memory space, etc. For example, when executing the strategy of controlling peripherals, the executor needs to obtain the interface and parameters of the controlled peripheral program through the terminal interaction module, and then control the peripheral through the driver.

[0060] During the execution process, the executor obtains the inference word and state word description from the inference engine and state machine, evaluates the condition part of each rule, determines which rules are applicable, and then maintains and updates the basic rule base and policy base. After processing, the results are sent to the inference engine.

[0061] Feedback mechanism of the executor: According to the execution logic generated by the parser, the corresponding strategy is actually executed on the terminal according to the rule base. For example, when executing the device control rule, the executor will control the status of the hardware device through the corresponding device driver. In order to ensure the reliability of policy execution, the executor has an error handling mechanism. After the policy is executed, the execution result needs to be fed back to the system. If the execution is successful, the relevant information of the execution is recorded, such as the execution time, execution parameters, etc.; when an error occurs during the execution of the strategy, such as device failure or insufficient resources, the error information can be recorded in time, and feedback processing is performed according to the pre-set strategy (such as retry, skip or warning), etc. The core module of the entire runtime engine is in a closed-loop state.

[0062] The interpreter performs adjustment and optimization based on the feedback from the executor. Adjustment and optimization include: fine-tuning of rules or policies, such as adjusting thresholds, time intervals, and the number of retries, etc., to better adapt to the current system status or business needs. The interpreter can analyze the success or failure cases in the execution results, identify the logical loopholes or redundant parts in the rules or policies, and perform corresponding optimizations; optimization of the interpreter's internal mechanism. The interpreter can cache frequently executed instructions or intermediate results to reduce the overhead of repeated calculations and parsing and improve execution efficiency. For rules or policies containing conditional branches, the interpreter can use branch prediction technology to optimize the execution path and reduce the performance loss caused by branch errors. The interpreter can optimize the memory access mode, such as reducing the memory access overhead through memory alignment, batch operations and other technologies; interaction optimization between the executor and the interpreter. The interpreter can dynamically adjust the task allocation strategy based on the load of the executor, resource utilization and other factors to ensure that the tasks can be efficiently and evenly allocated to each executor. Error handling mechanism: The interpreter can optimize the error handling mechanism, such as adding a retry mechanism, error classification processing, early warning notification, etc., to improve the system's fault tolerance and response speed, etc.

[0063] The resource management module is used to manage the system itself or hardware resources according to the resource management strategy, including LOG management for recording system logs, memory management for managing the system's memory resources, external memory management for managing resources on external storage devices, on-chip resource management for managing on-chip resources on embedded terminals, and off-chip extended resource management for managing extended external resources.

[0064] As attached Figure 2 As shown, a method for implementing a multi-rule, policy engine system applied to an embedded terminal, that is, a multi-rule, policy engine implementation method applied to an embedded terminal, includes:

[0065] S1. When the server interaction module receives business demands from the central server, the business demands include archive data, task data, rule data and policy data, and processes these business demands and stores them in the local data storage module; the business demand pool transmits the business demand-related data to the engine core module according to the changes in business demands to drive it to perform corresponding processing.

[0066] S2. When the engine core module receives data or instructions, it compiles and matches the stored rule object model and strategy object model, and passes the matching results to the interpreter. The interpreter interprets and executes the intermediate expression instructions one by one, and passes the underlying tasks to the executor for further execution. The executor controls the operation of external devices through the terminal interaction module and feeds back the execution results of the external devices to the interpreter. The interpreter further adjusts and optimizes according to the execution results fed back by the executor, and the server interaction module outputs the execution status.

[0067] S3. The terminal interaction module connects to the sensor of the external device through the terminal input interface, collects the operation data of the external device in real time, and passes the collected data to the event-driven module. When the event-driven module determines that the current collected data meets the event triggering conditions, it passes the relevant monitoring data that meets the event triggering conditions to the engine core module. The inference engine and the state machine call the business demand pool to transfer the relevant business data in the data storage module according to the rule requirements, perform reasoning and decision-making, and execute corresponding actions or instructions according to the results of reasoning and decision-making; the inference engine and the state machine call the business demand pool to transfer the relevant business data in the data storage module according to the data and instructions, perform reasoning and decision-making, and execute corresponding actions or instructions according to the results of reasoning and decision-making. The system updates the corresponding state information or data storage according to the execution results.

[0068] S4. The resource management module will manage various resources according to the resource management strategy and release unnecessary resources.

[0069] The engine system is deployed in industrial automatic control to illustrate the implementation method:

[0070] Industrial production bases involve order input, where the order contains detailed production equipment types and detailed configuration data of the products; the archive data includes the type and configuration of production equipment, product type and configuration details, factory layout and production line configuration, and the relationship between equipment. Task data includes production time, location (production line), quantity, product type, production line start instructions, pause instructions, stop instructions, etc. Rule data includes production time rules, such as "orders must start production at a specified time", production line selection rules, such as "select the corresponding production line according to product type", and quantity check rules, such as "production quantity must be consistent with order quantity". Strategy data includes production planning strategies, such as "produce type A equipment from Monday to Wednesday, and type B equipment from Thursday to Sunday", and resource management strategies, such as "release unnecessary resources when the production line is idle".

[0071] The system obtains archives, tasks, rules, and strategies from the service interaction interface. After receiving the necessary data, the system adaptively adapts the current rule expressions and necessary business strategies, implements the current main business based on the inference engine, binds the state of the state machine and the confirmation interpretation of the production action, and can build a complete business process based on the basic data provided by the collection terminal.

[0072] When the terminal system is running, the core module of the engine is mainly responsible for compiling, matching, and executing the rules and policies issued by the user, and obtaining a series of production factor data issued by the current user based on the inference engine: for example, from the dimension of time, the order will enter the production operation on time at 10:00 am on August 1, 2024; from the dimension of location, the order refers to the automated production industrial assembly line of the factory; from the dimension of quantity, the order points to the determination of the quantity of production items of the factory's assembly line; from the dimension of item type, the order points to the determination of the type of items produced by the factory's assembly line, and so on. A series of essential data elements.

[0073] After confirmation, the state machine bound to the system will check the pre-execution status of each module and explain the feedback according to the current status, as well as whether the driver interface is ready. After each module enters the standby state, the event drive is finally triggered, thus starting the operation of the factory's automated assembly line.

[0074] During the working process, the acquisition terminal will collect the key data of the assembly line in real time and integrate and check the working status of the current assembly line. The system resource management strategy will manage the resources of the system and effectively release unnecessary resources, thereby improving the response speed and stability of the system. Finally, this industrial automation assembly line will complete the automated production operation according to the user's requirements.

[0075] The present invention can be applied to multiple scenarios, such as smart home, industrial automation, environmental monitoring and other fields, to achieve fast, safe and reliable communication between devices. For example, in smart home, it can be used to process business logic such as temperature control and lighting adjustment; in industrial automation, it can be used to monitor device status, control production process, etc. With the rapid growth of the embedded device market, the present invention has broad application prospects and market potential in the fields of smart home, smart city, industrial Internet, etc.

[0076] In addition to the above basic production services, you can also set and identify more strategies. For example, users can specify a broader time dimension, issue and bind strategies, and specify what type of equipment the assembly line should produce in a certain time period from Monday to Wednesday. What type of equipment should be produced in a certain time period from Thursday to Sunday. This system can reflect the importance, convenience and efficiency of multi-rule and multi-strategy engine systems.

[0077] In addition, the engine system of the intelligent manufacturing base also supports the setting and identification of multiple rules and strategies. Users can set broader rules and strategies such as time dimension, equipment priority, production sequence, etc. according to actual needs, and bind them to the corresponding production line. In this way, the engine system can automatically adjust the operation mode of the production line according to different production needs and conditions, and achieve more flexible and efficient production.

[0078] The above is only an embodiment of the present invention, and the common knowledge such as the known specific technical solutions and / or characteristics in the solution is not described in detail here. It should be pointed out that for those skilled in the art, without departing from the technical solution of the present invention, several modifications and improvements can be made, which should also be regarded as the protection scope of the present invention, and these will not affect the effect of the implementation of the present invention and the practicality of the patent. The scope of protection required by this application shall be based on the content of its claims, and the specific implementation methods and other records in the specification can be used to interpret the content of the claims.

Claims

1. A multi-rule, policy engine system applied to embedded terminals, characterized in that: include: The server interaction module is used to exchange data with other systems in a network environment and pre-process the received data; The core module of the engine includes an inference engine, a state machine, a compiler, a matcher, an interpreter, and an executor. The inference engine performs logical reasoning according to preset rules to coordinate the operation of the core modules of the engine. The state machine tracks and manages the state changes of each module in the system, and feeds back the response status of each module to the inference engine to assist the work of the inference engine. The compiler converts the expression of rules or policies from text description or data format into an intermediate expression. The matcher is responsible for matching business requirements with rules or policies when an event occurs. The interpreter reads the intermediate representation generated by the compiler and interprets and executes each item one by one. The executor executes the underlying tasks passed by the interpreter, and the terminal interface controls the operation of external devices. The executor is also used to feedback the execution results, and the interpreter further adjusts and optimizes according to the execution results fed back by the executor. Business demand pool, used to store and manage current pending business demands and coordinate overall business processes; The terminal interaction module is used to provide an interface to connect external devices, realize the collection and input of external device operation data and the output of instructions to control the operation of external devices; The event-driven module is used to determine whether the input data of the terminal interaction module triggers an event. When an event is triggered, the event information is passed to the engine core module; The data storage module is used for local storage of data required by the engine during operation, including a basic rule library for storing rule data, a basic policy library for storing policy data, an archive library for storing archive data, and a task library for storing task data; An application database used to store data received by the event-driven module and the terminal interaction module.

2. The multi-rule and policy engine system for embedded terminals according to claim 1, characterized in that: It also includes a resource management module, which is used to manage the system itself or hardware resources according to the resource management strategy, including LOG management for recording system logs, memory management for managing the system's memory resources, external memory management for managing resources on external storage devices, on-chip resource management for managing on-chip resources on embedded terminals, and off-chip extended resource management for managing extended external resources.

3. The multi-rule and policy engine system for embedded terminals according to claim 2, characterized in that: The server interaction module includes a service input unit, a service output unit and a processing unit; the service input unit receives archive data, task data, rule data and policy data sent by the central server, and the service output unit sends the terminal execution status, current terminal status and other session information to the central server; The processing unit processes the received data and converts it into a rule object model and a strategy object model.

4. The multi-rule and policy engine system for embedded terminals according to claim 3, characterized in that: The event-driven module includes an event-driven interface and an event driver; The event-driven interface builds interface support based on the business demand pool, and the terminal interaction module connects the sensors of external devices to collect monitoring data in real time. When the monitoring data meets the event trigger conditions, the event driver passes the relevant monitoring data to the engine core module.

5. The multi-rule and policy engine system for embedded terminals according to claim 4, characterized in that: The business demand pool triggers the engine core module according to the business demand, and stores the new data received by the event-driven module in the data storage module. When the business demand changes, the data transmitted in the business demand pool is updated in time.

6. The multi-rule and policy engine system for embedded terminals according to claim 5, characterized in that: The inference engine obtains new data or instructions through chain reasoning and obtains results by applying rules; the state machine is used to track and manage the state transition and state behavior of the system and works in coordination with the inference engine.

7. A method for implementing a multi-rule and policy engine applied to an embedded terminal, using the engine system of claim 6, characterized in that: include: S1: The server interaction module receives business requirements from the central server, processes these business requirements and stores them in the local data storage module; The business demand pool transfers business demand-related data to the engine core module according to changes in business demand; S2: The engine core module receives data or instructions, compiles and matches them in combination with the stored rule object model and policy object model, and passes the matching results to the interpreter, which interprets and executes the intermediate expression instructions one by one, and passes the underlying tasks to the executor for further execution. The executor controls the operation of external devices through the terminal interaction module and feeds back the execution results of the external devices to the interpreter. The interpreter further adjusts and optimizes according to the execution results fed back by the executor, and the server interaction module outputs the execution status; S3: The terminal interaction module connects to the sensor of the external device through the terminal input interface, collects the operation data of the external device in real time, and passes the collected data to the event-driven module. When the event-driven module determines that the current collected data meets the event triggering condition, it passes the relevant monitoring data that meets the event triggering condition to the engine core module. The inference engine and the state machine call the business demand pool according to the rule requirements to pass the relevant business data in the data storage module, perform reasoning and decision-making, and execute corresponding actions or instructions according to the results of reasoning and decision-making; S4: The resource management module manages each resource according to the resource management strategy and releases unnecessary resources.

8. The multi-rule and policy engine system for embedded terminals according to claim 7, characterized in that: In step S3, after the engine core module is triggered by the event-driven module, the inference engine and the state machine call the business demand pool according to the data and instructions to transfer the relevant business data in the data storage module, perform reasoning and decision-making, and the system updates the corresponding status information or data storage according to the execution results.

9. The multi-rule and policy engine system for embedded terminals according to claim 8, characterized in that: In step S4, the resource management module manages system logs, memory resources, external storage resources, on-chip resources, and off-chip expansion resources.

Citation Information

Patent Citations

  • Data transmission method and system suitable for various environments

    CN107786665A

  • Methods and systems for detection in industrial internet of things data collection environment with large data sets

    CN110073301A

  • Rule reasoning method for realizing edge-end collaboration

    CN113627613A

  • Rule engine-based energy consumption monitoring management system and method

    CN116738163A

  • Offline service processing system and method on mobile equipment

    CN118606336A