A control and data acquisition system for a synchrotron radiation light source experimental station

By designing standard modules of distributed general architecture and unified interfaces, the compatibility problems of EPICS and non-EPICS systems in the synchronous radiation light source experimental station are solved, and complex scanning and efficient data processing of multi-axis and multi-detectors are realized, which improves the experimental station's Level of automation and intelligence.

CN118746954BActive Publication Date: 2024-11-08SHANGHAI ADVANCED RES INST CHINESE ACADEMY OF SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411231040.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-04
Publication Date
2024-11-08
Estimated Expiration
2044-09-04

AI Technical Summary

Technical Problem

The existing synchronous radiation light source experimental station control and data acquisition system are not compatible with EPICS and non-EPICS underlying controls, resulting in difficulties in compatibility and synchronization between multiple experimental methods, making it difficult to realize complex scanning of multi-axis and multi-detectors. The system lacks unified interface and systematic accumulation, and the upgrade iteration efficiency is low.

Method used

A distributed general architecture was designed, including the device layer, the control layer, the data acquisition layer and the human-computer interaction layer. The experimental equipment and control logic are encapsulated into standard modules with unified interfaces through the device abstraction module and the experimental logic abstraction module to realize Compatibility between EPICS and non-EPICS systems, and uses Python language and asynchronous concurrency technology to complete multitasking.

Benefits of technology

It realizes compatibility and synchronization of multiple experimental methods, supports complex scanning of multi-axis and multi-detectors, improves the automation and intelligence level of the system, provides graphical user interface and command line interaction, and improves scientific research on the experimental station. Results output capacity and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118746954B_ABST
    Figure CN118746954B_ABST
Patent Text Reader

Abstract

The present invention provides a control and data acquisition system for a synchrotron radiation light source experimental station, comprising a distributed general architecture installed on a computing device and experimental equipment of a synchrotron radiation light source, wherein the general architecture comprises an equipment layer, a control layer, a data acquisition layer and a human-computer interaction layer; the data acquisition layer comprises a scheduling module, an equipment abstract module connected to the scheduling module, an experimental logic abstract module, an experimental data storage module, a data visualization module and a GUI interface module; the equipment abstract module and the experimental logic abstract module respectively abstractly encapsulate the experimental equipment and the control logic of the experimental equipment into inheritable standard modules of different granularities according to their commonality, store the standard modules corresponding to the experimental equipment into a module library, and the scheduling module schedules different modules to generate experimental data. The system of the present invention is compatible with EPICS and non-EPICS bottom-level controls, improves versatility, and is suitable for synchrotron radiation light source lines and stations under construction and already built.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of synchrotron radiation light sources, and the present invention relates to a control and data acquisition system for a synchrotron radiation light source experimental station, which is implemented based on a general architecture. Background Art

[0002] A synchrotron radiation source is an artificial light source. It is an electromagnetic wave emitted along the tangent direction of the motion of free electrons moving at speeds close to the speed of light in a magnetic field. As their motion state (speed and direction) changes, synchrotron radiation is named after the electron synchrotron accelerator on which it was first discovered. Its energy range covers a continuous spectrum from infrared to hard X-rays. Synchrotron radiation sources have gone through three generations of development, and the new generation of advanced synchrotron radiation sources will provide higher spatial, temporal, energy and dynamic resolution, greatly improving the exploration capabilities in multiple research fields such as energy science, environmental science, materials science, life science and earth science.

[0003] The control and data acquisition system of the Advanced Synchrotron Radiation Light Source Experiment Station is an important technical system, which is a bridge between the line station researchers, users and synchrotron radiation large scientific facilities. The Advanced Synchrotron Radiation Light Source Experiment Station has a variety of equipment, such as sample stages, manipulators, automatic sample changers, various detectors, etc. The experimental methods are also rich and complex. Taking the Shanghai Light Source as an example, there are four major categories (spectroscopy, diffraction / scattering, imaging, time resolution) and about 100 experimental methods.

[0004] At present, there are two mainstream systems for experimental station control in the world: Experimental Physics and Industrial Control System (EPICS) and TANGO. Based on the experimental station control system of EPICS and TANGO, different experimental station data acquisition systems have been developed. In addition to EPICS and TANGO, the underlying control of synchrotron radiation sources is also based on LabVIEW, C, C++, Python, etc.

[0005] For example, the National Synchrotron Light Source-II (NSLS-II) in the United States independently developed the Python-based open source Bluesky architecture. Bluesky assists beamline staff to implement complex experimental procedures without knowing much about the underlying control or data, and allows different beamlines to share as much software as possible to complete common tasks, such as one-dimensional motor scanning, multi-dimensional motor scanning, visualization or integrated images, etc., and has been applied to multiple beamlines of NSLS-II. However, Bluesky's underlying control is based on EPICS and is only applicable to experimental stations with EPICS underlying control.

[0006] Based on Bluesky, HEPS in China developed a full life cycle software framework system called Mamba, but Mamba is not open source.

[0007] In addition, the data acquisition and storage system of the British light source Diamond Light Source (DLS) adopts the self-developed DAWN / GDA architecture, which is based on Java development and requires a large development team.

[0008] European light sources such as ESRF, Soleil, DESY, and MAX IV have jointly developed the open source Sardana data acquisition software architecture based on Python and Tango, which is suitable for the underlying control of Tango-based systems.

[0009] The existing general experimental station control and data acquisition architecture usually has the following disadvantages: it is only compatible with EPICS or only compatible with non-EPICS; and it cannot realize complex scanning of multiple axes and multiple detectors. Specifically, there is currently no system based on a general architecture in the world that is not limited by the underlying control and is applicable to any experimental station of a synchrotron radiation source.

[0010] In addition to improving the experimental capabilities of synchrotron radiation facilities as much as possible, another important development direction of contemporary synchrotron radiation facilities is to improve the comprehensive research capabilities of synchrotron radiation facilities, especially to provide solutions for combining multiple experimental methods to achieve specific research goals. This can solve the problem that a single experimental characterization technology cannot obtain multi-dimensional information of the research system, thereby improving the overall research level. A typical example is the combined use of spectroscopy and diffraction methods. The combination of these two methods can simultaneously obtain short-range ordered information such as the local structure and valence state of the absorbing atoms in the sample and long-range structural information such as the physical phase. This information is completely complementary. The combined use of spectroscopy and diffraction methods is of great value to research fields such as materials, chemistry, and the environment. In particular, the dynamic system that needs to be studied is a multi-dimensional co-evolution process of the local structure of the active site and the long-range ordered structure, which requires the combined characterization of multiple in-situ experimental techniques.

[0011] Conventional characterization methods are to conduct independent tests in a variety of different in-situ experiments. The information obtained in this way is not from the same site of the sample, and the reaction process is not synchronized. The information obtained in this way is often contradictory. Therefore, the development of spectroscopy, diffraction and other methods combined can simultaneously obtain multi-dimensional evolution information such as the local structure around the absorbing atoms, valence state and long-range ordered structure of the system in the same dynamic process.

[0012] The biggest difficulty in combining multiple experimental methods lies in the incompatibility of the experimental method control and data acquisition systems. For example, spectroscopy methods usually use EPICS or LabVIEW programs, while diffraction usually uses SPEC test programs, and imaging and other methods often use Windows-based VC programs. Therefore, there are great difficulties in compatibility between multiple methods, especially under ultrafast time resolution conditions, where there are great obstacles to mutual compatibility and synchronization.

[0013] Therefore, it is necessary to develop an experimental station control and data acquisition system based on a universal architecture to be compatible with EPICS and non-EPICS underlying controls, improve the equipment compatibility in application fields where multiple experimental methods are used in combination, and be applicable to synchrotron radiation light source lines under construction and already built, to ensure the formation of systematic accumulation within the light source, accelerate the efficiency of experimental station function upgrades and iterations, improve the integration of experimental station control and data acquisition, thereby improving the level of automation, intelligence and user-friendliness, and ultimately improve the scientific research results output capacity and efficiency of large scientific facilities. Summary of the invention

[0014] The purpose of the present invention is to provide a control and data acquisition system for a synchrotron radiation light source experimental station, which is compatible with EPICS and non-EPICS underlying control, improves versatility, and is applicable to synchrotron radiation light source lines and stations under construction and already built.

[0015] In order to achieve the above-mentioned purpose, the present invention provides a control and data acquisition system for a synchrotron radiation light source experimental station, comprising a distributed general architecture installed on a computing device and experimental equipment of a synchrotron radiation light source that is communicatively connected to the computing device, wherein the distributed general architecture comprises: a device layer, comprising a driver for the experimental equipment; a control layer, comprising an EPICS system and a non-EPICS system; a data acquisition layer, comprising a scheduling module, a device abstraction module connected to the scheduling module, an experimental logic abstraction module, an experimental data storage module, a data visualization module and a GUI interface module; and a human-computer interaction layer, communicatively connected to a keyboard and a screen of the computing device, comprising a command line module and a GUI interface module, so as to realize human-computer interaction through the command line and the GUI interface; wherein the device abstraction module is configured to: abstractly encapsulate the experimental equipment into inheritable standard modules of different granularities according to their commonalities, and store the standard modules corresponding to the experimental equipment in a device module library; all experimental equipment are at least divided into motor class and detector class; the standard module of the device abstraction module is used to realize the standardized abstraction of all experimental equipment, so as to be called by the scheduling module and inherited by other standard modules; The experimental logic abstract module is set as follows: the control logic of the experimental equipment corresponding to the experimental method for obtaining experimental data is abstracted in a standardized manner according to its commonalities, encapsulated into inheritable standard modules of different granularities, and the standard modules corresponding to the control logic are stored in the experimental module library; all experimental methods are divided into at least scanning and counting categories; the standard modules of the experimental logic abstract module are used to support various scanning and counting functions for the scheduling module to call and for inheritance by other standard modules; the scheduling module is set as follows: downward to realize the scheduling of the experimental equipment in the device module library and the control logic of the experimental module library, and upward to call the user needs from the human-computer interaction layer to trigger the experiment, monitor the experimental status, and generate experimental data.

[0016] All experimental equipment inherits the standard module of the scheduling interface class during the process of encapsulation into standard modules. The standard module of the scheduling interface class defines the interface for scheduling. Therefore, the standard module abstracted by the experimental equipment encapsulation has a unified interface; and the standard modules of the counting class and the scanning class abstracted by the abstract encapsulation in the experimental logic abstract module respectively have corresponding unified interfaces.

[0017] The standard module is a Python class; the device abstract module is configured to abstract and encapsulate the experimental equipment into inheritable standard modules of different granularities according to their commonalities in the following manner:

[0018] Step A1: Encapsulate the scheduling-related definitions and properties in the scheduling interface class;

[0019] Step A2: abstract the common definitions and attributes related to the hardware objects into the hardware abstract object class;

[0020] Step A3: abstract the common definitions and properties of the experimental equipment into the equipment commonality class, and the equipment commonality class inherits the hardware abstract object class and the scheduling interface class;

[0021] Step A4: Divide the experimental equipment into motor class and detector class, abstract the common definitions and attributes of the motor class in, and abstract the common definitions and attributes of the detector class in the detector class, and both the motor class and the detector class inherit the equipment common class;

[0022] Step A5: Further encapsulate the motor-type and different detector-type experimental equipment into categories of different granularities according to their commonalities, abstract the common definitions and attributes of each category into the standard module corresponding to the category, and the large-granularity standard module inherits the small-granularity standard module.

[0023] The step A5 comprises:

[0024] Step A51: abstracting basic motion-related parameters into a basic motion parameter class, wherein the basic motion parameter class inherits the hardware abstract object class, and the motor class inherits the basic motion parameter class;

[0025] Step A52: abstracting the common definitions and properties of complex motors into a multi-motor class; and / or

[0026] The common definitions and properties of detectors with different usage modes are encapsulated, and the detector class is inherited to finally form the corresponding detector class.

[0027] The device abstraction module is further configured to: abstractly encapsulate the state of the experimental device into inheritable standard modules of different granularities according to its commonality, and store them in the device module library;

[0028] The states of experimental equipment are abstractly encapsulated into inheritable standard modules of different granularities according to their common characteristics, including:

[0029] Step B1: abstract the basic state parameters shared by the hardware into the basic state parameter class;

[0030] Step B2: abstract the device status parameters common to the experimental devices into the device status class, and the device status class inherits the basic status parameter class;

[0031] Step B3: abstract the subscription status parameters common to the experimental devices into the subscription status class, and the subscription status class inherits the device status class;

[0032] Step B4: Divide the experimental equipment into motor class and detector class, abstract the common state parameters of the motor class in the motor state class, and the motor state class inherits the subscription state class.

[0033] The experimental logic abstract module is configured to abstractly encapsulate the control logic of the experimental equipment corresponding to the experimental method for obtaining experimental data into inheritable standard modules of different granularities according to their commonality in the following manner:

[0034] Step C1: Divide the control logic of the experimental equipment into a counting class and a scanning class, abstract the common definitions and attributes of the counting class in the standard module of the counting class, and abstract the common definitions and attributes of the scanning class in the standard module of the scanning class;

[0035] Step C2: further divide the scanning category into step scanning and flight mode scanning; encapsulate the single-axis single-detector step scanning, multi-axis single-detector step scanning, single-axis multi-detector step scanning, and multi-axis multi-detector step scanning using the standard module of the scanning category; among them, the multi-axis single-detector step scanning, the single-axis multi-detector step scanning, and the multi-axis multi-detector step scanning use the device abstract module to encapsulate multiple experimental devices to obtain the standard module of the single motor category and the standard module of the single detector category, so as to convert the step scanning into the single-axis single-detector step scanning, and then use the standard module of the scanning category to realize the encapsulation; and / or

[0036] Step C3: further divide the scanning class into linear scanning and two-dimensional scanning; abstract the common definitions and attributes of linear scanning in the standard module of the linear scanning class; abstract the common definitions and attributes of two-dimensional scanning in the standard module of the map scanning class, and the standard modules of the linear scanning class and the map scanning class inherit the standard module of the scanning class.

[0037] The device abstraction module is connected to the EPICS system through the EPICS compatible module and to the non-EPICS system through the non-EPICS compatible module;

[0038] The EPICS compatible module has a PyEpics interface, through which the EPICS CA protocol of the EPICS system is called, the CA library of the EPICS system is accessed, and communication and control of each PV of the EPCIS are realized;

[0039] The non-EPICS compatible module includes an EPICS control program in a control layer implemented based on non-EPICS hardware compatible technology, an interface for EPICS channel access of a non-EPICS system implemented based on non-EPICS software compatible technology, a Python-based device driver located in a device layer and a matching control program located in a control layer, and a wrapper for a non-EPICS system located in a data acquisition layer;

[0040] The non-EPICS compatible module implements compatibility between the non-EPICS system and the EPICS system in the order of priority of utilizing the interface for EPICS channel access of the non-EPICS system, utilizing the wrapper of the non-EPICS system, developing the EPICS control program in the control layer, developing the device driver in the device layer and the supporting control program in the control layer.

[0041] The scheduling module uses Python's threading library to implement concurrent operations in the same process, and uses the asyncio library in Python to implement asynchronous concurrency and interrupt processes, so as to complete multi-tasking by using coroutine cooperation.

[0042] The input of the scheduling module is a Python variable, and the output is experimental data with a format definition, and the specific form of the format definition is the metadata corresponding to the experimental data;

[0043] The data visualization module is configured to: receive experimental data and metadata to achieve real-time plotting of experimental data;

[0044] The experimental data storage module is configured to receive experimental data and metadata to achieve data storage.

[0045] The command line module is developed based on Python; the GUI interface module is implemented based on one of PyQt and CS-Studio.

[0046] In summary, the control and data acquisition system of the synchrotron radiation light source experimental station of the present invention changes the current situation that the control and data acquisition system of each line station of the synchrotron radiation light source is developed independently, has no general solution, no unified interface, no systematic accumulation, slow upgrade iteration, low integration, low automation and intelligence level. The control and data acquisition system of the synchrotron radiation light source experimental station of the present invention changes from the perspective of experimental method to the perspective of control, and realizes the universal technical solution by being compatible with EPICS underlying control, compatible with non-EPICS underlying control, equipment and control logic abstraction; the commonality of experimental equipment and control logic is encapsulated into inheritable standard modules with unified interfaces of different granularities, and the standard modules of experimental equipment and control logic are obtained, which are suitable for any line station. The present invention realizes the storage of metadata and experimental data, data visualization, complex scanning of multiple axes and multiple detectors, and the cooperation of coroutines to complete multiple tasks, and provides two human-computer interaction modes: graphical user interface (GUI) interface and command line. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 It is an overall structural diagram of the general architecture of the control and data acquisition system of a synchrotron radiation light source experimental station according to an embodiment of the present invention.

[0048] FIG2 is a classification diagram of experimental methods of synchrotron radiation sources.

[0049] FIG3 is a classification diagram of the experimental equipment at the synchrotron radiation light source beamline station.

[0050] Figure 4 It is a classification diagram of the control logic of experimental equipment at the synchrotron radiation light source beamline station.

[0051] FIG5 is a device abstract specification diagram of the device abstract module of the control and data acquisition system of the synchrotron radiation light source experimental station.

[0052] Figure 6 It is the control logic abstract specification diagram of the experimental logic abstract module of the control and data acquisition system of the synchrotron radiation light source experimental station.

[0053] Figure 7 This is a schematic diagram of the human-computer interaction interface implemented based on CS-Studio. DETAILED DESCRIPTION

[0054] The present invention is further described below in conjunction with specific examples. It should be understood that the following examples are only used to illustrate the present invention and are not used to limit the scope of the present invention.

[0055] like Figure 1 The figure shows the overall structure of the control and data acquisition system of the synchrotron radiation light source experimental station according to one embodiment of the present invention. The control and data acquisition system of the synchrotron radiation light source experimental station of the present invention (named as Jasmine system) includes a distributed general architecture installed on a computing device and an experimental device of a synchrotron radiation light source that is communicatively connected to the computing device, such as Figure 1 As shown, the distributed general architecture includes a device layer 100, a control layer 200, a data acquisition layer 300, and a human-computer interaction layer 400, which are arranged in sequence from the bottom layer to the upper layer, and the core is the data acquisition layer 300 developed based on the Python language.

[0056] The specific contents of the distributed general architecture are:

[0057] (1) Equipment layer 100

[0058] Based on the control concept and common functions, the equipment layer divides the various experimental equipment of synchrotron radiation light sources into two categories: motor equipment and detector equipment. Motor equipment realizes the spatial attitude adjustment of the equipment, and detector equipment completes the experimental data collection. The equipment layer includes the driver program of the experimental equipment.

[0059] (2) Control layer 200

[0060] The control layer 200 includes an EPICS system 201 and a non-EPICS system 202, wherein the non-EPICS system includes an underlying control system based on one of LabView, C, C++, and Python. The control layer 200 is configured to control each experimental device based on the EPICS system 201 or based on the non-EPICS system 202.

[0061] (3) Data acquisition layer 300

[0062] The data acquisition layer 300 includes a scheduling module 301 , a device abstraction module 302 connected to the scheduling module 301 , an experiment logic abstraction module 303 , an experiment data storage module 304 , a data visualization module 305 and a GUI interface module 306 .

[0063] The device abstraction module 302 is configured as follows: abstractly encapsulate the experimental equipment into inheritable standard modules of different granularities according to their commonalities (motor-type equipment, detector-type equipment), and store the standard modules corresponding to the experimental equipment into the device module library; the standard modules are used to implement the standardized abstraction of all experimental equipment, so as to be called by the scheduling module 301 and inherited by other standard modules.

[0064] The experimental logic abstraction module 303 is configured to: abstract the control logic of the experimental equipment corresponding to the experimental method to obtain the experimental data in accordance with its commonality, encapsulate it into inheritable standard modules of different granularities, and store the standard modules corresponding to the control logic into the experimental module library; the standard modules are used to implement and support various scanning and counting functions, so that the scheduling module 301 can call them and other standard modules can inherit them. Various scanning and counting functions include multiple (or single) motors, multiple (or single) detectors, and complex (or simple) scanning and / or counting functions.

[0065] The output data of the device abstraction module 302 and the experimental logic abstraction module 303 are Python classes.

[0066] The scheduling module 301 is configured to: schedule the experimental equipment of the equipment module library and the control logic of the experimental module library downward, and call the user requirements from the human-computer interaction layer 400 upward to trigger the experiment, monitor the experimental status, and generate experimental data. The experimental data includes the motor position, detector measurement value, and other data obtained during the user experiment.

[0067] The scheduling module 301 uses Python's threading library to implement concurrent operation in the same process, and uses the asyncio library in Python to implement asynchronous concurrency and interrupt processes, so as to use coroutines to complete multiple tasks and adapt to the different needs of beamline stations.

[0068] The input of the scheduling module 301 is a Python variable, and the output is experimental data with format definition. The specific form of the format definition is the metadata corresponding to the experimental data, and the metadata is generated by the scheduling module 301. Metadata in Python is data used to describe data, which can be used for various purposes, such as function parameter information, class attributes, software package version information, etc. In the present invention, metadata is used to describe the unit, precision, meaning, etc. of the acquired data value.

[0069] The data visualization module 305 is configured to receive experimental data and metadata to realize real-time drawing of experimental data. The data visualization module 305 is implemented using the matplotlib library. After the experiment starts, the scheduling module passes the experimental data and metadata to the drawing function of the matplotlib library and completes the real-time visualization of the data. Therefore, the input of the data visualization module 305 is the experimental data, and the output is an image to display the experimental data in real time.

[0070] The experimental data storage module 304 is configured to receive experimental data and metadata to achieve data storage. During the experiment, the scheduling module 301 will generate a data stream of experimental data and metadata (i.e., experimental data with format definition), which flows into the experimental data storage module 304 and is stored in a document of a user-defined type.

[0071] The experimental data storage module 304 provides a variety of file formats for storing experimental data and metadata, such as CSV, Excel or TIFF file formats; the experimental data storage module 304 can use the to_csv function or to_excel function provided by Python to store the data into a CSV file or Excel file respectively. In addition, the data can also be stored in a HDF5 (Hierarchical Data Format version 5) file by calling the h5py library. In addition, the "Metadata and Experimental Data Storage Standard and Module" also provides file formats such as txt.

[0072] (4) Human-computer interaction layer 400

[0073] The human-computer interaction layer 400 is connected to the keyboard and screen of the computing device, and includes a command line module 401 and a GUI interface module 402, so as to realize human-computer interaction through the command line and the GUI interface. The GUI interface module 402 facilitates user operation.

[0074] The command line module 401 is developed based on Python. Users can use IPython to input command lines to interact with the scheduling module 301, but the core functions do not depend on IPython, and all important functions can be run from ordinary Python scripts.

[0075] The GUI interface module 402 can be implemented based on one of the two softwares: PyQt and CS-Studio.

[0076] like Figure 7 As shown, if the GUI interface module 402 is developed based on CS-Studio, the input is the Python operating environment and script corresponding to the experimental data. It is necessary to execute "xterm -e" and another pop-up window to use the IPython running program to start the experiment and implement drawing. The output is a running status pop-up window and an image pop-up window.

[0077] For example, the GUI interface module 402 is developed based on PyQt and its derivative software, and its input is the Python variable corresponding to the experimental data, and the output is the callback function of Python. As a result, the GUI interface can display the experimental data and status in real time. PyQt provides a matplotlib plug-in so that the output results of the data visualization module 305 are integrated in the GUI interface. The interface between the data visualization module 305 and PyQt is: after the experiment is started, the scheduling module 301 organizes the metadata and experimental data in a specified but flexible manner by a Python dictionary, and passes the obtained Python variables to a function list (these functions are called callback functions callbacks), wherein the callback function contains the drawing function of the matplotlib library corresponding to the data visualization module 305. The interface between the data visualization module 305 and the human-computer interaction layer is realized based on the dictionary and callback mechanism.

[0078] Since the core of the present invention is the data acquisition layer 300 , the specific composition of each module of the data acquisition layer 300 will be described in detail below.

[0079] The device abstraction module 302 is connected to the EPICS system 201 through the EPICS compatible module 307, and is connected to the non-EPICS system 202 through the non-EPICS compatible module 308. Therefore, the input data of the device abstraction module 302 are various PVs (Parameter Values) from the EPICS compatible module 307, and various PVs or Python variables from the non-EPICS compatible module 308, and the output data are all Python classes.

[0080] The EPICS compatible module 307 is configured as follows:

[0081] International mainstream control software includes two categories: EPICS and Tango. Among them, the EPICS system is a set of collaboratively developed open source software tools, libraries and applications, which are used worldwide to create distributed soft real-time control systems for scientific instruments (such as particle accelerators, telescopes and other large scientific experiments). Domestic large scientific facilities mostly use the EPCIS system to implement underlying control. The EPICS system exchanges data through the Channel Access (CA) mechanism and uses a distributed dynamic database to record frequently changing input / output data. The basic unit of each record is called a process variable (PV). The attributes of each record are defined by the field of the process variable. For example, the most basic field 'VAL' represents the value of PV.

[0082] The EPICS system has an EPCIS CA library and provides EPCIS CA library access interfaces for various high-level languages. The EPCIS CA library access interfaces are located in the control layer and face the data acquisition layer. For example, the EPICS system provides interfaces CA_Lab with LabVIEW, CAJ / JCA with JAVA, PyEpics, Cothread, and p4p with Python, aioca with Python and asyncio, pvaPy with Python and Conda, ca_matlab with Matlab, MatlabCA with Matlab and GNU Octave, EZCA with C / C++, CAP5 with Perl, and PHP_EPICS with PHP-based web applications.

[0083] In the present invention, since the data acquisition layer 300 is developed based on the Python language, the EPICS compatible module 307 has a PyEpics interface, through which the EPICS CA protocol of the EPICS system is called, the CA library of the EPICS system is accessed, and communication and control of each PV of EPCIS are realized, thereby completing compatibility with the underlying control of EPCIS.

[0084] The settings of the non-EPICS compliant module 308 are as follows:

[0085] The non-EPICS compatible module 308 is used to be compatible with non-EPICS systems, and being compatible with non-EPICS systems will further ensure the versatility of the present invention. In addition to the EPICS system, there are many types of underlying control of synchrotron radiation light source equipment, such as underlying control systems based on LabVIEW, C, C++, Python, etc. The non-EPICS compatible module 308 of the present invention uses non-EPICS hardware compatible technology and non-EPICS software compatible technology to enable the device abstract module 302 to access the non-EPICS system through the non-EPICS compatible module 308, thereby substantially integrating the non-EPICS system control into the EPICS system.

[0086] In the present invention, the non-EPICS compatible module 308 includes the EPICS control program in the control layer 200 implemented based on the non-EPICS hardware compatible technology (corresponding to "non-EPICS hardware compatible"), and the interface for EPICS channel access of the non-EPICS system 202 implemented based on the non-EPICS software compatible technology (corresponding to "using the interface"), the Python-based device driver located in the device layer 100 and the supporting control program developed based on Python located in the control layer 200 (corresponding to "development driver"), and the wrapper of the non-EPICS system 202 located in the data acquisition layer 300 (corresponding to "using Python IOC"). Therefore, the non-EPCIS software compatible technology can be divided into three means: "using the interface", "development driver" and "using Python IOC".

[0087] Among them, the "non-EPICS hardware compatibility" technology refers to starting from the hardware perspective, using the communication protocol to redevelop the EPICS control program in the control layer 200 to be compatible with non-EPICS from the hardware level, and the established EPICS control program can be a part of the EPICS system 201. EPICS supports bus types such as VME, IPAC, GPIB, RS-232, Ethernet, Ethernet-GPIB, VXI, VME64x-IPAC, Modbus / TCP (Linux), and VME-Bitbus.

[0088] The synApps package of EPICS provides or is compatible with communication-related modules: Asyn module, StreamDevice module, Modbus module. For experimental equipment with multiple different detector types and motor types, the same Asyn module, StreamDevice module or Modbus module may be used to establish an EPICS control program.

[0089] The Asyn module is a general tool for connecting device-specific code to low-level communication drivers, supporting blocking and non-blocking communication, and supporting experimental devices based on "register" and "message" communication. The Asyn module has multiple submodules, such as asynDriver, asynPortDriver, asynPortClient, asynRecord, asynManager, etc. The Asyn module defines standard interfaces so that device-specific code can communicate with multiple port drivers. These standard interfaces are provided by two submodules (asynCommon, asynDrvuser). AsynCommon is an interface that all low-level drivers must implement, and the implementation methods include: reporting the status of the port, connecting to the port or device, and disconnecting from the port or device. AsynDrvuser is an interface used to implement communication from device support to the driver, and the device support does not know any details of the transfer; in addition to the standard interface, Asyn also provides one or more interfaces for implementing message-based and / or register-based communication.

[0090] The StreamDevice module supports experimental equipment based on the "byte stream" communication interface (devices controlled by sending and receiving strings), and the "byte stream" communication interface includes serial ports (RS-232, RS-485...), IEEE-488 (also known as GPIB or HP-IB), and network ports (TCP / IP). The StreamDevice module is not limited to specific device types and manufacturers, and does not require recompiling anything to support new device types. Each record supported by the StreamDevice module can run a protocol for reading or writing values. The protocol can be as simple as only one output string, or it can consist of multiple strings such as sending and reading. The StreamDevice module comes with an asynDriver interface that can be extended to other bus drivers. The StreamDevice module converts record values ​​into strings and passes them to asynDriver to exchange these characters with the device. StreamDevice is a supplement to asynDriver.

[0091] The Modbus module supports EPICS control programs to communicate with Programmable Logic Controllers (PLCs) via TCP, serial RTU and serial ASCII links. EPICS control programs are distributed structures, and the Modbus module is located between the standard EPICS asyn module support and the TCP / IP or serial port driver of the EPICS asyn module.

[0092] The control and data acquisition system of the synchrotron radiation light source experimental station of the present invention adopts a distributed structure. The experimental equipment used by the synchrotron radiation light source is included in the lowest equipment layer. The experimental equipment has various communication modes with the outside world. From the perspective of bus / communication protocol, the experimental equipment can be divided into those based on VME, GPIB, IPAC, PCI, PCIe-IPAC, VME64x-IPAC, Ethernet, Ethernet-GPIB, RS-232, VME-Bitbus, VME-VXI, TCP / IP, IOC-DSO, IPAC-CAN, IPAC-RS-232, AB1794, Group3, VME-Group3, USB, IOC-PC / 104, ARM IOC, VXI, IOC-CAN, CAN, ISA-IPAC, PCI, CameraLink, Firewire, CAMAC, PXI, GigE, PMC, Ethernet SNMP, IOC-Arduino, TTL, CPIC, PXI, IOC-CPCI, etc. Therefore, the present invention utilizes the "non-EPICS hardware compatibility" approach to be compatible with non-EPICS systems, which refers to redeveloping the EPICS control program based on the bus / communication protocol using the communication protocol.

[0093] “Using an interface” means that the non-EPICS system 202 uses an existing interface or a self-developed interface to implement the channel access mechanism of EPICS, thereby integrating the non-EPICS system 202 into the EPICS system 201. The existing interface or the self-developed interface is located in the control layer 200.

[0094] The interface for EPICS channel access of non-EPICS system 202 mostly relies on user's own development, for example: LabCA, the interface for Matlab and Scilab to call EPICS developed by LAC (Stanford Linear Accelerator Center) National Accelerator Laboratory, and CaChannel, the interface for EPICS to access Python first developed by Geoff Savage.

[0095] "Development driver" is to redevelop the device driver and supporting control program based on Python language. The device driver is a lower-level code than the control program, and the control program is located above the device driver. Generally, for a product, the manufacturer will provide a driver, but not necessarily a suitable control program. It can be considered that the device driver is located in the device layer 100, and the control program is located in the control layer 200. If the device layer 100 lacks a driver, you need to develop the device driver based on Python language and then develop the supporting control program.

[0096] "Using PythonIOC" means that the non-EPICS system 202 builds a wrapper of the non-EPICS system 202 based on the existing EPICS module (such as PCASpy) to complete the low-level Python binding with the EPICS CA server and the high-level Python hardware abstraction. The wrapper of the non-EPICS system 202 is located at the data acquisition layer.

[0097] Among them, the PCASpy module allows running EPICS IOCs with Python device support in the Python interpreter. Using the PCASpy module, developers can write and run EPICS IOCs in a Python environment, which can control actual hardware devices with Python support. In addition to the PCASpy module, there are also pyhtonSoftIOC modules, python-ioc modules, etc.

[0098] The non-EPICS compatible module 308 implements the compatibility of the non-EPICS system 202 with the EPICS system 201 in the order of priority of utilizing the interface for EPICS channel access of the non-EPICS system 202, utilizing the wrapper of the non-EPICS system 202, developing the EPICS control program in the control layer 200, and developing the device driver located in the device layer 100 and the matching control program located in the control layer 200.

[0099] Specifically, for a single experimental device, when its corresponding underlying control system is a non-EPICS system 202 and there is an available developed interface between the non-EPICS system 202 and EPICS, or when one is willing to invest a great deal of effort in software development to form an interface, the interface of the non-EPICS system 202 for EPICS channel access is preferentially used;

[0100] If "using the interface for EPICS channel access of the non-EPICS system 202" cannot be implemented, or when facing a large two-dimensional surface detection with a huge amount of data, the wrapper of the non-EPICS system 202 is preferably used;

[0101] If neither of the above can be implemented (i.e., there is no available developed interface to EPICS, and no wrapper for the non-EPICS system 202 exists), then the EPICS control program in the control layer 200 is developed first;

[0102] If the above three cannot be implemented, then a device driver located in the device layer 100 and a matching control program located in the control layer 200 are developed.

[0103] The principles and working contents of the device abstraction module 302 and the experimental logic abstraction module 303 will be described in detail below.

[0104] like Figure 2 As shown, there are many experimental methods for synchrotron radiation light sources. Taking the Shanghai Synchrotron Radiation Light Source as an example, there are 4 categories of nearly 100 experimental methods. It is difficult to find commonality between the massive experimental methods, but there are commonalities in the experimental equipment involved in the experimental methods and the control logic of the experimental equipment. Therefore, the present invention uses the device abstraction module 302 and the experimental logic abstraction module 303 to extract these two types of commonality (that is, the experimental equipment is divided into motor-type equipment and detector-type equipment, and the control logic of the experimental equipment is divided into counting and scanning types), and abstractly encapsulates them into inheritable standard modules of different granularities, so that the control and data acquisition system of the synchrotron radiation light source experimental station of the present invention has universality. In the Python programming process, encapsulation is a method of packaging the state (data) and behavior (method) of an object together. The purpose of encapsulation is to improve the modularity and reusability of the code. Granularity in the present invention means the degree of commonality. The smaller the granularity, the higher the commonality, and it is at the top of the inheritance chain.

[0105] As described above, the device abstraction module 302 is configured to encapsulate the experimental devices into inheritable standard modules of different granularities according to their common abstractions, store the standard modules corresponding to the experimental devices in the device module library, and use the standard modules to implement the standardized abstraction of all experimental devices, so that the scheduling module 301 can call them and other standard modules can inherit them. In this embodiment, the standard module refers to a Python class.

[0106] There are many kinds of experimental equipment for synchrotron radiation sources, such as monochromators, SDD detectors, photodiodes, ionization chambers, sample stages, etc. All experimental equipment can be abstractly encapsulated into inheritable standard modules of different granularities according to their commonalities for inheritance and calling. Standard modules can be developed, inherited, and reused, which can achieve universality.

[0107] like Figure 3 As shown in the figure, all experimental equipment can be divided into motors and detectors according to their commonalities. The motors complete the spatial attitude adjustment of the experimental equipment, and the detectors complete the experimental data collection, such as measuring the relevant parameters of synchrotron radiation experiments and beam transmission.

[0108] All experimental equipment inherits the standard module of the scheduling interface class during the process of encapsulation into standard modules. The standard module of the scheduling interface class defines the interface for scheduling. Therefore, the standard module abstracted by the experimental equipment encapsulation has a unified interface. The function of the interface is to define the methods and properties of the class. By implementing a unified interface, different standard modules can be used in a unified way.

[0109] In Python, Python classes are a kind of blueprint or template for creating objects. They define the properties and behaviors of objects, where properties represent the state of an object and behaviors are the actions of an object. Interfaces define the common properties and behaviors of a class. Through the definition of classes and interfaces, we can control the behavior and interaction of objects, ensuring that different objects can interact and communicate in the agreed upon way.

[0110] like Figure 5 As shown in the figure, the motor class or the scaler class inherits the dispatch interface class. The dispatch interface class defines the interface, so the motor class, scaler class, etc. have a unified interface. The dispatch interface class defines the interface. Take an example of a dispatch interface definition about read as follows. Because it is the class with the smallest granularity, the motor class and scaler class with the largest granularity all inherit it and also have this interface:

[0111] Class ScheduleInterface:

[0112] Def read(self) ->OrderedDictType[str, Dict[str, Any]]:

[0113] return OrderedDict()

[0114] like Figure 5 As shown, the device abstraction module 302 is configured to abstract and encapsulate the experimental devices into inheritable standard modules of different granularities according to their commonalities in the following manner:

[0115] Step A1: Encapsulate the scheduling-related definitions and properties in the Schedule Interface class;

[0116] Step A2: abstract the common definitions and attributes (i.e. the most common parameters) related to the hardware objects into the "hardware abstract object class (object)", with attributes such as "name", "type", "parent", etc.

[0117] As mentioned above, the hardware abstract object class is Object. Examples of the name, type, and parent definitions in the Object class are as follows:

[0118] Class Object:

[0119] def _validate_kind(self, val):

[0120] if isinstance(val, str):

[0121] return Kind[val.lower()]

[0122] return Kind(val)

[0123] def kind(self):

[0124] return self._kind

[0125] def kind(self, val):

[0126] self._kind = self._validate_kind(val)

[0127] def name(self):

[0128] return self._name

[0129] def name(self, name):

[0130] self._name = name

[0131] def attr_name(self):

[0132] return self._attr_name

[0133] def parent(self):

[0134] return self._parent

[0135] Step A3: abstract the common definitions and properties of the experimental equipment into the "Device Common Class (Device Class)", for example, "initialization", "wait for connection", "read", etc., and the "Device Common Class" inherits the "Hardware Abstract Object Class" and "Scheduling Interface Class";

[0136] Step A4: Divide the experimental equipment into motor class and detector class, abstract the common definitions and properties of the motor class (for example, "set value", "readback value", "speed", etc.) in the "motor class", and abstract the common definitions and properties of the detector class in the "detector class" (Device class), and both the "motor class" and the "detector class" inherit the "device common class".

[0137] Step A5: Further encapsulate the motor and detector experimental equipment into categories of different granularities according to their commonalities, abstract the common definitions and attributes of each category into the standard module corresponding to the category, and the standard modules with large granularity (i.e., low commonality) inherit the standard modules with small granularity (i.e., high commonality).

[0138] In this embodiment, taking the motor as an example, step A5 includes:

[0139] Step A51: abstract the basic parameters related to motion in the "Basic Motion Parameter Class (MotorParameter Class)", which inherits the "Hardware Abstract Object Class" and the "Motor Class" inherits the "Basic Motion Parameter Class"; basic parameters related to motion, such as "assignment", "motion", "finish motion", etc., "assignment" means giving the motor a target position; "motion" means the motor is moving; "finish motion" means the motor reaches the specified target position;

[0140] Step A52: Abstract the common definitions and properties of complex motors into the "multi-motor class".

[0141] Common definitions and properties of complex motors include "multi-motor" asynchronous motion, "multi-motor" synchronous motion, etc.

[0142] The specific example given is as follows: a class named motor ("motor class") inherits the smaller-granular Device class ("device common class") and Positioner class ("basic motion parameter class"), and encapsulates new definitions, among which user_readback is used to obtain the current position of the motor (energy feedback); user_setpoint is used to assign values ​​and set the target position of the motor with position limits; the motor class encapsulates definitions related to the current state of the motor, such as whether it is moving (motor_is_moving), whether the move is completed (motor_done_move), the limit switch status (high_limit_switch and low_limit_switch), and the direction of movement (direction_of_travel); the motor class also encapsulates multiple definitions for calibration (such as user_offset and user_offset_dir) and configuration (such as velocity, acceleration, and motor_egu), and encapsulates definitions of control operations such as stopping the motor (motor_stop), homing forward (home_forward), and homing backward (home_reverse).

[0143] class motor(Device, Positioner):

[0144] # Encapsulate position definition

[0145] user_readback = Cpt(EpicsSignalRO, 'EnergyReadback', kind='hinted')

[0146] user_setpoint = Cpt(EpicsSignal, 'EnergySet', limits=True)

[0147] # calibration dial<->user

[0148] user_offset = Cpt(EpicsSignal, 'BraggTop.OFF', kind='config')

[0149] user_offset_dir = Cpt(EpicsSignal, 'BraggTop.DIR', kind='config')

[0150] offset_freeze_switch = Cpt(EpicsSignal, 'BraggTop.FOFF', kind='omitted')

[0151] set_use_switch = Cpt(EpicsSignal, 'BraggTop.SET', kind='omitted')

[0152] # Encapsulate the configuration definition

[0153] velocity = Cpt(EpicsSignal, 'BraggTop.VELO', kind='config')

[0154] acceleration = Cpt(EpicsSignal, 'BraggTop.ACCL', kind='config')

[0155] motor_egu = Cpt(EpicsSignal, 'BraggTop.EGU', kind='config')

[0156] # Encapsulate the motor status definition

[0157] motor_is_moving = Cpt(EpicsSignalRO, 'BraggTop.MOVN', kind='omitted')

[0158] motor_done_move = Cpt(EpicsSignalRO, 'BraggTop.DMOV', kind='omitted')

[0159] high_limit_switch = Cpt(EpicsSignal, 'BraggTop.HLS', kind='omitted')

[0160] low_limit_switch = Cpt(EpicsSignal, 'BraggTop.LLS', kind='omitted')

[0161] direction_of_travel = Cpt(EpicsSignal, 'BraggTop.TDIR', kind='omitted')

[0162] # Encapsulate commands definition

[0163] motor_stop = Cpt(EpicsSignal, 'BraggTop.STOP', kind='omitted')

[0164] home_forward = Cpt(EpicsSignal, 'BraggTop.HOMF', kind='omitted')

[0165] home_reverse = Cpt(EpicsSignal, 'BraggTop.HOMR', kind='omitted')

[0166] #Encapsulate alarm information definition

[0167] tolerated_alarm = AlarmSeverity.NO_ALARM

[0168] def __init__(self, *args, **kwargs):

[0169] super().__init__(*args, **kwargs)

[0170] self.user_readback.name = self.name #Private attribute

[0171] self.motor_done_move.subscribe(self._move_changed)

[0172] self.user_readback.subscribe(self._pos_changed)

[0173] def precision(self):

[0174] return self.user_readback.precision#Provide a method for external access to private attributes

[0175] def egu(self):

[0176] return self.motor_egu.get()

[0177] def limits(self):

[0178] return self.user_setpoint.limits

[0179] def moving(self):

[0180] return bool(self.motor_is_moving.get(use_monitor=False))

[0181] def stop(self, *, success=False):

[0182] self.motor_stop.put(1, wait=False)

[0183] super().stop(success=success)

[0184] def move(self, position, wait=True, **kwargs):

[0185] self._started_moving = False

[0186] status = super().move(position, **kwargs)

[0187] self.user_setpoint.check_value(pos) # Encapsulate the operation of setting user_setpoint.check_value

[0188] def _pos_changed(self, timestamp=None, value=None, **kwargs):

[0189] self._set_position(value)

[0190] def _move_changed(self, timestamp=None, value=None, sub_type=None,

[0191] **kwargs):

[0192] was_moving = self._moving

[0193] self._moving = (value != 1)

[0194] if not self._started_moving:

[0195] started = self._started_moving = (not was_moving and self._moving)

[0196] self.log.debug('[ts=%s] %s moving: %s (value=%s)', fmt_time(timestamp),

[0197] self, self._moving, value)

[0198] if started:

[0199] self._run_subs(sub_type=self.SUB_START, timestamp=timestamp,

[0200] value=value, **kwargs)

[0201] if was_moving and not self._moving:

[0202] success = True

[0203] if self.direction_of_travel.get() == 0:

[0204] if self.low_limit_switch.get() == 1:

[0205] success = False

[0206] else:

[0207] if self.high_limit_switch.get() == 1:

[0208] success = False

[0209] severity = self.user_readback.alarm_severity

[0210] if severity != AlarmSeverity.NO_ALARM:

[0211] status = self.user_readback.alarm_status

[0212] if severity>self.tolerated_alarm:

[0213] self.log.error('Motion failed: %s is in an alarmstate '

[0214] 'status=%s severity=%s',

[0215] self.name, status, severity)

[0216] success = False

[0217] else:

[0218] self.log.warning('Motor %s raised an alarm duringmotion '

[0219] 'status=%s severity %s',

[0220] self.name, status, severity)

[0221] self._done_moving(success=success, timestamp=timestamp,

[0222] value=value)

[0223] def report(self):

[0224] try:

[0225] rep = super().report

[0226] except DisconnectedError:

[0227] rep = {'position': 'disconnected'}

[0228] rep['pv'] = self.user_readback.pvname

[0229] return rep

[0230] The step A5 also includes: that is, encapsulating the common definitions and properties of the detectors in the scaler usage mode, and inheriting the "detector class" (Device class) to finally form the scaler class; encapsulating the common definitions and properties of SDD, and inheriting the "detector class" (Device class) to finally form the SDD class (see "SDD()", "Pilatus()", "GreatEyes()", "Mythen()", "PA()", "scaler()")... Similarly, Figure 5 All types of detectors in the upper left corner are packaged in this way.

[0231] Therefore, in Figure 5 Among them, the "hardware abstract object class" has the smallest granularity (highest commonality), and the "multi-motor class" and "scaler class" have the largest granularity.

[0232] The device abstraction module 302 is also configured to: based on the abstract specification, encapsulate the state of the experimental equipment into inheritable standard modules of different granularities according to its common abstraction, and store them in the device module library; the standard module is used to implement the standardized abstraction of all experimental equipment for the scheduling module 301 to call and for other standard modules to inherit.

[0233] The above is the process of device packaging. The above process is all implemented based on Python language.

[0234] like Figure 5 As shown in the figure, the states of the experimental equipment are abstractly encapsulated into inheritable standard modules of different granularities according to their commonalities, including:

[0235] Step B1: abstract the basic status parameters shared by the hardware into the "basic status parameter class"; the basic status parameters of the hardware include "waiting for clearing", "calling", "completion" and so on.

[0236] Step B2: Abstract the device status parameters common to the experimental equipment into the "device status class", which inherits the "basic status parameter class"; the basic status parameters of the hardware include "monitoring (watch)" and so on.

[0237] Step B3: Abstract the subscription status parameters shared by the experimental devices in the "subscription status class", which inherits the "device status class"; the subscription status parameters of the hardware include "check current value" and so on.

[0238] Step B4: Divide the experimental equipment into motor class and detector class, abstract the common state parameters of the motor class into the "motor state class", and the "motor state class" inherits the "subscription state class". The common state parameters of the motor class include "notification", "error", "time-consuming", etc.

[0239] As described above, the experimental logic abstraction module 303 is configured as follows: the control logic of the experimental equipment corresponding to the experimental method for obtaining experimental data is abstracted in a standardized manner according to its commonality, encapsulated into inheritable standard modules of different granularities, and the standard modules corresponding to the control logic are stored in the experimental module library; the standard modules are used to implement and support various scanning and counting functions for the scheduling module 301 to call and for other standard modules to inherit. Various scanning and counting functions include multiple (or single) motors, multiple (or single) detectors, and complex (or simple) scanning and / or counting functions. In this embodiment, the standard module refers to a Python class.

[0240] There are many different experimental methods for synchrotron radiation sources. For example, there are more than 100 experimental methods for Shanghai Light Source. However, from the perspective of experimental logic, different experimental methods have common control logic for motor and detector experimental equipment when obtaining experimental data. Figure 4 and Figure 6 As shown, all experimental methods are at least divided into a scanning class (scan() class) that controls motor movement and uses detectors to collect data, and a counting class (count() class) that has no motor movement and only uses detectors (single or multiple times) to collect data.

[0241] Among them, counting means that there is no movement of the motor, that is, the conditions of the interaction between the X-ray and the sample are not changed, and the experimental data is obtained by measuring the detector only. For example, in an X-ray imaging experiment, there is no movement of the motor during the acquisition of a single experimental data.

[0242] Scanning refers to the movement of motors involved in the acquisition of single experimental data. It can be the sample stage motor or the monochromator motor. The movement of any motor can change the interaction conditions between X-rays and samples. For example, in XAFS experiments, in a single experiment, the monochromator virtual energy motor (composed of actual multi-axis monochromator motors according to certain mathematical relationships) moves from the set energy point before the edge to the set energy point after the edge according to the set step length. At each step energy point, two detectors located in front of the sample and behind the sample are used to collect two readings as I0 and I1. The fluorescence absorption spectrum obtained by XAFS is finally obtained through processing and mathematical operations based on I0 and I1.

[0243] The experimental logic abstract module 303 encapsulates the commonality of the control logic of the experimental equipment into an inheritable standard module with a unified interface. Unlike the device abstract module 302, the unified interface here is only for the commonality of a specific control logic. Therefore, the standard modules of the counting class and the scanning class obtained by abstract encapsulation in the experimental logic abstract module 303 have corresponding unified interfaces respectively, and there is no separate scheduling interface class. The role of the interface is to define the methods and properties of the class. Through the definition of the interface, the behavior and interaction mode of the implementation object can be controlled to ensure that different objects interact and communicate according to the agreed method.

[0244] like Figure 6 As shown, the experimental logic abstraction module 303 is configured to abstractly encapsulate the control logic of the experimental device corresponding to the experimental method for obtaining experimental data into inheritable standard modules of different granularities according to their commonality in the following manner:

[0245] Step C1: Divide the control logic of the experimental equipment into counting class and scanning class, abstract the common definitions and attributes of the counting class in the standard module of the counting class (i.e., count()), and abstract the common definitions and attributes of the scanning class in the standard module of the scanning class (i.e., scan() class);

[0246] Step C2: The scanning class is further divided into step scanning and on-the-fly scanning; single-axis single-detector step scanning, multi-axis single-detector step scanning, single-axis multi-detector step scanning, and multi-axis multi-detector step scanning are all encapsulated using the standard module of the scanning class; the common definitions and properties of on-the-fly scanning are abstracted in the standard module of the multi-scan class (i.e., multiscan()), and the standard module of the multi-scan class inherits the standard module of the scanning class.

[0247] That is to say, multi-axis multi-detector complex scanning is divided into two cases: step scanning and on-the-fly scanning. Multi-axis multi-detector complex (step) scanning can be implemented based on the scan() class. Multi-axis multi-detector complex (on-the-fly) scanning requires calling multiscan(), which adds common definitions and properties such as synchronous triggering based on the inheritance of the scan() class.

[0248] More specifically, multi-axis single-detector step scanning, single-axis multi-detector step scanning, and multi-axis multi-detector step scanning utilize the device abstract module 302 to encapsulate multiple experimental devices to obtain standard modules of a single motor class and standard modules of a single detector class, so as to convert the step scanning into single-axis single-detector step scanning, and then utilize the scan() class to implement encapsulation.

[0249] The meaning of multi-axis single detector is that during the experiment, multiple motion axes are involved, and a detector measures the experimental data. The detector has nothing to do with the motion axis. The detector is used to measure the experimental data, such as SDD. The motion axis is used to change the posture of the device, and one motion axis is also one motor. For multi-axis single detector step scanning, if the synchronous trigger device is not used, it is necessary to use the device abstract module 302 to encapsulate multiple motor-class standard modules into a new composite motor-class standard module. The specific method of encapsulating multiple motor-class standard modules into a new composite motor-class standard module is: add the variable definition of the second, third...Nth motor-class standard module in the control logic of the first motor-class standard module, and add the instruction to trigger the second, third...Nth motor-class standard module in the "complete motion" definition of the first motor-class standard module, that is, complete the encapsulation of multiple motor-class standard modules into a new composite motor-class standard module.

[0250] In addition, the method may further include step C3: further dividing the scanning class into linear scanning and two-dimensional scanning; abstracting the common definitions and properties of linear scanning in the standard module of the linear scanning class (i.e., listscan() class); abstracting the common definitions and properties of two-dimensional scanning in the standard module of the map scanning class (i.e., mappingscan()), and the standard modules of the linear scanning class and the map scanning class inherit the standard module of the scanning class.

[0251] Taking the Shanghai Light Source BL16U1 non-aggregated experimental station as an example, the establishment process and effect of the control and data acquisition system (i.e., Jasmine system) of the synchrotron radiation light source experimental station of the present invention are as follows:

[0252] Step S1: Count the experimental equipment involved in different experimental methods of the line station and connect them to the computer;

[0253] The experimental methods involved in the BL16U1 non-aggregation experimental station include: fluorescence absorption spectrum, fluorescence spectrum, transmission absorption spectrum, etc. The equipment involved includes: monochromator, sample stage, photodiode, signal amplifier, amplitude-frequency converter, SIS3820 board, seven-element SDD detector, laser interferometer, etc.

[0254] Step S2: Use the EPICS system as the underlying control system for most experimental equipment at the line station;

[0255] The monochromator, sample stage, SIS3820 board, and seven-element SDD detector are all controlled based on EPICS. The laser interferometer is divided into two functions: motion and data reading. The motion function uses a stepper motor, and the control of this part is based on EPICS.

[0256] Step S3: Complete the underlying control of a few devices based on non-EPICS compatible technology;

[0257] The control of the data acquisition function of the laser interferometer is implemented based on non-EPICS compatible technology. The laser interferometer data acquisition function has a C++ underlying driver. It only needs to develop a self-developed interface for EPICS channel access to integrate non-EPICS control into EPICS. The self-developed solution and steps for the C++ and EPICS interface are as follows: First, establish a soft IOC; second, copy the C++ library file .lib and header file .h to the src folder of the soft IOC; third, modify the Makefile file under the src of the soft IOC to define the C++ header file, library, library path, etc.; fourth, modify the .dbd file according to the properties of the C++ content, for example, modify the property of the 'VAL' field from DBF_DOUBLE to DBF_LONG in the .dbd file; fifth, modify the .c file under the src folder, and define the content that EPICS needs to access in the .c file; sixth, modify the .db file, and define the content defined in the .c file in the .db.

[0258] Step S4: Building and configuring a virtual environment for the data acquisition layer 300 to run;

[0259] Considering that the data acquisition layer of the system of the present invention runs under the Linux operating system, and its library and code are packaged into a conda package. Users only need to use the conda install command to build and configure a virtual environment covering Jasmine. The specific process of building and configuring the virtual environment: (1) Install Anaconda software; (2) Use the condacreate command to create a virtual environment bl16u1-daq; (3) Use the conda activate command to enter the bl16u1-daq virtual environment; (4) Use the conda install Jasmine command to build and configure the virtual environment bl16u1-daq with one click.

[0260] Step S5: Complete the abstract encapsulation of the experimental equipment;

[0261] According to the classification rules, the experimental equipment is divided into motor and detector categories for control. Specifically, the motor category includes monochromator and sample stage; the detector category includes SIS3820 board and seven-element SDD detector. The motor category inherits the motor category, SIS3820 inherits the scaler category, and the seven-element SDD inherits the SDD category.

[0262] Step S6: abstractly encapsulate the control logic of the experimental equipment corresponding to the experimental data obtained by the experimental method;

[0263] In the present invention, the specific example of the experimental method is fluorescence absorption spectrum, and the control logic of the experimental equipment is single motor multi-detector.

[0264] The data acquisition process of a single energy point in the fluorescence absorption spectrum is as follows: the monochromator moves to the energy point, the SIS3820 board records the data from the PD measurement as the incident light I0, the SDD board records the data from the probe measurement as the fluorescence I1, and I1 / I0 is used as the fluorescence spectrum for real-time plotting.

[0265] Step S7: Draw a fluorescence absorption spectrum graph using a GUI interface based on CS-Studio;

[0266] Step S8: Complete the storage of experimental data.

[0267] Internationally, there are Bluesky of NSLS-II light source in the United States, Sardana of ESRF light source in Europe, GDA of Diamond light source in Germany, etc. In China, there is a "universal experimental station control and data acquisition architecture" developed based on Bluesky, namely Mamba of Institute of High Energy Physics of Chinese Academy of Sciences.

[0268] The control and data acquisition system of the synchrotron radiation light source experimental station of the present invention provides two technical methods, "compatible with EPICS" and "compatible with non-EPICS", to incorporate all experimental equipment of the line station into a unified underlying control architecture, providing guarantee for the combined use of multiple experimental methods.

[0269] The control and data acquisition system of the synchrotron radiation light source experimental station of the present invention stores the accumulated configuration and data in the database of the non-EPICS compatible module 308, the equipment module library, the experimental module library, the database of the GUI interface module, the file library of the experimental data storage module, and the standard library of the scheduling module, thereby realizing systematic accumulation and being able to use part of the configuration of the previous experimental method for the subsequent experimental method.

[0270] The control and data acquisition system of the synchrotron radiation light source experimental station of the present invention shifts from the perspective of experimental methods to the perspective of equipment control, ensures universality through a high degree of hardware abstraction and logic encapsulation mechanism, and provides convenient expansion means, thereby enabling the architecture to be efficiently deployed in different line stations; the present invention divides the experimental equipment into motor type and detector type based on the commonality of the experimental equipment, and divides the way in which the experimental method obtains experimental data into counting type and scanning type based on the commonality of the control logic.

[0271] The control and data acquisition system of the synchrotron radiation light source experimental station of the present invention encapsulates the commonality of experimental equipment and control logic into inheritable standard modules with unified interfaces of different granularities, and obtains standard modules of experimental equipment and control logic suitable for any line station. It is not limited to the control software line station of the equipment, and is suitable for various types of synchrotron radiation light sources and lines stations that have been built, are under construction, and are planned in China.

[0272] The control and data acquisition system of the synchrotron radiation light source experimental station of the present invention adopts a unified GUI interface module to improve user friendliness, and comprehensively, flexibly and automatically stores user experimental data through the experimental data storage module.

[0273] In summary, the control and data acquisition system of the synchrotron radiation light source experimental station of the present invention changes the current situation that the control and data acquisition system of each line station of the synchrotron radiation light source is developed independently, has no general solution, no unified interface, no systematic accumulation, slow upgrade iteration, low integration, low automation and intelligence level. The control and data acquisition system of the synchrotron radiation light source experimental station of the present invention changes from the perspective of experimental method to the perspective of control, and realizes the universal technical solution by being compatible with EPICS underlying control, compatible with non-EPICS underlying control, equipment and control logic abstraction; the commonality of experimental equipment and control logic is encapsulated into inheritable standard modules with unified interfaces of different granularities, and the standard modules of experimental equipment and control logic are obtained, which are suitable for any line station. The present invention realizes the storage of metadata and experimental data, data visualization, complex scanning of multiple axes and multiple detectors, and the cooperation of coroutines to complete multiple tasks, and provides two human-computer interaction modes: graphical user interface (GUI) interface and command line.

[0274] The above is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. The above embodiments of the present invention can also be modified in various ways. All simple, equivalent changes and modifications made according to the claims and the description of the present invention fall within the scope of protection of the claims of the present invention. The contents not described in detail in the present invention are all conventional technical contents.

Claims

1. A control and data acquisition system for a synchrotron radiation light source experimental station. It is characterized in that An experimental device comprising a distributed general architecture installed on a computing device and a synchrotron radiation light source communicatively connected to the computing device, wherein the distributed general architecture comprises: The device layer includes drivers for experimental devices; Control layer, including EPICS systems and non-EPICS systems; A data acquisition layer, including a scheduling module, a device abstraction module connected to the scheduling module, an experiment logic abstraction module, an experiment data storage module, a data visualization module, and a GUI interface module; and The human-computer interaction layer is connected to the keyboard and screen of the computing device, and includes a command line module and a GUI interface module to realize human-computer interaction through the command line and the GUI interface; The device abstraction module is set as follows: the experimental equipment is abstractly encapsulated into inheritable standard modules of different granularities according to its commonality, and the standard modules corresponding to the experimental equipment are stored in the device module library; all experimental equipment are at least divided into motor class and detector class; the standard module of the device abstraction module is used to realize the standardized abstraction of all experimental equipment, so as to be called by the scheduling module and inherited by other standard modules; The experimental logic abstract module is set as follows: the control logic of the experimental equipment corresponding to the experimental method for obtaining experimental data is standardized and abstracted according to its commonality, encapsulated into inheritable standard modules of different granularities, and the standard modules corresponding to the control logic are stored in the experimental module library; all experimental methods are divided into at least scanning and counting categories; the standard modules of the experimental logic abstract module are used to implement and support various scanning and counting functions, so as to be called by the scheduling module and inherited by other standard modules; The scheduling module is set up to: schedule the experimental equipment of the equipment module library and the control logic of the experimental module library downward, and call the user needs from the human-computer interaction layer upward to trigger the experiment, monitor the experimental status, and generate experimental data.

2. The control and data acquisition system of the synchrotron radiation light source experimental station according to claim 1, It is characterized in that All experimental devices inherit the standard module of the scheduling interface class when encapsulating them into standard modules. The standard module of the scheduling interface class defines the interface for scheduling. Therefore, the standard module obtained by encapsulating and abstracting the experimental devices has a unified interface; and The standard modules of the counting class and the scanning class obtained by abstract encapsulation in the experimental logic abstract module respectively have corresponding unified interfaces.

3. The control and data acquisition system of the synchrotron radiation light source experimental station according to claim 2, It is characterized in that The standard module is a Python class; The device abstraction module is set to encapsulate the experimental equipment into inheritable standard modules of different granularities according to their common abstraction in the following ways: Step A1: Encapsulate the scheduling-related definitions and properties in the scheduling interface class; Step A2: abstract the common definitions and attributes related to the hardware objects into the hardware abstract object class; Step A3: abstract the common definitions and properties of the experimental equipment into the equipment commonality class, and the equipment commonality class inherits the hardware abstract object class and the scheduling interface class; Step A4: Divide the experimental equipment into motor class and detector class, abstract the common definitions and attributes of the motor class in, and abstract the common definitions and attributes of the detector class in the detector class, and both the motor class and the detector class inherit the equipment common class; Step A5: Further encapsulate the motor-type and different detector-type experimental equipment into categories of different granularities according to their commonalities, abstract the common definitions and attributes of each category into the standard module corresponding to the category, and the large-granularity standard module inherits the small-granularity standard module.

4. The control and data acquisition system of the synchrotron radiation light source experimental station according to claim 3, It is characterized in that The step A5 comprises: Step A51: abstracting basic motion-related parameters into a basic motion parameter class, wherein the basic motion parameter class inherits the hardware abstract object class, and the motor class inherits the basic motion parameter class; Step A52: abstracting the common definitions and properties of complex motors into a multi-motor class; and / or The common definitions and properties of detectors with different usage modes are encapsulated, and the detector class is inherited to finally form the corresponding detector class.

5. The control and data acquisition system of the synchrotron radiation light source experimental station according to claim 1, It is characterized in that The device abstraction module is further configured to: abstractly encapsulate the state of the experimental device into inheritable standard modules of different granularities according to its commonality, and store them in the device module library; The states of experimental equipment are abstractly encapsulated into inheritable standard modules of different granularities according to their common characteristics, including: Step B1: abstract the basic state parameters shared by the hardware into the basic state parameter class; Step B2: abstract the device status parameters common to the experimental devices into the device status class, and the device status class inherits the basic status parameter class; Step B3: abstract the subscription status parameters common to the experimental devices into the subscription status class, and the subscription status class inherits the device status class; Step B4: Divide the experimental equipment into motor class and detector class, abstract the common state parameters of the motor class in the motor state class, and the motor state class inherits the subscription state class.

6. The control and data acquisition system of the synchrotron radiation light source experimental station according to claim 2, It is characterized in that The experimental logic abstract module is configured to abstractly encapsulate the control logic of the experimental equipment corresponding to the experimental method for obtaining experimental data into inheritable standard modules of different granularities according to their commonality in the following manner: Step C1: Divide the control logic of the experimental equipment into a counting class and a scanning class, abstract the common definitions and attributes of the counting class in the standard module of the counting class, and abstract the common definitions and attributes of the scanning class in the standard module of the scanning class; Step C2: further divide the scanning category into step scanning and flight mode scanning; encapsulate the single-axis single-detector step scanning, multi-axis single-detector step scanning, single-axis multi-detector step scanning, and multi-axis multi-detector step scanning using the standard module of the scanning category; among them, the multi-axis single-detector step scanning, the single-axis multi-detector step scanning, and the multi-axis multi-detector step scanning use the device abstract module to encapsulate multiple experimental devices to obtain the standard module of the single motor category and the standard module of the single detector category, so as to convert the step scanning into the single-axis single-detector step scanning, and then use the standard module of the scanning category to realize the encapsulation; and / or Step C3: further divide the scanning class into linear scanning and two-dimensional scanning; abstract the common definitions and attributes of linear scanning in the standard module of the linear scanning class; abstract the common definitions and attributes of two-dimensional scanning in the standard module of the map scanning class, and the standard modules of the linear scanning class and the map scanning class inherit the standard module of the scanning class.

7. The control and data acquisition system of the synchrotron radiation light source experimental station according to claim 1, It is characterized in that The device abstraction module is connected to the EPICS system through the EPICS compatible module and to the non-EPICS system through the non-EPICS compatible module; The EPICS compatible module has a PyEpics interface, through which the EPICS CA protocol of the EPICS system is called, the CA library of the EPICS system is accessed, and communication and control of each PV of the EPCIS are realized; The non-EPICS compatible module includes an EPICS control program in a control layer implemented based on non-EPICS hardware compatible technology, an interface for EPICS channel access of a non-EPICS system implemented based on non-EPICS software compatible technology, a Python-based device driver located in a device layer and a matching control program located in a control layer, and a wrapper for a non-EPICS system located in a data acquisition layer; The non-EPICS compatible module implements compatibility between the non-EPICS system and the EPICS system in the order of priority of utilizing the interface for EPICS channel access of the non-EPICS system, utilizing the wrapper of the non-EPICS system, developing the EPICS control program in the control layer, developing the device driver in the device layer and the supporting control program in the control layer.

8. The control and data acquisition system of the synchrotron radiation light source experimental station according to claim 1, It is characterized in that The scheduling module uses Python's threading library to implement concurrent operations in the same process, and uses the asyncio library in Python to implement asynchronous concurrency and interrupt processes, so as to complete multi-tasking by using coroutine cooperation.

9. The control and data acquisition system of the synchrotron radiation light source experimental station according to claim 1, It is characterized in that The input of the scheduling module is a Python variable, and the output is experimental data with a format definition, and the specific form of the format definition is the metadata corresponding to the experimental data; The data visualization module is configured to: receive experimental data and metadata to achieve real-time plotting of experimental data; The experimental data storage module is configured to receive experimental data and metadata to achieve data storage.

10. The control and data acquisition system of the synchrotron radiation light source experimental station according to claim 1, It is characterized in that The command line module is developed based on Python; The GUI interface module is implemented based on one of PyQt and CS-Studio.