A script-driven data acquisition and processing system
Through a script-driven data collection and processing system, the problem of traditional hard-coded data analysis is solved, the ease of use and scalability of data collection and fusion are achieved, the data processing capabilities and flexibility are improved, and real-time control and early warning are supported.
Patent Information
- Application Number
- CN202410940693.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-07-15
AI Technical Summary
Traditional data collection methods use hard coding to parse data, which results in difficulty in maintenance, lack of ease of use and scalability. Especially in multi-sensor data fusion calculations, the processing power and flexibility of the data transmission unit cannot be fully utilized.
Adopt a script-driven data collection and processing system, through a unified data interface and flexible script-driven method, including information configuration unit, data collection unit and script processing unit, use Lua script language to process data, support multiple protocols and equipment to realize automated collection and fusion of data.
It simplifies data collection and maintenance, improves the scalability and flexibility of the system, can effectively convert machine-oriented data into more meaningful physical data, and supports real-time control and early warning functions.
Smart Images

Figure CN118474156B
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a script-driven data acquisition and processing system. Background Art
[0002] With the continuous development of embedded technology and network technology, the performance of the microprocessors used is getting higher and higher, and the network transmission speed is getting faster and faster. This means that the data processing tasks that originally needed to be run on high-performance computers can be distributed into embedded data transmission units or data acquisition modules.
[0003] In addition, the data devices that need to be collected on site include custom serial port protocol devices, Modbus protocol devices, and various PLC devices, etc., and the data formats and meanings they define are different. The traditional approach is to use hard coding to parse the data. When a new protocol is added or the protocol is changed, the program needs to be recompiled. The most critical problem is that when multi-sensor data needs to be fused and calculated, it can only be handled by the backend. This leads to maintenance difficulties, lack of ease of use and scalability, and a lack of effective ways to transform machine-oriented data into more meaningful physical data. The data transmission unit or data acquisition module does not give full play to its due processing capabilities and flexibility. Summary of the invention
[0004] In view of this, the present application provides a script-driven data acquisition and processing system, which uses a unified data interface and a flexible script-driven method to solve the technical problems in traditional data acquisition methods that use hard-coding to parse data, or can only be handled by the back-end when performing fusion calculations on multiple data, making maintenance difficult, lacking ease of use and scalability.
[0005] To achieve the above object, the present invention provides the following technical solutions:
[0006] A script-driven data collection and processing system comprises: an information configuration unit, a data collection unit and a script processing unit;
[0007] The information configuration unit includes a device configuration module and a variable configuration module, wherein the device configuration module is used to configure the information of the lower device connected to the system, and the variable configuration module is used to configure an item of data information that can be obtained or set in the lower device;
[0008] The data acquisition unit is used to collect data according to different trigger modes and add the collected variables to the collection queue;
[0009] The script processing unit is used to process the original data of the preparation queue based on the script, obtain the processed physical quantity data, and store it in the database, and to issue an early warning based on the physical quantity data and to control the lower-level equipment in real time.
[0010] Furthermore, the lower-level device information includes a device name, a communication protocol, a communication interface, a communication address, and additional information.
[0011] Furthermore, the data information includes information of variable name, variable alias, device to which it belongs, XDATA address, XDATA quantity, YDATA type, YDATA quantity, GET script, and SET script.
[0012] The GET script is a processing script that the system calls and executes through the script interpreter after completing data collection and obtaining the original data. The script syntax conforms to the syntax rules of the Lua script language. The XDATA (original data) referenced in the GET script itself, if it is a single-value variable with a quantity of 1, only needs to be represented by "X", if it is an array variable with a quantity greater than 1, it needs to be represented by "X[1-N]". To reference the XDATA of another variable and the processed data YDATA, if it is a variable with a quantity of 1, it needs to be represented by "variable name.X" and "variable name.Y", if it is an array variable with a quantity greater than 1, it needs to be represented by "variable name.X[1-N]" and "variable name.Y[1-N]". The SET script performs the opposite operation of the GET script, that is, converting YDATA into XDATA and then writing it into the lower device. The writing specification of the SET script is consistent with the GET script.
[0013] Further, the data acquisition unit includes an acquisition trigger module, a queuing module and a concurrent acquisition module;
[0014] The acquisition trigger module is used for the user to select the manual acquisition trigger mode or the automatic acquisition trigger mode to realize the data acquisition trigger. The automatic acquisition trigger mode includes single automatic acquisition and periodic acquisition. The single automatic acquisition only performs one acquisition at the set time, and the periodic acquisition performs one acquisition at a fixed time interval from the start time.
[0015] The queuing module is used to analyze the relationship attributes of variables and add the collected variables to the collection queue according to the analysis results to ensure that the variables are not collected repeatedly and multiple collection instances exist and are triggered at the same time;
[0016] The concurrent acquisition module is used to extract the variables in the acquisition queue.
[0017] Furthermore, the relationship attributes of the analyzed variables include analyzing the GET script of the collected variable A. If another variable B is referenced in the GET script, a variable dependency relationship is formed, which is represented by variable A being dependent on variable B. Variable B is added to the collection queue first, and variable A is added to the collection queue later. The variable dependency relationship is specified as a single-layer unidirectional dependency, that is, variable B, which variable A depends on, cannot depend on other variables.
[0018] Furthermore, adding the acquisition variable to the acquisition queue includes:
[0019] If the current collection queue is empty, add the collection variable A directly;
[0020] If there is a variable B that variable A depends on in the queue, then variable A must be placed after variable B;
[0021] If there is a variable N belonging to the same device in the queue, variable A is inserted after the variable N.
[0022] Furthermore, extracting the variables in the acquisition queue includes:
[0023] Extracting variables to be collected from the collection queue in sequence, and calling a communication module corresponding to the communication protocol to collect data according to the communication protocol and communication interface used by the variables to be collected;
[0024] If the communication module feedbacks that the corresponding communication interface is occupied, the communication module is in a waiting state until the occupied communication interface is released;
[0025] If adjacent collected variables belong to the same lower device, and the lower device supports simultaneous collection, the adjacent variables belonging to the same device will be packaged into a group and submitted to the communication module for collection;
[0026] The collected data is used as the original data of the variable, namely, XDATA data. The variable that obtains the XDATA data is put into the preparation queue, and the variables in the preparation queue will be processed by the script data in turn.
[0027] Furthermore, the script processing unit includes a data processing module, a storage module and a data output module;
[0028] The data processing module is used to start the Lua script interpreter instance to execute the variable's GET script after obtaining the original data of the variable. If the dependent variable of the variable is not obtained, the corresponding variable will be put back to the tail of the preparation queue;
[0029] The storage module is used to store the variable data processed by the GET script into the SQLite3 database, and the stored content at least includes: device name, variable name, date and time, XDATA, YDATA;
[0030] The data output module is used to provide a unified data service RPC interface to implement various services for providing data to the outside world. Each data service calls the data service interface function to complete the data collection and acquisition functions.
[0031] Furthermore, the GET script that executes the variables includes:
[0032] Import the original data of the variable. The XDATA of the variable is pre-imported into the script interpreter in the form of "variable name.X". When the number of XDATA is more than 1, it is imported in the form of "variable name.X[1-N]";
[0033] If the script is empty, the XDATA data will be directly copied to YDATA, and the number of YDATA is the same as that of XDATA;
[0034] Execute a non-empty processing script. In the script, a calculated value must be explicitly assigned to the script variable of "variable name.Y". When the number of YDATA is greater than 1, YDATA is assigned in the form of "variable name.Y[1-N]";
[0035] When the script is executed, the calculated "variable name.Y" or "variable name.Y[1-N]" is extracted to the C++ execution environment as YDATA, that is, the processed data.
[0036] It can be seen from the above technical solution that the advantages of the present invention are:
[0037] 1. This application uses a unified data interface and flexible script drive to make data collection and maintenance simpler, with high scalability, and can effectively transform machine-oriented data into more meaningful physical data, with more flexible data collection and processing capabilities. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application.
[0039] Figure 1 This is a schematic diagram of the structure of this application.
[0040] Figure 2 This is a schematic diagram of the overall framework for scripting data processing in this application.
[0041] Figure 3 This is a schematic diagram of the process of the automated data collection method of the present application. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the implementation modes and the accompanying drawings. Here, the illustrative implementation modes and descriptions of the present application are used to explain the present application, but are not intended to limit the present application.
[0043] refer to Figures 1 to 3 ,like Figure 1 As shown, this embodiment provides a script-driven data acquisition and processing system, including: an information configuration unit, a data acquisition unit and a script processing unit.
[0044] The information configuration unit includes a device configuration module and a variable configuration module. The device configuration module is used to configure the information of the lower-level device connected to the system, and the variable configuration module is used to configure an item of data information that can be obtained or set in the lower-level device.
[0045] Specifically, the lower device information includes device name, communication protocol, communication interface, communication address and additional information. The device name is the unique identification name of the lower device in the system, and the communication protocol is the communication protocol supported by the system for the lower device. The system provides standard ModbusTCP / RTU, Mitsubishi PLC, and Siemens PLC standard communication protocols, and open interface protocols at the same time, allowing new communication protocols to be dynamically loaded in the form of dynamic link libraries. The communication interfaces used include serial ports, Ethernet interfaces, WLAN, etc., and the lower device is connected to the system through one of the interfaces. The communication address is the only address that guarantees normal communication under the communication protocol used by the lower device. The additional information is used to fill in this field when a specific communication protocol cannot achieve communication only by the communication address, and then the specific communication protocol is parsed. Examples of various types of device configurations are shown in Table 1.
[0046] Table 1
[0047]
[0048] The data information includes information of variable name, variable alias, device to which it belongs, XDATA address, XDATA quantity, YDATA type, YDATA quantity, GET script, and SET script.
[0049] The variable name is a name that uniquely identifies the variable. The name can only contain uppercase and lowercase letters, numbers, underscores, and hyphens "-". The variable alias is used to briefly describe the variable. Chinese characters can be entered. If it is left blank, the description name is the variable name. The device to which it belongs is used to indicate the device to which the variable corresponds. The address in the device corresponds to an accessible resource address in the device, for example: A. Siemens Ethernet connection PLC supports addresses with prefixes of DB, I, Q, M, T, and C, including DB1.DBB10, I0.1, MB100, etc. B. Siemens PPI protocol PLC supports addresses with prefixes of I, Q, V, M, T, C, and S. C. Mitsubishi Fx series PLC supports addresses with prefixes of X, Y, M, and D. D. Modbus devices support addresses with prefixes of X, Y, I, and H, which represent discrete inputs, coils, input registers, and holding registers, respectively. The XDATA address is the starting address of the original data of the variable in the device. Different device protocols have different address naming methods, which are determined by the specific communication protocol. The original data is referred to as XDATA in the future. The XDATA quantity is the number of consecutive addresses contained in the variable. The YDATA type is the corresponding processed data type with actual physical meaning. The corresponding data is referred to as YDATA in the future. It can be an international standard physical dimension or a custom type. When the GET script is not processed with variables (the script is empty), the YDATA quantity is equal to the original data quantity. When the GET script is used, its quantity is automatically determined by parsing the script.
[0050] When raw data is collected from the device, use this GET script to process the data and output it to physical data. In the script, pay attention to the following rules: the original value of the variable is represented by "variable name.X", and the output physical quantity is represented by "variable name.Y", that is, the variable data appears in the script in the form of var1.X, var1.Y. When the number of data is more than one, use square brackets plus index to represent it, and the index starts at 1, such as var1.X[1]. You can reference data from other variables, such as var1.X=var2.Y. The number of raw values appearing in the script must be consistent with the number of raw data defined previously. The raw values are the actual collected data and will be imported into the script running environment.
[0051] The SET script is called when the host computer needs to write a value to the slave device, and converts the given YDATA into XDATA. The overall framework for scripting data is as follows: Figure 2 shown.
[0052] The data acquisition unit is used to perform data acquisition according to different trigger modes and add the acquired variables into an acquisition queue.
[0053] The data acquisition unit includes an acquisition trigger module, a queuing module and a concurrent acquisition module; the acquisition trigger module is used for the user to select a manual acquisition trigger mode or an automatic acquisition trigger mode to realize data acquisition triggering, and the automatic acquisition trigger mode includes a single automatic acquisition and a periodic acquisition. The single automatic acquisition only performs an acquisition once at a set time, and the periodic acquisition performs an acquisition once every fixed time period starting from the start time; the queuing module is used to analyze the relationship attributes of the variables, and add the acquired variables to the acquisition queue according to the analysis results to ensure that the variables are not repeatedly acquired and multiple acquisition instances exist and are triggered at the same time; the concurrent acquisition module is used to extract the variables in the acquisition queue.
[0054] Specifically, the relationship attributes of the analyzed variables include analyzing the GET script of the collected variable A. If another variable B is referenced in the GET script, a variable dependency relationship is formed, which is represented by variable A being dependent on variable B. Variable B is added to the collection queue first, and variable A is added to the collection queue later. The variable dependency relationship is defined as a single-layer unidirectional dependency, that is, variable B, on which variable A depends, cannot depend on other variables.
[0055] The adding of the acquisition variables to the acquisition queue comprises:
[0056] If the current collection queue is empty, add the collection variable A directly;
[0057] If there is a variable B that variable A depends on in the queue, then variable A must be placed after variable B;
[0058] If there is a variable N belonging to the same device in the queue, variable A is inserted after the variable N.
[0059] Extracting variables from the acquisition queue includes:
[0060] Extracting variables to be collected from the collection queue in sequence, and calling a communication module corresponding to the communication protocol to collect data according to the communication protocol and communication interface used by the variables to be collected;
[0061] If the communication module feedbacks that the corresponding communication interface is occupied, the communication module is in a waiting state until the occupied communication interface is released;
[0062] If adjacent collected variables belong to the same lower device, and the lower device supports simultaneous collection, the adjacent variables belonging to the same device will be packaged into a group and submitted to the communication module for collection;
[0063] The collected data is used as the original data of the variable, namely, XDATA data. The variable that obtains the XDATA data is put into the preparation queue, and the variables in the preparation queue will be processed by the script data in turn.
[0064] The script processing unit is used to process the original data of the preparation queue based on the script, obtain the processed physical quantity data, and store it in the database, and to issue an early warning based on the physical quantity data and to control the lower-level equipment in real time.
[0065] Specifically, the script processing unit includes a data processing module, a storage module and a data output module; the data processing module is used to start a Lua script interpreter instance to execute the variable's GET script after obtaining the original data of the variable. If the dependent variable of the variable is not obtained, the corresponding variable will be placed back to the tail of the preparation queue; the storage module is used to store the variable data processed by the GET script into the SQLite3 database, and the stored content includes at least: device name, variable name, date and time, XDATA, YDATA; the data output module is used to provide a unified data service RPC interface to realize various types of services for providing data to the outside world, and each data service calls the data service interface function to complete the data collection and acquisition functions.
[0066] In this embodiment, a unified data service RPC interface is provided to implement various services that provide data to the outside world, including OPC UA Server, IOT client service, etc. Each data service calls the data service interface function to complete the data collection and acquisition function. The data service interface includes but is not limited to the following four basic functions: A. Service registration function ServiceRegister, which provides service name and data callback function when registering the service; B. Information query function InfoQuery, which can query items including: device information, variable information, and stored historical collection data; C. Data acquisition function DataGet, which provides service name, device name, and variable name when used; the data request function will manually collect the variables once, and call the data callback function to process the specific functions of each service when the collection is completed; D. Data write function DataSet, which provides service name, device name, variable name, and write value when used. Taking Alibaba Cloud IoT cloud platform as an example, using its IotLink SDK developed based on Python, the interface function provided by the RPC call system is used to complete the transmission of data to the cloud and the control of the lower-level device by the cloud.
[0067] The GET script that executes the variables includes:
[0068] Import the original data of the variable. The XDATA of the variable is pre-imported into the script interpreter in the form of "variable name.X". When the number of XDATA is more than 1, it is imported in the form of "variable name.X[1-N]";
[0069] If the script is empty, the XDATA data will be directly copied to YDATA, and the number of YDATA is the same as that of XDATA;
[0070] Execute a non-empty processing script. In the script, a calculated value must be explicitly assigned to the script variable of "variable name.Y". When the number of YDATA is greater than 1, YDATA is assigned in the form of "variable name.Y[1-N]";
[0071] When the script is executed, the calculated "variable name.Y" or "variable name.Y[1-N]" is extracted to the C++ execution environment as YDATA, that is, the processed data.
[0072] like Figure 3 As shown, this embodiment also provides an automated data collection method based on the above data collection and processing system, comprising the following steps:
[0073] S1: data acquisition trigger;
[0074] S2: Add the collected variables to the collection queue;
[0075] S3: concurrent data collection;
[0076] S4: scripting the data;
[0077] S5: storing the variable data processed by the GET script into a value database;
[0078] S6: Output the data to the service.
[0079] The data collection trigger in step S1 can be triggered in two ways: manual collection, single automatic collection, and periodic collection. The single automatic collection only performs collection once at a set time, and then it is no longer valid. The periodic collection will perform collection once at a fixed interval starting from the start time. The above triggering methods all require that the specified device variable name list be submitted to the system to trigger the corresponding communication protocol for data collection. The collected variables will be placed in the collection queue. This process will ensure that the variables are not collected repeatedly, so multiple collection instances exist and are triggered at the same time.
[0080] In step S2, in order to put the variables to be collected into the collection queue, the GET script of the variables to be collected is first analyzed. If other variables are referenced in the script, a variable dependency relationship is formed, which is represented by variable A depending on variable B. Then variable B is added to the collection queue first, and variable A is added to the collection queue later. In order to simplify the complexity, it is stipulated that the variable dependency relationship can only be a single-layer one-way dependency, that is, variable B that variable A depends on cannot depend on other variables. The rules for adding variables to the collection queue are as follows:
[0081] S21: If the queue is empty, join it directly;
[0082] S22: If there is a variable in the queue that this variable depends on, it must be placed after this variable;
[0083] S23: If there is a variable belonging to the same device in the queue, insert it after the variable.
[0084] In the step S3, the parallel data acquisition will extract the acquisition variables from the acquisition queue in turn, and then call the communication module corresponding to the communication protocol for data acquisition according to the communication protocol and communication interface used by the variable. If the communication module feedbacks that the corresponding communication interface is occupied, the communication module will be in a waiting state until the occupied communication interface is released. If adjacent acquisition variables belong to the same lower device, and the lower device supports simultaneous acquisition, the adjacent variables belonging to the same device will be packaged into a group and submitted to the communication module for acquisition. The collected data is used as the original data of the variable, that is, XDATA data. The variables that have obtained XDATA data are placed in the preparation queue, and the variables in the preparation queue will be processed with script data in turn.
[0085] The step S4 processes the raw data collected by the variables in the preparation queue. When the raw data of the collected variable and its dependent variables are collected, a Lua script interpreter instance is started to execute the GET script of the variable. If the dependent variable of the variable is not obtained, it will be put back to the end of the preparation queue. When executing the GET script, the steps are as follows:
[0086] S41: If the script is empty, the XDATA data will be directly copied to YDATA. The number of YDATA is the same as the number of XDATA;
[0087] S42: Import variable raw data. The variable's XDATA will be pre-imported into the script interpreter in the form of "variable name.X". When the number of XDATA is more than 1, it will be imported in the form of "variable name.X[1-N]";
[0088] S43: Execute a non-empty processing script, in which a certain calculated value must be explicitly assigned to the script variable of "variable name.Y". When the number of YDATA is greater than 1, YDATA is assigned in the form of "variable name.Y[1-N]";
[0089] S44: extract YDATA. When the script is executed, the calculated "variable name.Y" or "variable name.Y[1-N]" is extracted to the C++ execution environment as YDATA, i.e., processed data.
[0090] In the script executed in step S43, flexible logic processing can be implemented. For example, the system of the present application is connected to a bedrock displacement meter and its matching temperature sensor through Modbus. The calculation formula of the bedrock displacement meter is:
[0091] Lm=k×(F-F0)+(bh×a)×(T-T0),
[0092] Among them, k is the measurement sensitivity constant of the bedrock displacement meter, F is the current real-time data collected by the bedrock displacement meter (frequency modulus), F0 is the reference value (the initial data collected), b is the temperature correction coefficient of the bedrock displacement meter, h is the length of the measuring rod, a is the linear expansion coefficient of the measuring rod, T is the current real-time temperature value collected by the temperature sensor, and T0 is the initial value of the temperature sensor. The GET script corresponding to the bedrock displacement meter can be written as:
[0093] k=1.3e-2
[0094] b=2.44e-3
[0095] h=125
[0096] a=16.5e-6
[0097] LM_001.Y=k*(LM_001.X-prev(“LM_001”,0)+(bh*a)*(T_001-
[0098] prev("T_001",0),
[0099] Among them, "LM_001" is the variable corresponding to the bedrock displacement meter, "T_001" is the variable corresponding to the thermometer, and prev is a function for obtaining the historical value corresponding to the variable, where parameter 0 represents the initial value.
[0100] The step S5 stores the data into the SQLite3 database, and the stored content at least includes: device name, variable name, date and time, XDATA, and YDATA.
[0101] The present invention discloses a script-driven data acquisition and processing system. The system runs a script interpreter in an embedded device to collect and process data from lower devices, including: realizing a unified data protocol interface for different protocols and device protocols from different manufacturers, and supporting device-side protocol extension; defining unified data variable information, and the system collects and processes data based on the data variable information; using scripts to fuse and convert non-physical quantity data collected from lower devices such as sensors and PLCs to obtain intuitive physical quantity data; the script has logic processing capabilities, and can issue early warnings and control lower devices in real time based on the processed physical quantity data; and providing the data acquisition function as RPC for use by Opc UA services and IOT cloud platform services.
[0102] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the embodiments of the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A script-driven data acquisition and processing system, It is characterized in that Including: information configuration unit, data acquisition unit and script processing unit; The information configuration unit includes a device configuration module and a variable configuration module, wherein the device configuration module is used to configure the information of the lower device connected to the system, and the variable configuration module is used to configure an item of data information that can be obtained or set in the lower device; The data acquisition unit is used to collect data according to different trigger modes and add the collected variables to the collection queue; The data acquisition unit includes an acquisition trigger module, a queuing module and a concurrent acquisition module; The acquisition trigger module is used for the user to select the manual acquisition trigger mode or the automatic acquisition trigger mode to realize the data acquisition trigger. The automatic acquisition trigger mode includes single automatic acquisition and periodic acquisition. The single automatic acquisition only performs one acquisition at the set time, and the periodic acquisition performs one acquisition at a fixed time interval from the start time. The queuing module is used to analyze the relationship attributes of variables, including analyzing the GET script of the collected variables. If other variables are referenced in the script, a variable dependency relationship is formed. According to the analysis results, the collected variables and dependent variables are added to the collection queue to ensure that the variables are not collected repeatedly and multiple collection instances exist and are triggered at the same time. The concurrent acquisition module is used to extract the variables to be collected from the acquisition queue in turn, and the collected data is used as the original data of the variable, that is, XDATA data. The variables that obtain the XDATA data are put into the preparation queue, and the variables in the preparation queue will be processed by script data in turn, and the processed data is extracted as YDATA data; The script processing unit is used to process the original data of the preparation queue based on the script, obtain the processed physical quantity data, and store it in the database, and to issue early warnings based on the physical quantity data and to control the lower-level equipment in real time. The original data collected from the variables in the preparation queue is processed. When the original data of the collected variables and their dependent variables are collected, a Lua script interpreter instance is started to execute the GET script of the variables.
2. The script-driven data acquisition and processing system according to claim 1, It is characterized in that The lower-level device information includes device name, communication protocol, communication interface, communication address and additional information.
3. The script-driven data acquisition and processing system according to claim 1, It is characterized in that The data information includes information of variable name, variable alias, device, XDATA address, XDATA quantity, YDATA type, YDATA quantity, GET script, and SET script. The GET script is a processing script called and executed by the system through a script interpreter after completing data collection and obtaining raw data. The SET script performs the opposite operation of the GET script, and the writing specifications of the SET script are consistent with those of the GET script.
4. The script-driven data acquisition and processing system according to claim 1, It is characterized in that The relationship attributes of the analyzed variables include analyzing the GET script of the collected variable A. If another variable B is referenced in the GET script, a variable dependency relationship is formed, which is represented by variable A being dependent on variable B. Variable B is added to the collection queue first, and variable A is added to the collection queue later. The variable dependency relationship is specified as a single-layer unidirectional dependency, that is, variable B, which variable A depends on, cannot depend on other variables.
5. The script-driven data acquisition and processing system according to claim 4, It is characterized in that Adding a collection variable to the collection queue involves: If the current collection queue is empty, add the collection variable A directly; If there is a variable B that variable A depends on in the queue, then variable A must be placed after variable B; If there is a variable N belonging to the same device in the queue, variable A is inserted after the variable N.
6. The script-driven data acquisition and processing system according to claim 1, It is characterized in that Extracting variables from the acquisition queue includes: Extracting variables to be collected from the collection queue in sequence, and calling a communication module corresponding to the communication protocol to collect data according to the communication protocol and communication interface used by the variables to be collected; If the communication module feedbacks that the corresponding communication interface is occupied, the communication module is in a waiting state until the occupied communication interface is released; If adjacent collected variables belong to the same lower device, and the lower device supports simultaneous collection, the adjacent variables belonging to the same device will be packaged into a group and submitted to the communication module for collection; The collected data is used as the original data of the variable, namely, XDATA data. The variable that obtains the XDATA data is put into the preparation queue, and the variables in the preparation queue will be processed by the script data in turn.
7. The script-driven data acquisition and processing system according to claim 6, It is characterized in that The script processing unit includes a data processing module, a storage module and a data output module; The data processing module is used to start the Lua script interpreter instance to execute the variable's GET script after obtaining the original data of the variable. If the dependent variable of the variable is not obtained, the corresponding variable will be put back to the tail of the preparation queue; The storage module is used to store the variable data processed by the GET script into the SQLite3 database, and the stored content at least includes: device name, variable name, date and time, XDATA, YDATA; The data output module is used to provide a unified data service RPC interface to implement various services for providing data to the outside world. Each data service calls the data service interface function to complete the data collection and acquisition functions.
8. The script-driven data acquisition and processing system according to claim 7, It is characterized in that The GET script that executes the variables includes: Import the original data of the variable. The XDATA of the variable is pre-imported into the script interpreter in the form of "variable name.X". When the number of XDATA is more than 1, it is imported in the form of "variable name.X[1-N]"; If the script is empty, the XDATA data will be directly copied to YDATA, and the number of YDATA is the same as that of XDATA; Execute a non-empty processing script. In the script, a calculated value must be explicitly assigned to the script variable "variable name.Y". When the number of YDATA is greater than 1, YDATA is assigned in the form of "variable name.Y[1-N]"; When the script is executed, the calculated "variable name.Y" or "variable name.Y[1-N]" is extracted to the C++ execution environment as YDATA, that is, the processed data.
Citation Information
Patent Citations
Vulnerability detection system for network security of power distribution automation system
CN111385253A
Method for collecting, transmitting and processing high-frequency mass data of fan in real time
CN113944601A
Shell script-based data acquisition and loading method and system
CN117149380A
Energy data acquisition method
CN117373225A
Script conversion program for model inspection, model inspection program, script conversion device for model inspection and model inspection device
JP2020030490A
