Equipment data acquisition and processing method, system, equipment and medium
By presetting the sensor device instruction table information in the database, the remote terminal unit obtains and executes lua scripts in the RTU, solving the problems of high cost in device data acquisition and complex analysis function management, and achieving efficient unified data acquisition and analysis manage.
Patent Information
- Application Number
- CN202411249470.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2024-12-13
AI Technical Summary
In the prior art, when RTU collects and processes equipment data, there are problems such as high data acquisition cost and system management and maintenance costs, and the analytical transformation function naming is chaotic, resulting in complex system management.
The database presets the instruction table information of the sensor device, including sensor type, instruction characters and lua scripts. The remote terminal unit obtains this information, sends instruction characters to the corresponding device, executes the lua script to parse the data, and stores it locally to realize data collection and analysis .
It reduces data acquisition costs and system management and maintenance costs, and uniformly analyzes conversion function management to adapt to the acquisition needs of more different devices.
Smart Images

Figure CN119127530A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Internet of Things, and in particular to a method, system, device and medium for collecting and processing device data. Background Art
[0002] With the rapid development of Internet of Things technology, RTU (Remote Terminal Unit, also known as remote terminal unit) plays an increasingly important role in industrial automation, smart cities and other fields as a bridge connecting devices and the cloud. It is mainly used for the collection, transmission and control of device data.
[0003] In the prior art, when RTU collects device data, it is necessary to connect the device to RTU through a hardware protocol before data collection can be performed. Therefore, once the number of devices increases, it will lead to difficulties in device management and high data collection costs. In addition, after collecting device data through RTU, it is necessary to set up a separate parsing tool to parse and process the device data, and the parsing conversion functions used in parsing data may come from different sources, such as being written by different staff members, which will lead to confusion in function naming, thereby bringing high system management and maintenance costs.
[0004] Therefore, no effective solution has been proposed for the problems of high data collection cost and high system management and maintenance cost in the prior art of equipment data collection and processing. Summary of the invention
[0005] The embodiments of the present invention provide a method, system, device and medium for collecting and processing device data, aiming to solve the problems of high data collection cost and high system management and maintenance cost in the prior art methods for collecting and processing device data.
[0006] In a first aspect, an embodiment of the present invention provides a device data acquisition and processing method, which is applied to a device data acquisition and processing system, wherein the system includes a sensor device, a remote terminal unit, and a database, wherein the database is used to preset sensor device instruction table information, and the method includes:
[0007] The remote terminal unit obtains sensor device instruction table information from the database; wherein the sensor device instruction table information includes sensor type, instruction symbol, execution cycle, and Lua scripts for different execution purposes;
[0008] The remote terminal unit sends the instruction symbol to the corresponding type of sensor device based on the execution cycle in the sensor device instruction table information, and the corresponding type of sensor device returns the instruction result corresponding to the instruction symbol to the remote terminal unit based on the received instruction symbol;
[0009] The remote terminal unit receives the command result, and obtains and executes the corresponding first lua script from the sensor device command table information;
[0010] The remote terminal unit parses the instruction result based on the custom conversion function in the first lua script to obtain parsed data, and stores the parsed data in a local preset area.
[0011] In a second aspect, an embodiment of the present invention provides a device data acquisition and processing system, the system comprising a sensor device, a remote terminal unit and a database, wherein the database is used to preset sensor device instruction table information;
[0012] The remote terminal unit obtains sensor device instruction table information from the database; wherein the sensor device instruction table information includes sensor type, instruction symbol, execution cycle, and Lua scripts for different execution purposes;
[0013] The remote terminal unit sends the instruction symbol to the corresponding type of sensor device based on the execution cycle in the sensor device instruction table information, and the corresponding type of sensor device returns the instruction result corresponding to the instruction symbol to the remote terminal unit based on the received instruction symbol;
[0014] The remote terminal unit receives the command result, and obtains and executes the corresponding first lua script from the sensor device command table information;
[0015] The remote terminal unit parses the instruction result based on the custom conversion function in the first lua script to obtain parsed data, and stores the parsed data in a local preset area.
[0016] In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the device data collection and processing method described in the first aspect is implemented.
[0017] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the device data acquisition and processing method described in the first aspect above.
[0018] The embodiment of the present invention provides a device data acquisition and processing method and system, the system includes a sensor device, a remote terminal unit and a database, wherein the database is used to preset the sensor device instruction table information. The remote terminal unit obtains the sensor device instruction table information from the database; wherein the sensor device instruction table information includes the sensor type, instruction symbol, execution cycle, and Lua scripts for different execution purposes; the remote terminal unit sends the instruction symbol to the corresponding type of sensor device based on the execution cycle in the sensor device instruction table information, and the corresponding type of sensor device returns the instruction result corresponding to the instruction symbol to the remote terminal unit based on the received instruction symbol; the remote terminal unit receives the instruction result, and obtains and executes the corresponding first Lua script from the sensor device instruction table information; the remote terminal unit parses the instruction result based on the custom conversion function in the first Lua script, obtains the parsed data, and stores the parsed data in a local preset area.
[0019] In the above method, the sensor device instruction table information is preset by means of a database, which mainly includes data information, data acquisition instructions and parsing functions. Therefore, when collecting and processing data, different from the prior art method that requires the sensor device to be connected to the remote terminal unit through the traditional hardware protocol before data collection and processing can be performed, the present invention only needs to let the remote terminal unit download the sensor device instruction table information in the database through external instructions, and can realize the collection of device data based on the information in the instruction table, as well as the subsequent parsing and transmission, which greatly reduces the data collection cost, realizes the unified management of the parsing conversion function, reduces the system management and maintenance cost, and as time goes by, the continuously enriched database can adapt to the collection of more different devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0021] Figure 1 A schematic block diagram of a device data acquisition and processing system provided by an embodiment of the present invention;
[0022] Figure 2 A schematic diagram of a flow chart of a device data collection and processing method provided by an embodiment of the present invention;
[0023] Figure 3 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0024] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0026] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0027] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0028] The embodiment of the present invention provides a device data acquisition and processing system. Figure 1 The following is a schematic block diagram of a device data acquisition and processing system provided by an embodiment of the present invention. Figure 1 As shown, the device data acquisition and processing system includes a sensor device, a remote terminal unit and a database. The database is used to preset the sensor device instruction table information. Specifically,
[0029] The remote terminal unit obtains the instruction table information of the sensor device from the database; wherein the instruction table information of the sensor device includes the sensor type, instruction symbol, execution cycle, and Lua scripts for different execution purposes.
[0030] In this embodiment, the remote terminal unit obtains the sensor device instruction table information from the sqlite database; wherein the sensor device instruction table information includes the sensor type, instruction symbol, execution cycle, and Lua scripts for different execution purposes. For example, the sensor type is a PH sensor, the instruction symbol is to read the pH value, the execution cycle is 3 seconds, and the Lua script is used for parsing purposes.
[0031] It should be noted that there are many ways for the remote terminal unit to obtain the sensor device instruction table information from the sqlite database, for example, remotely burning the sqlite database into the remote terminal unit, or the remote terminal unit synchronously downloading the sensor device instruction table information in the database through the network, thereby avoiding a lot of development costs and data collection costs.
[0032] In one embodiment, after the remote terminal unit obtains the sensor device instruction table information from the database, the remote terminal unit responds to a sensor device instruction table information update request initiated by the external network to update the sensor device instruction table information in the database in real time.
[0033] In one embodiment, after the remote terminal unit obtains the sensor device instruction table information from the database, the remote terminal unit sends a sensor device instruction table information update request to the external network based on a preset time period, such as 30 minutes, to update the sensor device instruction table information in the database.
[0034] Different from the prior art method that requires the sensor device to be connected to the remote terminal unit through the traditional hardware protocol before data collection and processing can be performed, this embodiment presets the sensor device instruction table information through a database, which not only greatly reduces the complexity of installation and debugging between the hardware device and the remote terminal unit, but also reduces the cost of data collection and processing.
[0035] The remote terminal unit is also used to send the instruction symbol to the corresponding type of sensor device based on the execution cycle in the sensor device instruction table information, and the corresponding type of sensor device returns the instruction result corresponding to the instruction symbol to the remote terminal unit based on the received instruction symbol.
[0036] In this embodiment, first, the remote terminal unit sends the instruction symbol to the corresponding type of sensor device based on the instruction execution cycle in the sensor device instruction table information.
[0037] Specifically, the remote terminal unit sends the instruction symbol to the corresponding type of sensor device based on the execution cycle in the sensor device instruction table information, including: the remote terminal unit takes the instruction symbol data of each sensor device contained in the sensor device instruction table information as a task and puts it into the task pool; then the remote terminal unit obtains the instruction symbol data of each sensor device from the task pool in sequence based on the execution cycle corresponding to the instruction symbol data of each sensor device, such as 3 seconds, and sends it to the corresponding type of sensor device to execute the corresponding task.
[0038] Next, the sensor device of the corresponding type receives the instruction character: 010301000002C5 F7, and based on the received instruction character, transmits the instruction result corresponding to the instruction character: 01030400C002AE 7AD3 back to the remote terminal unit.
[0039] The above is the process of the remote terminal unit automatically reading the sensor device data. However, in some cases, the installation height, pipe diameter and other data registered when the sensor device is installed on site need to be written into the remote terminal unit. Since these on-site parameters are often recognizable by humans, but cannot be directly recognized by machines, these on-site parameters need to be converted into machine-recognizable data before processing.
[0040] Based on the above reasons, in one embodiment, before the corresponding type of sensor device returns the instruction result corresponding to the instruction symbol based on the received instruction symbol to the remote terminal unit, it also includes: if it is necessary to manually write the field parameters of the sensor device into the remote terminal unit based on the actual situation, the remote terminal unit receives the field parameters of the sensor device, and performs parameter conversion processing on the field parameters through the second Lua script in the sensor device instruction table information to obtain the instruction symbol of the sensor device; the remote terminal unit sends the instruction symbol of the sensor device to the corresponding type of sensor. It should be noted that the second Lua script in this embodiment is used to convert and assemble the field parameters into an instruction symbol that can be recognized by the sensor.
[0041] The remote terminal unit receives the command result, and obtains and executes the corresponding first lua script from the sensor device command table information.
[0042] In this embodiment, the remote terminal unit receives the command result returned by the sensor device, and obtains and executes the first Lua script corresponding to the command result returned by the sensor device from the sensor device command table information. It should be noted that the first Lua script is used to parse the command result returned by the sensor device.
[0043] The remote terminal unit parses the instruction result based on the custom conversion function in the first lua script, obtains parsed data, and stores the parsed data in a local preset area.
[0044] In this embodiment, the remote terminal unit parses the instruction result based on the custom conversion function in the first lua script, obtains parsed data, and stores the parsed data in a local preset area.
[0045] In one embodiment, after the remote terminal unit parses the instruction result based on the custom conversion function in the first lua script, obtains the parsed data, and stores the parsed data in the local preset area, the remote terminal unit obtains the parsed data from the local preset area. Then, the remote terminal unit pushes the parsed data to the corresponding service object based on the preset push strategy. Specifically, the remote terminal unit pushes the parsed data to the corresponding service object based on the preset push cycle and push method in the database, such as using MQTT, HTTP or websocket push methods. It should be noted that for low-power devices, the push cycle of the parsed data should not be too fast, otherwise it will cause excessive power consumption.
[0046] In one embodiment, when the remote terminal unit pushes the parsed data to the corresponding service object based on the preset push strategy, if a network failure occurs during the push process resulting in a push failure, the current parsed data will continue to be saved in the local preset area to wait for subsequent push retries; if the push still fails after a preset number of push retries, the current parsed data will be cleared to avoid memory pressure on the microcontroller; if no network failure occurs during the push process and the push is successful, the current parsed data will be deleted from the local preset area.
[0047] In the device data acquisition and processing system provided by the embodiment of the present invention, the remote terminal unit obtains the sensor device instruction table information from the database; wherein the sensor device instruction table information includes the sensor type, instruction symbol, execution cycle, and Lua scripts with different execution purposes; the remote terminal unit sends the instruction symbol to the corresponding type of sensor device based on the execution cycle in the sensor device instruction table information, and the corresponding type of sensor device returns the instruction result corresponding to the instruction symbol to the remote terminal unit based on the received instruction symbol; the remote terminal unit receives the instruction result, and obtains and executes the corresponding first Lua script from the sensor device instruction table information; the remote terminal unit parses the instruction result based on the custom conversion function in the first Lua script, obtains the parsed data, and stores the parsed data in the local preset area. In the above system, the instruction table information of the sensor device is preset by means of a database, which mainly includes data information, data acquisition instructions and parsing functions. Therefore, when collecting and processing data, it is different from the prior art method that requires the sensor device to be connected to the remote terminal unit through the traditional hardware protocol before data collection and processing can be carried out. The present invention only needs to let the remote terminal unit download the sensor device instruction table information in the database through external instructions, and can realize the collection of device data based on the information in the instruction table, as well as the subsequent analysis and transmission, which greatly reduces the data collection cost, realizes the unified management of the parsing conversion function, reduces the system management and maintenance cost, and as time goes by, the continuously enriched database can adapt to the collection of more different devices.
[0048] The embodiment of the present invention further provides a device data acquisition and processing method, which is applied to the device data acquisition and processing system. Figure 2 A flow chart of a device data collection and processing method provided by an embodiment of the present invention is shown in FIG. Figure 2 As shown, the method includes steps S210 to S240.
[0049] S210. The remote terminal unit obtains sensor device instruction table information from a database; wherein the sensor device instruction table information includes sensor type, instruction symbol, execution cycle, and Lua scripts for different execution purposes.
[0050] In this embodiment, the remote terminal unit obtains the sensor device instruction table information from the sqlite database; wherein the sensor device instruction table information includes the sensor type, instruction symbol, execution cycle, and Lua scripts for different execution purposes. For example, the sensor type is a PH sensor, the instruction symbol is to read the pH value, the execution cycle is 3 seconds, and the Lua script is used for parsing purposes.
[0051] It should be noted that there are many ways for the remote terminal unit to obtain the sensor device instruction table information from the sqlite database, for example, remotely burning the sqlite database into the remote terminal unit, or the remote terminal unit synchronously downloading the sensor device instruction table information in the database through the network, thereby avoiding a lot of development costs and data collection costs.
[0052] In one embodiment, after the remote terminal unit obtains the sensor device instruction table information from the database, the remote terminal unit responds to a sensor device instruction table information update request initiated by the external network to update the sensor device instruction table information in the database in real time.
[0053] In one embodiment, after the remote terminal unit obtains the sensor device instruction table information from the database, the remote terminal unit sends a sensor device instruction table information update request to the external network based on a preset time period, such as 30 minutes, to update the sensor device instruction table information in the database.
[0054] Different from the prior art method that requires the sensor device to be connected to the remote terminal unit through the traditional hardware protocol before data collection and processing can be performed, this embodiment presets the sensor device instruction table information through a database, which not only greatly reduces the complexity of installation and debugging between the hardware device and the remote terminal unit, but also reduces the cost of data collection and processing.
[0055] S220. The remote terminal unit sends the instruction symbol to the corresponding type of sensor device based on the execution cycle in the sensor device instruction table information. The corresponding type of sensor device returns the instruction result corresponding to the instruction symbol to the remote terminal unit based on the received instruction symbol.
[0056] In this embodiment, first, the remote terminal unit sends the instruction symbol to the corresponding type of sensor device based on the instruction execution cycle in the sensor device instruction table information.
[0057] Specifically, the remote terminal unit sends the instruction symbol to the corresponding type of sensor device based on the execution cycle in the sensor device instruction table information, including: the remote terminal unit takes the instruction symbol data of each sensor device contained in the sensor device instruction table information as a task and puts it into the task pool; then the remote terminal unit obtains the instruction symbol data of each sensor device from the task pool in sequence based on the execution cycle corresponding to the instruction symbol data of each sensor device, such as 3 seconds, and sends it to the corresponding type of sensor device to execute the corresponding task.
[0058] Next, the sensor device of the corresponding type receives the instruction character: 010301000002C5 F7, and based on the received instruction character, transmits the instruction result corresponding to the instruction character: 01030400C002AE 7AD3 back to the remote terminal unit.
[0059] The above is the process of the remote terminal unit automatically reading the sensor device data. However, in some cases, the installation height, pipe diameter and other data registered when the sensor device is installed on site need to be written into the remote terminal unit. Since these on-site parameters are often recognizable by humans, but cannot be directly recognized by machines, these on-site parameters need to be converted into machine-recognizable data before processing.
[0060] Based on the above reasons, in one embodiment, before the corresponding type of sensor device returns the instruction result corresponding to the instruction symbol based on the received instruction symbol to the remote terminal unit, it also includes: if it is necessary to manually write the field parameters of the sensor device into the remote terminal unit based on the actual situation, the remote terminal unit receives the field parameters of the sensor device, and performs parameter conversion processing on the field parameters through the second Lua script in the sensor device instruction table information to obtain the instruction symbol of the sensor device; the remote terminal unit sends the instruction symbol of the sensor device to the corresponding type of sensor. It should be noted that the second Lua script in this embodiment is used to convert and assemble the field parameters into an instruction symbol that can be recognized by the sensor.
[0061] S230: The remote terminal unit receives the command result, and obtains and executes the corresponding first lua script from the sensor device command table information.
[0062] In this embodiment, the remote terminal unit receives the command result returned by the sensor device, and obtains and executes the first Lua script corresponding to the command result returned by the sensor device from the sensor device command table information. It should be noted that the first Lua script is used to parse the command result returned by the sensor device.
[0063] S240. The remote terminal unit parses the instruction result based on the custom conversion function in the first lua script, obtains parsed data, and stores the parsed data in a local preset area.
[0064] In this embodiment, the remote terminal unit parses the instruction result based on the custom conversion function in the first lua script, obtains parsed data, and stores the parsed data in a local preset area.
[0065] In one embodiment, after the remote terminal unit parses the instruction result based on the custom conversion function in the first lua script, obtains the parsed data, and stores the parsed data in the local preset area, the remote terminal unit obtains the parsed data from the local preset area. Then, the remote terminal unit pushes the parsed data to the corresponding service object based on the preset push strategy. Specifically, the remote terminal unit pushes the parsed data to the corresponding service object based on the preset push cycle and push method in the database, such as using MQTT, HTTP or websocket push methods. It should be noted that for low-power devices, the push cycle of the parsed data should not be too fast, otherwise it will cause excessive power consumption.
[0066] In one embodiment, when the remote terminal unit pushes the parsed data to the corresponding service object based on the preset push strategy, if a network failure occurs during the push process resulting in a push failure, the current parsed data will continue to be saved in the local preset area to wait for subsequent push retries; if the push still fails after a preset number of push retries, the current parsed data will be cleared to avoid memory pressure on the microcontroller; if no network failure occurs during the push process and the push is successful, the current parsed data will be deleted from the local preset area.
[0067] In the device data acquisition and processing method provided in an embodiment of the present invention, a remote terminal unit obtains sensor device instruction table information from a database; wherein the sensor device instruction table information includes sensor type, instruction symbol, execution cycle, and Lua scripts for different execution purposes; the remote terminal unit sends the instruction symbol to a sensor device of a corresponding type based on the execution cycle in the sensor device instruction table information, and the sensor device of the corresponding type returns the instruction result corresponding to the instruction symbol to the remote terminal unit based on the received instruction symbol; the remote terminal unit receives the instruction result, and obtains and executes the corresponding first Lua script from the sensor device instruction table information; the remote terminal unit parses the instruction result based on the custom conversion function in the first Lua script, obtains parsed data, and stores the parsed data in a local preset area. In the above method, the sensor device instruction table information is preset by means of a database, which mainly includes data information, data acquisition instructions and parsing functions. Therefore, when collecting and processing data, different from the prior art method that requires the sensor device to be connected to the remote terminal unit through the traditional hardware protocol before data collection and processing can be performed, the present invention only needs to let the remote terminal unit download the sensor device instruction table information in the database through external instructions, and can realize the collection of device data based on the information in the instruction table, as well as the subsequent parsing and transmission, which greatly reduces the data collection cost, realizes the unified management of the parsing conversion function, reduces the system management and maintenance cost, and as time goes by, the continuously enriched database can adapt to the collection of more different devices.
[0068] The above-mentioned device data collection and processing method can be implemented in the form of a computer program. The computer program can be used in Figure 3 Runs on the computer device shown.
[0069] See also Figure 3 , Figure 3 1 is a schematic block diagram of a computer device provided by an embodiment of the present invention. The computer device may be used to execute a device data collection and processing method.
[0070] See also Figure 3 The computer device 500 includes a processor 502 , a memory and a network interface 505 connected via a system bus 501 , wherein the memory may include a storage medium 503 and an internal memory 504 .
[0071] The storage medium 503 may store an operating system 5031 and a computer program 5032. When the computer program 5032 is executed, the processor 502 may execute a device data acquisition and processing method, wherein the storage medium 503 may be a volatile storage medium or a non-volatile storage medium.
[0072] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500 .
[0073] The internal memory 504 provides an environment for the operation of the computer program 5032 in the storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute the device data collection and processing method.
[0074] The network interface 505 is used for network communication, such as providing data information transmission, etc. Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device 500 to which the solution of the present invention is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0075] The processor 502 is used to run the computer program 5032 stored in the memory to implement the corresponding functions in the above-mentioned device data collection and processing method.
[0076] Those skilled in the art will understand that Figure 3 The embodiments of the computer device shown in the figure do not constitute a limitation on the specific composition of the computer device. In other embodiments, the computer device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. For example, in some embodiments, the computer device may only include a memory and a processor. In such embodiments, the structure and function of the memory and the processor are the same as those of the embodiment of the present invention. Figure 3 The embodiments shown are consistent and will not be described again here.
[0077] It should be understood that in the embodiment of the present invention, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0078] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium may be a volatile or non-volatile computer-readable storage medium. The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps included in the above-mentioned device data acquisition and processing method are implemented.
[0079] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the above-described equipment, devices and units can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. Those of ordinary skill in the art can appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0080] In the several embodiments provided by the present invention, it should be understood that the disclosed equipment, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. Units with the same function may also be combined into one unit. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices or units, or may be an electrical, mechanical or other form of connection.
[0081] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present invention.
[0082] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0083] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a computer-readable storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned computer-readable storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a magnetic disk or an optical disk.
[0084] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A device data acquisition and processing method, applied to a device data acquisition and processing system, characterized in that: The system comprises a sensor device, a remote terminal unit and a database, wherein the database is used to preset instruction table information of the sensor device, and the method comprises: The remote terminal unit obtains sensor device instruction table information from the database; wherein the sensor device instruction table information includes sensor type, instruction symbol, execution cycle, and Lua scripts for different execution purposes; The remote terminal unit sends the instruction symbol to the corresponding type of sensor device based on the execution cycle in the sensor device instruction table information, and the corresponding type of sensor device returns the instruction result corresponding to the instruction symbol to the remote terminal unit based on the received instruction symbol; The remote terminal unit receives the command result, and obtains and executes the corresponding first lua script from the sensor device command table information; The remote terminal unit parses the instruction result based on the custom conversion function in the first lua script to obtain parsed data, and stores the parsed data in a local preset area.
2. The method according to claim 1, characterized in that The remote terminal unit sends the instruction symbol to the corresponding type of sensor device based on the execution cycle in the sensor device instruction table information, including: The remote terminal unit takes the instruction symbol data of each sensor device contained in the sensor device instruction table information as a task and puts it into a task pool; The remote terminal unit sequentially obtains the instruction data of each sensor device from the task pool based on the execution cycle corresponding to the instruction data of each sensor device and sends it to the corresponding type of sensor device to execute the corresponding task.
3. The method according to claim 1, characterized in that Before the corresponding type of sensor device transmits back the instruction result corresponding to the instruction symbol to the remote terminal unit based on the received instruction symbol, the method further includes: If it is necessary to manually write the field parameters of the sensor device into the remote terminal unit based on the actual situation, the remote terminal unit receives the field parameters of the sensor device, and performs parameter conversion processing on the field parameters through the second Lua script in the instruction table information of the sensor device to obtain the instruction symbol of the sensor device; The remote terminal unit sends the instruction code of the sensor device to the sensor of the corresponding type.
4. The method according to claim 1, characterized in that: After the remote terminal unit parses the instruction result based on the custom conversion function in the first lua script to obtain parsed data and stores the parsed data in a local preset area, the method includes: The remote terminal unit acquires parsed data from the local preset area; The remote terminal unit pushes the parsed data to the corresponding service object based on a preset push strategy.
5. The method according to claim 4, characterized in that When the remote terminal unit pushes the parsed data to the corresponding service object based on a preset push strategy, the method includes: If a network failure occurs during the push process, resulting in a push failure, the current parsed data will continue to be stored in the local preset area to wait for subsequent push retries; If the push still fails after the preset number of push retries, the current parsed data is cleaned up; If no network failure occurs during the push process and the push is successful, the current parsed data is deleted from the local preset area.
6. The method according to claim 1, characterized in that After the remote terminal unit obtains the sensor device instruction table information from the database, the method includes: The remote terminal unit updates the sensor device instruction table information in the database in real time in response to a sensor device instruction table information update request initiated by an external network.
7. The method according to claim 1, characterized in that After the remote terminal unit acquires the sensor device instruction table information from the database, the method further includes: The remote terminal unit sends a sensor device instruction table information update request to the external network based on a preset time period to update the sensor device instruction table information in the database.
8. A device data acquisition and processing system, characterized in that: The system includes a sensor device, a remote terminal unit and a database, wherein the database is used to preset the sensor device instruction table information; The remote terminal unit obtains sensor device instruction table information from the database; wherein the sensor device instruction table information includes sensor type, instruction symbol, execution cycle, and Lua scripts for different execution purposes; The remote terminal unit sends the instruction symbol to the corresponding type of sensor device based on the execution cycle in the sensor device instruction table information, and the corresponding type of sensor device returns the instruction result corresponding to the instruction symbol to the remote terminal unit based on the received instruction symbol; The remote terminal unit receives the command result, and obtains and executes the corresponding first lua script from the sensor device command table information; The remote terminal unit parses the instruction result based on the custom conversion function in the first lua script to obtain parsed data, and stores the parsed data in a local preset area.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the device data collection and processing method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the device data acquisition and processing method according to any one of claims 1 to 7 is implemented.
