Industrial mechanism model building and real-time calculation method, system, equipment and medium
By building an industrial mechanism model based on the DAG model and combining the technology of flow computing engine and rule engine, the problems of poor adaptability of industrial mechanism modeling technology and insufficient dynamic adaptability of data calculation are solved, efficient real-time computing and data display are achieved, and the response ability and decision-making efficiency of industrial production are improved.
Patent Information
- Application Number
- CN202510406232.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2045-04-02
AI Technical Summary
The existing industrial mechanism modeling technology has problems such as poor adaptability, insufficient dynamic adaptability of data calculation, low data storage and display efficiency, and an efficient dynamic integration mechanism is established between the industrial mechanism model and the streaming computing engine to improve the system's real-time computing power and result display efficiency.
By building an industrial mechanism model based on the DAG model, and submitting the DAG model structure data to the stream computing engine, the stream computing engine uses the rule engine to analyze and generate an execution sequence, and trigger execution, store the execution results through the data gateway, and visually display it.
It improves the efficiency and accuracy of the construction of industrial mechanism models, improves the utilization rate of computing resources and the flexibility of task execution, enhances the real-time and visualization capabilities of data storage and display, and meets the needs of modern industrial production for rapid response and dynamic decision-making.
Smart Images

Figure CN119903090A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of industrial mechanism modeling and real-time computing technology, and specifically to industrial mechanism model building and real-time computing methods, systems, equipment and media. Background Art
[0002] With the rapid development of industrial automation and intelligence, industrial mechanism modeling technology has been widely used. Traditional industrial mechanism modeling usually relies on expert experience and rule-based models, and the model establishment process is relatively complex and difficult to update dynamically. In recent years, with the development of big data technology, cloud computing and stream computing, industrial mechanism models have gradually developed towards real-time computing and dynamic adaptive modeling. In particular, the introduction of the directed acyclic graph (DAG) model enables the structure and calculation path of the model to be clearly defined through the relationship between nodes and edges, and can be efficiently executed in a real-time computing environment. Stream computing engines such as Flink and Spark are widely used to process real-time data streams, which can receive, process and feedback data in industrial processes in real time. Combined with the application of rule engines, real-time streaming computing can flexibly generate execution sequences and perform task scheduling according to rules, providing a new solution for real-time computing of industrial mechanism models.
[0003] Although the existing industrial mechanism models and real-time computing methods have improved the efficiency and accuracy of modeling to a certain extent, there are still some obvious shortcomings. Most traditional industrial mechanism modeling methods rely on expert experience or preset rules, lack flexibility, and are difficult to cope with complex and dynamically changing industrial processes. Many existing methods rely on static model architectures. Once the model changes, the update process is complex and prone to errors. Although the existing stream computing engine can perform real-time data processing, it is still insufficient in the dynamic adaptability of the model. The existing stream computing engine mainly relies on fixed computing rules and model structures, which are difficult to adjust quickly to cope with rapidly changing industrial needs. Especially when processing large-scale data, efficiency and performance bottlenecks still exist. The data storage and display methods in the existing technology are usually based on traditional databases or static reports, lacking real-time and visualization capabilities, and are difficult to meet the needs of rapid response and dynamic decision-making in modern industrial production. Therefore, how to improve the adaptability, real-time and accuracy of industrial mechanism models through a more flexible and efficient model construction method combined with advanced stream computing engines and visualization display technologies has become a difficult problem in current technology. Summary of the invention
[0004] In view of the above-mentioned problems, the present invention is proposed.
[0005] Therefore, the technical problems solved by the present invention are: the existing industrial mechanism modeling technical methods have poor adaptability, insufficient dynamic adaptability of data calculation, low efficiency of result data storage and display, and the problem of establishing an efficient dynamic integration mechanism between the industrial mechanism model and the streaming computing engine to improve the system's real-time computing capability and result display efficiency.
[0006] To solve the above technical problems, the present invention provides the following technical solutions: an industrial mechanism model construction and real-time calculation method, including building an industrial mechanism model based on a DAG model, submitting DAG model structure data to a stream computing engine; the stream computing engine uses a rule engine to parse and generate an execution sequence, and triggers execution; the execution results are stored through a data gateway and displayed visually; triggering execution includes generating a corresponding calculation rule package according to the rule definition, the rule engine parses the rule definition and the DAG structure according to the incoming calculation rule package, generates a unified execution sequence from the parsing result, triggers all nodes to execute in sequence, and the rule engine pushes the calculation results to the data gateway and the model canvas front end synchronously; triggering execution includes rhythm control of all rule calculations through a calculation controller, triggering rule checks every second in a specified cycle, checking whether each rule has reached the next calculation cycle, whether the previous cycle of the rule has been executed, and whether the rule has exceeded the set execution timeout event; when the rule is checked to be able to execute the next cycle calculation, the triggering rule package calls the rule engine to execute the calculation, and adds a lock control to the current rule, and waits for the next cycle execution to check whether it is unlocked; according to the needs of different businesses, modular parsing and processing are performed on business applications, and output to different business data event streams.
[0007] As a preferred solution for the industrial mechanism model building and real-time calculation method described in the present invention, the industrial mechanism model includes generating DAG model structure data through a canvas engine, the DAG model generates the topological structure of the industrial mechanism model by defining nodes, edges and paths, the rule definition generates an execution sequence based on the topological path of the DAG structure, and the rule configuration in the calculation process is performed through the rule definition. Each rule is uniquely identified by ruleId and the handler field specifies the processing operation of the rule. Each node is identified by nodeId, and the node includes input items and sub-nodes. The input item uses default_in to specify the remaining nodes and parameters.
[0008] As a preferred solution of the industrial mechanism model building and real-time calculation method described in the present invention, wherein: the submission of DAG model structure data to the stream computing engine includes the DAG engine receiving the DAG model structure data generated by the canvas engine, and pushing it to the DAG parser in the Flink stream computing engine job through Kafka to generate a complete topology structure, and the DAG structure data after parsing is stored in a third-party cache.
[0009] As a preferred solution for the industrial mechanism model building and real-time calculation method described in the present invention, the trigger execution includes generating a corresponding calculation rule package according to the rule definition, including a rule identifier and multiple input data items, each input data item including a label name, a label value and a timestamp, and organizing the input data items through the calculation rule package and submitting them to the rule engine for calculation.
[0010] The rule engine parses the rule definition and DAG structure into a unified execution sequence based on the incoming calculation rule package, and executes all nodes in the order of the execution sequence. After all nodes are executed, the rule engine synchronously pushes the calculation result data to the data gateway and the model canvas front end.
[0011] As a preferred solution for the industrial mechanism model building and real-time calculation method described in the present invention, the trigger execution also includes, through the calculation controller, rhythm control of all rule calculations, triggering rule checks every second in a specified cycle, checking whether each rule has reached the next calculation cycle, whether the previous cycle of the rule has been executed, and whether the rule has exceeded the set execution timeout event.
[0012] When the rule is checked and can be executed for the next cycle calculation, the trigger rule package calls the rule engine to perform the calculation, and adds a lock control to the current rule, waiting for the next cycle execution to check whether it is unlocked.
[0013] According to the needs of different businesses, business applications are modularly parsed and processed and output to different business data event streams.
[0014] As a preferred solution for the industrial mechanism model building and real-time calculation method described in the present invention, the execution result storage includes: after the data gateway receives the result data pushed by the rule engine, it writes the write-back data into the designated real-time database, and the historical calculation data is transmitted through Kafka and then stored in the historical data warehouse using InfluxDB for persistence.
[0015] As a preferred solution for the industrial mechanism model building and real-time calculation method described in the present invention, the visual display includes visually displaying the calculation results of each node of the model after the model canvas front end receives the data. The display content includes node ID, node status, execution results, and execution time. It supports dynamic refresh and interactive operations, and dynamically adjusts the execution strategy of subsequent tasks according to the task execution status and system load.
[0016] Another object of the present invention is to provide an industrial mechanism model building and real-time computing system, which can use the rule engine to parse and generate execution sequences through the stream computing engine and trigger execution, thereby solving the problems of rigid execution paths and inflexible scheduling in current industrial mechanism model computing technology.
[0017] As a preferred solution of the industrial mechanism model building and real-time computing system described in the present invention, it includes: a model building module, an execution trigger module, and a storage and display module; the model building module includes an industrial mechanism model building module and a structure data submission module. The industrial mechanism model building module generates a DAG model structure through a canvas engine, defines nodes, edges and paths, and forms a topological structure of the industrial mechanism model. The structure data submission module is used to push the DAG model structure data to the DAG parser in the Flink stream computing engine through Kafka, generate a complete topological structure and store it in a third-party cache; the execution trigger module includes a parsing module and a rule checking trigger module. The parsing module is used to generate a computing rule package according to the rule definition, the rule engine parses the rule and the DAG structure, generates an execution sequence and triggers the task execution, and the rule checking trigger module is used to The calculation controller is used to control the rhythm of all rule calculations, and regularly check whether the rules meet the execution conditions. If the conditions are met, the calculation is triggered and the lock control is executed. The modular business application requirements are analyzed and output to different business data event streams; the storage and display module includes a result storage module and a result display module. The result storage module is used for the data gateway to write the write-back data into the specified real-time database after receiving the result data pushed by the rule engine. The historical calculation data is transmitted through Kafka and then stored in the historical data warehouse using InfluxDB for persistence. The result display module is used for the model canvas front end to visually display the calculation results of each node of the model after receiving the data. The display content includes node ID, node status, execution result, execution time, supports dynamic refresh and interactive operations, and dynamically adjusts the execution strategy of subsequent tasks according to the task execution status and system load.
[0018] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of building an industrial mechanism model and a real-time calculation method.
[0019] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of building an industrial mechanism model and a real-time calculation method.
[0020] Beneficial effects of the present invention: The industrial mechanism model building and real-time calculation method provided by the present invention builds an industrial mechanism model based on a DAG model, and submits DAG model structure data to a stream computing engine, thereby reducing the complexity and error probability in traditional modeling methods, making the construction of the industrial mechanism model more efficient and accurate, and providing a clear execution path for subsequent real-time calculations and data flows. The stream computing engine uses a rule engine to parse and generate an execution sequence, and triggers execution, effectively improving the utilization rate of computing resources and the flexibility of task execution, and reducing the need for human intervention. The execution results are stored through a data gateway and displayed visually, thereby improving the real-time and manageability of the operation, and providing support for subsequent data analysis and decision-making. The present invention achieves better results in terms of modeling flexibility, dynamic adaptability of real-time calculations, and visualization and efficiency of data storage and display. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0022] Figure 1 This is an overall flow chart of the industrial mechanism model building and real-time calculation method provided in the first embodiment of the present invention.
[0023] Figure 2 A real-time calculation flow chart of the industrial mechanism model building and real-time calculation method provided in the second embodiment of the present invention. DETAILED DESCRIPTION
[0024] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0025] Example 1, reference Figure 1 , which is an embodiment of the present invention, provides an industrial mechanism model building and real-time calculation method, including: S1: Build an industrial mechanism model based on the DAG model and submit the DAG model structure data to the stream computing engine.
[0026] Furthermore, the industrial mechanism model includes generating DAG model structure data through the canvas engine. The DAG model generates the topological structure of the industrial mechanism model by defining nodes, edges and paths. The rule definition generates an execution sequence based on the topological path of the DAG structure. The rule configuration in the calculation process is performed through the rule definition. Each rule is uniquely identified by ruleId and the handler field specifies the processing operation of the rule. Each node is identified by nodeId. The node includes input items and sub-nodes. The input item uses default_in to specify the remaining nodes and parameters.
[0027] It should be noted that submitting DAG model structure data to the stream computing engine includes the DAG engine receiving the DAG model structure data generated by the canvas engine, and pushing it to the DAG parser in the Flink stream computing engine job through Kafka to generate a complete topology structure. The DAG structure data after parsing is stored in a third-party cache.
[0028] It should also be noted that a preferred solution for generating a complete topological structure through a DAG engine specifically includes that the DAG engine generates a topological structure based on a directed acyclic graph (DAG) algorithm for topological sorting, performs topological sorting, and arranges the nodes in the graph according to dependency relationships, which is expressed as: ; in, is the set of vertices in DAG (directed acyclic graph), is a set of directed edges, Represented by the vertex and edge The constructed DAG model defines the overall structure of the model and the execution path of the tasks.
[0029] Define the topological sorting function, expressed as: ; in, represents the topological sorting function, Represents the set of vertices in a DAG (directed acyclic graph), , Representation Node The topological number of Representation Node The topological number of each edge All established, The edge set representing directed edges.
[0030] The steps of the topological sorting algorithm are as follows: calculate the in-degree of each vertex, for each vertex in the graph , calculate the vertex In-degree , that is, how many edges point to this vertex; put all vertices with in-degree 0 into a queue or stack; take a vertex from the queue , add it to the result of topological sorting, and remove the vertex All outgoing edges (i.e. points to), for each edge removed , update the vertex If The in-degree of becomes 0, then Add to the queue and repeat this step until the queue is empty; check whether there is a cycle in the graph: if the number of vertices in the final sorted result is equal to the total number of vertices in the graph, the topological sort is successfully completed; otherwise, there is a cycle in the graph.
[0031] It should also be noted that by building an industrial mechanism model based on the DAG model, it is possible to model and dynamically configure the topological structure of complex industrial processes; the DAG model generates a complete topological structure by defining nodes (nodeId), edges and paths, and clarifies the execution order and dependencies of tasks; DAG structure data is generated through the canvas engine and pushed to the DAG parser in the Flink stream computing engine through Kafka (message middleware) to generate a complete topological structure; Kafka is based on the publish-subscribe model and is used to efficiently transmit and process large-scale real-time data streams in the system. It has high throughput, low latency and strong expansion capabilities, and realizes efficient transmission and decoupled operations of real-time data during the generation and execution of the DAG (directed acyclic graph) model. The combination of Kafka and Flink supports high concurrency and real-time parsing, ensuring the stability and flexibility of the model in a dynamic environment; through dynamic topological configuration and path generation, it can quickly adapt to different task execution environments according to business needs, solving the problem of difficult adjustment of traditional static models in complex task environments.
[0032] S2: The stream computing engine uses the rule engine to parse and generate the execution sequence and trigger the execution.
[0033] Furthermore, triggering execution includes generating a corresponding calculation rule package according to the rule definition, including a rule identifier and multiple input data items, each input data item including a label name, a label value and a timestamp, organizing the input data items through the calculation rule package and submitting them to the rule engine for calculation.
[0034] The rule engine parses the rule definition and DAG structure into a unified execution sequence based on the incoming calculation rule package, and executes all nodes in the order of the execution sequence. After all nodes are executed, the rule engine synchronously pushes the calculation result data to the data gateway and the model canvas front end.
[0035] It should be noted that triggering execution also includes controlling the rhythm of all rule calculations through a computing controller, triggering rule checks every second at a specified cycle, checking whether each rule has reached the next calculation cycle, whether the previous cycle of the rule has been executed, and whether the rule has exceeded the set execution timeout event.
[0036] When the rule is checked and can be executed for the next cycle calculation, the trigger rule package calls the rule engine to perform the calculation, and adds a lock control to the current rule, waiting for the next cycle execution to check whether it is unlocked.
[0037] According to the needs of different businesses, business applications are modularly parsed and processed and output to different business data event streams.
[0038] The data gateway service collects data in real time and pushes it to the stream computing engine. After receiving the data, the stream computing engine performs calculations through the calculation controller in the rule engine and pushes the calculation results to the data gateway and the model canvas front end.
[0039] The calculation controller includes triggering rule checks every second at a specified cycle, including whether each rule has reached the next calculation cycle, whether the rule has been executed in the previous cycle, or whether the rule has exceeded a set execution timeout event.
[0040] When the rule is checked and can be executed for the next cycle calculation, the rule package is triggered to call the rule engine to execute the calculation, and a lock control is added to the current rule, waiting for the next cycle to check whether it is unlocked; the rule engine output is parsed, and the business application parsing requirements are modularized according to different business needs, and output to different business data event streams.
[0041] It should also be noted that a preferred solution for generating the corresponding calculation rule packet specifically includes, after the packet is generated, first performing an integrity check on the label name, label value and timestamp, and at the same time, adding a verification identifier and a processing priority field to the packet to ensure that the execution order of the nodes is dynamically adjusted according to the priority during the execution of the rule engine; when the rule engine parses the DAG structure and generates an execution sequence, it is necessary to dynamically check the status of the node before executing each node (for example, whether the previous node has been executed, whether the input data is complete, etc.), and for nodes that do not meet the execution conditions, a suspension mechanism is added to automatically trigger the execution when the conditions are met; a parallel processing mechanism is added during the rule execution process, allowing the execution tasks to be dynamically split according to the dependencies of different nodes and the rule priorities, thereby improving the overall execution efficiency.
[0042] It should also be noted that a preferred solution for controlling the rhythm of all rule calculations through a computing controller specifically includes that the computing controller needs to set a maximum timeout and retry mechanism during the execution process, trigger an interrupt and record a log for rule packets that have not responded for a long time or execution tasks that have timed out, to avoid execution blocking.
[0043] It should also be noted that by using the stream computing engine to parse and generate execution sequences and trigger execution, dynamic scheduling and real-time execution of tasks can be achieved. The rule engine generates an execution sequence based on the rule package (including label name, label value, timestamp, etc.) and parses it according to priority and path dependency. When there is a rule conflict or execution fails, the system gives priority to high-priority rules through an arbitration mechanism, and adjusts the execution order through path reconstruction and packet rollback mechanisms to ensure task integrity. Through rhythm control, the system dynamically adjusts the execution cycle according to task complexity and load conditions, improves task execution efficiency, and solves the execution blocking problem caused by resource competition and conflict in traditional task execution.
[0044] S3: Stores execution results through the data gateway and displays them visually.
[0045] Furthermore, the execution result storage includes that after the data gateway receives the result data pushed by the rule engine, it writes the write-back data into the specified real-time database, and the historical calculation data is transmitted through Kafka (message middleware) and then persistently stored in the historical data warehouse using InfluxDB.
[0046] It should also be noted that the visualization display includes the visualization of the calculation results of each node of the model after the model canvas front end receives the data. The display content includes node ID, node status, execution results, and execution time. It supports dynamic refresh and interactive operations, and dynamically adjusts the execution strategy of subsequent tasks according to the task execution status and system load.
[0047] It should also be noted that a preferred solution for storing and displaying result data specifically includes that after the data gateway receives the real-time streaming calculation result data, it classifies and identifies the data according to the tag name and tag value. The tag name is used to distinguish the data source (such as device ID, timestamp, task ID, etc.), and the tag value identifies the data content (such as calculation results, node output value, etc.). The system verifies the tag structure before writing back the data to ensure that it is consistent with the model structure. When the data is written to the real-time database, an index is built based on the tag, and batch processing or streaming processing is used to store it by tag and timestamp to improve query efficiency. Kafka transmits the calculation results to the specified topic, and the data consumer listens to the topic and stores the data in InfluxDB, and establishes multi-level indexes to support fast query.
[0048] It should also be noted that a preferred solution for displaying result data specifically includes that after the model canvas front end receives the result data, it actively pushes it to the front-end interface through WebSocket communication, triggering dynamic refresh, and adjusting the display content according to the hierarchical relationship between nodes and edges in the DAG structure, displaying node ID, node type, input items, output values and execution status. The display interface uses different colors or icons according to the node status (such as executing, completed, abnormal, etc.), supports zooming and dragging operations, and helps users quickly locate and monitor data status.
[0049] It should also be noted that by storing the execution results and visually displaying them through the data gateway, real-time monitoring and dynamic adjustment of the task execution status can be achieved. A unique index is generated based on the tag name and timestamp, and the data is stored in a real-time database or a historical database. While displaying the task status, the model canvas allows users to dynamically adjust the path and task priority by dragging or clicking. When a task fails or conflicts, the system can quickly repair it through alarm prompts and path reconstruction mechanisms. Combined with historical data, the system supports trend analysis and anomaly detection to ensure task execution stability and system responsiveness in complex environments.
[0050] Example 2, reference Figure 2 , which is an embodiment of the present invention, provides an industrial mechanism model building and real-time calculation method. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through economic benefit calculation and simulation experiments.
[0051] First, through Figure 2 The canvas engine in is used to build models, generate DAG model structure data, define nodes, edges and paths, and form the topological structure of the industrial mechanism model. To ensure the integrity of the model structure, each node is identified by a unique nodeId. The node includes input items and subnodes. The input items use default_in to specify the remaining nodes and parameters. After the configuration is completed, Figure 2As shown in the figure, the Flink stream computing engine is used to dynamically parse and execute the rule definition and data flow: the DAG engine receives the DAG model structure data generated by the canvas engine and pushes it to the DAG parser in the Flink stream computing engine job through Kafka; the DAG engine generates a complete topological structure through topological sorting, which includes steps such as calculating the in-degree, removing nodes, and updating the graph structure to ensure that the sorting is successful and loop-free; in the stream computing engine, the rule engine generates an execution sequence based on the incoming rule packet (including label name, label value, and timestamp, etc.); after the rule engine parses the DAG structure, it executes all nodes in the order of the execution sequence; if there are conflicts between the rules, the system dynamically adjusts the execution order according to the priority field in the packet; in the case of incomplete input or rule conflicts, the system solves them through path reconstruction and rollback mechanisms; the rule engine dynamically monitors the node status and task progress in a cycle per second, and triggers an interrupt and retries when a timed out or failed task is found; as shown in the figure, the DAG structure is dynamically generated by the DAG engine, and the DAG model structure is generated by the Flink stream computing ... Figure 2 As shown in the figure, after the task is executed, the rule engine pushes the calculation results to the data gateway through Kafka. The data gateway classifies the result data according to the tag name and tag value, and stores them in the real-time database and historical data warehouse (InfluxDB) respectively; the model canvas front end actively pushes the results through WebSocket communication, triggers dynamic refresh, and displays the node ID, node status, execution results and execution time; users can dynamically adjust the node order and path through the interface, and the system regenerates the topology structure according to the adjusted structure and updates the execution sequence. Refer to Table 1 to record and analyze the experimental data.
[0052] Table 1 Experimental data record table Test subjects Tag Name Tag value Timestamp Input integrity Priority Execution Status Node A Tag 1 12.5 2025 / 3 / 1 10:00 TRUE 1 success Node B Tag 2 15 2025 / 3 / 1 10:05 TRUE 2 success Node C Tag 3 18.2 2025 / 3 / 1 10:10 FALSE 3 Suspend Node D Tag 4 20.3 2025 / 3 / 1 10:15 TRUE 1 success Node E Tag 5 22.1 2025 / 3 / 1 10:20 FALSE 2 Suspend Node F Tag 6 19.7 2025 / 3 / 1 10:25 TRUE 3 success
[0053] It can be seen from the experimental data that under different task execution conditions, the DAG model and rule engine can dynamically adapt to the complex execution environment; first, it can be seen from the experimental data that nodes A, B, D and F are successfully executed in the topological sorting, indicating that the system has stability and adaptability in terms of input integrity and path optimization; and due to incomplete input of nodes C and E, the system triggers the suspension mechanism during execution and will execute again after the input data is complete; in terms of priority resolution, nodes A and D have the highest priority (level 1), so they are executed first in the case of task conflict. When parsing the execution sequence, the rule engine can dynamically adjust the execution path according to the tag name, tag value and timestamp to ensure that high-priority tasks are executed first; for nodes C and E, due to the missing input data, the system triggers the path reconstruction mechanism and waits for the complete data to be input before processing, thereby avoiding execution failure; in terms of execution status monitoring, the rule engine dynamically monitors the progress of task execution during task execution, and completes the interruption and recovery of the task within the timeout period, ensuring the integrity and stability of task execution; using Kafka as the data middleware, the system realizes the efficient transmission of rule packaging and execution results, ensuring the real-time and concurrency of task scheduling in complex industrial environments.
[0054] Compared with the existing technology, the present invention generates a topological structure through a DAG model, combines the data transmission and rule parsing of Kafka and Flink, and ensures the efficient execution and dynamic scheduling capabilities of tasks in complex dependency environments. At the same time, the system solves the problems of task interruption and failure caused by path conflicts and incomplete input in traditional solutions through dynamic path reconstruction, packet rollback and rhythm control, and has stability and adaptability.
[0055] Embodiment 3 is an embodiment of the present invention, which provides an industrial mechanism model building and real-time computing system, including a model building module, an execution trigger module, and a storage and display module.
[0056] Among them, S4: the model building module includes the industrial mechanism model building module and the structural data submission module. The industrial mechanism model building module generates the DAG model structure through the canvas engine, defines nodes, edges and paths, and forms the topological structure of the industrial mechanism model. The structural data submission module is used to push the DAG model structure data to the DAG parser in the Flink stream computing engine through Kafka, generate a complete topological structure and store it in a third-party cache.
[0057] It should be noted that in the model building module, the industrial mechanism model building module generates a DAG (directed acyclic graph) model structure through the canvas engine, and forms the topological structure of the industrial mechanism model by defining nodes, edges and paths; each node is identified by a unique nodeId, and input and output items are configured to clarify the dependencies between nodes; then, the structure data submission module pushes the generated DAG model structure data to the DAG parser in the Flink stream computing engine through Kafka. The DAG parser generates a complete execution sequence based on the topological sorting algorithm, and stores the parsed DAG structure in a third-party cache for the rule engine to call when executing.
[0058] The model building module generates a DAG model structure through the canvas engine, defines nodes, edges and paths, and generates a complete topological structure. The generated DAG structure data is pushed to the DAG parser in the Flink stream computing engine through Kafka, and the execution path is generated and stored in the third-party cache. The execution trigger module generates an execution sequence based on the parsing results. The rule engine triggers task execution in combination with the DAG structure to ensure that tasks are carried out in order according to the topological relationship. The generation of the DAG structure and the path definition directly determine the order in which the rule engine generates the execution sequence and the priority of task execution. Therefore, the output of the model building module directly affects the working logic and scheduling path of the execution trigger module.
[0059] S5: The execution trigger module 200 includes a parsing module and a rule checking trigger module. The parsing module is used to generate a calculation rule package according to the rule definition. The rule engine parses the rules and DAG structure, generates an execution sequence and triggers task execution. The rule checking trigger module is used to control the rhythm of all rule calculations through the calculation controller, and regularly checks whether the rules meet the execution conditions. If the conditions are met, the calculation is triggered and the execution lock control is performed. The modular business application demand analysis is output to different business data event streams.
[0060] It should be noted that after the DAG model structure is generated, the system is linked to the execution trigger module. The parsing module generates the corresponding calculation rule package according to the rule definition. The package includes information such as the rule identifier (ruleId), label name, label value and timestamp. When parsing the package, the rule engine combines the DAG structure to generate a unified execution sequence; the rule check trigger module triggers the rule check regularly (such as every second) through the calculation controller to determine whether each rule meets the execution conditions, including input data integrity, execution status of the preceding node, etc.; if the execution conditions are met, the rule package is triggered, and the task execution order is dynamically adjusted according to the priority and execution status; to avoid rule conflicts, the system sets a lock control mechanism during the execution process to prevent the same rule from being repeatedly triggered on different paths; during the execution process, the rule engine can perform modular business application analysis according to different business needs, and output the execution results to different business data event streams.
[0061] In the execution trigger module, the rule engine executes tasks according to the generated execution sequence. After the task is executed, the rule engine transmits the execution results to the data gateway through Kafka. The data gateway classifies the result data according to the tag name, timestamp and other information, and stores them in the real-time database or historical database (InfluxDB) respectively; after the storage is completed, the result storage module in the storage display module will index the data to support fast query. At the same time, the result display module actively pushes the execution results to the front-end model canvas through WebSocket communication. The front-end model canvas displays the execution status, results and paths between nodes of the task. Users can view the execution details through the interface and dynamically adjust the task path according to the execution results; if the task execution is abnormal or fails, the system will generate an alarm prompt in the display module. Users can adjust the task path or trigger the task retry through the canvas interface. The output of the execution trigger module (i.e., the task result) directly affects the display content and path adjustment in the storage display module, forming a closed-loop mechanism of "execution-display-feedback".
[0062] S6: The storage and display module includes a result storage module and a result display module. The result storage module is used for the data gateway to write the write-back data into the specified real-time database after receiving the result data pushed by the rule engine. The historical calculation data is transmitted through Kafka and then stored in the historical data warehouse using InfluxDB for persistence. The result display module is used for the model canvas front end to visually display the calculation results of each node of the model after receiving the data. The display content includes node ID, node status, execution result, and execution time. It supports dynamic refresh and interactive operations, and dynamically adjusts the execution strategy of subsequent tasks according to the task execution status and system load.
[0063] It should be noted that after the task is executed, the system is further linked to the storage and display module. The result storage module is responsible for receiving the result data pushed by the rule engine, and storing the result data in the specified real-time database according to the label name, timestamp and data type. After the historical calculation data is transmitted through Kafka, it is stored in the InfluxDB persistent database and indexed to support fast query. After receiving the data, the result display module pushes the data to the model canvas front end through WebSocket communication for visual display. The display content includes node ID, node status (such as executing, completed, failed, etc.), execution results and execution time. Users can interact through the canvas interface, support dynamic refresh, scaling and path adjustment. When the system load changes or the task status is updated, the system can dynamically adjust the execution strategy of subsequent tasks to ensure the stability and real-time performance of the overall execution.
[0064] In the storage display module, users can adjust the task execution path, node configuration and rule parameters through the model canvas. When users modify the task configuration or path in the model canvas, the system will automatically generate new DAG structure data. The structure data submission module will push the new DAG structure data to the DAG parser of the Flink stream computing engine through Kafka, triggering new path generation and execution sequence update; the updated execution sequence will automatically act on the rule engine in the execution trigger module, triggering new task path parsing and dynamic scheduling. If the modification involves task priority or execution conditions, the rule engine will dynamically adjust the execution path and node order according to the new configuration when parsing the package. The user's adjustment of the execution path and rule configuration in the storage display module directly triggers the re-modeling of the model building module and the dynamic scheduling of the execution trigger module, forming an adaptive linkage mechanism of "adjustment-modeling-execution".
[0065] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0066] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0067] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk case (magnetic devices), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0068] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logical function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc. It should be noted that the above embodiments are only used to illustrate the technical solution of the present invention and are not limited. Although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention, which should be included in the scope of the claims of the present invention.
[0069] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. Industrial mechanism model construction and real-time calculation method, characterized in that: include: Build an industrial mechanism model based on the DAG model and submit the DAG model structure data to the stream computing engine; The stream computing engine uses the rule engine to parse and generate execution sequences and trigger execution; The execution results are stored and visualized through the data gateway; Triggering execution includes generating the corresponding calculation rule package according to the rule definition. The rule engine parses the rule definition and DAG structure according to the incoming calculation rule package, generates a unified execution sequence from the parsing results, and triggers all nodes to execute in sequence. The rule engine pushes the calculation results to the data gateway and the model canvas front end synchronously. Triggering execution includes controlling the rhythm of all rule calculations through the calculation controller, triggering rule checks every second at a specified cycle, checking whether each rule has reached the next calculation cycle, whether the previous cycle of the rule has been executed, and whether the rule has exceeded the set execution timeout event; When the rule is checked and can be executed for the next cycle calculation, the rule package is triggered to call the rule engine to perform the calculation, and a lock control is added to the current rule, and the next cycle execution is checked to see if it is unlocked; According to the needs of different businesses, business applications are modularly parsed and processed and output to different business data event streams.
2. The industrial mechanism model building and real-time calculation method according to claim 1, characterized in that: The industrial mechanism model includes, The DAG model structure data is generated through the canvas engine. The DAG model generates the topological structure of the industrial mechanism model by defining nodes, edges and paths. The rule definition generates the execution sequence based on the topological path of the DAG structure. The rule configuration in the calculation process is performed through the rule definition. Each rule is uniquely identified by ruleId and the handler field specifies the processing operation of the rule. Each node is identified by nodeId. The node includes input items and subnodes. The input item uses default_in to specify the remaining nodes and parameters.
3. The industrial mechanism model building and real-time calculation method according to claim 1 or 2, characterized in that: Submitting the DAG model structure data to the stream computing engine includes: The DAG engine receives the DAG model structure data generated by the canvas engine and pushes it to the DAG parser in the Flink stream computing engine job through Kafka to generate a complete topology structure. The DAG structure data after parsing is stored in the third-party cache.
4. The industrial mechanism model building and real-time calculation method according to claim 1, characterized in that: The trigger execution includes: Generate a corresponding calculation rule package according to the rule definition, including a rule identifier and multiple input data items, each input data item including a tag name, a tag value and a timestamp, organize the input data items through the calculation rule package and submit them to the rule engine for calculation; The rule engine parses the rule definition and DAG structure into a unified execution sequence based on the incoming calculation rule package, and executes all nodes in the order of the execution sequence. After all nodes are executed, the rule engine synchronously pushes the calculation result data to the data gateway and the model canvas front end.
5. The industrial mechanism model building and real-time calculation method according to claim 1 or 4, characterized in that: The triggering execution also includes: The calculation controller is used to control the rhythm of all rule calculations. The rule check is triggered every second at a specified cycle to check whether each rule has reached the next calculation cycle, whether the previous cycle of the rule has been executed, and whether the rule has exceeded the set execution timeout event. When the rule is checked and can be executed for the next cycle calculation, the rule package is triggered to call the rule engine to perform the calculation, and a lock control is added to the current rule, and the next cycle execution is checked to see if it is unlocked; According to the needs of different businesses, business applications are modularly parsed and processed and output to different business data event streams.
6. The industrial mechanism model building and real-time calculation method according to claim 5, characterized in that: The execution result storage includes: After the data gateway receives the result data pushed by the rule engine, it writes the write-back data into the specified real-time database. The historical calculation data is transmitted through Kafka and then persistently stored in the historical data warehouse using InfluxDB.
7. The industrial mechanism model building and real-time calculation method according to any one of claims 1, 2, 4 or 6, characterized in that: The visual display includes: After receiving the data, the model canvas front end visualizes the calculation results of each node of the model. The displayed content includes node ID, node status, execution results, and execution time. It supports dynamic refresh and interactive operations, and dynamically adjusts the execution strategy of subsequent tasks according to the task execution status and system load.
8. Industrial mechanism model building and real-time calculation system, characterized by: It includes model building module, execution trigger module, storage and display module; The model building module includes an industrial mechanism model building module and a structure data submission module. The industrial mechanism model building module generates a DAG model structure through a canvas engine, defines nodes, edges and paths, and forms a topological structure of the industrial mechanism model. The structure data submission module is used to push the DAG model structure data to the DAG parser in the Flink stream computing engine through Kafka, generate a complete topological structure and store it in a third-party cache; The execution trigger module includes a parsing module and a rule checking trigger module. The parsing module is used to generate a calculation rule package according to the rule definition. The rule engine parses the rule and DAG structure, generates an execution sequence and triggers the task execution. The rule checking trigger module is used to control the rhythm of all rule calculations through the calculation controller, regularly check whether the rules meet the execution conditions, and if the conditions are met, trigger the calculation and execute the lock control, modularize the business application requirements analysis, and output to different business data event streams; The storage and display module includes a result storage module and a result display module. The result storage module is used for the data gateway to write the write-back data into the specified real-time database after receiving the result data pushed by the rule engine. The historical calculation data is transmitted through Kafka and then stored in the historical data warehouse using InfluxDB for persistence. The result display module is used for the model canvas front end to visually display the calculation results of each node of the model after receiving the data. The display content includes node ID, node status, execution result, and execution time. It supports dynamic refresh and interactive operations, and dynamically adjusts the execution strategy of subsequent tasks according to the task execution status and system load.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the industrial mechanism model building and real-time calculation method described in any one of claims 1 to 7 are implemented.
10. 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 industrial mechanism model building and real-time calculation method described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
An alarm message center system for a regional power generation company
CN109086894A
Streaming computing method and device based on DAG interaction
CN111782371A
Visual programming method and system based on Flink
CN115617326A
Database deadlock analysis method and device, storage medium and electronic equipment
CN116955368A
Server-free workflow engine implementation method based on event arrangement
CN119377049A