Real-time control method based on multistage state machine model
Through the message event distribution mechanism of multi-level state machine model and process scheduling components, the problem that traditional state machines are difficult to deal with complex distributed plasma control systems is solved, and unified management of system processes and stable and reliable control are realized, adapting to the toka Mark installation requirements.
Patent Information
- Application Number
- CN202411346605.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2024-12-31
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional simple state machines are difficult to meet the needs of parallel relationship processing of sub-processes in complex distributed plasma control systems, resulting in unclear, inflexible control processes, and difficult to expand and modify.
Using a multi-level state machine model, the process scheduling components and their message event distribution mechanism can realize unified management of system processes. The core state machine and sub-state machine work together to provide stable process control and appropriate granularity, and support parallel sub-components. Status management.
It realizes unified management of system processes under the distributed control framework, provides stable and reliable process control, clear and flexible processes, and is easy to expand and modify, adapting to the iterative evolution needs of tokamak devices and similar experimental devices.
Smart Images

Figure CN119225218A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of plasma control, and in particular relates to a real-time control method based on a multi-level state machine model. Background Art
[0002] The Tokamak device uses magnetic confinement to confine plasma fusion materials in a vacuum chamber, and uses auxiliary means to heat the plasma to achieve nuclear fusion reaction conditions and release fusion energy. The heated plasma is high temperature and high pressure, and real-time and precise control of it is one of the important technical conditions for achieving magnetic confinement nuclear fusion.
[0003] The plasma control system (PCS) for tokamak experiments includes complex processes throughout its life cycle from system startup to discharge experiments. Each system stage performs different tasks. In the Eastern Super Ring (EAST), PCS handles the system state in a coarse-grained and isolated manner, and the system uses a simple state machine called a lock server. This service receives notifications of various events and responds to events by changing the state of the PCS. In this system, the system is divided into several states such as idle, initial lock, final lock, and discharge. It can be seen that its process control is single-line and there is no support for parallel internal states of sub-components.
[0004] For the new distributed plasma control system, the system process is complex, and individual components or subsystems have sub-processes with upper and lower or parallel relationships. The traditional simple state machine cannot meet the requirements. Summary of the invention
[0005] The purpose of the present invention is to provide a real-time control method based on a multi-level state machine model, which realizes unified management of system processes under a distributed control framework through a process scheduling component and its message event distribution mechanism. The multi-layer state machine is well adapted to the needs of tokamak plasma discharge experiments, provides stable and reliable process control and appropriate process granularity, and makes the control process clear and flexible, and easy to expand and modify.
[0006] To achieve the above object, the present invention proposes a real-time control method based on a multi-level state machine model, comprising the following method steps:
[0007] S1. The system consists of multiple components, among which the process scheduling component maintains the system workflow operation, which contains the core state machine. The other components run their own state machines, namely sub-state machines. The core state machine maintains the top-level state of the system and deploys the sub-state machines of external components.
[0008] S2. The interface between the process scheduling component and the external component is uniformly defined by messages. The component implements the callback function of the event corresponding to the message response, executes tasks and performs state transfer;
[0009] S3, the process scheduling component transfers states and publishes messages according to its own state and messages sent by external components to manage the global discharge process of plasma;
[0010] S4. The external component executes the corresponding callback function according to the message sent by the process scheduling component, processes the state transition of its own sub-state machine and executes the task. It can also publish messages to the process scheduling component to change the main process.
[0011] Optionally, the process scheduling component in S1 is connected to the external component via ZeroMQ publish-subscribe mode messages.
[0012] Optionally, the ZeroMQ filters messages based on character prefixes, using dot-separated string messages as topic format.
[0013] Optionally, the naming rule of the topic format is: FunctionCode.Component.Service.MessageName;
[0014] Among them, the FunctionCode part is the identification function code, the default is event, indicating an event; Component is the abbreviation of the component name, such as wfe (work flow engine); the Service part is the abbreviation of the service name, such as DAQservice; MessageName is the message name.
[0015] Optionally, the core state machine includes an idle state, an initialization state, a calibration state, a ready state, a work execution state and a failure state.
[0016] Optionally, the specific steps of S3 are as follows:
[0017] S31, first the system starts, and each component is initialized, at which point the entire system is not fully started;
[0018] S32, after the startup is completed, the process scheduling component enters the waiting state;
[0019] S33, in the waiting state, if a configuration message is received from the configuration component, the initial locking state is entered, and this stage is triggered by the operator confirming on the user interface that the discharge configuration is complete;
[0020] S34, during the initial locking, the user confirms again to enter the final locking and waits for the discharge to start;
[0021] S35, during the initial lock, if the discharge needs to be canceled, the user can cancel the initial lock, the process component enters the unlocked state, and re-enters the initial lock state after reconfiguring the discharge;
[0022] S36, in the final locking, a trigger command from the master control is received to enter the running state and start discharging.
[0023] S37: In the running state, when the configured end time is reached or the system is terminated unexpectedly, the system enters the end state and performs post-discharge cleaning.
[0024] S38: In any state, if a major abnormality or other specified special state occurs in the device, the system will enter a failure state.
[0025] S39. In the failure state, if the system abnormality is resolved, the process scheduling component can re-enter the waiting state.
[0026] Optionally, the external component in S4 includes a sub-state machine, and the sub-machine includes a waiting state, a ready state, a discharging state, an end state and a failure state.
[0027] Optionally, the specific steps include:
[0028] S41, after the startup is completed, the component will enter the waiting state;
[0029] S42, when the process scheduling component enters the initial lock, the component sub-state machine enters the ready state, processes the discharge configuration, and initializes the discharge;
[0030] S43, after being triggered, the device enters the discharge state and performs the main task in the plasma discharge process;
[0031] S44, after the discharge is completed, the cleaning state will be entered;
[0032] S45. After the cleaning state is completed, re-enter the waiting state.
[0033] S46. When a fatal exception occurs in any link, it enters a failure state, performs local exception processing and publishes a message to the process control component so that the main process also enters an abnormal state.
[0034] Optionally, the sub-state machine process described in S4 is a typical process and may be appropriately changed for special services or control components.
[0035] Compared with the prior art, the present invention has the following beneficial effects:
[0036] The present invention realizes unified management of system processes under a distributed control framework through the process scheduling component and its message event distribution mechanism. The multi-layer state machine is well adapted to the needs of the tokamak plasma discharge experiment, provides stable and reliable process control and appropriate process granularity, and makes the control process clear and flexible, easy to expand and modify. It conforms to the characteristics of the current tokamak device and other similar experimental devices that are constantly iteratively evolving. It can quickly adapt to experimental development and technological progress. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a schematic diagram of the overall structure of the plasma control system components.
[0038] Figure 2 State transition diagram of the core state machine.
[0039] Figure 3 Typical state transition diagram of other component sub-state machines in .
[0040] Figure 4 It is a workflow diagram of the communication between the process scheduling component and other components. DETAILED DESCRIPTION
[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0042] See also Figure 1-4 In this embodiment, a real-time control method based on a multi-level state machine model is implemented in sequence by the following steps:
[0043] Step 1. The system consists of multiple components, among which the process scheduling component maintains the system workflow operation. It contains the core state machine, and the other components run their own state machines, namely sub-state machines. The core state machine maintains the top-level state of the system and deploys the sub-state machines of external components;
[0044] Step 2: The interface between the process scheduling component and the external component is uniformly defined by messages. The component implements the callback function of the event corresponding to the message response, executes the task and performs state transfer;
[0045] The services of the process scheduling component mainly include external interface services for interacting with external systems and internal services for plasma control workflow management. The component relationship between them is shown in Figure 1. For each external component that is controlled by the process scheduling component, the corresponding interface and event response need to be implemented.
[0046] Step 3: The process scheduling component transfers states and publishes messages according to its own state and messages sent by external components to manage the global discharge process of plasma;
[0047] See also Figure 2 , the specific steps of step 3 are as follows:
[0048] Step 31: First, the system starts and each component is initialized. At this time, the entire system is not fully started;
[0049] Step 32: After the startup is completed, the process scheduling component enters the waiting state;
[0050] Step 33: In the waiting state, if a configuration message is received from the configuration component, the device enters the initial locking state. This stage is triggered by the operator confirming on the user interface that the discharge configuration is completed.
[0051] Step 34: During the initial locking, the user confirms again to enter the final locking and waits for the discharge to start;
[0052] Step 35: During the initial lock, if the discharge needs to be canceled, the user can cancel the initial lock, and the process component enters the unlocked state. After the discharge is reconfigured, it re-enters the initial lock state;
[0053] Step 36: During the final locking, the trigger command from the master control is received to enter the running state and start discharging.
[0054] Step 37: In the running state, when the configured end time is reached or the battery is terminated unexpectedly, the battery enters the end state and performs post-discharge cleaning.
[0055] Step 38: In any state, if a major abnormality or other specified special state occurs in the device, the system will enter the failure state.
[0056] Step 39: In the failure state, if the system anomaly is resolved, the process scheduling component can re-enter the waiting state.
[0057] Step 4: The external component executes the corresponding callback function according to the message sent by the process scheduling component, processes the state transition of its own sub-state machine and executes the task. It can also publish messages to the process scheduling component to change the main process.
[0058] See also Figure 3 , step 4 specifically includes the following steps:
[0059] Step 41, after the startup is completed, the component will enter the waiting state;
[0060] Step 42: When the process scheduling component enters the initial lock, the component sub-state machine enters the ready state, processes the discharge configuration, and initializes the discharge;
[0061] Step 43, after being triggered, the discharge state is entered, and the component performs the main task in the plasma discharge process;
[0062] Step 44: After the discharge is completed, the cleaning state will be entered;
[0063] Step 45: After the cleaning state is completed, re-enter the waiting state.
[0064] Step 46: When a fatal exception occurs in any link, the process enters a failure state, performs local exception processing, and publishes a message to the process control component so that the main process also enters an abnormal state.
[0065] In step 1, the process scheduling component connects with external components through ZeroMQ publish-subscribe mode messages. The messages between the process control component and other components are carried out using the publish-subscribe mode, which can achieve many-to-many communication, message concurrency and message filtering.
[0066] ZeroMQ filters messages based on character prefixes and uses dot-separated string messages as topic format.
[0067] The naming rule of the topic format is: FunctionCode.Component.Service.MessageName;
[0068] Among them, the FunctionCode part is the identification function code, the default is event, indicating an event; Component is the abbreviation of the component name, such as wf (work flow); the Service part is the abbreviation of the service name, such as DAQ service; MessageName is the message name.
[0069] See also Figure 4 , the process scheduling component communicates with other components and the following external system interfaces by passing messages. The message sent by the user interface can guide the process scheduling component to enter the initial lock state or unlock it. The message from the master control guides the process scheduling component to enter the running state. When the process scheduling component processes a message or changes its own state, it sends a message to other components that define the interface to control the operation of the sub-state machine inside the component. Taking the configuration component as an example, in the ready state, the discharge configuration is read from the database and serialized and sent to the support component;
[0070] Taking the real-time component as an example, in the ready state, it receives the deserialized configuration data of the supporting component and initializes the control algorithm; in the end state, it stores the discharge experiment data into the database for analysis, tracking and repeating the experiment.
[0071] In summary: The present invention realizes unified management of system processes under a distributed control framework through the process scheduling component and its message event distribution mechanism. The multi-layer state machine is well adapted to the needs of the Tokamak plasma discharge experiment, provides stable and reliable process control and appropriate process granularity, and makes the control process clear and flexible, easy to expand and modify. It conforms to the characteristics of the continuous iterative evolution of the current Tokamak device and other similar experimental devices. It can adapt quickly in experimental development and technological progress.
[0072] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A real-time control method based on a multi-level state machine model, wherein the plasma control system is composed of multiple components, including a process scheduling component and an external component, characterized in that: The method includes the following steps: S1. The process scheduling component is used to maintain the workflow operation of the plasma control system. The process scheduling component includes a core state machine, and the other components run their own local state machines, i.e., sub-state machines. The core state machine maintains the top-level state of the plasma control system and deploys the sub-state machines of external components. S2. The interfaces between the process scheduling component and the external component are uniformly defined by messages. The process scheduling component and the external component implement callback functions of events corresponding to message responses, execute tasks and perform state transfers. S3, the process scheduling component transfers states and publishes messages according to its own state and messages sent by external components to manage the global discharge process of plasma; S4. The external component executes the corresponding callback function according to the message sent by the process scheduling component, processes the state transition of its own sub-state machine and executes the task. It can also publish messages to the process scheduling component to change the main process.
2. A real-time control method based on a multi-level state machine model according to claim 1, characterized in that: The process scheduling component in S2 communicates with external components through the publish-subscribe mode messages of the ZeroMQ message middleware, and each component subscribes to the messages it needs to process.
3. A real-time control method based on a multi-level state machine model according to claim 2, characterized in that: The ZeroMQ message middleware filters messages based on character prefixes and uses dot-separated string messages as topic formats.
4. A real-time control method based on a multi-level state machine model according to claim 3, characterized in that: The naming rule of the topic format is: FunctionCode.Component.Service.MessageName; Among them, the FunctionCode part is the identification function code, the default is event, indicating an event; Component is the abbreviation of the component name, indicating the source of the message; the Service part is the abbreviation of the service name; MessageName is the message name.
5. The real-time control method based on a multi-level state machine model according to claim 1, characterized in that: The core state machine includes a waiting state, a preliminary locking state, a final locking state, an unlocking state, a running state, an ending state and a failure state.
6. A real-time control method based on a multi-level state machine model according to claim 5, characterized in that: The specific steps of S3 are as follows: S31, first the system starts, and each component is initialized, at which point the entire system is not fully started; S32, after the startup is completed, the process scheduling component enters the waiting state; S33, in the waiting state, if a configuration message is received from the configuration component, the initial locking state is entered, and this stage is triggered by the operator confirming on the user interface that the discharge configuration is complete; S34, during the initial locking, the user confirms again to enter the final locking and waits for the discharge to start; S35, during the initial lock, if the discharge needs to be canceled, the user can cancel the initial lock, the process component enters the unlocked state, and re-enters the initial lock state after reconfiguring the discharge; S36, in the final locking, a trigger command from the master control is received to enter the running state and start discharging. S37: In the running state, when the configured end time is reached or the system is terminated unexpectedly, the system enters the end state and performs post-discharge cleaning. S38: In any state, if a major abnormality or other specified special state occurs in the device, the system will enter a failure state. S39. In the failure state, if the system abnormality is resolved, the process scheduling component can re-enter the waiting state.
7. A real-time control method based on a multi-level state machine model according to claim 1, characterized in that: The external component in S4 includes a sub-state machine, and the sub-machine includes a waiting state, a ready state, a discharge state, an end state and a failure state.
8. A real-time control method based on a multi-level state machine model according to claim 7, characterized in that: The sub-state machine specifically includes the following steps: S41, after the startup is completed, the component will enter the waiting state; S42, when the process scheduling component enters the initial lock, the component sub-state machine enters the ready state, processes the discharge configuration, and initializes the discharge; S43, after being triggered, the device enters the discharge state and performs the main task in the plasma discharge process; S44, after the discharge is completed, the cleaning state will be entered; S45. After the cleaning state is completed, re-enter the waiting state. S46. When a fatal exception occurs in any link, it enters a failure state, performs local exception processing and publishes a message to the process control component so that the main process also enters an abnormal state.
9. A real-time control method based on a multi-level state machine model according to claim 7, characterized in that: The sub-state machine process is a typical process and may be appropriately changed for special services or control components.
Citation Information
Patent Citations
Method for realizing real-time control of power supply system by using EPICS-based finite-state machine
CN105955085A
Lightweight workflow component based on finite-state machine and processing method thereof
CN112613832A
Dual-processor plasma digital power supply system
CN114499106A
RPA controller scheduling method and system based on event driving and infinite state machine
CN115056234A
