Quick deployment and scheduling method for control algorithm

By using dynamic configuration and XML files, the problem of high control algorithm complexity in plasma control systems is solved, enabling rapid deployment and flexible scheduling, meeting real-time requirements, and reducing user learning costs.

CN118939303AActive Publication Date: 2024-11-12HEFEI INSTITUTE OF PHYSICAL SCIENCE CHINESE ACADEMY OF SCIENCES
View PDF 4 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In existing plasma control systems, the control algorithms are highly complex and difficult to write, resulting in inflexible deployment and scheduling, making it difficult to meet real-time requirements.

Method used

A dynamic configuration approach is adopted, using XML configuration files to specify the runtime of the control directory and library metadata, and setting the execution sequence through the user interface. Combined with anomaly detection, the algorithm can be quickly deployed and scheduled.

Benefits of technology

It enables rapid deployment and flexible scheduling of control algorithms, reduces user learning costs, and ensures the real-time performance and exception handling capabilities of the algorithms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939303A_ABST
    Figure CN118939303A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of algorithm deployment, in particular to a rapid deployment and scheduling method for a control algorithm. According to the technical scheme, the method comprises the following steps: S1, developing an algorithm, and compiling to obtain a dynamic library file; s2, deploying algorithms by taking algorithm catalogs as units, wherein each algorithm catalog uses one XML configuration file; s3, calling the configuration file in the XML format by using a starter, and starting the specified control directory according to the configuration; s4, configuring an execution sequence of each used gateway through a user interface; s5, describing the control sequence as a waveform with step change to obtain a control section; s6, executing a default Primary sequence by the sequence, and performing non-autonomous switching; and S7, checking the sequence and the discharge section at the beginning of each control period. On the basis of ensuring the algorithm instantaneity and supporting the flexible execution sequence, the deployment of the system is quicker and more flexible, the modification is easy, and the learning cost of the user is reduced.
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 in particular to a method for rapid deployment and scheduling of a control algorithm. Background Art

[0002] The algorithm of the plasma control system (PCS) needs 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, the control algorithm requires exclusive computing resources during its execution. On the Linux operating system, it is manifested as a real-time scheduling strategy, with high priority and CPU affinity binding operation. The plasma control system used by EAST comes from DIII-DPCS, and its algorithm deployment is completely specified by the C program code, which requires the deployment plan to be determined when the algorithm is developed, and it is determined when the program is compiled, and it places high demands on the developer's understanding of the entire system. In the existing plasma control system EAST PCS, the control directory running on each CPU core, the control algorithm and its order and operation cycle 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, and 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 difficulty in writing. Therefore, this application proposes a method for rapid deployment and scheduling of a control algorithm. Summary of the invention

[0003] The purpose of the present invention is to propose a method for rapid deployment and scheduling of control algorithms in view of the problem that control algorithms in the background technology are highly complex and difficult to write.

[0004] The technical solution of the present invention is a method for rapid deployment and scheduling of a control algorithm, comprising the following steps:

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

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

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

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

[0009] S5. The execution sequence is composed of one or more control sections and is described as a step-change waveform;

[0010] S6. The algorithm directory executes the main sequence by default and does not switch autonomously;

[0011] S7. Check the sequence and discharge sections at the beginning of each control cycle;

[0012] S8. An abnormality 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;

[0013] S9. Terminate the discharge at the end discharge point set in the main sequence or other execution sequences, and complete 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, and stop function.

[0015] Optionally, the step S2 specifically includes:

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

[0017] S202, using the script file to execute a set of starters to start the entire system;

[0018] S203, after the control cycle specified by the cycle element is parsed, it is saved in the framework process and used to maintain the control cycle during discharge. After the control task is executed in one control cycle, polling is performed to determine whether the time has reached the cycle. If the time has not reached, polling continues. If the time has reached, the next control cycle is entered.

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

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

[0021] S302, the loading element specifies the library file to be loaded, wherein 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, and 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 public functions provided by the framework; the loading service is used to provide services for collecting data, which 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 from the beginning of discharge and does not rely on configuration data; the directory contains one or more function members, which are used to specify the algorithms contained in the directory. The given algorithm 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 cycle;

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

[0025] Optionally, in step S4, an execution sequence is configured for each directory used on the user interface, wherein the main sequence is the default execution sequence, the main sequence uses an absolute timeline, and other sequences are used for exception handling and use a relative timeline, that is, the zero point on the timeline is actually the time to switch to the sequence, and each control directory maintains its own discharge sequence list and discharge paragraph list.

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

[0027] Optionally, the control section includes an algorithm belonging to the current control directory and all configuration data of the algorithm. The control section has a unique number and name to distinguish one from another when multiple sections using the same algorithm appear.

[0028] Optionally, in step S6, an event monitoring algorithm is responsible for switching the execution sequence, which monitors one or several indicators. When it reaches a preset threshold, the algorithm determines whether to terminate the discharge or switch to other sequence operations based on the set strategy, and publishes an event to the system framework. The process component receives the sequence list maintained by the event modification directory, and moves the data in the sequence relative to the timeline to convert it into actual time.

[0029] Optionally, in S7, the current discharge sequence list is checked, if the sequence number is different from that of the previous cycle, the sequence switching process is performed, if the sequence number is the same as that of the previous cycle, the current discharge segment number is detected, if the current segment number is different from that of the previous cycle, the segment switching process is performed, if the current segment number is the same as that of the previous cycle, the control algorithm corresponding to the previous segment is executed.

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

[0031] The present invention designs a dynamic configuration deployment solution, using a self-describing XML configuration file to specify metadata such as the operation cycle and library of each control directory or public service.

[0032] Lingshu is started according to a set of configuration files, and each control directory is bound to a CPU core to run at a specified priority, achieving dynamic configuration while ensuring real-time performance. The scheduling order when the algorithm is running is set on the user interface. Multiple execution sequences can be set, and the switching of sequences can be triggered by events during runtime to achieve exception handling.

[0033] The present invention ensures the real-time performance of the algorithm and supports flexible execution sequences, thereby making the deployment of the system itself faster and more flexible, easier to modify, and reducing the learning cost of users. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 A schematic diagram of a rapid deployment and scheduling method of a control algorithm of the present invention is provided;

[0035] Figure 2 A structural schematic diagram of an embodiment of the present invention is provided;

[0036] Figure 3 A structural schematic diagram of an embodiment of the present invention is provided;

[0037] Figure 4 A schematic diagram of the principle of the discharge phase inspection of the present invention is given. DETAILED DESCRIPTION

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

[0039] Example

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

[0041] 1. After the algorithm suitable for the plasma control framework is developed, it is compiled to obtain a dynamic library file. Figure 2As shown, the same algorithm may have multiple versions, and suffixes are added to the names to distinguish them. 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 develops algorithm code under the plasma control framework. The algorithm can implement seven interface functions supported by the framework as needed, namely:

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

[0044] 2) init: executed when each experimental configuration is released;

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

[0046] 4) execute: every control cycle is executed;

[0047] 5) exit: executed when phase exits;

[0048] 6) clean: executed at the end of each shot experiment;

[0049] 7) stop: executed when the system is shut down;

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

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

[0052] 2. Algorithms are deployed in units of algorithm directories, see Figure 2-Figure 3 ,Each algorithm directory uses an XML configuration file as shown below. XML is a hierarchical, sub-description general markup language that can be easily parsed by the launcher.

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

[0054] 2.2 Use the script file to execute a set of launchers to start the entire system, for example:

[0055] taskset-c4. / launcher--rt=CPU4-log=empty&

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

[0057] 2.3 The control period specified by the period element (hereinafter referred to as periods) is parsed and saved in the framework process. The control period is maintained during discharge. After the control task is executed in a control period, polling is performed to determine whether the time has reached periods. If the time has not reached, polling continues. If it has reached the time, the next control period is entered.

[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: organization name, CPU: the control directory sets affinity to bind to the CPU with a given number, and periods: specifies the execution period of the control directory in seconds. There is only one top-level element, and other configured elements are members of this top-level element.

[0060] 2) The loading element (hereinafter referred to as loading) specifies the library file to be loaded, where the address (path) 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.

[0061] 3) The component element is responsible for loading components in the environment where the algorithm runs and starting services to use some common functions provided by the framework. In particular, the loading service is used to provide data collection services, which provide the collected data to the algorithm based on the given signal list, data source and data type.

[0062] 4) The directory (hereinafter referred to as category) element is responsible for loading the control directory. It has a request element that indicates 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 from the beginning of discharge and does not rely on configuration data. The category contains one or more function members to specify the algorithms contained in the directory. The given algorithm must exist in the library specified by the loading element. There can be multiple category elements, which are executed sequentially in the control cycle.

[0063] 5) Archive (hereinafter referred to as archive) is a special category element responsible for archiving data. Each directory configuration file should configure a directory at the end to execute the archive algorithm.

[0064] 4. Use the launcher to call the configuration file in XML format, and then the specified control directory can be started according to the configuration. The process will occupy a 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, where the Primary sequence is the default execution sequence, which uses the absolute time axis, and other sequences are used for exception handling and use the relative time axis, that is, the zero point on the time axis is actually the time to switch to the sequence. Each control directory maintains its own discharge sequence list and discharge paragraph list.

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

[0067] 7. A control phase is the basic unit for executing a control algorithm. It includes an algorithm belonging to the current control directory and all configuration data for the algorithm. A control phase has a unique number and name to distinguish between multiple phases 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 handled by an abnormal monitoring algorithm. It monitors one or several indicators. When it reaches the preset threshold, the algorithm determines whether to terminate the discharge or switch to another sequence according to the set strategy. At the same time, an event is published to the system framework. The process component receives the sequence list maintained by the event modification directory and moves the data in the sequence relative to the time axis to convert it into actual time.

[0069] 9. The sequence and discharge section checks are performed at the beginning of each control cycle, i.e. Figure 1 The principle of the inspection is as follows: Figure 4 As shown, check the current discharge sequence list. If the sequence number is different from the previous cycle, the sequence switching process is performed. If the sequence number is not different from 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 not different from the previous cycle, execute the control algorithm corresponding to the previous segment.

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

[0071] The above specific embodiments are only several optional embodiments of the present invention. Based on the technical solutions of the present invention and the relevant inspirations 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: The following steps are involved: S1. Developing algorithm code under the plasma control framework so that the plasma control algorithm has multiple groups of interface functions supported by the plasma control framework, and compiling to obtain a dynamic library file; S2. Deploy algorithms in units of algorithm directories, each of which uses an XML configuration file; S3. Use the launcher to call the XML format configuration file and start the specified control directory according to the configuration; S4. Configure the execution sequence of each algorithm directory used through the user interface, wherein the main sequence of the execution sequence is responsible for the control of the system under normal conditions, and other execution sequences are responsible for the control of the system under specific abnormal conditions; S5. The execution sequence is composed of one or more control sections and is described as a step-change waveform; S6. The algorithm directory executes the main sequence by default and does not switch autonomously; S7. Check the sequence and discharge sections at the beginning of each control cycle; S8. An abnormality 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 discharge point set in the main sequence or other execution sequences, and complete the rapid deployment and scheduling of the control algorithm under the plasma control framework.

2. A method for rapid deployment and scheduling 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, and stop function.

3. The method for rapid deployment and scheduling of a control algorithm according to claim 1, characterized in that: The step S2 specifically includes: S201, the launcher uses the taskset instruction to deploy the program on the given CPU core according to the parsed CPU number, and loads the dynamic library using the indicated library name in the loading module; S202, using the script file to execute a set of starters to start the entire system; S203, after the control cycle specified by the cycle element is parsed, it is saved in the framework process and used to maintain the control cycle during discharge. After the control task is executed in one control cycle, polling is performed to determine whether the time has reached the cycle. If the time has not reached, polling continues. If the time has reached, the next control cycle is entered.

4. A method for rapid deployment and scheduling of a control algorithm according to claim 3, characterized in that: The step S3 specifically includes the following steps: S301, the top-level element namespace is responsible for specifying three attributes: name: organization name; CPU: this control directory sets affinity to bind to the CPU with a given number of this element to run; cycle: specifies the execution cycle 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 file to be loaded, wherein 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, and there can be multiple loading elements; S303, the component element is responsible for loading components in the environment where the algorithm runs and starting services to use the public functions provided by the framework; the loading service is used to provide services for collecting data, which 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 configuration from the user interface. If it is 1, the directory runs according to the configuration; if it is 0, the directory runs autonomously from the beginning of discharge and does not rely on configuration data; the directory contains one or more function members, which are used to specify the algorithms contained in the directory. The given algorithm 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 cycle; S305. Archiving is a special directory element used for data archiving. Each directory configuration file configures a directory at the end to execute the archiving algorithm.

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, wherein the main sequence is the default execution sequence, the main sequence uses an absolute time axis, and 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 to switch to the sequence, and each control directory maintains its own discharge sequence list and discharge paragraph list.

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

7. A method for rapid deployment and scheduling of a control algorithm according to claim 6, characterized in that: The control section includes an algorithm belonging to the current control directory and all configuration data of the algorithm. The control section has a unique number and name to distinguish between them when multiple sections using the same algorithm appear.

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

9. The method for rapid deployment and scheduling of a control algorithm according to claim 1, characterized in that: In S7, the current discharge sequence list is checked. If the sequence number is different from that of the previous cycle, the sequence switching process is performed. If the sequence number is the same as that of the previous cycle, the current discharge segment number is detected. If the current segment number is different from that of the previous cycle, the segment switching process is performed. If the current segment number is the same as that of the previous cycle, the control algorithm corresponding to the previous segment is executed.

Citation Information

Patent Citations

  • Plasma control system software development platform and method

    CN112181483A

  • BeeGFS high-availability configuration method and tool

    CN113961213A

  • Data sharing and communication collaboration method in plasma control system

    CN118051353A

  • Pre / post deployment customization

    US20180081702A1