Data collection method, system, electronic device and readable storage medium
By setting up a collection configuration table containing device identification, parameters and communication protocols in the data acquisition system, the device is automatically configured and data collection is realized, which solves the problem of long device configuration time in traditional technology and improves configuration efficiency and data collection accuracy.
Patent Information
- Application Number
- CN202310355710.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-04
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2043-04-04
AI Technical Summary
Traditional data collection technology requires defining different collection protocols and parameters based on device brand and type, resulting in long configuration time.
By setting up the collection configuration table, including device identification, device parameters and device communication protocol, automatic configuration and data collection of the device can be achieved.
It reduces equipment configuration time, improves configuration efficiency, and ensures the accuracy and completeness of data collection through judgment of data length and verification rules.
Smart Images

Figure CN116346859B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data processing, and in particular to a data acquisition method, system, electronic device, and readable storage medium. Background Art
[0002] With the continuous emergence of smart products, more and more smart products are being applied to people's lives, and people's demand for intelligent living and office is also increasing. Data monitoring of smart products is required, for example, to collect and analyze data such as heating, water, and electricity supply in buildings; to collect and analyze data such as energy consumption and temperature of split air conditioners on each floor and in each room of a building; and to collect data from security monitoring equipment. Traditional data collection technology requires different collection protocols and parameters for different devices and different parameters, depending on the device brand and type. This setup method requires a lot of manual work and takes a long time.
[0003] The above-mentioned existing technical solutions have the following drawbacks: the configuration time of the device is relatively long. Summary of the Invention
[0004] In order to improve the problem of long device configuration time, the present application provides a data collection method, system, electronic device and readable storage medium.
[0005] In a first aspect of the present application, a data collection method is provided. The method comprises:
[0006] Obtaining a collection configuration table, wherein the collection configuration table includes a device identifier, device parameters, and a device communication protocol;
[0007] Traversing the acquisition configuration table, and establishing a communication connection with the device corresponding to the device identifier according to the device identifier and the device communication protocol;
[0008] According to the device parameters, collected data of the device corresponding to the device identifier is obtained.
[0009] It can be seen from the above technical solution that by setting the collection configuration table, selecting the appropriate communication protocol and realizing the communication connection, data collection is realized, the device configuration for obtaining the collected data is completed, and the problem of needing different settings for different devices is improved. To a certain extent, the configuration time of the device can be reduced and the configuration efficiency of the device can be improved.
[0010] In a possible implementation, the method further includes:
[0011] Obtaining the data length of the collected data;
[0012] Determining whether the data length is the same as a preset length;
[0013] If not, output data loss information.
[0014] From the above technical solution, it can be seen that by judging whether the data length of the acquired collected data is the same as the preset data length, if they are not the same, it means that the collected data is lost during the transmission process, and data loss information is output. By judging the data length of the collected data, it can be detected whether the collected data is abnormal, and the user can be reminded in time that there is an abnormality in the data.
[0015] In a possible implementation, the method further includes:
[0016] According to the preset verification rules, determine whether the collected data is transmitted incorrectly;
[0017] If so, a data transmission error message is output.
[0018] In a possible implementation, the method further includes:
[0019] The device parameters include parameter formats;
[0020] Acquiring a collection format of the collected data;
[0021] Determining whether the acquisition format is the same as the parameter format;
[0022] If not, the acquisition format of the acquired data is converted into a parameter format according to a preset data conversion rule to determine the target acquired data.
[0023] In one possible implementation, the device identification corresponds to one or more device communication protocols;
[0024] When there are multiple device communication protocols, obtaining user communication requirements;
[0025] sorting the plurality of device communication protocols according to the user communication requirement and determining a target communication protocol;
[0026] A communication connection is established with the device corresponding to the device identification according to the device identification and the target communication protocol.
[0027] In a possible implementation, when the user communication requirement is empty, obtaining a default protocol attribute;
[0028] sorting the plurality of device communication protocols according to the default protocol attributes and determining a target communication protocol;
[0029] A communication connection is established with the device corresponding to the device identification according to the device identification and the target communication protocol.
[0030] In a possible implementation, the method further includes:
[0031] Determine the collection period corresponding to the device identifier according to the data upload period table and the device identifier;
[0032] Upload the collected data according to the collection cycle and the collected data.
[0033] In a second aspect of the present application, a data acquisition system is provided. The system comprises:
[0034] A configuration acquisition module is used to acquire an acquisition configuration table, wherein the acquisition configuration table includes a device identifier, device parameters, and a device communication protocol;
[0035] A communication connection module, configured to traverse the acquisition configuration table and establish a communication connection with the device corresponding to the device identifier according to the device identifier and the device communication protocol;
[0036] The data acquisition module is used to acquire the collected data of the device corresponding to the device identification according to the device parameters.
[0037] In a third aspect of the present application, an electronic device is provided, comprising: a memory and a processor, wherein the memory stores a computer program, and the processor implements the above method when executing the program.
[0038] In a fourth aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method according to the first aspect of the present application is implemented.
[0039] In summary, this application includes at least one of the following beneficial technical effects:
[0040] By setting up the acquisition configuration table, selecting the appropriate communication protocol and realizing the communication connection, data collection is realized, which improves the problem of needing different settings for different devices. To a certain extent, it can reduce the configuration time of the device and improve the configuration efficiency of the device. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 It is a flow chart of the data collection method provided by this application.
[0042] Figure 2 It is a structural diagram of the data acquisition system provided by this application.
[0043] Figure 3 It is a structural diagram of the electronic device provided in this application.
[0044] In the figure, 200, data acquisition system; 201, configuration acquisition module; 202, communication connection module; 203, data acquisition module; 301, CPU; 302, ROM; 303, RAM; 304, I / O interface; 305, input part; 306, output part; 307, storage part; 308, communication part; 309, drive; 310, removable medium. DETAILED DESCRIPTION
[0045] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0046] In this document, the term "and / or" simply describes a relationship between related objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " in this document, unless otherwise specified, generally indicates an "or" relationship between the related objects.
[0047] The embodiments of the present application are described in further detail below with reference to the accompanying drawings.
[0048] An embodiment of the present application provides a data collection method, and the main process of the method is described as follows.
[0049] like Figure 1 As shown:
[0050] Step S101: Obtain a collection configuration table.
[0051] Specifically, the acquisition configuration table includes device identification, device parameters, device communication protocol and the correspondence between the three. The above-mentioned acquisition configuration table is set by the user according to the data acquisition requirements. The above-mentioned device identification represents the unique identification of a data acquisition device. The above-mentioned device identification corresponds to multiple device parameters. The above-mentioned device parameters represent the parameters that need to be collected by the device corresponding to a certain device identification. The above-mentioned device communication protocol represents the communication protocol supported by the data acquisition device corresponding to the device identification. The device communication protocol corresponding to a device identification can be one or more.
[0052] Step S102: traverse the collection configuration table, and establish a communication connection with the device corresponding to the device identifier according to the device identifier and the device communication protocol.
[0053] Specifically, the above-mentioned acquisition configuration table is traversed to obtain the device communication protocol corresponding to each device identifier in turn. For a certain device identifier, when there are multiple device communication protocols corresponding to the device identifier, it is necessary to obtain the user communication requirements. The above-mentioned user communication requirements are the content input by the user, and can be other attributes of the device communication protocol such as transmission rate, transmission delay, and transmission data reliability; according to the user communication requirements, the multiple device communication protocols corresponding to the device identifier are sorted, and the target communication protocol is determined; according to the device identifier and the target communication protocol, a communication connection is established with the device corresponding to the device identifier. When the above-mentioned user communication requirements are empty, the default protocol attributes are obtained. The above-mentioned default protocol attributes have a one-to-one correspondence with the above-mentioned device identifier, and the above-mentioned default protocol attributes are attributes pre-set by the user, and can be one of other attributes of the device communication protocol such as transmission rate and transmission data reliability. The above-mentioned device communication protocol also includes the attributes of the communication protocol, which include but are not limited to the transmission rate of the communication protocol, the transmission reliability of the communication protocol, and the transmission delay of the communication protocol. According to the default protocol attributes of the multiple device communication protocols corresponding to a certain device identifier, the multiple device communication protocols are sorted, and the target communication protocol is determined. For example, when the default protocol attribute is the transmission delay, the device communication protocols are sorted in ascending order according to the attribute value of the transmission delay, and the first device communication protocol is used as the target communication protocol. According to the target communication protocol corresponding to the device identifier, a communication connection is established with the device corresponding to the device identifier. Similarly, the method of "sorting the multiple device communication protocols corresponding to the device identifier according to the user's communication needs and determining the target communication protocol" is the same as the sorting method of the above-mentioned default protocol attributes, which will not be repeated here.
[0054] The user communication requirement includes an attribute name and an attribute value. The attribute value is a string. "When the user communication requirement is empty" indicates that the attribute value corresponding to the user communication requirement is null. Methods for determining whether a user communication requirement is empty are well known to those skilled in the art and are not described in detail here.
[0055] Step S103: Acquire the collected data of the device corresponding to the device identifier according to the device parameters.
[0056] Specifically, for a certain device, the device can collect multiple parameters, such as temperature, humidity and voltage, but for the user, only the temperature and humidity need to be obtained through the device. The above temperature and humidity are the above device parameters. When the device corresponding to the device identifier establishes a communication connection, the corresponding collected data is obtained according to the device parameters corresponding to the device identifier.
[0057] Step S104: Determine target acquisition data based on the acquisition data, device parameters and preset judgment rules.
[0058] Specifically, the data length of the collected data is obtained, and it is determined whether the above data length is the same as the preset length. When the data length is the same as the preset length, it means that the collected data is not lost during the transmission process. If the data length is different from the preset length, it means that the collected data is lost during the transmission process, and data loss information is output to prompt the user that the data is lost and may become unavailable.
[0059] If no data is lost during the transmission of the collected data, a predetermined check rule is used to determine whether the collected data is transmitted incorrectly. If the result of the determination is a transmission error, a data transmission error message is output. The aforementioned check rule is a CRC check, which is a well-known technical means for those skilled in the art and will not be described in detail here.
[0060] The above-mentioned device parameters include parameter formats. When the above-mentioned judgment result is that no transmission error occurs, the acquisition format of the above-mentioned acquired data is obtained, and it is determined whether the above-mentioned acquisition format is the same as the above-mentioned parameter format. When the acquisition format and the parameter format are the same, the acquired data is the target acquired data; when the acquisition format and the parameter format are different, the acquisition format of the above-mentioned acquired data is converted into the parameter format according to the preset data conversion rules to determine the target acquired data.
[0061] For example, when the temperature data obtained by the device is a decimal, but the temperature data required by the user is an integer, the temperature data will be converted into an integer according to the preset configuration rules when parsing the temperature data, that is, the temperature data in integer format is the target collection data.
[0062] Step S105: uploading the target collected data according to the device identification, the data upload periodic table and the target collected data.
[0063] Specifically, according to the data upload cycle table, the device identification and the device parameters, the collection cycle corresponding to a device parameter of the above device identification is determined; according to the above collection cycle and the target collection data, the above target collection data is uploaded.
[0064] For example, the power consumption data of a certain device is the difference between two data. The collected data needs to be subtracted within a certain time range. If the data upload cycle is 24 hours, the power consumption data at midnight of the current day needs to be subtracted from the power consumption data at midnight of the previous day to obtain the power consumption data of the previous day, which can then be uploaded.
[0065] In step S102 above, "user communication requirements" are mentioned, which include transmission rate and transmission delay. It is understood that when the user communication requirement is transmission rate or transmission delay, it indicates that the user desires efficient data transmission. That is, there is a minimum transmission rate and a maximum transmission delay for transmission delay. The minimum transmission rate and maximum transmission delay are pre-stored in the database.
[0066] Data collection methods also include:
[0067] When the user communication requirement is the transmission rate, the real-time transmission rate of the collected data is determined; when the real-time transmission rate is lower than the minimum transmission rate, the collected data is periodically transmitted based on the data transmission rule.
[0068] When the user communication requirement is transmission delay, the real-time transmission delay of the collected data is determined; when the real-time transmission delay is lower than the maximum transmission delay, the collected data is periodically transmitted based on the data transmission rule.
[0069] Based on the data transmission rules, the above collected data is periodically transmitted, including:
[0070] The data importance and change probability corresponding to the different collected data are obtained, and the data monitoring intensity is calculated based on the data importance and change probability, where monitoring intensity = data importance + change probability. A larger monitoring intensity value indicates more important and more likely to change the corresponding collected data, while a smaller monitoring intensity value indicates less important and substantially unchanged data. The collected data are sorted in ascending order according to the monitoring intensity. In this embodiment, the collected data are first data, second data, third data, and fourth data. The first data is acquired according to a corresponding preset period. If the real-time transmission rate or real-time transmission delay at this time meets the user's communication requirements, the second, third, and fourth data are acquired in real time. If the real-time transmission rate or real-time transmission delay at this time does not meet the user's communication requirements, the second data is acquired according to the corresponding preset period, and a determination is made as to whether the user's communication requirements are met. If not, the third data is acquired according to the corresponding preset period until the user's communication requirements are met.
[0071] The preset period for the collected data can be set by the user, or by analyzing historical data to determine the period of change for each type of collected data, which can be used as the preset period. For example, for the temperature collected by a device, this temperature is a type of collected data. Through analysis of historical temperature data, it is found that the temperature fluctuates approximately every hour, so the preset period for this temperature can be set to one hour.
[0072] The present application embodiment provides a data acquisition system 200, referring to Figure 2 , the data acquisition system 200 includes:
[0073] Configuration acquisition module 201, used to obtain an acquisition configuration table, the acquisition configuration table including device identification, device parameters and device communication protocol;
[0074] The communication connection module 202 is used to traverse the acquisition configuration table and establish a communication connection with the device corresponding to the device identifier according to the device identifier and the device communication protocol;
[0075] The data collection module 203 is configured to obtain the collected data of the device corresponding to the device identifier according to the device parameters.
[0076] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working process of the described module can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.
[0077] The embodiment of the present application discloses an electronic device. Figure 3 The electronic device includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 302 or the program loaded from the storage part 307 to the random access memory (RAM) 303. Various programs and data required for system operation are also stored in the RAM 303. The CPU 301, ROM 302, and RAM 303 are connected to each other via a bus. An input / output (I / O) interface 304 is also connected to the bus.
[0078] The following components are connected to the I / O interface 304: an input section 305 including a keyboard, a mouse, and the like; an output section 306 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and speakers; a storage section 307 including a hard disk; and a communication section 308 including a network interface card such as a LAN card or a modem. The communication section 308 performs communication processing via a network such as the Internet. A drive 309 is also connected to the I / O interface 304 as needed. Removable media 310, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 309 as needed, so that computer programs read therefrom can be installed into the storage section 307 as needed.
[0079] In particular, according to the embodiment of the present application, the above reference flow chart Figure 1The described process can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product comprising a computer program carried on a machine-readable medium, the computer program containing program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 308 and / or installed from a removable medium 310. When the computer program is executed by the central processing unit (CPU) 301, the above-mentioned functions defined in the apparatus of the present application are performed.
[0080] It should be noted that the computer-readable medium shown in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this application, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. This propagated data signal can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber cable, RF, or any suitable combination thereof.
[0081] The above description is merely a preferred embodiment of the present application and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of application involved in this application is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the aforementioned application concept. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions applied for in this application.
Claims
1. A data collection method, characterized in that: include: Obtaining a collection configuration table, wherein the collection configuration table includes a device identifier, device parameters, and a device communication protocol; Traversing the acquisition configuration table, and establishing a communication connection with the device corresponding to the device identifier according to the device identifier and the device communication protocol; Acquire the collected data of the device corresponding to the device identifier according to the device parameters; The device identification corresponds to one or more device communication protocols; When there are multiple device communication protocols, obtaining user communication requirements; Acquiring real-time communication parameters of the collected data, wherein the real-time communication parameters include a real-time transmission rate; Determining whether the real-time communication parameters meet the user's communication needs; If the real-time communication parameters cannot meet the user's communication needs; Based on data transmission rules, periodically transmitting the collected data; The determining whether the real-time communication parameters meet the user's communication needs includes determining whether the real-time transmission rate is lower than a preset minimum transmission rate value; Based on the data transmission rule, the collected data is periodically transmitted, including: Obtain the data importance and change possibility corresponding to different collected data; Calculate data monitoring intensity based on the data importance and change possibility, where monitoring intensity = data importance + change possibility; sorting the collected data in ascending order according to the monitoring intensity, and determining the different collected data as first data, second data, third data, and fourth data in sequence; Acquiring the first data according to a corresponding preset period, and determining whether the real-time communication parameters meet the user's communication needs; If the user communication requirement is met, the second data, the third data, and the fourth data are acquired in real time; If the user communication demand is not met, the second data is acquired according to the corresponding preset period, and it is continued to be determined whether the user communication demand is met. If not, the third data is continued to be acquired according to the corresponding preset period until the user communication demand is met.
2. The data collection method according to claim 1, characterized in that: The method further includes: Obtaining the data length of the collected data; Determining whether the data length is the same as a preset length; If not, output data loss information.
3. The data collection method according to claim 2, characterized in that: The method further includes: According to the preset verification rules, determine whether the collected data is transmitted incorrectly; If so, a data transmission error message is output.
4. The data collection method according to claim 1, wherein: The method further includes: The device parameters include parameter formats; Acquiring a collection format of the collected data; Determining whether the acquisition format is the same as the parameter format; If not, the acquisition format of the acquired data is converted into a parameter format according to a preset data conversion rule to determine the target acquired data.
5. The data collection method according to claim 1, wherein: sorting the plurality of device communication protocols according to the user communication requirement and determining a target communication protocol; A communication connection is established with the device corresponding to the device identification according to the device identification and the target communication protocol.
6. The data collection method according to claim 5, characterized in that: When the user communication requirement is empty, obtaining a default protocol attribute; sorting the plurality of device communication protocols according to the default protocol attributes and determining a target communication protocol; A communication connection is established with the device corresponding to the device identification according to the device identification and the target communication protocol.
7. The data collection method according to claim 1, characterized in that: The method further includes: Determine the collection period corresponding to the device identifier according to the data upload period table and the device identifier; Upload the collected data according to the collection cycle and the collected data.
8. A data acquisition system for implementing the data acquisition method according to claim 1, characterized in that: include: A configuration acquisition module (201) is used to acquire an acquisition configuration table, wherein the acquisition configuration table includes a device identifier, device parameters, and a device communication protocol; A communication connection module (202) is used to traverse the acquisition configuration table and establish a communication connection with the device corresponding to the device identifier according to the device identifier and the device communication protocol; The data acquisition module (203) is used to acquire the collected data of the device corresponding to the device identification according to the device parameters.
9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that A computer program is stored thereon, and when the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Data acquisition method and data acquisition device based on LoRaWAN
CN110517471A
Multi-protocol connection method and device for block chain network, and storage medium
CN113114670A
Data transmission method and device, electronic equipment and storage medium
CN115664599A