A Method for Rapid Deployment and Scheduling of a Control Algorithm

Through dynamic configuration and the use of XML files, the problem of high complexity of control algorithms in plasma control systems is solved, rapid deployment and flexible scheduling is achieved, user learning costs are reduced, and the real-time algorithm and flexibility of execution order are ensured.

CN118939303BActive Publication Date: 2025-07-18HEFEI INSTITUTE OF PHYSICAL SCIENCE CHINESE ACADEMY OF SCIENCES
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410978196.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2025-07-18
Estimated Expiration
2044-07-22

AI Technical Summary

Technical Problem

The control algorithms in existing plasma control systems are complex and difficult to write, resulting in difficulty in deployment and scheduling.

Method used

Using a dynamic configuration method, the XML configuration file is used to specify the running cycle and library metadata of the control directory, and the execution sequence is configured through the user interface, and dynamic scheduling is achieved in combination with the exception detection component.

Benefits of technology

It realizes the rapid deployment and flexible scheduling of control algorithms, reduces user learning costs, and ensures the real-time nature of the algorithm and the flexibility of execution order.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939303B_ABST
    Figure CN118939303B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of algorithm deployment, and particularly to a method for rapid deployment and scheduling of control algorithms. Its technical solutions include the following steps: S1. Develop an algorithm and compile it to obtain a dynamic library file; S2. Deploy the algorithm in units of algorithm directories, and each algorithm directory uses an XML configuration file; S3. Use a launcher to call the configuration file in XML format and start the specified control directory according to the configuration; S4. Configure the execution sequence of each used category through the user interface; S5. Describe the control sequence as a step-change waveform to obtain a control segment; S6. The sequence executes the default Primary sequence without autonomous switching; S7. Check the sequence and discharge segment at the beginning of each control cycle. On the basis of ensuring the real-time performance of the algorithm and supporting flexible execution sequences, the present invention makes the deployment of the system itself faster and more flexible, easier to modify, and reduces the learning cost of users.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of algorithm deployment, and particularly to a method for rapid deployment and scheduling of control algorithms. Background Art

[0002] The algorithms of the Plasma Control System (PCS) need to be correctly deployed according to a certain logic to ensure the correctness and good real-time performance of its operation. Generally speaking, on a general-purpose computer, control algorithms require exclusive computing resources during their execution. On the Linux operating system, it is manifested as a real-time scheduling policy, running with high priority and CPU affinity binding. The plasma control system used by EAST comes from DIII-D PCS, and its algorithm deployment is completely specified by C program code, which requires the deployment plan to be determined during algorithm development and be fixed during program compilation, and also puts forward relatively high requirements for developers' understanding of the entire system. In the existing plasma control system EAST PCS, the control directories running on each CPU core, control algorithms, their order and running cycles are specified in a C file, and it can only take effect after the entire system is recompiled. The ITER plasma control system is still under design and development. Its control framework RTF (Real-Time Framework) is a completely configuration-driven framework, and its configuration content is complex and comprehensive, with high complexity and great difficulty in writing. Therefore, this application proposes a method for rapid deployment and scheduling of control algorithms. Summary of the Invention

[0003] The object of the present invention is to propose a method for rapid deployment and scheduling of control algorithms in view of the problems of high complexity and great difficulty in writing control algorithms in the background art.

[0004] The technical solution of the present invention: A method for rapid deployment and scheduling of control algorithms includes the following steps:

[0005] S1. Develop algorithm code under the plasma control framework, so that the plasma control algorithm has multiple sets of interface functions supported by the plasma control framework, and compile to obtain a dynamic library file;

[0006] S2. Deploy algorithms in units of algorithm directories, and each algorithm directory uses an XML configuration file;

[0007] S3. Use a launcher to call the configuration file in XML format and start the specified control directory according to the configuration;

[0008] S4. Configure the execution sequence of each used algorithm directory through a user interface, where the main sequence of the execution sequence is responsible for the control under normal system conditions, and other execution sequences are responsible for the control under specific abnormal system conditions;

[0009] S5. The execution sequence consists of one or more control paragraphs and is described as a waveform with step changes.

[0010] S6. The algorithm directory defaults to executing the main sequence and does not switch autonomously.

[0011] S7. At the start of each control cycle, the sequence and discharge paragraphs are checked.

[0012] S8. An anomaly detection component monitors the discharge state and generates an event when the state changes. The control framework switches the execution sequence according to the event, and the execution sequences switch with each other according to the discharge state.

[0013] S9. Discharge is terminated at the end of discharge set in the main sequence or other execution sequences, completing the rapid deployment and scheduling of the control algorithm under the plasma control framework.

[0014] Optionally, the supported interface functions include: start function, init function, entry function, execute function, exit function, clean function, stop function.

[0015] Optionally, in step S2, it specifically includes:

[0016] S201. The launcher, according to the parsed CPU number, uses the taskset instruction to deploy the program on the given CPU core and loads the dynamic library using the library name indicated in the loading module.

[0017] S202. Use a script file to execute a set of launchers to start the entire system.

[0018] S203. After the control period specified by the periodic element is parsed, it is saved in the framework process and used to maintain the control period during discharge. After the control tasks are completed in one control period, it is polled to determine whether the elapsed time reaches the period. If not, polling continues; if it reaches, the next control period is entered.

[0019] Optionally, in step S3, it specifically includes the following steps:

[0020] S301. The top-level element namespace is responsible for specifying three attributes: name: the organization name; CPU: the affinity of this control directory is bound to the CPU with the given number of this element for running; period: the execution period of this control directory, in seconds. There is only one top-level element, and all other configured elements are members of this top-level element.

[0021] S302. The loading element specifies the library files to be loaded. Among them, the address attribute specifies the search path of the library file with a relative address, and each of the remaining library files forms a member. There can be multiple loading elements.

[0022] S303. The component element is responsible for loading components in the environment where the algorithm runs and starting services to use the common functions provided by the framework; the loading service is used to provide data collection services. It provides the collected data to the algorithm according to the given signal list, data source, and data type.

[0023] S304. The directory element is used to load the control directory and has a request attribute indicating whether the control directory needs to obtain configuration from the user interface. If it is 1, the directory runs according to the configuration; if it is 0, the directory runs autonomously since self-discharge starts and does not depend on configuration data. The directory contains one or more function members to specify the algorithms included in the directory. The given algorithm must exist in the library specified by the loading module element. Multiple directory elements can exist and are executed in sequence during the control cycle.

[0024] S305. Archiving is a special directory element for data archiving. Each directory configuration file configures an archiving algorithm for execution at the end.

[0025] Optionally, in step S4, an execution sequence is configured for each used directory on the user interface. The main sequence is the default execution sequence, which uses an absolute time axis. Other sequences are used for exception handling and use a relative time axis, that is, the zero point on the time axis is actually the time when switching to this sequence. Each control directory maintains a list of its own discharge sequences and a list of discharge paragraphs.

[0026] Optionally, in step S5, at time t of the control sequence, if the value of the waveform is a non-negative integer k, it means that the current control directory executes the kth control paragraph at time t. The discharge paragraph value corresponding to the current time and the current sequence is calculated by the framework and assigned to the directory's list of discharge paragraphs.

[0027] Optionally, the control paragraph includes an algorithm belonging to the current control directory and all configuration data of the algorithm. The control paragraph has a unique number and name to distinguish each other when there are multiple paragraphs using the same algorithm.

[0028] Optionally, in step S6, the switching of the execution sequence is responsible for an event monitoring algorithm, which monitors one or several metrics. When it reaches the preset threshold, the algorithm determines whether to terminate the discharge or switch to other sequences for operation according to the set strategy, and at the same time publishes an event to the system framework. The process component receives the event, modifies the sequence list maintained by the directory, and moves the data in the sequence along the relative time axis to become the actual time.

[0029] Optionally, in S7, check the current discharge sequence list. If the sequence number is different from that of the previous cycle, perform the sequence switching process. If the sequence number is the same as that of the previous cycle, detect the current discharge paragraph number. If the current paragraph number is different from that of the previous cycle, enter the paragraph switching process. If the current paragraph number is the same as that of the previous cycle, execute the control algorithm corresponding to the past paragraph.

[0030] Compared with the prior art, the present invention has the following beneficial technical effects:

[0031] The present invention designs a dynamically configured deployment solution, and uses a self-describing XML configuration file to specify metadata such as the running period and library of each control directory or public service.

[0032] Lingshu is started according to a set of configuration files, binds each control directory to a CPU core and runs with a specified priority, realizes dynamic configuration while ensuring real-time performance, sets the scheduling order during algorithm operation on the user interface, can set multiple execution sequences, and can switch sequences according to events during operation to implement exception handling.

[0033] On the basis of ensuring the real-time performance of the algorithm and supporting flexible execution sequences, the present invention makes the deployment of the system itself faster, more flexible, easier to modify, and reduces the learning cost of users. Brief Description of the Drawings

[0034] Figure 1 Give the schematic diagram of the principle of a fast deployment and scheduling method for a control algorithm of the present invention;

[0035] Figure 2 Give the structural schematic diagram of an embodiment of the present invention;

[0036] Figure 3 Give the structural schematic diagram of an embodiment of the present invention;

[0037] Figure 4 Give the schematic diagram of the principle of the discharge stage inspection of the present invention. Detailed Embodiment

[0038] The technical solution of the present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.

[0039] Embodiment

[0040] As Figure 1 shown, the life cycle of the plasma control algorithm includes three stages: development, deployment, and operation:

[0041] 1. After the algorithm applicable to the plasma control framework is developed, it is compiled to obtain a dynamic library file. Similar to the following Figure 2As shown, there may be multiple versions of the same algorithm, and suffixes are added to the names for differentiation. By unifying the cmake compilation file, all dynamic libraries are copied to a directory specified by the system environment variable to ensure correct access; specifically,

[0042] S1.1 Develop algorithm code under the plasma control framework. The algorithm can implement seven interface functions supported by the framework as needed, namely:

[0043] 1) start: Execute when the system starts;

[0044] 2) init: Execute when the experimental configuration of each shot is released;

[0045] 3) entry: Execute when entering the phase;

[0046] 4) execute: Execute in each control cycle;

[0047] 5) exit: Execute when exiting the phase;

[0048] 6) clean: Execute when the experiment of each shot ends;

[0049] 7) stop: Execute when the system shuts down;

[0050] S1.2 The algorithm needs to belong to a control directory. The control directory usually has an algorithm with the same name. Algorithms in this directory manage common data, usually including the final output command and the status flag of the current directory.

[0051] S1.3 Use the CMake compilation system of the framework to compile the algorithm into a dynamic library suitable for the framework.

[0052] 2. The algorithm is deployed in units of algorithm directories. Refer to Figure 2 - Figure 3 , and each algorithm directory uses an XML configuration file as shown below. XML is a hierarchical general markup language and can be easily parsed by the launcher.

[0053] 2.1 According to the parsed CPU number, the launcher uses the taskset instruction to deploy the program on the given CPU core and loads the dynamic library using the library name indicated in the loading;

[0054] 2.2 Use a script file to execute a set of launchers to achieve the purpose of starting the entire system. For example:

[0055] taskset -c 4. / launcher --rt = CPU4 –log = empty &

[0056] Start a framework process on CPU4 using the configuration file named "CPU4.rt" without logging.

[0057] After the control period specified by the 2.3 cycle elements (hereinafter referred to as periods) is parsed, it is saved in the framework process. During discharge, the control period is maintained. After the control tasks are completed in one control period, it is polled to determine whether the elapsed time reaches the periods. If the time has not arrived, continue polling. If it has arrived, enter the next control period.

[0058] 3. The XML configuration file includes several parts from top to bottom:

[0059] 1) The top-level element namespace is responsible for specifying three attributes: name: the organization name, CPU: the affinity of this control directory is bound to a given numbered CPU for running, and periods: specifies the execution period of this control directory in seconds. There is only one top-level element, and all other configured elements are members of this top-level element.

[0060] 2) The loading element specifies the library files to be loaded. The address (path) attribute specifies the search path of the library files in relative address, and each of the remaining library files forms a member. There can be multiple loading elements.

[0061] 3) The component element is responsible for loading components in the environment where the algorithm runs and starting the service to use some common functions provided by the framework. Specifically, the loading service is used to provide the service of collecting data. It provides the collected data to the algorithm according to the given signal list, data source, and data type.

[0062] 4) The category element is responsible for loading the control directory. It has a request element that indicates whether this control directory needs to obtain configuration from the user interface. If it is 1, this directory runs according to the configuration. If it is 0, this directory runs autonomously since discharge and does not depend on configuration data. Category contains one or more function members to specify the algorithms included in this directory. The given algorithm must exist in the library specified by the loading element. There can be multiple category elements, and they are executed in sequence during the control period.

[0063] 5) Archive is a special category element responsible for data archiving. Each directory configuration file should finally configure a directory to execute the archive algorithm.

[0064] 4. By using a launcher to call a configuration file in XML format, the specified control directory can be started according to the configuration. This process will exclusively occupy one CPU core and wait for the discharge to start in the idle state.

[0065] 5. Configure the execution sequence for each used category on the user interface. The Primary main sequence is the default execution sequence, which uses an absolute timeline. Other sequences are used for exception handling and use a relative timeline, that is, the zero point on the timeline is actually the time when switching to this sequence. Each control directory maintains a list of its own discharge sequences and a list of discharge paragraphs.

[0066] 6. The control sequence is a set of ordered control phases, which is described as a step-changing waveform. At time t, if the value of this waveform is a non-negative integer k, it means that at time t, the current control directory executes the k-th control phase. The current time and the value of the discharge paragraph corresponding to the current sequence are calculated by the framework and assigned to the directory's list of discharge paragraphs.

[0067] 7. A control phase is the basic unit for executing a control algorithm, which includes an algorithm belonging to the current control directory and all configuration data of this algorithm. The control phase has a unique number and name to distinguish each other when there are multiple paragraphs using the same algorithm.

[0068] 8. The sequence usually executes the default Primary sequence and will not switch autonomously. The switching of the execution sequence is responsible for an exception monitoring algorithm. It monitors one or several metrics. When they reach the preset thresholds, the algorithm determines whether to terminate the discharge or switch to other sequences to run according to the set strategy. At the same time, an event is published to the system framework. The process component receives the event, modifies the list of sequences maintained by the directory, and moves the data in the sequence relative to the timeline to become the actual time.

[0069] 9. The inspection of the sequence and the discharge paragraph is carried out at the beginning of each control cycle, that is Figure 1 the inspection of the discharge phase. The inspection principle is as Figure 4 shown. Check the current list of discharge sequences. If the sequence number is different from the previous cycle, the sequence switching process is carried out. If the sequence number is not different from the previous cycle, check the current discharge paragraph number. If the current paragraph number is different from the previous cycle, enter the paragraph switching process. If the current paragraph number is not different from the previous cycle, then execute the control algorithm corresponding to the past paragraph.

[0070] 10. The execution sequence can be switched to another execution sequence to implement exception handling. Or, after the discharge state changes, switch back to the main sequence to continue discharging or terminate the discharge.

[0071] The above specific embodiments are only several alternative embodiments of the present invention. Based on the technical solution of the present invention and the relevant revelations of the above embodiments, those skilled in the art can make various alternative improvements and combinations to the above specific embodiments.

Claims

1. A method for rapid deployment and scheduling of a control algorithm, characterized in that, It includes the following steps: S1. Develop algorithm code under the plasma control framework, so that the plasma control algorithm has multiple interface functions supported by the plasma control framework, and compile to obtain a dynamic library file; S2. Deploy the algorithm in units of algorithm directories, and each algorithm directory uses an XML configuration file; S3. Use the launcher to call the configuration file in XML format and start the specified control directory according to the configuration; S4. Configure the execution sequence of each used algorithm directory through the user interface. Among them, the main sequence of the execution sequence is responsible for the control under normal system conditions, and other execution sequences are responsible for the control under specific abnormal system conditions; S5. The execution sequence consists of one or more control paragraphs and is described as a step-change waveform; S6. The algorithm directory defaults to execute the main sequence and does not switch autonomously; S7. Check the sequence and discharge paragraph at the beginning of each control cycle; S8. An abnormal detection component monitors the discharge state and generates an event when the state changes. The control framework switches the execution sequence according to the event, and each execution sequence switches with each other according to the discharge state; S9. Terminate the discharge at the end of the discharge set in the main sequence or other execution sequences to complete the rapid deployment and scheduling of the control algorithm under the plasma control framework.

2. The rapid deployment and scheduling method of a control algorithm according to claim 1, characterized in that The supported interface functions include: start function, init function, entry function, execute function, exit function, clean function, stop function.

3. A method for rapid deployment and scheduling of a control algorithm according to claim 1, characterized in that, In step S2, it specifically includes: S201. The launcher uses the taskset instruction according to the parsed CPU number to deploy the program on the given CPU core and loads the dynamic library using the library name indicated in the loading module; S202. Use the script file to execute a group of launchers to start the entire system; S203. After parsing the control period specified by the periodic element, it is saved in the framework process and used to maintain the control period during the discharge. After the control task is completed in a control period, it polls to determine whether the elapsed time reaches the period. If not, it continues to poll. If it reaches, it enters the next control period.

4. A method for rapid deployment and scheduling of a control algorithm according to claim 3, characterized in that, In step S3, it specifically includes the following steps: S301. The top-level element namespace is responsible for specifying three attributes, name: organization name; CPU: the affinity of this control directory is bound to the CPU with the given number of this element to run; period: specify the execution period of this control directory in seconds. There is only one top-level element, and other configured elements are members of this top-level element; S302. The loading element specifies the library files to be loaded, where the address attribute specifies the search path of the library file in relative address, and each of the remaining library files forms a member. The loading element can be multiple; S303. The component element is responsible for loading components in the environment where the algorithm runs and starting services to use the common functions provided by the framework; the loading service is used to provide the service of collecting data. It provides the collected data to the algorithm according to the given signal list, data source and data type. S304. The directory element is used to load the control directory and has a request attribute indicating whether the control directory needs to obtain the configuration from the user interface. If it is 1, the directory runs according to the configuration; if it is 0, the directory runs autonomously since the self-discharge starts and does not depend on the configuration data. The directory contains one or more function members to specify the algorithms included in the directory. The given algorithms must exist in the library specified by the loading module element. There can be multiple directory elements and they are executed in sequence during the control period. S305. Archiving is a special directory element for data archiving. Each directory configuration file configures an archiving algorithm for the directory at the end.

5. A method for rapid deployment and scheduling of a control algorithm according to claim 4, characterized in that, In step S4, an execution sequence is configured for each used directory on the user interface. The main sequence is the default execution sequence, which uses an absolute time axis. Other sequences are used for exception handling and use a relative time axis, that is, the zero point on the time axis is actually the time when switching to this sequence. Each control directory maintains a list of its own discharge sequences and a list of discharge segments.

6. The rapid deployment and scheduling method of a control algorithm according to claim 5, characterized in that, In step S5, at time t of the control sequence, if the value of the waveform is a non-negative integer k, it means that at time t, the current control directory executes the kth control segment. The discharge segment value corresponding to the current time and the current sequence is calculated by the framework and assigned to the directory's discharge segment list.

7. A method for rapid deployment and scheduling of a control algorithm according to claim 6, characterized in that, The control segment includes an algorithm belonging to the current control directory and all configuration data of the algorithm. The control segment has a unique number and name to distinguish each other when there are multiple segments using the same algorithm.

8. A method for rapid deployment and scheduling of a control algorithm according to claim 1, characterized in that In step S6, the switching of the execution sequence is responsible for an event monitoring algorithm that monitors one or several metrics. When it reaches the preset threshold, the algorithm determines whether to terminate the discharge or switch to other sequences to run according to the set strategy, and at the same time publishes an event to the system framework. The process component receives the event, modifies the sequence list maintained by the directory, and moves the data in the sequence along the relative time axis to become the actual time.

9. A method for rapid deployment and scheduling of a control algorithm according to claim 1, characterized in that In S7, check the current discharge sequence list. If the sequence number is different from the previous cycle, enter the sequence switching process. If the sequence number is the same as the previous cycle, detect the current discharge segment number. If the current segment number is different from the previous cycle, enter the segment switching process. If the current segment number is the same as the previous cycle, then execute the control algorithm corresponding to the previous segment.