A multi-process nested concurrent industrial control method based on finite state machines

CN122151795BActive Publication Date: 2026-09-01NAVAL UNIV OF ENG PLA
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202610621603.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-05-08
Publication Date
2026-09-01
Estimated Expiration
2046-05-08

AI Technical Summary

Technical Problem

传统的流程控制方案多采用单一的串行执行机制

Benefits of technology

(1)顶层流程级状态机负责全局调度和状态流转,底层步骤级状态机负责具体动作的精细控制与状态反馈。两者通过状态信息进行交互,使得系统能够并发处理多个流程,同时严格按照嵌套逻辑执行各个步骤,从而实现工业控制场景下的多流程嵌套并发,提升了系统的处理效率和控制精度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122151795B_ABST
    Figure CN122151795B_ABST
Patent Text Reader

Abstract

This application belongs to the field of industrial automation control technology, specifically disclosing a multi-process nested concurrent industrial control method based on finite state machines. The method includes: acquiring multiple industrial control processes and configuring corresponding top-level process-level state machines for each industrial control process; managing the state of the corresponding industrial control process based on each top-level process-level state machine; configuring corresponding bottom-level step-level state machines for each industrial control step in the industrial control process; managing the state of the corresponding industrial control step based on the bottom-level step-level state machines; and controlling the bottom-level step-level state machines or switching the state of the industrial control process based on the state information fed back by the bottom-level step-level state machines corresponding to each industrial control step in the industrial control process, through the corresponding top-level process-level state machine. This application enables multi-process nested concurrency in industrial control scenarios, improving processing efficiency and control accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of industrial automation control technology, and more specifically, relates to an industrial control method based on a multi-process nested concurrency of finite state machines. Background Technology

[0002] With the continuous development of industrial automation technology, industrial control systems play a crucial role in modern manufacturing, chemical production, and intelligent warehousing. To improve production efficiency and system throughput, industrial control equipment typically needs to handle multiple complex business processes simultaneously. Traditional process control solutions often employ a single, serial execution mechanism.

[0003] However, in complex industrial scenarios, business logic often exhibits multi-layered and tightly coupled characteristics. A single main control process frequently contains multiple nested sub-processes, and strict timing dependencies and competition for underlying hardware resources exist between processes at different levels. When a system attempts to concurrently execute these nested processes, existing control architectures struggle to effectively coordinate context switching and dynamic resource allocation across different levels, easily leading to process deadlocks, instruction response delays, and low overall system resource utilization. Existing task scheduling mechanisms generally lack concurrency optimization for multi-layered nested structures, failing to meet the high processing efficiency and control precision requirements of modern industrial control. Therefore, achieving multi-process nested concurrency in industrial control scenarios is a pressing technical problem that needs to be solved in this field. Summary of the Invention

[0004] In view of the shortcomings of the existing technology, the purpose of this application is to realize multi-process nesting and concurrency in industrial control scenarios.

[0005] To achieve the above objectives, in a first aspect, this application provides an industrial control method based on a finite state machine with nested multi-process concurrency, comprising: Acquire multiple industrial control processes and configure corresponding top-level process state machines for each industrial control process; Based on each top-level process state machine, the state of the corresponding industrial control process is managed; Configure corresponding underlying step-level state machines for each industrial control step in the industrial control process; Based on a low-level step-level state machine, the state of the corresponding industrial control step is managed; When the industrial control process is in operation, based on the state information fed back by the underlying step-level state machine corresponding to each industrial control step in the industrial control process, the underlying step-level state machine is controlled or the state of the industrial control process is switched through the corresponding top-level process-level state machine. Among them, the top-level process-level state machine and the bottom-level step-level state machine are finite state machines; an industrial control process contains multiple nested industrial control steps.

[0006] This section provides an illustrative example of the aforementioned nested concurrency of multiple processes. An industrial control process serves as the parent task, containing multiple industrial control steps arranged in a specific order as child tasks, forming a nested relationship between processes and steps. Within the same time period, multiple independent industrial control processes can be running simultaneously, forming a concurrency relationship between processes. The initiation or execution of some industrial control processes depends on the execution results or status data of other industrial control processes, forming a dependency relationship between processes. When multiple industrial control processes need to access the same shared resource or have logical mutual exclusion, a state machine mechanism ensures that only one process can execute a specific operation at any given time, forming an interlocking relationship between processes.

[0007] The above-mentioned industrial control processes are illustrated here. These processes include material handling, equipment heating, and product testing, each responsible for a different stage of industrial production.

[0008] The industrial control steps in the above-mentioned industrial control process are illustrated by example. For example, the industrial control steps included in the material handling process include starting the conveyor belt, detecting the arrival of materials, the robotic arm grabbing the materials, and the robotic arm placing the materials.

[0009] This section provides an illustrative example of the process of controlling the underlying step-level state machine or switching the state of the industrial control process. When the underlying step-level state machine reports a state that the step has been completed normally, the top-level process-level state machine controls the start of the next underlying step-level state machine. When the underlying step-level state machine reports a state that an error has occurred during the step, the top-level process-level state machine switches the state of the industrial control process from the running state to the error handling state.

[0010] Understandably, the above method, by introducing a two-tier architecture of a top-level process-level state machine and a bottom-level step-level state machine, decomposes complex industrial control tasks into macro-level process management and micro-level step execution. The top-level process-level state machine is responsible for global scheduling and state transitions, while the bottom-level step-level state machine is responsible for fine-grained control of specific actions and state feedback. The two interact through state information, enabling the system to process multiple processes concurrently while strictly executing each step according to nested logic. This achieves multi-process nested concurrency in industrial control scenarios, improving system processing efficiency and control accuracy.

[0011] In one possible implementation, the above-mentioned management of the state of the corresponding industrial control process is based on various top-level process state machines, including: When an industrial control process is started, it is in the initialization state. In the initialization state, based on the number of industrial control steps contained in the industrial control process, the same number of step structures are initialized. The step structures are used to record the state information fed back by the underlying step-level state machine. Then, it enters the running waiting state. In the running waiting state, it is determined whether all preset preconditions are met. If it is determined that all preset preconditions are met, then it enters the running state. In the running state, the industrial control steps included in the industrial control process are executed. Based on the state information fed back by the underlying step-level state machine, it is determined whether an error has occurred during the execution of the industrial control steps. If an error is determined, the process enters the error handling state or the error completion state. If it is determined that the industrial control steps included in the industrial control process have not been completed and no error has occurred during the execution of the industrial control steps, the industrial control steps corresponding to each underlying step-level state machine are continuously executed based on the sequence of underlying step-level state machines. When the industrial control steps corresponding to the previous underlying step-level state machine are completed, the execution of the industrial control steps corresponding to the next underlying step-level state machine is started. If it is determined that the industrial control steps included in the industrial control process have been completed and no error has occurred during the execution of the industrial control steps, the process enters the completion state. In the completion state, information indicating the completion of all industrial control processes is output, and then the process enters the cleanup state. In the error handling state, user input is received; if the user input indicates a retry or forced execution, the process enters the running state and provides the user's instruction to the lower-level step-level state machine; if the user input indicates that the skipped and erroneous industrial control step is not the last step of the industrial control process, the process enters the running state and provides the user's instruction to the lower-level step-level state machine; if the user input indicates that the skipped and erroneous industrial control step is the last step of the industrial control process, the process enters the completion state and provides the user's instruction to the lower-level step-level state machine; if the user input indicates abort, the process enters the error completion state and provides the user's instruction to the lower-level step-level state machine. In the error completion state, the error information of the industrial control process is output, and then the cleanup state is entered. When an error occurs in the process of the industrial control step, the error information can be extracted from the state information fed back by the corresponding underlying step-level state machine. In the cleanup state, the current top-level process state machine is removed from the process queue, which is used to store the top-level process state machines corresponding to the industrial control processes being executed.

[0012] For example, retry means controlling the lower-level step-level state machine to return to the initialization state to re-execute the industrial control step that has encountered an error. Force execution means ignoring the current error state and controlling the lower-level step-level state machine to directly enter the execution state to continue executing the current industrial control step. Skip means abandoning the execution of the current industrial control step that has encountered an error and controlling the lower-level step-level state machine to directly enter the completion state to trigger the top-level process-level state machine to execute the next industrial control step.

[0013] This section explains the aforementioned sequence of underlying step-level state machines. The sequence of underlying step-level state machines describes the execution order and serial or parallel relationship of a set of underlying step-level state machines contained in an industrial control process. The top-level process-level state machine strictly triggers the corresponding underlying step-level state machines in sequence according to the scheduling order determined by this sequence during the running state.

[0014] Understandably, the state transition process of the aforementioned top-level process-level state machine achieves closed-loop management of the entire lifecycle of the industrial control process by defining seven core states: initialization state, running and waiting state, running state, completion state, error handling state, error completion state, and cleanup state. It dynamically adjusts the macro-process direction based on feedback from the lower-level step-level state machine and provides various manual intervention strategies in case of anomalies. This approach clearly defines each execution stage of the process, improves the reliability of process scheduling, and endows the system with fault tolerance and flexible anomaly recovery capabilities when facing sudden failures in complex industrial environments.

[0015] In one possible implementation, the above-mentioned management of the state of the corresponding industrial control step, based on a low-level step-level state machine, includes: When the industrial control step is started, the industrial control step is in the initialization state. In the initialization state, it is determined whether the industrial control step is configured with a delay. If so, it enters the delay state; otherwise, it enters the judgment skip state. In the delayed state, the waiting is performed in a non-blocking manner until the waiting time is reached; In the skip state, it is determined whether the preset skip condition is met. If so, it enters the normal termination state; otherwise, it enters the execution state. In the execution state, it is determined whether the preset execution preconditions are met. If so, it enters the execution state; otherwise, it enters the error handling state. In the execution state, the industrial control steps are initiated and then the judgment completion state is entered. In the completion state, it is determined whether the preset completion conditions are met. If the preset completion conditions are met within the preset time (no timeout), the system enters the completion state. If the preset completion conditions are not met within the preset time (timeout), the system enters the error handling state. In the completion state, information indicating the completion of the industrial control step is output, and then the process enters the normal termination state. In the normal termination state, a message indicating successful execution of the industrial control step is fed back to the top-level process state machine; In the error handling state, it receives user instructions from the top-level process state machine; if the user indicates a retry, it enters the initialization state; if the user indicates forced execution, it enters the execution state; if the user indicates skipping, it enters the completion state; if the user input indicates abort, it enters the error completion state. In the error completion state, the error information of the industrial control step is output, and then the error termination state is entered. In the error termination state, a message indicating that the industrial control step was not successfully executed is fed back to the top-level process state machine.

[0016] Specifically, the state transition process of the aforementioned underlying step-level state machine achieves precise control over a single industrial control action by refining the various micro-states during the step execution process. The steps are broken down into initialization, delay, skip judgment, execute judgment, execute, complete judgment, completion, and various error handling states. Strict condition checks and logical processing are performed at each state node to ensure that a success signal is output only when all preconditions are met and no timeout occurs; otherwise, the error handling mechanism is triggered promptly.

[0017] Understandably, the top-level process-level state machine and the bottom-level step-level state machine work closely together through the state information (i.e., step return values) fed back by the bottom-level step-level state machine. After each run, the bottom-level step-level state machine feeds back the execution result to the top-level process-level state machine, which then decides whether to continue executing the next step, switch to an error handling state, or terminate the process. This cooperation decouples the control logic, ensuring that macro-level process scheduling and micro-level action execution do not interfere with each other. This guarantees the orderly progress of complex business processes while ensuring the safe and reliable operation of underlying equipment, effectively enhancing the maintainability and scalability of the industrial control system.

[0018] It is worth noting that during the execution of industrial control processes, combining "determining whether the industrial control step is configured with a delay," "determining whether the preset skip condition is met," and "determining whether the preset completion condition is met" can achieve dynamic interlocking between currently executing processes, avoiding conflicts. Specifically, delay determination can stagger the concurrent access time of different processes to the same device; skip condition determination can dynamically avoid invalid or conflicting actions based on the status of external devices; and completion condition determination can continuously monitor the action execution results within a set time, ensuring that resources are released or subsequent actions are triggered only after the preceding actions are completely completed, thereby effectively preventing logical conflicts and equipment malfunctions in a multi-process concurrent environment.

[0019] One possible implementation also includes: Before adding the top-level process state machine to the process queue, state machine execution conflict detection is performed to avoid adding two or more top-level process state machines with opposite business processes to the process queue at the same time.

[0020] Understandably, before the top-level process-level state machine officially enters the execution queue, the system pre-analyzes its business logic identifier and the logical relationship with existing state machines in the queue, intercepting state machines with mutually exclusive logic. This effectively resolves execution conflicts that may arise when multiple state machines run simultaneously, preventing the system from falling into logical deadlock or issuing contradictory control commands, thus ensuring the stable operation of the industrial control system.

[0021] For example, the specific implementation of conflict detection in the state machine is as follows: a mutual exclusion rule base for business processes is established in advance. When attempting to add a top-level process-level state machine that controls the opening of a valve to the process queue, the system queries the rule base and traverses the current process queue. If it finds that a top-level process-level state machine that controls the closing of the same valve already exists in the queue, it is determined that the business processes are completely opposite, and the state machine that opens the valve is refused to be added to the queue, and a conflict alarm message is output.

[0022] One possible implementation also includes: When the underlying step-level state machine accesses a shared resource, it first checks whether the shared resource's occupancy flag is occupied by the resource lock. When the occupancy flag is "occupied," the underlying step-level state machine transitions to the error handling state; after the error handling mechanism is triggered, the resource conflict is resolved through manual intervention. If the occupancy flag is not in use, set the occupancy flag to in use and then obtain the shared resource.

[0023] Specifically, a unique occupancy identifier is assigned to each shared resource in the system. The underlying step-level state machine checks and obtains this identifier before executing an action, forming an exclusive access mechanism. This effectively solves the problem of multiple state machines competing for shared resources when executing concurrently, prevents data overwriting or device instruction confusion, and ensures that shared resources are safely and exclusively used by a single step at any given time.

[0024] One possible implementation also includes the transition process between state machines when multiple state machines are running simultaneously: After allocating CPU time slices, check whether all top-level process-level state machines have been executed. If not all processes are completed, retrieve an unprocessed top-level process state machine node and load the corresponding top-level process state machine. Determine whether the current state of the loaded top-level process state machine is in the running state; If the current state is running, the corresponding underlying step-level state machine is loaded and executed; if an error occurs during the execution of the underlying step-level state machine, the top-level process-level state machine enters the error handling state and waits for the next CPU time slice allocation; if no error occurs during the execution of the underlying step-level state machine, it directly waits for the next CPU time slice allocation. If the current state is not in the running state, the business logic corresponding to the state (non-running state) of the top-level process-level state machine is executed; if a state change occurs, the state change is performed and the state data of the top-level process-level state machine is saved, and then the machine waits for the next CPU time slice allocation; if no state change occurs, the state data of the top-level process-level state machine is saved and the machine waits for the next CPU time slice allocation.

[0025] Understandably, by utilizing the CPU time-slice round-robin mechanism, the state machine management object traverses the top-level process-level state machine queue within each time slice. Based on the current state of each top-level process-level state machine, it decides whether to proceed to execute its underlying step-level state machine or handle the top-level state transition logic. After processing, it saves the state data to relinquish CPU control. This enables concurrent processing of multiple state machines, ensuring that each industrial control process has an execution opportunity and preventing a single time-consuming process from blocking the entire system.

[0026] In one possible implementation, when an exception occurs during the execution of the underlying step-level state machine, the steps for handling the exception through manual intervention include: Obtain the error description context from the error source and send the error description context to the error management object; The error description context is added to the mapping table through the error management object, and the error display form is notified that new error information has arrived. Display errors and pop up an error display box by adding display items to the error display form; Obtain the user's error handling strategy and settings through the error display form, and remove the corresponding display items; Send the unique error identifier and error handling strategy to the error handling object through the error display form; The error handling object distributes error handling information to the error management object and removes that information; The error handling object performs retry, abort, skip, or force execution based on the error handling policy entered by the user.

[0027] Understandably, when the underlying step-level state machine detects an exception, it passes an error description context containing the execution environment and parameters to the error display window, suspends the automated execution process, and awaits user decision. Subsequently, it drives the error handling object to perform corresponding recovery actions based on the user-issued policy instructions. This combination of unattended automatic control and necessary human decision-making ensures that the system does not completely collapse when encountering complex faults that cannot be automatically recovered from, but rather provides flexible intervention methods, effectively reducing the impact of faults on industrial production.

[0028] Secondly, this application provides an industrial control device based on a finite state machine with multiple nested concurrent processes, comprising: The top-level process-level state machine configuration module is used to acquire multiple industrial control processes and configure the corresponding top-level process-level state machine for each industrial control process. The first management module is used to manage the state of the corresponding industrial control process based on the top-level process state machines; The underlying step-level state machine configuration module is used to configure the corresponding underlying step-level state machine for each industrial control step in the industrial control process. The second management module is used to manage the state of the corresponding industrial control steps based on the underlying step-level state machine; The first management module is also used to control the underlying step-level state machine or switch the state of the industrial control process when the industrial control process is in the running state, based on the state information fed back by the underlying step-level state machine corresponding to each industrial control step in the industrial control process, through the corresponding top-level process-level state machine. Among them, the top-level process-level state machine and the bottom-level step-level state machine are finite state machines; an industrial control process contains multiple nested industrial control steps.

[0029] Thirdly, this application provides an electronic device, including: a memory and one or more processors; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code including computer instructions; the one or more processors invoke the computer instructions to cause the electronic device to perform the method described in the first aspect or any possible implementation of the first aspect.

[0030] Fourthly, this application provides a computer-readable storage medium including instructions that, when executed on an electronic device, cause the electronic device to perform the method described in the first aspect or any possible implementation thereof.

[0031] Fifthly, this application provides a computer program product, including a computer program or instructions that, when run on an electronic device, cause the electronic device to perform the method described in the first aspect or any possible implementation thereof.

[0032] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here.

[0033] Overall, the technical solutions conceived in this application have the following beneficial effects compared with the prior art: (1) The top-level process-level state machine is responsible for global scheduling and state transition, while the bottom-level step-level state machine is responsible for fine-grained control of specific actions and state feedback. The two interact through state information, enabling the system to process multiple processes concurrently, while strictly executing each step according to the nested logic, thereby realizing multi-process nested concurrency in industrial control scenarios and improving the system's processing efficiency and control accuracy.

[0034] (2) The top-level process-level state machine and the bottom-level step-level state machine cooperate closely through the state information (i.e., step return values) fed back by the bottom-level step-level state machine. This cooperation achieves the decoupling of control logic, so that macro-process scheduling and micro-action execution do not interfere with each other. This ensures the orderly progress of complex business processes and the safe and reliable operation of the underlying equipment, effectively enhancing the maintainability and scalability of the industrial control system.

[0035] (3) By performing conflict detection through state machines, the execution conflicts that may occur when multiple state machines are running at the same time can be effectively resolved, avoiding the system from falling into logical deadlock or issuing contradictory control commands, thus ensuring the stable operation of the industrial control system. Attached Figure Description

[0036] Figure 1 This is a flowchart illustrating the multi-process nested concurrent industrial control method based on a finite state machine provided in this application embodiment; Figure 2 This is a schematic diagram of the state transition process of the top-level process-level state machine provided in the embodiments of this application; Figure 3 This is a schematic diagram of the state transition process of the underlying step-level state machine provided in the embodiments of this application; Figure 4 This is a schematic diagram illustrating the switching between state machines when multiple state machines are running simultaneously, as provided in an embodiment of this application. Figure 5 This is a schematic diagram illustrating the handling of anomalies through manual intervention, provided in an embodiment of this application. Figure 6This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application.

[0037] In all the accompanying drawings, the same reference numerals are used to denote the same elements or structures, wherein: S0 is the initialization state; S1 is the delay state; S2 is the skip judgment state; S3 is the execution judgment state; S4 is the execution state; S5 is the completion judgment state; S6 is the completion state; S7 is the normal termination state; S8 is the error handling state; S9 is the error completion state; S10 is the error termination state. C1 configures a delay; C2 has no delay; C3 ends the delay; C4 skips the condition if the condition is met; C5 skips the condition if the condition is not met; C6 executes the condition if the condition is met; C7 executes the condition if the condition is not met; C8 starts execution; C9 completes the condition if the condition is met; C10 times out / completes the condition if the condition is not met; C11 outputs completion information; C12 retrys the user; C13 forces the user to execute; C14 skips the user's request; C15 aborts the user's request; C16 outputs error information. P1 indicates all processes have been completed; P2 indicates not all processes have been completed; P3 indicates the current state is running; P4 indicates the current state is not running; P5 indicates an error has occurred; P6 indicates no error has occurred; P7 indicates a state transition has occurred; P8 indicates no state transition has occurred. Detailed Implementation

[0038] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0039] In this application, the terms "first" and "second," etc., are used to distinguish different objects, not to describe a specific order of objects. For example, "first management module" and "second management module," etc., are used to distinguish different management modules, not to describe a specific order of management modules.

[0040] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.

[0041] In the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more, for example, multiple processing units means two or more processing units, multiple elements means two or more elements, etc.

[0042] This application provides an industrial control method for multi-process nested concurrency based on finite state machines. The method employs a two-layer architecture of a top-level process-level state machine and a bottom-level step-level state machine, and designs the logical association between the top-level process-level state machine and the bottom-level step-level state machine, as well as a dynamic interlock detection mechanism.

[0043] The embodiments of this application are described below with reference to the accompanying drawings.

[0044] Example 1.

[0045] like Figure 1 As shown, this embodiment provides an industrial control method for multi-process nested concurrency based on finite state machines. This method employs a two-layer state machine architecture. In this application, the lower-level step-level state machine is used as a sub-state machine, and both have the same technical meaning. The specific process includes the following steps.

[0046] S101: Acquire multiple industrial control processes and configure corresponding top-level process-level state machines for each process. Upon system startup, the system identifies all industrial control processes based on preset business logic and instantiates a top-level process-level state machine object for each process.

[0047] S102: Based on the top-level process state machines, it manages the state of the corresponding industrial control process. The top-level process state machines are responsible for macroscopic control of the entire process lifecycle, including the initialization, waiting, running, completion, and exception handling stages.

[0048] S103: Configure the corresponding underlying step-level state machine for each industrial control step in the industrial control process. During the initialization of the top-level process-level state machine, the same number of underlying step-level state machine execution data structures (step structures) will be initialized according to the specific number of steps contained in the process.

[0049] S104: Based on a low-level step-level state machine, it manages the state of the corresponding industrial control steps. The low-level step-level state machine is responsible for the micro-control of the execution details of each specific step, such as delay waiting, condition judgment, instruction issuance, and result confirmation.

[0050] S105: When the industrial control process is in operation, based on the state information fed back by the underlying step-level state machines corresponding to each industrial control step in the process, the corresponding top-level process-level state machine is used to control the underlying step-level state machine or switch the state of the industrial control process. Each time the underlying step-level state machine runs, it returns a value representing its execution state (step return value) based on its execution result. The corresponding top-level process-level state machine then performs the appropriate state transition or logical processing based on this return value after the next CPU time slice allocation.

[0051] Understandably, the above method, by introducing a two-tier architecture of a top-level process-level state machine and a bottom-level step-level state machine, decomposes complex industrial control tasks into macro-level process management and micro-level step execution. The top-level process-level state machine is responsible for global scheduling and state transitions, while the bottom-level step-level state machine is responsible for fine-grained control of specific actions and state feedback. The two interact through state information, enabling the system to process multiple processes concurrently while strictly executing each step according to nested logic. This achieves multi-process nested concurrency in industrial control scenarios, improving system processing efficiency and control accuracy.

[0052] Example 2.

[0053] like Figure 2 As shown, this embodiment details the state transition process of the top-level process-level state machine. The top-level process-level state machine is designed with a process state management mechanism, defining seven core states that cover process attributes to achieve effective process management.

[0054] (1) Initialization state: Start the control flow and initialize the same number of underlying step-level state machine execution data structures (step structures) according to the number of steps contained in the flow. When "initialization is complete", the flow state changes from the initialization state to the running waiting state or directly enters the running state.

[0055] (2) Running Waiting State: Some processes need to wait in the queue until all prerequisites are met. When the prerequisites are met, the process state changes from the running waiting state to the running state.

[0056] (3) Running state: The system executes each underlying step-level state machine contained in the process according to the process design and judges its return value.

[0057] When all the underlying step-level state machines have been executed without errors, the process enters the "complete state".

[0058] When the execution return value of the underlying step-level state machine indicates that error handling is required (e.g., an error has occurred), the process state switches from the running state to the "error handling state".

[0059] (4) Completed state: After all steps are completed, the process state changes from running state to completed state, and all process completion information is output. When "completed information output", the process state changes from completed state to cleanup state.

[0060] (5) Error handling state: If the underlying step-level state machine returns an error during the execution of the process, it enters this state, waits for manual intervention, and receives user input (retry, forced execution, skip, abort).

[0061] When the user enters "Retry / Force Execution / Skip (not the last step)", the system returns to "Running Status".

[0062] When the user enters "Skip (last step)", the system enters the "Completed state".

[0063] When the user enters "abort", the system enters the "error completion state".

[0064] (6) Error completion state: Output process error information. When "error information output is complete", enter "cleanup state".

[0065] (7) Cleanup state: Remove the process from the process queue and release related resources.

[0066] Understandably, the state transition process of the aforementioned top-level process-level state machine achieves closed-loop management of the entire lifecycle of the industrial control process by defining seven core states: initialization state, running and waiting state, running state, completion state, error handling state, error completion state, and cleanup state. It dynamically adjusts the macro-process direction based on feedback from the lower-level step-level state machine and provides various manual intervention strategies in case of anomalies. This approach clearly defines each execution stage of the process, improves the reliability of process scheduling, and endows the system with fault tolerance and flexible anomaly recovery capabilities when facing sudden failures in complex industrial environments.

[0067] Example 3.

[0068] Figure 3 Multiple states and conditions are defined. The states include: S0 - Initialization, S1 - Delay, S2 - Skip Check, S3 - Execution Check, S4 - Execution, S5 - Completion Check, S6 - Completion, S7 - Normal End, S8 - Error Handling, S9 - Error Completion, and S10 - Error End. The process progresses based on a series of condition checks: C1 - Configure Delay, C2 - No Delay, C3 - Delay Ends, C4 - Skip Condition Met, C5 - Skip Condition Not Met, C6 - Execution Condition Met, C7 - Execution Condition Not Met, C8 - Start Execution, C9 - Completion Condition Met, C10 - Timeout / Completion Condition Not Met, and C11 - Output Completion Information. Additionally, conditions related to user interaction are included: C12 - User Retry, C13 - User Force Execution, C14 - User Skip, C15 - User Abort, and C16 - Output Error Information.

[0069] like Figure 3 As shown, this embodiment details the state transition process of the underlying step-level state machine. The underlying step-level state machine defines 11 execution states covering step attributes, as follows.

[0070] S0 - Initialization State: Perform initialization processing. If a delay is configured (i.e., C1), then enter S1 - Delay State; if there is no delay (i.e., C2), then directly enter S2 - Skip Judgment State.

[0071] S1 - Delay State: Runs the waiting logic in a non-blocking manner, determining whether the time elapsed since entering this state is greater than the set waiting time. When the delay ends (i.e., C3), jumps to S2 - Skip Judgment State.

[0072] S2 - Skip Judgment State: Perform the skip judgment. If the skip condition is met (i.e., C4), proceed to S7 - Normal Termination State; if the skip condition is not met (i.e., C5), proceed to S3 - Execute Judgment State.

[0073] S3 - Execution Judgment State: Determines whether the execution conditions are met. If met (i.e., C6), proceed to S4 - Execution State; if not met (i.e., C7), proceed to S8 - Error Handling State and display the error handling dialog box.

[0074] S4 - Execution State: Start execution (i.e., C8), perform step execution processing (such as issuing instructions), and then jump to S5 - Completion Judgment State.

[0075] S5 - Completion Judgment State: Execute the completion judgment logic. If the completion condition (i.e., C9) is met within the set timeout period, then enter S6 - Completion State; if the timeout occurs or the completion condition is not met (i.e., C10), then jump to S8 - Error Handling State.

[0076] S6 - Completed State: After the step is completed and the completion information (i.e., C11) is output, it enters S7 - Normal End State.

[0077] S7 - Normal End State: Returns a "Complete" signal (return_fin), triggering the top-level process state machine to proceed to the next step.

[0078] S8 - Error Handling State: Waiting for error handling. State transitions based on user input: If the user chooses to retry (C12), the state transitions back to S0 - Initialization State; if the user chooses to force execution (C13), the state transitions to S4 - Execution State; if the user chooses to skip (C14), the state transitions to S6 - Completion State; if the user chooses to abort (C15), the state transitions to S9 - Error Completion State.

[0079] S9 - Error Completion State: After performing error handling and outputting the error message (i.e., C16), it enters the S10 - Error Termination State.

[0080] S10 - Error Termination State: Returns a step error exit signal, triggering the top-level process state machine to exit or enter the corresponding error handling logic.

[0081] Understandably, the top-level process-level state machine and the bottom-level step-level state machine work closely together through the state information (i.e., step return values) fed back by the bottom-level step-level state machine. After each run, the bottom-level step-level state machine feeds back the execution result to the top-level process-level state machine, which then decides whether to continue executing the next step, switch to an error handling state, or terminate the process. This cooperation decouples the control logic, ensuring that macro-level process scheduling and micro-level action execution do not interfere with each other. This guarantees the orderly progress of complex business processes while ensuring the safe and reliable operation of underlying equipment, effectively enhancing the maintainability and scalability of the industrial control system.

[0082] Logical Connection Explanation: The logical connection between the top-level process-level state machine and the bottom-level step-level state machine is achieved through step return values. Each time the bottom-level step-level state machine runs, it returns a value representing its execution state (step return value) based on its execution result. The corresponding top-level process-level state machine then makes corresponding changes based on this return value after the next CPU time slice allocation.

[0083] The specific steps and return value enumeration are defined as follows.

[0084] `return_null`: Indicates an unknown error occurred during the execution of the underlying step-level state machine. This error does not require manual intervention. The corresponding top-level process-level state machine will immediately switch to the error completion state, log the error, and then switch to the cleanup state. After the next CPU time slice allocation, this top-level process-level state machine will be cleaned up.

[0085] `return_next`: Indicates that the underlying step-level state machine is currently executing normally. After the next CPU time slice allocation, the corresponding top-level process-level state machine will be reloaded, and execution of that underlying step-level state machine will continue.

[0086] `return_fin`: Indicates that the underlying step-level state machine has completed normally. After the next CPU time slice allocation, the corresponding top-level process-level state machine will be reloaded, and the next underlying step-level state machine will be executed according to its underlying step-level state machine sequence.

[0087] `return_errWait`: Indicates that an error requiring manual intervention has occurred during the execution of the underlying step-level state machine. The corresponding top-level process-level state machine will switch to the error handling state and display an error handling message.

[0088] `return_errFin`: Indicates that an error occurred during the execution of the underlying step-level state machine without human intervention. The corresponding top-level process-level state machine will immediately switch to the error completion state, log the error, and then switch to the cleanup state. This top-level process-level state machine will be cleaned up after the next CPU time slice allocation.

[0089] `return_indexErr`: Indicates an abnormal state in the underlying step-level state machine, requiring manual intervention. The corresponding top-level process-level state machine will switch to the error handling state and display an error handling message.

[0090] Example 4.

[0091] Figure 4 This describes the state transition logic during CPU time slice allocation, including decision nodes (Series A) and processing nodes (Series B). Decision parameters include: P1 - All executed successfully, P2 - Not all executed successfully, P3 - Current state is running, P4 - Current state is not running, P5 - Error occurred, P6 - No error occurred, P7 - State transition occurred, P8 - State transition did not occur. The functions of the decision nodes are: A1 - Check if all top-level process-level state machines have completed execution, A2 - Determine running state, A3 - Check for execution errors, A4 - Determine state transition. The functions of the processing nodes are: B1 - Retrieve an unprocessed top-level process-level state machine node and load the corresponding top-level process-level state machine, B2 - Load and execute the underlying state machine, B3 - Top-level process-level state machine enters error handling state, B4 - Execute the business logic corresponding to the current state (non-running state) of the top-level process-level state machine, B5 - State transition and save data, B6 - Save only state data.

[0092] This embodiment illustrates a nested state machine management mechanism, namely a mechanism for concurrent execution of multiple top-level process-level state machines within a CPU time slice. This mechanism supports concurrent processing of multiple top-level process-level state machines and is managed by a top-level process-level state machine management object. Its components include: a top-level process-level state machine queue, a top-level process-level state machine execution data structure, a bottom-level step-level state machine execution sequence, and a bottom-level step-level state machine execution data structure (step structure).

[0093] Top-level process-level state machine queue: A queue used to store the state data of all top-level process-level state machines in the system.

[0094] Top-level process-level state machine execution data structure: used to describe relevant information of the top-level process-level state machine during execution, including execution logic identifier, 7 core states covering process attributes, description, sequence number of the currently executing underlying step-level state machine, state queue of the underlying step-level state machine, and execution parameters, etc.

[0095] The execution sequence of the underlying step-level state machines describes the sequential order and parallel relationships of a set of underlying step-level state machines during execution. The top-level process-level state machine strictly follows this sequence to schedule the underlying step-level state machines during execution.

[0096] The underlying step-level state machine execution data structure (step structure) is used to describe the relevant information of the underlying step-level state machine during the execution process, including the execution logic identifier, 11 execution states covering step attributes, descriptions, and execution parameters.

[0097] Figure 4 It describes the state transition logic of the top-level process-level state machine management object during the CPU time slice allocation process, including decision nodes (A series) and processing nodes (B series).

[0098] Start: Allocate CPU time slices.

[0099] Node A1: Check if all top-level process-level state machines have been executed. If all have been executed (i.e., P1), wait for the next allocation; if not all have been executed (i.e., P2), proceed to B1.

[0100] B1 node: Take out an unprocessed top-level process-level state machine node and load the corresponding top-level process-level state machine.

[0101] Node A2: Determines whether the current state of the top-level process state machine is in the running state. If it is in the running state (i.e., P3), proceed to B2; if it is not in the running state (i.e., P4), proceed to B4.

[0102] B2 node: Loads and executes the underlying step-level state machine.

[0103] Node A3: Checks if any errors occur during execution. If an error occurs (i.e., P5), it enters B3 (the top-level process state machine enters the error handling state); if no error occurs (i.e., P6), it ends the processing of the current time slice.

[0104] B4 node: Executes the business logic corresponding to the state (non-running state) of the top-level process-level state machine.

[0105] Node A4: Determine if a state transition has occurred. If a state transition has occurred (i.e., P7), proceed to B5 (state transition and data saving); if no state transition has occurred (i.e., P8), proceed to B6 (only save state data).

[0106] Understandably, by utilizing the CPU time-slice round-robin mechanism, the state machine management object traverses the top-level process-level state machine queue within each time slice. Based on the current state of each top-level process-level state machine, it decides whether to proceed to execute its underlying step-level state machine or handle the top-level state transition logic. After processing, it saves the state data to relinquish CPU control. This enables concurrent processing of multiple state machines, ensuring that each industrial control process has an execution opportunity and preventing a single time-consuming process from blocking the entire system.

[0107] In addition, the system is designed with a variety of detection mechanisms to ensure the safety and stability of concurrent operation of multiple top-level process state machines, including: interlock detection, execution conflict detection, and resource conflict detection.

[0108] Interlock detection: Based on the status data of external devices, detect the feasibility of the state transition logic of the underlying step-level state machine, including skip conditions, execution conditions and completion conditions.

[0109] Conflict detection: Resolve potential conflicts that may arise when multiple top-level process state machines are running simultaneously, and avoid adding two or more top-level process state machines with completely opposite business processes to the process queue at the same time.

[0110] Resource conflict detection: Resource locks are used to resolve the issue of multiple underlying step-level state machines competing for shared resources while running simultaneously. When a resource is occupied, the underlying step-level state machine enters an error handling state, which is then resolved through manual intervention.

[0111] Example 5.

[0112] This embodiment provides an interventionist state machine multi-process complete exception handling mechanism. For example... Figure 5 As shown, E1 indicates obtaining the error description context, E2 indicates sending the error description context to the error management object, E3 indicates adding the error description context to the mapping table (MAP), F1 indicates notifying the error display window that a new error has arrived, F2 indicates adding a display item and popping up an error box, F3 indicates obtaining the processing strategy input by the user, G1 indicates removing the corresponding display item, G2 indicates sending the error identification code (UUID) and processing strategy to the error handling object, G3 indicates sending the strategy information to the error management object, the error management object distributes the information and removes the original error record, and G4 indicates performing operations such as retry, abort, skip, or force execution according to the processing strategy input by the user.

[0113] Figure 5 An error handling process involving five roles—error source, error management object, error display form, user, and error handling object—is described: (1) Error generation and reporting; (2) Error information management; (3) Error display; (4) Manual intervention; and (5) Strategy feedback and execution.

[0114] (1) Error generation and reporting: The error source (the source of the top-level process-level state machine or the bottom-level step-level state machine that generates an exception during the operation of the top-level process-level state machine management object) obtains the error description context through E1 and sends it to the error management object through E2. The error description context refers to the execution environment and parameters when the error occurs, such as the top-level process-level state machine processing logic identifier, state, the sequence number of the currently executing bottom-level step-level state machine, the bottom-level step-level state machine processing logic identifier, state, and the cause of the error.

[0115] (2) Error information management: In step E3, the error management object adds the obtained error description context to the mapping table (MAP) for management and maintenance.

[0116] (3) Error display: The error management object notifies the error display form of a new error via F1. The error display form adds a display item in step F2 to show the error description context and pops up the error display box.

[0117] (4) Manual intervention: Users can view error information in step F3 and select error handling strategies and related settings.

[0118] (5) Strategy feedback and execution; The error display window removes the corresponding display item in G1 and sends the error identification code (UUID) and the user-selected processing strategy to the error handling object via G2; The error handling object sends the policy information to the error management object via G3, and the error management object distributes the information and removes the original error record. Finally, in step G4, the error handling object performs specific retry, abort, skip, or force operations according to the user's policy, thereby restoring or terminating the corresponding industrial control process.

[0119] Understandably, when the underlying step-level state machine detects an exception, it passes an error description context containing the execution environment and parameters to the error display window, suspends the automated execution process, and awaits user decision. Subsequently, it drives the error handling object to perform corresponding recovery actions based on the user-issued policy instructions. This combination of unattended automatic control and necessary human decision-making ensures that the system does not completely collapse when encountering complex faults that cannot be automatically recovered from, but rather provides flexible intervention methods, effectively reducing the impact of faults on industrial production.

[0120] The following describes the multi-process nested concurrent industrial control device based on finite state machines provided in this application. The multi-process nested concurrent industrial control device based on finite state machines described below can be referred to in correspondence with the multi-process nested concurrent industrial control method based on finite state machines described above.

[0121] This application also provides an industrial control device based on a finite state machine with multiple nested concurrent processes, including: a top-level process-level state machine configuration module, a first management module, a bottom-level step-level state machine configuration module, and a second management module. Wherein: The top-level process-level state machine configuration module is used to acquire multiple industrial control processes and configure the corresponding top-level process-level state machine for each industrial control process. The first management module is used to manage the state of the corresponding industrial control process based on the top-level process state machines; The underlying step-level state machine configuration module is used to configure the corresponding underlying step-level state machine for each industrial control step in the industrial control process. The second management module is used to manage the state of the corresponding industrial control steps based on the underlying step-level state machine; The first management module is also used to control the underlying step-level state machine or switch the state of the industrial control process when the industrial control process is in the running state, based on the state information fed back by the underlying step-level state machine corresponding to each industrial control step in the industrial control process, through the corresponding top-level process-level state machine. Among them, the top-level process-level state machine and the bottom-level step-level state machine are finite state machines; an industrial control process contains multiple nested industrial control steps.

[0122] It is understood that the detailed functional implementation of each of the above units / modules can be found in the description in the aforementioned method embodiments, and will not be repeated here.

[0123] It should be understood that the above-described device is used to execute the methods in the above embodiments. The implementation principle and technical effect of the corresponding program modules in the device are similar to those described in the above methods. The working process of the device can be referred to the corresponding process in the above methods, and will not be repeated here.

[0124] Based on the methods in the above embodiments, this application provides an electronic device, such as... Figure 6 As shown, the electronic device may include a processor 810, a communications interface 820, a memory 830, and a communication bus 840, wherein the processor 810, the communications interface 820, and the memory 830 communicate with each other through the communication bus 840. The processor 810 can call logical instructions in the memory 830 to execute the methods in the above embodiments.

[0125] Furthermore, the logical instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the 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 to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.

[0126] Based on the methods in the above embodiments, this application provides a computer-readable storage medium storing a computer program that, when run on a processor, causes the processor to execute the methods in the above embodiments.

[0127] Based on the methods in the above embodiments, this application provides a computer program product that, when run on a processor, causes the processor to execute the methods in the above embodiments.

[0128] It is understood that the processor in the embodiments of this application can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. A general-purpose processor can be a microprocessor or any conventional processor.

[0129] The method steps in this application embodiment can be implemented in hardware or by a processor executing software instructions. The software instructions can consist of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, portable hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can reside in an ASIC.

[0130] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0131] It is understood that the various numerical designations used in the embodiments of this application are merely for the convenience of description and are not intended to limit the scope of the embodiments of this application.

[0132] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. An industrial control method based on finite state machines with multi-process nested concurrency, characterized in that, include: Acquire multiple industrial control processes and configure corresponding top-level process state machines for each industrial control process; Based on each top-level process state machine, the state of the corresponding industrial control process is managed; Configure corresponding underlying step-level state machines for each industrial control step in the industrial control process; Based on the underlying step-level state machine, the state of the corresponding industrial control step is managed; When the industrial control process is in operation, based on the state information fed back by the underlying step-level state machine corresponding to each industrial control step in the industrial control process, the underlying step-level state machine is controlled or the state of the industrial control process is switched through the corresponding top-level process-level state machine. Among them, the top-level process-level state machine and the bottom-level step-level state machine are finite state machines; an industrial control process contains multiple nested industrial control steps; The management of the state of the corresponding industrial control process based on each top-level process state machine includes: When an industrial control process is started, it is in the initialization state. In the initialization state, based on the number of industrial control steps contained in the industrial control process, the same number of step structures are initialized, and then it enters the running waiting state. In the running waiting state, it is determined whether all preset preconditions are met. If it is determined that all preset preconditions are met, then it enters the running state. In the running state, the industrial control steps included in the industrial control process are executed. Based on the state information fed back by the underlying step-level state machine, it is determined whether an error has occurred during the execution of the industrial control steps. If an error is determined, the process enters the error handling state or the error completion state. If it is determined that the industrial control steps included in the industrial control process have not been completed and no error has occurred during the execution of the industrial control steps, the industrial control steps corresponding to each underlying step-level state machine are continuously executed based on the sequence of underlying step-level state machines. When the industrial control steps corresponding to the previous underlying step-level state machine are completed, the execution of the industrial control steps corresponding to the next underlying step-level state machine is started. If it is determined that the industrial control steps included in the industrial control process have been completed and no error has occurred during the execution of the industrial control steps, the process enters the completion state. In the completion state, information indicating the completion of all industrial control processes is output, and then the process enters the cleanup state. In the error handling state, user input is received; if the user input indicates a retry or forced execution, the process enters the running state and provides the user's instruction to the lower-level step-level state machine; if the user input indicates that the skipped and erroneous industrial control step is not the last step of the industrial control process, the process enters the running state and provides the user's instruction to the lower-level step-level state machine; if the user input indicates that the skipped and erroneous industrial control step is the last step of the industrial control process, the process enters the completion state and provides the user's instruction to the lower-level step-level state machine; if the user input indicates abort, the process enters the error completion state and provides the user's instruction to the lower-level step-level state machine. In the error completion state, the error information of the industrial control process is output, and then the cleanup state is entered. In the cleanup state, the current top-level process state machine is removed from the process queue, which is used to store the top-level process state machines corresponding to the industrial control processes being executed. The underlying step-level state machine, which manages the state of the corresponding industrial control step, includes: When the industrial control step is started, the industrial control step is in the initialization state. In the initialization state, it is determined whether the industrial control step is configured with a delay. If so, it enters the delay state; otherwise, it enters the judgment skip state. In the delayed state, the waiting is performed in a non-blocking manner until the waiting time is reached; In the skip state, it is determined whether the preset skip condition is met. If so, it enters the normal termination state; otherwise, it enters the execution state. In the execution state, it is determined whether the preset execution preconditions are met. If so, it enters the execution state; otherwise, it enters the error handling state. In the execution state, the industrial control steps are initiated and then the judgment completion state is entered. In the completion state, it is determined whether the preset completion conditions are met. If the preset completion conditions are met within the preset time, the system enters the completion state. If the preset completion conditions are not met within the preset time, the system enters the error handling state. In the completion state, information indicating the completion of the industrial control step is output, and then the process enters the normal termination state. In the normal termination state, a message indicating successful execution of the industrial control step is fed back to the top-level process state machine; In the error handling state, it receives user instructions from the top-level process state machine; if the user indicates a retry, it enters the initialization state; if the user indicates forced execution, it enters the execution state; if the user indicates skipping, it enters the completion state; if the user input indicates abort, it enters the error completion state. In the error completion state, the error information of the industrial control step is output, and then the error termination state is entered. In the error termination state, a message indicating that the industrial control step was not successfully executed is fed back to the top-level process state machine.

2. The industrial control method based on finite state machines with multi-process nested concurrency as described in claim 1, characterized in that, Also includes: Before adding the top-level process state machine to the process queue, state machine execution conflict detection is performed to avoid adding two or more top-level process state machines with opposite business processes to the process queue at the same time.

3. The industrial control method based on finite state machines with multi-process nested concurrency as described in claim 1, characterized in that, Also includes: When the underlying step-level state machine accesses a shared resource, it first checks whether the shared resource's occupancy flag is occupied by the resource lock. When the occupancy flag is "occupied", the underlying step-level state machine jumps to the error handling state; If the occupancy flag is not in use, set the occupancy flag to in use and then obtain the shared resource.

4. The industrial control method based on finite state machines with multi-process nested concurrency as described in claim 1, characterized in that, Also includes: After allocating CPU time slices, check whether all top-level process-level state machines have been executed. If not all processes are completed, retrieve an unprocessed top-level process state machine and load it. Determine whether the current state of the loaded top-level process state machine is in the running state; If the current state is running, then load and execute the corresponding underlying step-level state machine; If an error occurs during the execution of the underlying step-level state machine, the top-level process-level state machine enters the error handling state and waits for the next CPU time slice allocation; if no error occurs during the execution of the underlying step-level state machine, it directly waits for the next CPU time slice allocation. If the current state is not in the running state, the business logic corresponding to the state of the top-level process-level state machine is executed; if a state change occurs, the state change is performed and the state data of the top-level process-level state machine is saved, and then the machine waits for the next CPU time slice allocation; if no state change occurs, the state data of the top-level process-level state machine is saved and the machine waits for the next CPU time slice allocation.

5. An industrial control device based on a finite state machine with nested multi-process concurrency, characterized in that, include: The top-level process-level state machine configuration module is used to acquire multiple industrial control processes and configure the corresponding top-level process-level state machine for each industrial control process. The first management module is used to manage the state of the corresponding industrial control process based on the top-level process state machines; The underlying step-level state machine configuration module is used to configure the corresponding underlying step-level state machine for each industrial control step in the industrial control process. The second management module is used to manage the state of the corresponding industrial control steps based on the underlying step-level state machine; The first management module is also used to control the underlying step-level state machine or switch the state of the industrial control process when the industrial control process is in the running state, based on the state information fed back by the underlying step-level state machine corresponding to each industrial control step in the industrial control process, through the corresponding top-level process-level state machine. Among them, the top-level process-level state machine and the bottom-level step-level state machine are finite state machines; an industrial control process contains multiple nested industrial control steps; The management of the state of the corresponding industrial control process based on each top-level process state machine includes: When an industrial control process is started, it is in the initialization state. In the initialization state, based on the number of industrial control steps contained in the industrial control process, the same number of step structures are initialized, and then it enters the running waiting state. In the running waiting state, it is determined whether all preset preconditions are met. If it is determined that all preset preconditions are met, then it enters the running state. In the running state, the industrial control steps included in the industrial control process are executed. Based on the state information fed back by the underlying step-level state machine, it is determined whether an error has occurred during the execution of the industrial control steps. If an error is determined, the process enters the error handling state or the error completion state. If it is determined that the industrial control steps included in the industrial control process have not been completed and no error has occurred during the execution of the industrial control steps, the industrial control steps corresponding to each underlying step-level state machine are continuously executed based on the sequence of underlying step-level state machines. When the industrial control steps corresponding to the previous underlying step-level state machine are completed, the execution of the industrial control steps corresponding to the next underlying step-level state machine is started. If it is determined that the industrial control steps included in the industrial control process have been completed and no error has occurred during the execution of the industrial control steps, the process enters the completion state. In the completion state, information indicating the completion of all industrial control processes is output, and then the process enters the cleanup state. In the error handling state, user input is received; if the user input indicates a retry or forced execution, the process enters the running state and provides the user's instruction to the lower-level step-level state machine; if the user input indicates that the skipped and erroneous industrial control step is not the last step of the industrial control process, the process enters the running state and provides the user's instruction to the lower-level step-level state machine; if the user input indicates that the skipped and erroneous industrial control step is the last step of the industrial control process, the process enters the completion state and provides the user's instruction to the lower-level step-level state machine; if the user input indicates abort, the process enters the error completion state and provides the user's instruction to the lower-level step-level state machine. In the error completion state, the error information of the industrial control process is output, and then the cleanup state is entered. In the cleanup state, the current top-level process state machine is removed from the process queue, which is used to store the top-level process state machines corresponding to the industrial control processes being executed. The underlying step-level state machine, which manages the state of the corresponding industrial control step, includes: When the industrial control step is started, the industrial control step is in the initialization state. In the initialization state, it is determined whether the industrial control step is configured with a delay. If so, it enters the delay state; otherwise, it enters the judgment skip state. In the delayed state, the waiting is performed in a non-blocking manner until the waiting time is reached; In the skip state, it is determined whether the preset skip condition is met. If so, it enters the normal termination state; otherwise, it enters the execution state. In the execution state, it is determined whether the preset execution preconditions are met. If so, it enters the execution state; otherwise, it enters the error handling state. In the execution state, the industrial control steps are initiated and then the judgment completion state is entered. In the completion state, it is determined whether the preset completion conditions are met. If the preset completion conditions are met within the preset time, the system enters the completion state. If the preset completion conditions are not met within the preset time, the system enters the error handling state. In the completion state, information indicating the completion of the industrial control step is output, and then the process enters the normal termination state. In the normal termination state, a message indicating successful execution of the industrial control step is fed back to the top-level process state machine; In the error handling state, it receives user instructions from the top-level process state machine; if the user indicates a retry, it enters the initialization state; if the user indicates forced execution, it enters the execution state; if the user indicates skipping, it enters the completion state; if the user input indicates abort, it enters the error completion state. In the error completion state, the error information of the industrial control step is output, and then the error termination state is entered. In the error termination state, a message indicating that the industrial control step was not successfully executed is fed back to the top-level process state machine.

6. An electronic device, characterized in that, include: Memory and one or more processors; The memory is coupled to the one or more processors, and the memory is used to store computer program code, the computer program code including computer instructions; The one or more processors invoke the computer instructions to cause the electronic device to perform the method as described in any one of claims 1-4.

7. A computer-readable storage medium comprising instructions, characterized in that: When the instructions are executed on an electronic device, the electronic device causes the electronic device to perform the method as described in any one of claims 1-4.

8. A computer program product, comprising a computer program or instructions, characterized in that: When the computer program or instructions are run on an electronic device, the electronic device causes the electronic device to perform the method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Process control method, device and equipment of multistage state machine based on software

    CN115827118A

  • Vibration isolation platform control system and method

    CN118897453A

  • Exception handling method and exception handling module

    CN120086046A

  • Abnormity control method and device based on running log, equipment and storage medium

    CN121209741A

  • Multi-task scheduling method and system of safety controller

    CN121578714A