CN111654545B - General analysis method and system for sensor data - Google Patents

General analysis method and system for sensor data Download PDF

Info

Publication number
CN111654545B
CN111654545B CN202010496273.5A CN202010496273A CN111654545B CN 111654545 B CN111654545 B CN 111654545B CN 202010496273 A CN202010496273 A CN 202010496273A CN 111654545 B CN111654545 B CN 111654545B
Authority
CN
China
Prior art keywords
sensor
message
data
communication protocol
protocol
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010496273.5A
Other languages
Chinese (zh)
Other versions
CN111654545A (en
Inventor
方八零
贾运珍
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hunan University of Technology
Original Assignee
Hunan University of Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hunan University of Technology filed Critical Hunan University of Technology
Priority to CN202010496273.5A priority Critical patent/CN111654545B/en
Publication of CN111654545A publication Critical patent/CN111654545A/en
Application granted granted Critical
Publication of CN111654545B publication Critical patent/CN111654545B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/26Special purpose or proprietary protocols or architectures
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computing Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Arrangements For Transmission Of Measured Signals (AREA)

Abstract

The invention discloses a general analysis method and a system for sensor data, wherein the method comprises the following steps: generating a protocol corresponding file; acquiring a first message sent by the sensor, wherein the first message is a message sent by the sensor to the host for the first time, and the first message comprises a sensor address of the sensor sending the first message; acquiring all the standard communication protocols; analyzing the first message according to each standard communication protocol, judging whether the first message can be successfully analyzed and obtaining first analysis data; different analysis programs do not need to be developed for the sensors adopting different communication protocols, and all common industrial internet of things communication protocols on the market are only stored in the storage equipment, so that the universal analysis of the sent messages of different sensors can be completed; namely, the analysis program does not need to be changed, and the communication protocol adopted by the analysis program is changed, so that the method is very convenient and fast.

Description

General analysis method and system for sensor data
Technical Field
The invention relates to the field of communication of the Internet of things, in particular to a general analysis method and system for sensor data.
Background
In network communication, a communication protocol is used for realizing a standard between computers and network connection, and if the network does not have a uniform communication protocol, information transmission between the computers cannot be identified. The communication protocol refers to a communication rule predefined by each communication party, and can be simply understood as a common language used for mutual conversation among computers.
In the field of industrial internet of things, communication between various sensors and a host also needs to be completed through a communication protocol, namely, a communication analysis program solidified in the host analyzes communication data between the sensors according to the communication protocol agreed with the sensors; for example, 0203003425FA, which is the return data transmitted by the temperature sensor to the host, is difficult for a person who is not familiar with the sensor communication protocol to process and understand, a parsing program is required here, and the parsing program in the host parses the data into data that can be read and understood by an ordinary person according to the communication protocol.
However, the types of sensors used in practical applications are very various, different sensors and different manufacturers cause different communication protocols used by the various sensors to be different, each different communication protocol requires a specific development of a different matching analysis program, which is very cumbersome, and a method and a system capable of compatibly using different communication protocols and correctly analyzing communication data of the sensors are urgently needed.
Disclosure of Invention
The invention mainly aims to provide a universal analysis method and a universal analysis system for sensor data, and aims to solve the problems that in the field of the existing industrial Internet, different sensors adopt different communication protocols, and each different communication protocol needs to develop different analysis programs in a targeted manner.
The invention provides a general analysis method of sensor data, which is applied to a general analysis system of the sensor data, wherein the system comprises a host, a storage device, a display device and a plurality of sensors; the storage device stores a plurality of standard communication protocols; the storage device, the display device and the sensor are all in communication connection with the host; the method comprises the following steps:
generating a protocol corresponding file;
acquiring a first message sent by the sensor, wherein the first message is a message sent by the sensor to the host for the first time, and the first message comprises a sensor address of the sensor sending the first message;
acquiring all the standard communication protocols;
analyzing the first message according to each standard communication protocol, judging whether the first message can be successfully analyzed and obtaining first analysis data;
if so, displaying the first analysis data, establishing a first corresponding relation between the standard communication protocol for successfully analyzing the first message and the sensor address, and storing the first corresponding relation into the protocol corresponding file;
acquiring a second message sent by the sensor, wherein the second message comprises the sensor address of the sensor sending the second message;
judging whether the sensor address included in the second message has the corresponding standard communication protocol according to the protocol corresponding file;
and if the second message exists, analyzing the second message according to the corresponding standard communication protocol to obtain second analysis data, and displaying the second analysis data.
Preferably, the determining whether the first analysis data can be successfully analyzed to obtain the first analysis data further includes:
if not, acquiring a user-defined communication protocol;
analyzing the first message according to each user-defined communication protocol, judging whether the first message can be successfully analyzed and obtaining third analysis data;
if yes, displaying the third analysis data, establishing a second corresponding relation between the user-defined communication protocol successfully analyzing the first message and the sensor address, and storing the second corresponding relation into the protocol corresponding file.
Preferably, the acquiring the second message sent by the sensor further includes:
judging whether the sensor address included in the second message has the corresponding self-defined communication protocol according to the protocol corresponding file;
and if so, analyzing the second message according to the corresponding custom communication protocol to obtain fourth analysis data, and displaying the fourth analysis data.
Preferably, the determining whether the analysis can be successfully performed to obtain third analysis data further includes:
and if not, generating first error information and displaying the first error information, wherein the first error information comprises the sensor address in the first message.
Preferably, the general analysis system for sensor data further comprises an information input device, and the information input device is in communication connection with the host; the method further comprises the following steps:
will pass through information input device inputs self-defined communication protocol is deposited storage device, wherein, self-defined communication protocol includes frame head value, sensor address position value, sensor address word length value, function code position value, function code word length value, data type value, data address position value, data address word length value, data block position value, data block word length value, check code position value, check code word length value and frame tail value.
Preferably, the method further comprises:
acquiring data request information input through the information input equipment, wherein the data request information comprises a sensor address;
judging whether a standard communication protocol corresponding to the sensor address exists or not according to the protocol corresponding file;
if so, compiling the data request information into a third message according to the corresponding standard communication protocol;
and sending the third message to the sensor corresponding to the sensor address in the data request information.
Preferably, the determining whether a standard communication protocol corresponding to the sensor address exists according to the protocol correspondence file further includes:
if not, judging whether a user-defined communication protocol corresponding to the sensor address exists according to the protocol corresponding file;
if so, compiling the data request information into a fourth message according to the corresponding custom communication protocol;
and sending the third message to the sensor corresponding to the sensor address in the data request information.
Preferably, the determining whether a user-defined communication protocol corresponding to the sensor address exists according to the protocol correspondence file further includes:
and if not, generating second error information and displaying the second error information, wherein the second error information comprises the sensor address in the data request information.
Preferably, the method further comprises the following steps:
and storing the first analysis data into the storage device.
The invention also provides a general analysis system of sensor data, which is applied to the general analysis method of the sensor data, and the system comprises a host, a storage device, a display device and a plurality of sensors; the storage device stores a plurality of standard communication protocols; the storage device, the display device and the sensor are all in communication connection with the host.
Through above-mentioned technical scheme, can realize following beneficial effect:
according to the general analysis method for the sensor data, provided by the invention, a plurality of standard communication protocols are preset in a storage device, wherein the standard communication protocols include but are not limited to common industrial Internet of things common protocols such as Modbus-RUT, modbus-ASCII and the like, when a host receives a first message (sent and monitored data) sent by a sensor, the host judges whether a sensor address included in the first message corresponds to the standard communication protocol, and if so, the corresponding standard communication protocol is directly adopted to analyze the first message and obtain analysis data; if not, the first message is sequentially analyzed according to all standard communication protocols until the first message is successfully analyzed and analysis data is obtained, and then the standard communication protocol which successfully analyzes the first message is corresponding to the sensor address (namely, the sensor is corresponding to the standard communication protocol which can analyze the sensor message), so that the message sent by the sensor can be subsequently analyzed again.
By the technical scheme, different analysis programs do not need to be developed for the sensors adopting different communication protocols, and all common industrial Internet of things communication protocols on the market only need to be stored in the storage equipment, so that the universal analysis of the sent messages of different sensors can be completed; namely, the analysis program does not need to be changed, and the communication protocol adopted by the analysis program is changed, so that the method is very convenient and fast.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the structures shown in the drawings without creative efforts.
Fig. 1 is a flowchart of a general method for analyzing sensor data according to a first embodiment of the present invention.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The invention provides a general analysis method and a general analysis system for sensor data.
As shown in fig. 1, in a first embodiment of a general parsing method for sensor data according to the present invention, the general parsing method is applied to a general parsing system for sensor data, where the system includes a host, a storage device (preferably a hard disk), a display device (preferably a display), and a plurality of sensors; the storage device stores a plurality of standard communication protocols; the storage device, the display device and the sensor are all in communication connection with the host; the embodiment comprises the following steps:
step S110: and generating a protocol corresponding file.
Specifically, the protocol correspondence file is a text file, which records a correspondence between the sensor address of each sensor and a standard communication protocol, and each sensor sends a message with the sensor address of the sensor sending the message, and the sensor address is unique (i.e., different sensor addresses of different sensors).
Step S120: acquiring a first message sent by the sensor, wherein the first message is a message sent by the sensor to the host for the first time, and the first message includes a sensor address of the sensor sending the first message.
Specifically, the sensor sends a first message to the host, and the host receives the first message, where the first message is a message sent by the sensor to the host for the first time, and the host does not know what communication protocol is used to parse the first message.
Step S130: all of the standard communication protocols are acquired.
Specifically, the host retrieves all standard communication protocols, such as Modbus-RUT, modbus-ASCII, etc., from the storage device.
Step S140: and analyzing the first message according to each standard communication protocol, judging whether the first message can be successfully analyzed, and obtaining first analysis data.
Specifically, since the sensor sends a message to the host for the first time, the sensor address in the first message does not have a corresponding standard communication protocol, and at this time, the first message is sequentially analyzed according to all the standard communication protocols until the first message is successfully analyzed and the first analysis data is obtained.
If yes, go to step S150: and displaying the first analysis data, establishing a first corresponding relation between the standard communication protocol for successfully analyzing the first message and the sensor address, and storing the first corresponding relation into the protocol corresponding file.
Specifically, if the first message is successfully analyzed, it is proved that a protocol capable of analyzing the first message exists in a preset standard communication protocol in the storage device, a first corresponding relationship is established between the protocol and a sensor address in the first message, where the first corresponding relationship actually corresponds a sensor and the standard communication protocol capable of analyzing the sensor message, so as to analyze a message sent by the sensor in the subsequent process, that is, when the sensor sends a message again, the standard communication protocol corresponding to the sensor is directly called to analyze the message.
And analyzing the first message into first analysis data, and displaying the first analysis data on a display.
Step S160: and acquiring a second message sent by the sensor, wherein the second message comprises the sensor address of the sensor sending the second message.
Specifically, the second message is different from the first message, that is, the second message is no longer the first message sent to the host.
Step S170: and judging whether the sensor address included in the second message has the corresponding standard communication protocol according to the protocol corresponding file.
Specifically, since the second message is actually a message sent to the host again after the first message (i.e., a message not sent to the host for the first time), if the first message sent by the sensor is analyzed normally, a standard communication protocol corresponding to the sensor address of the sensor exists (i.e., the first correspondence relationship between the sensor address of the sensor and the standard communication protocol is recorded in the protocol correspondence file).
Step S180: and if the second message exists, analyzing the second message according to the corresponding standard communication protocol to obtain second analysis data, and displaying the second analysis data.
Specifically, according to the first corresponding relationship, the host may directly analyze the second message by using the corresponding standard communication protocol to obtain second analysis data, where the second analysis data is a data value (e.g., a voltage value) detected by the sensor, and the second analysis data is displayed on the display.
For example, the sensor address of the first message corresponds to a standard Modbus-RUT communication protocol, the first message is 0203003425FA, and according to the standard Modbus-RUT communication protocol, 02 is an address code, i.e., a sensor address; 03 is a function code, which represents read data; 0034 represents the detection data of the sensor (the sensor takes a voltage sensor as an example, namely the detection data is three-phase voltage data), and since the data transmission in the industrial internet of things is 16-system, the three-phase voltage data obtained after the conversion of 0034 is 52KV; the 25FA is a check code for checking whether the first message is in error.
According to the general analysis method for the sensor data, a plurality of standard communication protocols are preset in storage equipment, wherein the standard communication protocols include but are not limited to common industrial internet of things common protocols, such as Modbus-RUT, modbus-ASCII and the like, when a host receives a first message sent by a sensor (namely, a message sent to the host by each sensor for the first time), the host can sequentially analyze the first message according to all the standard communication protocols until the first message is successfully analyzed and first analysis data are obtained, then establish a first corresponding relation between the standard communication protocol successfully analyzing the first message and the sensor address (namely, the sensor is corresponding to the standard communication protocol capable of analyzing the sensor message), and store the first corresponding relation in a protocol corresponding file; therefore, when the host equipment receives the message of the sensor again, the standard communication protocol corresponding to the sensor address of the sensor can be directly found through the protocol corresponding file, and the standard communication protocol is called to directly analyze the message received again subsequently.
By the technical scheme, different analysis programs do not need to be developed for the sensors adopting different communication protocols, and all common industrial Internet of things communication protocols on the market only need to be stored in the storage equipment, so that the universal analysis of the sent messages of different sensors can be completed; namely, the analysis program does not need to be changed, and the communication protocol adopted by the analysis program is changed, so that the method is very convenient and fast.
In a second embodiment of the method for universally parsing sensor data according to the present invention, based on the first embodiment, step S140 further includes the following steps:
if not, go to step S210: and acquiring a custom communication protocol.
Specifically, in practical applications, besides the regular communication protocol, some sensor manufacturers may also use their own defined communication protocol, and in this case, the messages sent by the sensors cannot be analyzed using the conventional standard communication protocol. A custom communication protocol defined by the sensor vendor itself is required. The customized communication protocol is manually input and stored in the storage device, and please refer to the third embodiment.
The number of custom communication protocols is 1 or more.
Step S220: and analyzing the first message according to each user-defined communication protocol, judging whether the first message can be successfully analyzed, and obtaining third analysis data.
Specifically, since the sensor address in the first message does not have a corresponding standard communication protocol, at this time, an attempt to perform resolution by using a custom communication protocol is required; the first message is sequentially analyzed according to all standard communication protocols until the first message is successfully analyzed and third analysis data is obtained.
If yes, go to step S230: and displaying the third analysis data, establishing a second corresponding relation between the user-defined communication protocol for successfully analyzing the first message and the sensor address, and storing the second corresponding relation into the protocol corresponding file.
Specifically, if the first message is successfully analyzed, it is proved that a custom communication protocol capable of analyzing the first message is stored in the storage device, a second corresponding relationship is established between the protocol and the sensor address in the first message, where the second corresponding relationship actually corresponds to the sensor and the custom communication protocol capable of analyzing the sensor message, so as to analyze the message sent by the sensor later, that is, when the sensor sends the message again later, the custom communication protocol corresponding to the sensor is directly called to analyze the message.
And analyzing the first message into third analysis data, and displaying the third analysis data on a display so as to be convenient for operators to use.
In a third embodiment of the method for universally analyzing sensor data according to the present invention, based on the second embodiment, step S160 further includes the following steps:
step S310: and judging whether the sensor address included in the second message has the corresponding user-defined communication protocol according to the protocol corresponding file.
Specifically, since the second message is actually a message sent to the host again after the first message (i.e., a message not sent to the host for the first time), if the first message sent by the sensor is analyzed normally, a standard communication protocol or a custom communication protocol corresponding to the sensor address of the sensor may exist (i.e., the first corresponding relationship between the sensor address of the sensor and the standard communication protocol or the second corresponding relationship between the sensor address of the sensor and the custom communication address may be recorded in the protocol corresponding file), which is the method that should be adopted when the sensor address included in the second message corresponds to the custom communication protocol.
If yes, go to step S320: and analyzing the second message according to the corresponding custom communication protocol to obtain fourth analysis data, and displaying the fourth analysis data.
Specifically, according to the second correspondence, the host may directly analyze the second message by using the corresponding custom communication protocol to obtain fourth analysis data, where the fourth analysis data is a data value (e.g., a voltage value) detected by the sensor, and the fourth analysis data is displayed on the display.
In a fourth embodiment of the method for universally analyzing sensor data according to the present invention, based on the second embodiment, step S320 further includes the following steps:
if not, execute step S410: generating first error information and displaying the first error information, wherein the first error information comprises the sensor address in the first message.
Specifically, if the first message is not analyzed through the stored standard communication protocol or the stored user-defined communication protocol, the first message indicates that the communication protocol adopted by the sensor is temporarily unknown or is not recorded in the storage device, and the first error information needs to be displayed on the display to remind an operator of timely processing.
In a fifth embodiment of the method for universal parsing of sensor data according to the present invention, based on the second embodiment, the system for universal parsing of sensor data further includes an information input device, where the information input device is in communication connection with the host; the embodiment further comprises the following steps:
step S510: the user-defined communication protocol input through the information input device is stored in the storage device, wherein the user-defined communication protocol includes a frame header value, a sensor address location value, a sensor address word length value, a function code location value, a function code word length value, a data type unit value, a data address location value, a data address word length value, a data block location value, a data block word length value, a check code location value, a check code word length value, and a frame tail value.
Specifically, the user-defined communication protocol is a text file, the number of the user-defined communication protocols is multiple, the communication protocols are respectively defined to correspond to the sensors which adopt the user-defined communication protocols for communication, relevant information of the user-defined communication protocols used by the sensors can be obtained from the use specifications of the sensors which adopt the user-defined communication protocols, and the user-defined communication protocols can be manually input according to the relevant information.
In this embodiment, the custom communication protocol includes: frame header, address, data type, data address, data block, check code, and frame trailer. A message can be correctly analyzed only by including all the contents; this custom format information can be obtained from the sensor's specifications.
For purposes of explanation, an embodiment of a custom communication protocol is illustrated herein in which the frame header value is FFFF, occupying 2 bytes; the position value of the sensor address is 3, which indicates that the sensor address begins to take a value from the 3 rd byte of the message, the word length value of the sensor address is 2, which indicates that the sensor address occupies 2 bytes; the position value of the function code is 5, which indicates that the function code begins to take value from the 5 th byte of the message, and the length value of the function code is 3, which indicates that the function code occupies 3 bytes; the data type value is a voltage value, and the data type unit value is KV; the data address position value is 8, which indicates that the data address begins to take values from the 8 th byte of the message, the data address word length value is 3, which indicates that the data address occupies 3 bytes; the data block position value is 11, which indicates that the data block begins to take value from the 11 th byte of the message, and the data block word length value is 4, which indicates that the data block occupies 4 bytes; the position value of the check code is 15, the check code starts to take values from the 15 th byte of the message, the check code word length value is 4, and the check code word length is 4 bytes; the end of frame value is DD.
For example, the host receives the following messages: FFFF030020050025SD05DD, the address of the message sensor is 03, the message corresponds to one embodiment of the self-defined communication protocol, and then the message can be analyzed according to the self-defined communication protocol to obtain analysis data, wherein the analysis process is that the frame head is FFFF and the frame tail is DD; the check code is checked to be correct, which shows that the message has no error; the function code is 002, which represents reading data, that is, the host reads the data in the storage space with the storage address of 005 from the sensor with the address of 03, the data is 0025, decimal conversion is performed to 37KV, the data is voltage data, which represents that the voltage value detected by the sensor is 37KV, and display is performed after conversion, so that the voltage value data can be read and understood.
Specifically, the data type values in the customized communication protocol include, but are not limited to, a voltage value, a current value, a temperature value, a humidity value, a speed value, and an illumination intensity value; in practice, the data types are in one-to-one correspondence with the types of sensors that are used to measure what data, and the data types here are what data are expressed.
In a sixth embodiment of the method for universal parsing of sensor data according to the present invention, based on the fifth embodiment, the step S220 includes the following steps:
step S610: generating a parsing list, wherein the parsing list is used for storing the custom communication protocol that has been adopted to parse the first message.
Specifically, sequential analysis of the custom communication protocols is managed by generating an analysis list so as to conveniently know which custom communication protocol has been adopted to analyze the first message, and the analysis list is stored in the storage device.
Step S620: and acquiring any one of the custom communication protocols, and judging whether the acquired custom communication protocol exists in the analysis list.
If yes, go to step S630: returning to step S620.
Specifically, the meaning here is to find a custom communication protocol that has not been used to parse the first message yet, because if the obtained custom communication protocol already exists in the parsing list, it is proved that the custom communication protocol has been adopted to parse the first message.
If not, go to step S640: and marking the acquired custom communication protocol as a current protocol, and judging whether the frame head value and the frame tail value in the current protocol simultaneously exist in the first message.
Specifically, when the current protocol is used for analyzing the first message, the frame head value and the frame tail value are found first, and then subsequent judgment is performed, and if the frame head value and the frame tail value are not matched, it is proved that the current protocol can certainly not analyze the first message, and subsequent analysis is not necessary.
Step S650: if the data address position value, the data address word length value, the data block position value and the data block word length value of the current protocol exist at the same time, data in a first message are read according to the data address position value, the data address word length value, the data block position value and the data block word length value of the current protocol, and first preliminary data are generated.
Specifically, for example, the word length of the data address is 3, which means that the data address occupies 3 bytes; the data block position value is 11, which indicates that the data block begins to take value from the 11 th byte of the message, and the data block word length value is 4, which indicates that the data block occupies 4 bytes; this way the first preliminary data in the first message can be read.
For example, if the first message is: FFFF030020050025SD05DD, and the first preliminary data of the packet is 0025.
Step S660: and converting the first preliminary data into second preliminary data through system conversion according to the system type of the first message.
Specifically, in this embodiment, the first message is hexadecimal, so that the decimal conversion result is 37.
Step S670: converting the second preliminary data into the third parsed data according to the data type value and the data type unit value of the current protocol.
Specifically, if the data type value is voltage data and the data type unit value is KV, the third analysis data is 37KV.
Step S680: if the protocol does not exist simultaneously, the current protocol is stored in the protocol list, and then whether all the self-defined communication protocols are included in the protocol list is judged.
Specifically, if the messages do not exist at the same time, the current protocol is proved to be incapable of analyzing the first message, and the subsequent analysis step is not performed; then storing the current protocol into the protocol list; and then judging the contents of the protocol list so as to judge whether all the self-defined protocols are analyzed.
Step S690: if yes, go to step S410.
Specifically, if included, it is verified that all the custom communication protocols are adopted, and the third analysis data may not be generated, so step S410 is directly performed.
Step S6110: if not, return to step S620.
Specifically, if not, it is verified that a custom communication protocol is not adopted, and the process directly returns to step S620 to perform the determination again.
In a seventh embodiment of the method for generic parsing of sensor data according to the present invention, based on the first embodiment, the method further comprises the following steps:
step S710: and acquiring data request information input through the information input equipment, wherein the data request information comprises a sensor address.
Specifically, the data request information includes the sensor address of the sensor requesting to be read, and after all the sensors send messages to the host, the sensor addresses of all the sensors are known.
Step S720: and judging whether a standard communication protocol corresponding to the sensor address exists or not according to the protocol corresponding file.
If yes, go to step S730: and compiling the data request information into a third message according to the corresponding standard communication protocol.
Step S740: and sending the third message to the sensor corresponding to the sensor address in the data request information.
Specifically, the technical solution of this embodiment actually converts the request sent to the sensor into a message recognizable by the sensor through a communication protocol, so as to implement bidirectional communication, i.e. compiling the data request information into a third message recognizable by the sensor, where the compiling process is completed according to a standard communication protocol corresponding to the sensor address of the target sensor to be sent.
In an eighth embodiment of the method for analyzing sensor data in general according to the present invention, based on the seventh embodiment, step S720 further includes the following steps:
if not, go to step S810: and judging whether a user-defined communication protocol corresponding to the sensor address exists or not according to the protocol corresponding file.
If yes, go to step S820: compiling the data request information into a fourth message according to the corresponding custom communication protocol.
Step S830: and sending the third message to the sensor corresponding to the sensor address in the data request information.
Specifically, the technical solution of this embodiment actually converts the request sent to the sensor into a message recognizable by the sensor through a communication protocol, so as to implement bidirectional communication, i.e., compiling the data request information into a third message recognizable by the sensor, where the compiling process is completed according to a custom communication protocol corresponding to the sensor address of the target sensor to be sent.
In a ninth embodiment of the method for analyzing sensor data in general according to the present invention, based on the eighth embodiment, step S810 further includes the following steps:
if not, go to step 910: and generating second error information and displaying the second error information, wherein the second error information comprises the sensor address in the data request information.
Specifically, if not, it is proved that the sensor address of the sensor to be sent of the data request information does not correspond to the standard communication protocol or the custom communication protocol, the host and the sensor to be sent cannot communicate with each other, and second error information needs to be generated, where the second error information includes the sensor address in the data request information, so as to facilitate the checking by an operator.
In a tenth embodiment of the method for analyzing sensor data in general according to the present invention, based on the first embodiment, the communication connection between the sensor and the host is serial connection. Serial Interface (Serial Interface) refers to data transmission sequentially bit by bit, and features simple communication line and less error in transmission.
In an eleventh embodiment of the method for universal parsing of sensor data according to the present invention, based on the first embodiment, the method further includes the following steps;
step S1010: and storing the first analysis data into the storage device.
Specifically, the first analysis data is stored in the storage device so as to be convenient for archiving and subsequent viewing.
The invention also provides a general analysis system of the sensor data, which is applied to the general analysis method of the sensor data, and the system comprises a host, a storage device, a display device and a plurality of sensors; the storage device stores a plurality of standard communication protocols; the storage device, the display device and the sensor are all in communication connection with the host.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, wherein the software product is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (8)

1. The general analysis method of the sensor data is characterized in that the general analysis method is applied to a general analysis system of the sensor data, and the system comprises a host, a storage device, a display device and a plurality of sensors; the storage device stores a plurality of standard communication protocols; the storage device, the display device and the sensor are all in communication connection with the host; the method comprises the following steps:
generating a protocol corresponding file;
acquiring a first message sent by the sensor, wherein the first message is a message sent by the sensor to the host for the first time, and the first message comprises a sensor address of the sensor sending the first message;
acquiring all the standard communication protocols;
analyzing the first message according to each standard communication protocol, judging whether the first message can be successfully analyzed and obtaining first analysis data;
if so, displaying the first analysis data, establishing a first corresponding relation between the standard communication protocol for successfully analyzing the first message and the sensor address, and storing the first corresponding relation into the protocol corresponding file;
acquiring a second message sent by the sensor, wherein the second message comprises the sensor address of the sensor sending the second message;
judging whether the sensor address included in the second message has the corresponding standard communication protocol according to the protocol corresponding file;
if the second message exists, analyzing the second message according to the corresponding standard communication protocol to obtain second analysis data, and displaying the second analysis data;
the judging whether the analysis can be successfully performed and the first analysis data is obtained, and then the method further comprises the following steps:
if not, acquiring a user-defined communication protocol;
analyzing the first message according to each user-defined communication protocol, judging whether the first message can be successfully analyzed and obtaining third analysis data;
if so, displaying the third analysis data, establishing a second corresponding relation between the user-defined communication protocol for successfully analyzing the first message and the sensor address, and storing the second corresponding relation into the protocol corresponding file;
the judging whether the analysis can be successfully performed and the third analysis data is obtained, and then the method further comprises the following steps:
if not, generating first error information, and displaying the first error information, wherein the first error information comprises the sensor address in the first message;
the analyzing the first message according to each user-defined communication protocol respectively, judging whether the first message can be successfully analyzed and obtaining third analysis data, and the method comprises the following steps:
generating a parsing list, wherein the parsing list is used for storing the custom communication protocol which is adopted to parse the first message;
acquiring any one of the custom communication protocols, and judging whether the acquired custom communication protocol exists in the analysis list or not;
if yes, returning to the step of acquiring any one of the custom communication protocols and judging whether the acquired custom communication protocol exists in the analysis list;
if not, marking the acquired user-defined communication protocol as a current protocol, and judging whether a frame head value and a frame tail value in the current protocol simultaneously exist in the first message;
if the data address position value, the data address word length value, the data block position value and the data block word length value of the current protocol exist at the same time, data in the first message are read according to the data address position value, the data address word length value, the data block position value and the data block word length value of the current protocol, and first preliminary data are generated;
converting the first preliminary data into second preliminary data through carrying conversion according to the carrying type of the first message;
converting the second preliminary data into the third analytic data according to the data type value and the data type unit value of the current protocol;
if the current protocols do not exist simultaneously, storing the current protocols into a protocol list, and then judging whether all the self-defined communication protocols are included in the protocol list;
if yes, executing the step of generating first error information and displaying the first error information, wherein the first error information comprises the sensor address in the first message;
and if not, returning to the step of acquiring any one of the custom communication protocols and judging whether the acquired custom communication protocol exists in the analysis list.
2. The method for universally parsing sensor data according to claim 1, wherein the obtaining a second message sent by the sensor further comprises:
judging whether the sensor address included in the second message has the corresponding self-defined communication protocol according to the protocol corresponding file;
and if so, analyzing the second message according to the corresponding user-defined communication protocol to obtain fourth analysis data, and displaying the fourth analysis data.
3. The method for universal parsing of sensor data according to claim 1, wherein the system for universal parsing of sensor data further comprises an information input device, the information input device being communicatively connected to the host; the method further comprises the following steps:
will pass through information input device inputs self-defined communication protocol is deposited storage device, wherein, self-defined communication protocol includes frame head value, sensor address position value, sensor address word length value, function code position value, function code word length value, data type value, data address position value, data address word length value, data block position value, data block word length value, check code position value, check code word length value and frame tail value.
4. The method for universal parsing of sensor data according to claim 3, the method further comprising:
acquiring data request information input through the information input equipment, wherein the data request information comprises a sensor address;
judging whether a standard communication protocol corresponding to the sensor address exists or not according to the protocol corresponding file;
if so, compiling the data request information into a third message according to the corresponding standard communication protocol;
and sending the third message to the sensor corresponding to the sensor address in the data request information.
5. The method of claim 4, wherein the determining whether a standard communication protocol corresponding to the sensor address exists according to the protocol correspondence file further comprises:
if not, judging whether a user-defined communication protocol corresponding to the sensor address exists according to the protocol corresponding file;
if so, compiling the data request information into a fourth message according to the corresponding custom communication protocol;
and sending the third message to the sensor corresponding to the sensor address in the data request information.
6. The method of claim 5, wherein the determining whether a custom communication protocol corresponding to the sensor address exists according to the protocol correspondence file further comprises:
and if not, generating second error information and displaying the second error information, wherein the second error information comprises the sensor address in the data request information.
7. The method for universal parsing of sensor data according to claim 1, further comprising:
and storing the first analysis data into the storage device.
8. A general parsing system for sensor data, applied to the general parsing method for sensor data according to any one of claims 1 to 7, the system comprising a host, a storage device, a display device and a plurality of sensors; the storage device stores a plurality of standard communication protocols; the storage device, the display device and the sensor are all in communication connection with the host.
CN202010496273.5A 2020-06-03 2020-06-03 General analysis method and system for sensor data Active CN111654545B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010496273.5A CN111654545B (en) 2020-06-03 2020-06-03 General analysis method and system for sensor data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010496273.5A CN111654545B (en) 2020-06-03 2020-06-03 General analysis method and system for sensor data

Publications (2)

Publication Number Publication Date
CN111654545A CN111654545A (en) 2020-09-11
CN111654545B true CN111654545B (en) 2023-02-07

Family

ID=72347151

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010496273.5A Active CN111654545B (en) 2020-06-03 2020-06-03 General analysis method and system for sensor data

Country Status (1)

Country Link
CN (1) CN111654545B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112505246B (en) * 2020-11-11 2023-05-02 山西科致成科技有限公司 Digital mining gas sensor calibration and verification device and method
CN112383547A (en) * 2020-11-13 2021-02-19 广州众诺电子技术有限公司 Data transmission method and device and imaging box
CN114024990A (en) * 2021-11-19 2022-02-08 深圳创维智慧科技有限公司 General access method for Internet of things platform, network equipment and readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101227351A (en) * 2008-01-23 2008-07-23 深圳国人通信有限公司 Method and apparatus for processing multi protocol data packets in remote control
CN109218261A (en) * 2017-07-03 2019-01-15 腾讯科技(深圳)有限公司 A kind of data processing method and data processing equipment
CN110868336A (en) * 2019-11-11 2020-03-06 北京明略软件系统有限公司 Data management method, device and computer readable storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017177362A1 (en) * 2016-04-11 2017-10-19 武汉芯泰科技有限公司 Wireless configurable flash memory

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101227351A (en) * 2008-01-23 2008-07-23 深圳国人通信有限公司 Method and apparatus for processing multi protocol data packets in remote control
CN109218261A (en) * 2017-07-03 2019-01-15 腾讯科技(深圳)有限公司 A kind of data processing method and data processing equipment
CN110868336A (en) * 2019-11-11 2020-03-06 北京明略软件系统有限公司 Data management method, device and computer readable storage medium

Also Published As

Publication number Publication date
CN111654545A (en) 2020-09-11

Similar Documents

Publication Publication Date Title
CN111654545B (en) General analysis method and system for sensor data
CN111045952B (en) Software testing method, flow playback device, terminal equipment and readable storage medium
KR101993239B1 (en) Method and apparatus for managing user device and contents using QR code
CN108289060B (en) Data processing method and device based on RPC service
CN113872967B (en) Vehicle information transmission method and device, electronic equipment and storage medium
CN110830442A (en) Message processing method, device and gateway
CN110324281B (en) Vehicle-mounted network controller refreshing system and method
US20160140345A1 (en) Information processing device, filtering system, and filtering method
CN105323128B (en) method, device and system for accessing front-end equipment to server
CN113961836A (en) Page jump method and device, electronic equipment and storage medium
JP2004129142A (en) Method of connecting network line
CN112929720A (en) Screen projection method and device, electronic equipment and readable storage medium
CN111797345B (en) Application page display method, device, computer equipment and storage medium
CN108282374B (en) Method, system and readable storage medium for configuring NCSI network card
CN113438226B (en) Message generating and analyzing method, device and system based on hybrid transmission protocol
CN114328130B (en) Server monitoring method, system, equipment and computer readable storage medium
KR101192900B1 (en) Method for determining complementary data relating to at least one content, method for transmitting said complementary data, and associated processing device and application server
CN111131369B (en) APP use condition transmission method and device, electronic equipment and storage medium
CN114285774A (en) Flow recording method and device, electronic equipment and storage medium
CN108833568B (en) Message synchronization method, client, server and electronic equipment
CN114615235A (en) Method, device and computer program product for managing addresses of devices in a network
CN113472878A (en) Method and device for realizing file dragging transmission in VNC by using browser plug-in
CN110855782A (en) Service calling system, method, electronic equipment and readable storage medium
CN116915875B (en) General method for analyzing modbus equipment by Internet of things and modbus system
CN111294382A (en) Real-time data pushing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant