Industrial mechanism model construction and real-time calculation method, system, device 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 and insufficient dynamic adaptability of data calculation in industrial mechanism modeling technology are solved, efficient data storage and display are achieved, and real-time and accuracy of industrial mechanism models are improved.
Patent Information
- Application Number
- CN202510406232.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2045-04-02
AI Technical Summary
The existing industrial mechanism modeling technologies have problems such as poor adaptability, insufficient dynamic adaptability of data calculations, low efficiency in storage and display of results, and establishing an efficient dynamic integration mechanism between industrial mechanism models and streaming computing engines.
By building an industrial mechanism model based on the DAG model, submitting the DAG model structure data to the stream computing engine, and analyzing the rules engine to generate an execution sequence, triggering execution, and storing the execution results through the data gateway and visually displaying them.
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 CN119903090B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of industrial mechanism modeling and real-time computing, and specifically to an industrial mechanism model construction and real-time computing method, system, device, and medium. Background Art
[0002] With the rapid development of industrial automation and intelligence, industrial mechanism modeling technology has been widely applied. 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 stream computing can flexibly generate execution sequences and perform task scheduling according to rules, providing a new solution for the real-time computing of industrial mechanism models.
[0003] Although the existing industrial mechanism models and real-time computing methods have improved the modeling efficiency and accuracy to a certain extent, there are still some obvious deficiencies. Most traditional industrial mechanism modeling methods rely on expert experience or preset rules, lacking flexibility and being 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 error-prone. Although the existing stream computing engines can perform real-time data processing, they are still insufficient in the dynamic adaptability of the model. The existing stream computing engines mainly rely on fixed computing rules and model structures, and are difficult to quickly adjust to meet the rapidly changing industrial needs. Especially when dealing with large-scale data, the bottlenecks of efficiency and performance 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 requirements of rapid response and dynamic decision-making in modern industrial production. Therefore, how to improve the adaptability, real-time performance, and accuracy of industrial mechanism models through a more flexible and efficient model construction method, combined with advanced stream computing engines and visualization display technology, has become a difficult problem in the current technology. Summary of the Invention
[0004] In view of the above problems, the present invention is proposed.
[0005] Therefore, the technical problem to be solved by the present invention is as follows: the existing industrial mechanism modeling technology methods have poor adaptability, insufficient dynamic adaptability in data calculation, low efficiency in storing and displaying result data, and the problem of establishing an efficient dynamic integration mechanism between the industrial mechanism model and the streaming computing engine to improve the real-time computing ability and result display efficiency of the system.
[0006] To solve the above technical problems, the present invention provides the following technical solutions: an industrial mechanism model building and real-time calculation method, including building an industrial mechanism model based on a DAG model and submitting the DAG model structure data to a streaming computing engine; the streaming computing engine uses a rule engine to parse and generate an execution sequence and trigger the execution; the execution result is stored through a data gateway and visually displayed; triggering the execution includes generating a corresponding calculation rule packet according to the rule definition, and the rule engine parses the rule definition and the DAG structure according to the incoming calculation rule packet, generates a unified execution sequence from the parsing result, and triggers the execution of all nodes in sequence according to the sequence order. The rule engine synchronously pushes the calculation result to the data gateway and the front end of the model canvas; triggering the execution includes rhythm control of all rule calculations through a calculation controller, specifying a trigger rule check per second, checking whether each rule reaches 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 can execute the next cycle of calculation after inspection, trigger the rule packet to call the rule engine to execute the calculation, and add a lock control to the current rule, and wait for the next cycle of execution to check whether it is unlocked; according to the requirements of different services, modularly parse and process the service application and output it to different service data event streams.
[0007] As a preferred solution of the industrial mechanism model building and real-time calculation method described in the present invention, wherein: 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, configures the rules in the calculation process through the rule definition. Each rule is uniquely identified by a ruleId and the handler field specifies the processing operation of the rule. Each node is identified by a nodeId, and the node includes input items and sub-nodes. The input items use 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: submitting the DAG model structure data to the streaming computing engine includes that the DAG engine receives the DAG model structure data generated by the canvas engine and pushes it to the DAG parser in the Flink streaming computing engine job through Kafka to generate a complete topological structure. The DAG structure data after parsing is stored in a third-party cache.
[0009] As a preferred solution of the industrial mechanism model construction and real-time calculation method described in the present invention, wherein: the trigger execution includes generating corresponding calculation rule packets according to rule definitions, including rule identifiers and multiple input data items, and each input data item includes a tag name, a tag value, and a timestamp. The input data items are sorted out through the calculation rule packets and submitted to the rule engine for calculation.
[0010] According to the incoming calculation rule packets, the rule engine parses the rule definitions and the DAG structure into a unified execution sequence, executes all nodes in the order of the execution sequence, and after all nodes are executed, the rule engine synchronously pushes the calculation result data to the data gateway and the front end of the model canvas.
[0011] As a preferred solution of the industrial mechanism model construction and real-time calculation method described in the present invention, wherein: the trigger execution further includes rhythm control of all rule calculations through a calculation controller, specifying a cycle to trigger rule checks per second, checking whether each rule reaches 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 execute the next cycle of calculation, it triggers the rule packet to call the rule engine to execute the calculation, and adds a lock control to the current rule, and waits to check whether it is unlocked in the next cycle.
[0013] According to the requirements of different services, modular analysis and processing of business applications are carried out and output to different business data event streams.
[0014] As a preferred solution of the industrial mechanism model construction and real-time calculation method described in the present invention, wherein: 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 passed through kafka and then persistently stored in the historical data warehouse using influxdb.
[0015] As a preferred solution of the industrial mechanism model construction and real-time calculation method described in the present invention, wherein: the visualization display includes that after the front end of the model canvas receives the data, it visually displays the calculation results of each node of the model, and the display content includes the node ID, node status, execution result, and 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 conditions.
[0016] Another object of the present invention is to provide an industrial mechanism model construction and real-time calculation system, which can use a rule engine to parse and generate an execution sequence through a stream calculation engine and trigger execution, solving the problems of rigid execution paths and inflexible scheduling in the current industrial mechanism model calculation technology.
[0017] As a preferred solution of the industrial mechanism model building and real-time calculation 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 to form the 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 check and trigger module. The parsing module is used to generate a calculation rule packet according to rule definitions. The rule engine parses the rules and the DAG structure, generates an execution sequence and triggers task execution. The rule check and trigger module is used to control the rhythm of all rule calculations through a calculation controller, regularly check whether the rules meet the execution conditions. If the conditions are met, trigger the calculation and execute the lock control, parse the modular business application requirements, 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 to write the back-written data into a specified real-time database after the data gateway receives the result data pushed by the rule engine. The historical calculation data is persisted and stored in a historical data warehouse using InfluxDB after being transmitted through Kafka. The result display module is used to visually display the calculation results of each node of the model after the model canvas front-end receives the data. The display content includes the node ID, node status, execution result, and execution time, and supports dynamic refresh and interactive operations. According to the task execution status and system load conditions, dynamically adjust the execution strategy of subsequent tasks.
[0018] A computer device includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the industrial mechanism model building and real-time calculation method.
[0019] A computer-readable storage medium stores a computer program thereon. When the computer program is executed by a processor, it implements the steps of the industrial mechanism model building and real-time calculation method.
[0020] Advantages of the present invention: The industrial mechanism model construction and real-time calculation method provided by the present invention constructs an industrial mechanism model based on a DAG model, submits the DAG model structure data to a stream computing engine, reduces the complexity and error probability in traditional modeling methods, makes the construction of the industrial mechanism model more efficient and accurate, provides a clear execution path for subsequent real-time calculation and data flow, the stream computing engine uses a rule engine to parse and generate an execution sequence and trigger the execution, effectively improving the utilization rate of computing resources and the flexibility of task execution, reducing the need for manual intervention, storing the execution results through a data gateway and performing visual display, improving the real-time performance and manageability of operations, 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 calculation, and visualization and efficiency of data storage and display. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other accompanying drawings can be obtained based on these drawings without creative efforts.
[0022] Figure 1 It is the overall flowchart of the industrial mechanism model construction and real-time calculation method provided by the first embodiment of the present invention.
[0023] Figure 2 It is the real-time calculation flowchart of the industrial mechanism model construction and real-time calculation method provided by the second embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0024] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following will provide a detailed description of the specific embodiments of the present invention in conjunction with the accompanying drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of the present invention.
[0025] Embodiment 1, referring to Figure 1 This is an embodiment of the present invention, providing an industrial mechanism model construction and real-time calculation method, including:
[0026] S1: Construct an industrial mechanism model based on a DAG model, and submit the DAG model structure data to a stream computing engine.
[0027] Furthermore, 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. Rule definitions generate an execution sequence based on the topological paths of the DAG structure, and rule configurations in the calculation process are performed through rule definitions. Each rule is uniquely identified by a ruleId and the handling operation of the rule is specified by the handler field. Each node is identified by a nodeId, and the node includes input items and child nodes. The input items use default_in to specify the remaining nodes and parameters.
[0028] It should be noted that submitting the DAG model structure data to the stream computing engine includes that 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 topological structure. The DAG structure data after parsing is stored in a third-party cache.
[0029] It should also be noted that a preferred solution for generating a complete topological structure through the DAG engine specifically includes that the DAG engine generates the topological structure based on the topological sorting directed acyclic graph (DAG) algorithm, performs topological sorting, and arranges the nodes in the graph according to the dependency relationship, expressed as:
[0030] ;
[0031] Among them, is the vertex set in the DAG (directed acyclic graph), is the set of directed edges, represents the DAG model composed of the vertex and the edge , which defines the overall structure of the model and the execution path of the task.
[0032] Define the topological sorting function, expressed as:
[0033] ;
[0034] Among them, represents the topological sorting function, represents the vertex set in the DAG (directed acyclic graph), , represents the topological serial number of the node , represents the topological serial number of the node , and for each edge it holds, represents the edge set of the directed edges.
[0035] 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.
[0036] 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.
[0037] S2: The stream computing engine uses the rule engine to parse and generate the execution sequence and trigger the execution.
[0038] 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.
[0039] The rule engine wraps the incoming calculation rule packets, parses the rule definitions and DAG structures into a unified execution sequence, 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 front end of the model canvas.
[0040] It should be noted that triggering execution also includes rhythm control of all rule calculations through a calculation controller, specifying a trigger rule check per second, and checking whether each rule has reached the next calculation cycle, whether the previous cycle of the rule has been completed, and whether the rule has exceeded the set execution timeout event.
[0041] When the rule passes the check and can execute the next cycle of calculation, it triggers the rule packet to call the rule engine to execute the calculation, and adds a lock control to the current rule, and waits to check whether it is unlocked in the next cycle.
[0042] According to the requirements of different services, modular parsing and processing of service applications are performed and output to different service data event streams.
[0043] 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 front end of the model canvas.
[0044] The calculation controller includes triggering a rule check per second at a specified cycle, including whether each rule has reached the next calculation cycle, whether the previous cycle of the rule has been completed, or whether the rule has exceeded the set execution timeout event.
[0045] When the rule passes the check and can execute the next cycle of calculation, it triggers the rule packet to call the rule engine to execute the calculation, and adds a lock control to the current rule, and waits to check whether it is unlocked in the next cycle; parses the output of the rule engine, and according to the modular service application parsing requirements of different service needs, outputs to different service data event streams.
[0046] It should also be noted that a preferred solution for generating corresponding calculation rule packets specifically includes, after the packet is generated, first performing integrity checks on the tag name, tag value, and timestamp. At the same time, a verification identifier and a processing priority field can be added to the packet to ensure dynamic adjustment of the execution order of nodes 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 nodes before each node execution (such as whether the previous nodes have been executed, whether the input data is complete, etc.). For nodes that do not meet the execution conditions, a suspension mechanism is added, and execution is automatically triggered after the conditions are met; a parallel processing mechanism is added during the rule execution, allowing dynamic splitting of execution tasks according to the dependency relationships and rule priorities of different nodes to improve the overall execution efficiency.
[0047] It should also be noted that a preferred solution for the rhythm control of all rule calculations by the calculation controller specifically includes that the calculation controller needs to set a maximum timeout period and a retry mechanism during execution. For rule packets that have not responded for a long time or execution tasks that have timed out, an interruption is triggered and a log is recorded to avoid execution blocking.
[0048] It should also be noted that by using a rule engine to parse and generate an execution sequence through a stream computing engine and triggering the execution, dynamic scheduling and real-time execution of tasks can be achieved. The rule engine generates an execution sequence based on rule packets (including tag names, tag values, timestamps, etc.) and parses them according to the priority and path dependency relationships; when there are rule conflicts or execution failures, the system preferentially executes high-priority rules through an arbitration mechanism and adjusts the execution order through a path reconstruction and packet rollback mechanism to ensure task integrity; through rhythm control, the system dynamically adjusts the execution cycle according to the task complexity and load conditions to improve the task execution efficiency and solve the execution blocking problem caused by resource competition and conflicts in traditional task execution.
[0049] S3: Store the execution result through the data gateway and perform visual display.
[0050] Furthermore, the storage of the execution result 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 passed through Kafka (message middleware) and then persistently stored in the historical data warehouse using InfluxDB.
[0051] It should also be noted that the visual display includes that after the front end of the model canvas receives the data, it visually displays the calculation results of each node of the model. The display content includes node ID, node status, execution result, and execution time, and supports dynamic refresh and interactive operations. According to the task execution status and system load conditions, the execution strategy of subsequent tasks is dynamically adjusted.
[0052] It should also be noted that a preferred solution for the storage and display of the result data specifically includes that after the data gateway receives the real-time stream computing 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 result, node output value, etc.). The system verifies the tag structure before data write-back to ensure consistency with the model structure. When the data is written into the real-time database, an index is built based on the tag, and it is stored according to the tag and timestamp in a batch processing or stream processing manner to improve the query efficiency. Kafka transmits the calculation result to the specified topic, and the data consumer listens to this topic and stores the data in InfluxDB, and a multi-level index is established to support fast query.
[0053] It should also be noted that a preferred solution for the display of result data specifically includes that after the front end of the model canvas receives the result data, it actively pushes it to the front-end interface through WebSocket communication, triggers dynamic refresh, and adjusts the display content according to the hierarchical relationship of nodes and edges in the DAG structure, displaying the node ID, node type, input items, output values, and execution status. The display interface uses different colors or icons for identification according to the node status (such as in execution, completed, abnormal, etc.), and supports zooming and dragging operations to help users quickly locate and monitor the data status.
[0054] It should also be noted that storing the execution results through the data gateway and performing visual display can achieve real-time monitoring and dynamic adjustment of the task execution status, generate a unique index according to the tag name and timestamp, and store the data in the real-time database or 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 the task fails or conflicts, the system can quickly repair through the alarm prompt and path reconstruction mechanism. Combining historical data, the system supports trend analysis and anomaly detection to ensure the stability of task execution and the system response ability in complex environments.
[0055] Example 2, referring to Figure 2 , which is an embodiment of the present invention, provides an industrial mechanism model construction 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.
[0056] First, model through the Figure 2 canvas engine in to generate DAG model structure data, define nodes, edges, and paths to 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, and the node includes input items and sub-nodes. The input items use default_in to specify the remaining nodes and parameters; after the configuration is completed, as Figure 2As shown in the figure, the Flink streaming computing engine is adopted to perform dynamic parsing and execution in combination with rule definitions and data streams: The DAG engine receives the DAG model structure data generated by the canvas engine and pushes it to the DAG parser in the Flink streaming computing engine job through Kafka; The DAG engine generates a complete topological structure through topological sorting, and the topological sorting includes steps such as calculating the in-degree, removing nodes, and updating the graph structure to ensure successful sorting and no loops; In the streaming computing engine, the rule engine generates an execution sequence according to the incoming rule packet (including tag name, tag value, 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 rules, the system dynamically adjusts the execution order according to the priority field in the packet; For cases 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 within each second cycle, and triggers an interruption and retry when a timeout or failed task is found; As Figure 2 shown in the figure, after the task execution is completed, the rule engine pushes the calculation result 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 the historical data warehouse (InfluxDB) respectively; The front end of the model canvas actively pushes the result through WebSocket communication, triggering dynamic refresh, and displaying the node ID, node status, execution result, and execution time; Users can dynamically adjust the node order and path through the interface, and the system regenerates the topological structure and updates the execution sequence according to the adjusted structure. Refer to Table 1 to record and analyze the experimental data.
[0057] Table 1 Experimental Data Record Table
[0058] Test subject Label name Label value Timestamp Input integrity Priority Execution status Node A Label 1 12.5 2025 / 3 / 1 10:00 TRUE 1 Success Node B Label 2 15 2025 / 3 / 1 10:05 TRUE 2 Success Node C Label 3 18.2 2025 / 3 / 1 10:10 FALSE 3 Suspended Node D Label 4 20.3 2025 / 3 / 1 10:15 TRUE 1 Success Node E Label 5 22.1 2025 / 3 / 1 10:20 FALSE 2 Suspended Node F Label 6 19.7 2025 / 3 / 1 10:25 TRUE 3 Success
[0059] It can be seen from the experimental data that under different task execution conditions, the DAG model and the rule engine can dynamically adapt to complex execution environments. First of all, from the experimental data, it can be seen that nodes A, B, D, and F have all been successfully executed in the topological sorting, indicating that the system has stability and adaptability in terms of input integrity and path optimization. Nodes C and E, due to incomplete input, triggered a suspension mechanism during the system execution and will be executed after the input data is complete. In terms of priority parsing, nodes A and D have the highest priority (level 1), so they are preferentially executed in case of task conflicts. 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 tasks with higher priorities are executed first. For nodes C and E, due to the lack of input data, the system triggers a path reconstruction mechanism and will process them after the complete data is input to avoid execution failures. In terms of execution status monitoring, during the task execution, the rule engine dynamically monitors the task execution progress and completes the interruption and recovery of the task within the timeout period, ensuring the integrity and stability of the task execution. Through Kafka as the data middleware, the system realizes the efficient transmission of rule packets and execution results, ensuring the real-time performance and concurrency of task scheduling in complex industrial environments.
[0060] Compared with the prior art, the present invention generates a topological structure through the DAG model, combines the data transmission and rule parsing of Kafka and Flink, ensuring the efficient execution and dynamic scheduling capabilities of tasks in complex dependency environments. At the same time, through dynamic path reconstruction, packet rollback, and rhythm control, the system solves the problems of task interruption and failure caused by path conflicts and incomplete input in traditional solutions, and has stability and adaptability.
[0061] Embodiment 3, which is an embodiment of the present invention, 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.
[0062] Among them, S4: The model building module includes an industrial mechanism model building module and a structural data submission module. The industrial mechanism model building module generates a DAG model structure through a canvas engine, defines nodes, edges, and paths to form 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 to generate a complete topological structure and store it in a third-party cache.
[0063] 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 items and output items are configured to clarify the dependency relationships between nodes; subsequently, the structure data submission module pushes the generated DAG model structure data to the DAG parser in the Flink streaming computing engine through Kafka. The DAG parser generates a complete execution sequence according to the topological sorting algorithm, and stores the parsed DAG structure in a third-party cache for the rule engine to call during execution.
[0064] The model building module generates a DAG model structure through the canvas engine, defines nodes, edges, and paths to generate a complete topological structure. The generated DAG structure data is pushed to the DAG parser in the Flink streaming computing engine through Kafka to generate an execution path and store it in a third-party cache. The execution trigger module generates an execution sequence based on the parsing result, and the rule engine triggers task execution in combination with the DAG structure to ensure that tasks are carried out in an orderly manner according to the topological relationship. The generation of the DAG structure and path definition directly determine the order of the execution sequence generated by the rule engine 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.
[0065] S5: The execution trigger module 200 includes a parsing module and a rule check trigger module. The parsing module is used to generate a calculation rule packet according to the rule definition. The rule engine parses the rules and the DAG structure, generates an execution sequence and triggers task execution. The rule check 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, parse the modular business application requirements, and output to different business data event streams.
[0066] 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 corresponding calculation rule packets according to the rule definition. The packets include information such as the identifier (ruleId) of the rule, the tag name, the tag value, and the timestamp. When the rule engine parses the packets, it generates a unified execution sequence in combination with the DAG structure; the rule check trigger module triggers rule checks regularly (such as every second) through the calculation controller to determine whether each rule meets the execution conditions, including the integrity of the input data, the execution status of the previous nodes, etc.; if the execution conditions are met, the rule packet 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 parsing according to different business requirements and output the execution results to different business data event streams.
[0067] In the execution trigger module, the rule engine executes tasks according to the generated execution sequence. After the task execution is completed, the rule engine transmits the execution result to the data gateway through Kafka. The data gateway classifies the result data according to information such as the tag name and the timestamp, and stores it in the real-time database or the historical database (InfluxDB) respectively; after the storage is completed, the result storage module in the storage display module indexes the data to support fast query. At the same time, the result display module actively pushes the execution result to the front-end model canvas through WebSocket communication. The front-end model canvas displays the execution status, result, and path between nodes of the task. Users can view the execution details through the interface and dynamically adjust the task path according to the execution result; 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 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".
[0068] S6: The storage display module includes a result storage module and a result display module. The result storage module is used to write the back-written data into the specified real-time database after the data gateway receives the result data pushed by the rule engine. The historical calculation data is persistently stored in the historical data warehouse using InfluxDB after being transmitted through Kafka. The result display module is used to visually display the calculation results of each node of the model after the front-end of the model canvas receives the data. The display content includes the node ID, node status, execution result, and execution time, and supports dynamic refresh and interactive operations. According to the task execution status and system load conditions, the execution strategy of subsequent tasks is dynamically adjusted.
[0069] It should be noted that after the task execution is completed, the system further links to the storage and display module. The result storage module is responsible for receiving the result data pushed by the rule engine, and classifying and storing the result data into the specified real-time database according to the tag name, timestamp, and data type. After the historical calculation data is transmitted through Kafka, it is stored in the InfluxDB persistent database, and an index is established to support fast query. After receiving the data, the result display module pushes the data to the front end of the model canvas through WebSocket communication for visual display. The display content includes the node ID, node status (such as in execution, completed, failed, etc.), execution result, and execution time. Users can perform interactive operations through the canvas interface, supporting dynamic refresh, zooming, 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 nature of the overall execution.
[0070] In the storage and 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 the generation of a new path and the update of the execution sequence. The updated execution sequence will automatically act on the rule engine in the execution trigger module, triggering the parsing of the new task path 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 packet. The adjustment of the execution path and rule configuration by users in the storage and display module directly triggers the re-modeling of the model building module and the dynamic scheduling of the execution trigger module, forming an "adjustment-modeling-execution" adaptive linkage mechanism.
[0071] If a 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, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in various embodiments of the present invention. The aforementioned storage medium includes: USB flash drive, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk, or optical disc, etc., which can store program codes.
[0072] The logic and / or steps represented in the flowchart or otherwise described herein can, for example, be considered a definitional sequence of executable instructions for implementing logical functions, which can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, a system including a processor, or other systems that can fetch and execute instructions from the instruction execution system, apparatus, or device. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by or in connection with the instruction execution system, apparatus, or device.
[0073] More specific examples (a non-exhaustive list) of the computer-readable medium include the following: an electrical connection part (electronic device) having one or more wirings, a portable computer diskette case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium can even be paper or other suitable media on which a program can be printed, as the program can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpretation, or other appropriate processing as necessary, and then stored in a computer memory.
[0074] It should be understood that various parts of the present invention can be implemented by hardware, software, firmware, or a combination thereof. In the above-described 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 in hardware, as in another embodiment, any one or a combination of the following techniques known in the art can be used: discrete logic circuits having logic gate circuits for implementing logical functions on data signals, application-specific integrated circuits having appropriate combinational logic gate circuits, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc. It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention, and they should all be covered by the scope of the claims of the present invention.
[0075] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention, and they should all be covered by 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. 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 according to the incoming calculation rule package, and executes all nodes in the order of the execution sequence. After all nodes are executed, the rule engine pushes the calculation result data to the data gateway and the model canvas front end synchronously; Triggering execution also 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 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.
5. The industrial mechanism model building and real-time calculation method according to any one of claims 1, 2 or 4, 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.
6. 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, 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. 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 according to the incoming calculation rule package, and executes all nodes in the order of the execution sequence. After all nodes are executed, the rule engine pushes the calculation result data to the data gateway and the model canvas front end synchronously; Trigger 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.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the industrial mechanism model building and real-time calculation method described in any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the industrial mechanism model building and real-time calculation method described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Visual programming method and system based on Flink
CN115617326A
Server-free workflow engine implementation method based on event arrangement
CN119377049A
Data processing task execution method and device, storage medium and equipment
CN119718568A