IOC remote control system
Technical Field
The invention relates to the technical field of nuclear fusion, in particular to an IOC remote control system.
Background
The tokamak is a large-scale fusion experimental device which is formed by a plurality of subsystems. In the tokamak experiment process, different subsystems need to be effectively managed and scheduled, the exchange of data and commands among the subsystems is involved in the process, and meanwhile, experiment operation control personnel are required to be capable of timely mastering the operation state of each subsystem. If the communication protocol is independently defined for each subsystem to obtain the state information of the subsystem, the difficulty of later maintenance and expansion is extremely high.
The EPICS is an open-source software framework and provides a reliable platform for realizing a distributed control system. The IOC program in the software package is used as a server and is responsible for finishing specific input/output actions and local control tasks, and a channel access protocol is used for issuing self state information to the client or receiving instructions from the client from a network. For a fusion experimental device, the condition monitoring of subsystems and the sharing of operation data among the subsystems can be conveniently realized by using the IOC and the channel access protocol.
The user directly starts the IOC program through the script st.cmd under the default condition, but the method is inconvenient to do and the user needs to manually start the IOC program after starting the computer. If the IOC program is forgotten to run, the experimenter cannot monitor the running state of the system through EPICS.
Disclosure of Invention
The invention aims to provide an IOC remote control system, which enables an IOC program to automatically run in a background after being started, provides a remote control interface for a user and is convenient for the user to carry out centralized control and management on the IOC.
The invention is realized by the following technical scheme:
an IOC remote control system is characterized by comprising a terminal provided with a Linux operating system, wherein an IOC program, a procServ tool and a management-procs tool are arranged on the Linux operating system, and the procServ tool and the management-procs tool are used for realizing background operation and process management of the IOC program;
when the system works, a user accesses the Shell of the IOC program, and adds the IOC program as a subprocess of the procServ tool to a system service of a Linux operating system according to the management-procs tool, so that the IOC program can be automatically started after being started; and controlling the starting or stopping of the process of the IOC program by utilizing the management-procs tool.
Preferably, the system further comprises an IOC-manager program, wherein the IOC-manager program runs on each IOC server and is started together with the Linux operating system; when the IOC-manager program receives an HTTP request, the IOC-manager program remotely controls the process of the IOC program according to the HTTP request.
Preferably, the IOC-manager program is provided with an IOC management module, the IOC management module is provided with a plurality of subunits, and when the subunits are clicked, the program background sends a corresponding HTTP request to the IOC host according to an IP address of the IOC host.
Preferably, the subunits comprise a promoter subunit, a stop subunit and an application configuration subunit.
Preferably, when the sub-promoter unit is clicked, a program background sends a GET request to the corresponding IOC server, and after the IOC-manager program on the IOC server receives the GET request, the procServ tool is used to view the running state of the IOC program; if the IOC program is not started, starting the IOC program; and after the IOC program is successfully started, the user receives corresponding prompt information.
Preferably, when the application configuration subunit is clicked, the program background firstly modifies the state of the PV archiving storage according to the Archived attribute of the PV; then sending a request to the corresponding IOC host to enable the IOC-manager program to store the SDD in the database as a local JSON configuration file; then the IOC-manager program generates a db file of an EPICS IOC, a req file of an autosave module and a command script file of the IOC program by using the JSON configuration file; and finally restarting the IOC program to enable the new configuration file to take effect.
By default, the user directly starts the IOC program through the script st.cmd, and therefore the user needs to manually start the IOC program after starting up each time. If the IOC program is forgotten to run, the experimenter cannot monitor the running state of the IOC program through EPICS. Therefore, it is highly desirable for the experimenter that the IOC program is capable of self-starting at boot time. Based on this, after long-time research, the inventor designs the technical scheme of the application, so that the IOC program can automatically run in the background after being started, a remote control interface can be provided for a user, and the user can conveniently and centrally control and manage the IOC.
In the design process of the scheme, the inventor considers that the IOC process does not support to be directly put into the background operation through the nohup command, so a procServ tool is added, and the background operation and the process management of the IOC are realized in the Linux environment by using the procServ tool (the procServ is an open-source software tool which operates a process server in a background manner in a system service manner and is used for enabling the IOC by one sub-process). Meanwhile, an IOC-manager program of the Web server application program is written, and the IOC-manager program supports remote control over the process of the IOC program on the server through an HTTP protocol, so that a user can conveniently perform centralized control and management on the IOC program.
Compared with the prior art, the invention has the following advantages and beneficial effects:
in the scheme, a procServ tool is arranged, so that an IOC program can automatically run in a background after being started, and meanwhile, a Web server application program IOC-manager is written to provide a remote control interface for a user, so that the user can conveniently and centrally control and manage the IOC.
Drawings
The accompanying drawings, which are included to provide a further understanding of the embodiments of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the principles of the invention. In the drawings:
FIG. 1 is a schematic structural diagram of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to examples and accompanying drawings, and the exemplary embodiments and descriptions thereof are only used for explaining the present invention and are not meant to limit the present invention.
An IOC remote control system, as shown in fig. 1, includes a terminal installed with a Linux operating system, on which an IOC program, a procServ tool and a management-procs tool are installed, where the procServ tool and the management-procs tool are used to implement background operation and process management on the IOC program.
procServ is an open-source software tool that runs a process server in the background in a system-service fashion, and fork starts an IOC program with a sub-process. When the system works, a user accesses the Shell of the IOC program and combines a tool management-procs written by Python, the user can add an instance (sub-process) of procServ to the systemd system service of Linux, so that the IOC program is automatically started after being started; the user can also conveniently control the starting and stopping of the IOC process by using a series of commands provided by the management-procs, wherein the commands provided by the management-procs comprise:
creating a procServ instance newly by the manager-procs add, and adding the procServ instance into the system service;
the management-procs remove the procServ instance from the system service;
a scope-procs start starts a procServ instance;
the management-procs stop stops the procServ instance;
the management-procs status checks the status of all procServ instances.
Further, in the scheme, in order to realize remote control of the IOC program, based on a Spring Boot framework, a Web server application program IOC-manager is developed by using Java language, and the IOC-manager program runs on each IOC server and is started together with an operating system.
In the scheme, the ioc-manager program is used for monitoring a specific port, and the port receives an HTTP request from a client and executes a corresponding command according to the content of the request. For example, updating the configuration file of the IOC program, starting or stopping the IOC process, etc., thereby achieving the purpose of remote control. Under a Linux operating system, an IOC-manager program indirectly controls the progress of an IOC program by using a procServ tool; under the Windows operating system, the IOC program is directly operated by the process name.
It should be noted that the port is not unique and can be specified according to actual requirements.
Fig. 1 shows a basic architecture of a complete configuration at an IOC host (using Linux as an example) side, in this embodiment, an IOC-manager program and a procServ tool have been used to implement a remote control interface of an IOC process, and the IOC program can be remotely controlled only by sending an HTTP request to the IOC-manager program on the IOC host.
In addition, in order to control and manage the IOC program, an IOC management module is arranged on the IOC-manager program, and the IOC management module is provided with three subunits: a promoter unit, a stop subunit and an application configuration subunit. When a user clicks any subunit, the program background sends a corresponding HTTP request to the IOC host according to the IP address of the IOC host.
Specifically, when a user clicks a promoter unit, a program background sends a GET request to a corresponding IOC server; after receiving the request, an IOC-manager on the IOC server checks the running state of the IOC program by using a procServ tool, and if the IOC program is not started, the IOC program is started; after the IOC program is successfully started, the user receives a corresponding prompt.
When a user clicks the stop subunit, the program background sends a GET request to the corresponding IOC server, an IOC-manager on the IOC server receives the request, and then checks the running state of the IOC program by using a procServ tool, and if the IOC program is not closed, the IOC program is closed.
When a user clicks an application configuration subunit, a program background firstly modifies the PV filing storage state according to the Archived attribute of the PV; then sending a request to a corresponding IOC host, and storing the SDD in the database as a local JSON configuration file by an IOC-manager program; then, the IOC-manager program generates a db file of the EPICS IOC, a req file of the autosave module and a command script file of the IOC program by using the JSON configuration file; and finally restarting the IOC program to enable the new configuration file to take effect.
In the application, the program background is a web backend program for managing the IOC.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.