CN117215988A - LabVIEW-based serial data receiving, analyzing and playing back method and system - Google Patents
LabVIEW-based serial data receiving, analyzing and playing back method and system Download PDFInfo
- Publication number
- CN117215988A CN117215988A CN202311268994.0A CN202311268994A CN117215988A CN 117215988 A CN117215988 A CN 117215988A CN 202311268994 A CN202311268994 A CN 202311268994A CN 117215988 A CN117215988 A CN 117215988A
- Authority
- CN
- China
- Prior art keywords
- data
- frame
- playback
- serial
- parameters
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title abstract description 24
- 238000007405 data analysis Methods 0.000 abstract description 25
- 238000004458 analytical method Methods 0.000 abstract description 13
- 239000000284 extract Substances 0.000 abstract description 8
- 230000009467 reduction Effects 0.000 description 18
- 238000010586 diagram Methods 0.000 description 10
- 230000002159 abnormal effect Effects 0.000 description 9
- 238000004891 communication Methods 0.000 description 7
- 238000012545 processing Methods 0.000 description 7
- 230000008569 process Effects 0.000 description 6
- 238000012795 verification Methods 0.000 description 5
- 238000000605 extraction Methods 0.000 description 4
- 238000007493 shaping process Methods 0.000 description 4
- 230000000694 effects Effects 0.000 description 3
- 101000746134 Homo sapiens DNA endonuclease RBBP8 Proteins 0.000 description 2
- 101000969031 Homo sapiens Nuclear protein 1 Proteins 0.000 description 2
- 102100021133 Nuclear protein 1 Human genes 0.000 description 2
- 230000005856 abnormality Effects 0.000 description 2
- 239000003086 colorant Substances 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000003745 diagnosis Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Landscapes
- Communication Control (AREA)
Abstract
The invention relates to the field of software development, in particular to a method and a system for receiving, analyzing and playing back serial data based on LabVIEW, comprising the following steps that S1, a data receiving module configures interface parameters according to serial interface types, circularly reads serial data, puts the serial data into a data queue, adopts the data queue to transmit the data, and stores data source codes; s2, the data analysis module reads serial data from the data queue, extracts complete data frames according to the configured data frame format, analyzes the data frames, and displays and stores the results; step S3, the data playback module receives and reads the data source codes in the step S1 according to the configured playback parameters, and places the read data source codes into a data queue for data analysis according to the configured playback parameters, and displays and stores the result; the invention can meet the analysis requirements of different serial data, avoid developing respective software for analyzing different serial data, and improve the utilization rate of software codes.
Description
Technical Field
The invention relates to the field of software development, in particular to a LabVIEW-based serial data receiving, analyzing and playing back method and system.
Background
Serial communication is widely applied to various testing fields, and is a main communication mode among modules, products and systems. Because different serial communications have different communication protocols, the data frame formats are different, which results in the need for different software for targeted reception and parsing. The existing software can only process serial data under normal conditions, and when abnormality exists in the serial data, such as data loss, data repetition or data errors, the existing software cannot correctly cope with the abnormality; in addition, the existing solutions tend to develop a completely new software for data playback, as required for data playback. This not only does not make use of existing parsing tools, increasing development and maintenance costs, but also does not ensure the authenticity and accuracy of playback.
Disclosure of Invention
The invention aims at solving the technical problems, and provides a method and a system for receiving, analyzing and playing back serial data based on LabVIEW, which can meet different serial data analysis requirements, can correctly cope with the abnormal situation of serial data, improve the utilization rate of software codes and have a real data playback function, and the aim of the invention can be realized by the following technical scheme:
the invention provides a LabVIEW-based serial data receiving, analyzing and playing back method, which comprises the following steps of,
step S1, a data receiving module configures interface parameters according to serial interface types, circularly reads serial data, puts the serial data into a data queue, adopts the data queue to transmit the data, and stores data source codes;
step S2, the data analysis module reads serial data from the data queue in the step S1, extracts complete data frames according to the configured data frame format, restores corresponding parameters according to the settings including parameter positions and types in the data frame format, judges whether the data frames are correct and continuous, analyzes the data frames, and displays and stores the results;
and step S3, the data playback module receives and reads the data source codes in the step S1 according to the configured playback parameters, and places the read data source codes into a data queue in the step S1 according to the configured playback parameters including playback speed and playback position to analyze the data in the step S2, and displays and stores the result.
Further, in step S1, the data is transmitted by using a data queue, the data receiving module and the data playback module time-share put the data into the same data queue, and the data analyzing module reads the data from the data queue for analysis and playback.
Further, in step S2, the configured data frame format is defined by a configuration file, and the data parsing module reads the complete data frame extracted by the configuration file; and analyzing the corresponding data extracted according to the parameters in the data frame, and providing error frame and missing frame statistics.
Further, in step S2, when the data frame is extracted, the character string is searched by using a preset regular expression and through a matching mode VI, the fixed-length frame and the indefinite-length frame are processed, and the correct data frame is quickly found in abnormal data.
Based on the same inventive concept, the invention also provides a LabVIEW-based serial data receiving, analyzing and playing back system, which performs the serial data receiving, analyzing and playing back method, and is characterized by comprising
The data receiving module configures interface parameters according to the type of the serial interface, circularly reads serial data, puts the serial data into a data queue and stores data source codes;
the data analysis module reads serial data from the data queue, extracts a complete data frame according to the configured data frame format, restores corresponding parameters according to the settings in the configured data frame format, judges whether the data frame is correct and continuous, analyzes the data frame and displays a storage result;
and the data playback module is used for reading the data source codes of the data receiving module, extracting the data source codes according to the set playback parameters including playback speed and playback position, and putting the data source codes into a data queue for the data analysis module to use.
Further, the data receiving module comprises a receiving configuration unit, an interface management unit, a data reading unit, a data caching and storing unit;
the receiving configuration unit is used for setting parameters of the serial interface; the method comprises the steps that for a serial port, a receiving configuration unit sets parameters including a serial port number and a baud rate verification mode; for a network port, the setting parameters include a network protocol type, an IP address, and a port number.
Interface management unit: and managing and maintaining whether the state of the serial interface is normal or not, and ensuring the normal operation of the interface.
A data reading unit: when the interface management unit works normally, the serial data received by the serial interface are circularly read through the parameters set by the receiving configuration unit; until the interface is closed or the module is stopped;
data caching and storage unit: the read serial data is put into a data queue to carry out the next data analysis; meanwhile, the data source codes are stored, and the next step of data playback is performed.
Further, the data analysis module comprises an analysis configuration unit, a data reading unit, a data frame extraction unit, a data frame processing unit and a data display storage unit;
the analysis configuration unit configures a data frame format through a configuration file, wherein the data frame format comprises a frame head, a frame length and a frame tail;
a data reading unit for reading serial data from the data queue according to the configured data frame format;
and the data frame extraction unit searches the character string according to a preset regular expression and through a matching mode VI, processes the fixed-length frame and the non-fixed-length frame and quickly finds the correct data frame in abnormal data.
The data frame processing unit comprises checksum frame missing judging processing, and is responsible for calculating and comparing the checksum when the data frame comprises the checksum, so that the integrity and the accuracy of the data frame are ensured; when the data frame contains frame count; the continuity of the frame count is judged to detect whether a missing frame exists in the data frame.
A data display storage unit; and restoring parameters in the data frame according to the configured data frame format and the type of the parameters, wherein the parameters comprise numerical values, state quantities and enumeration quantities, and displaying and storing the results.
Further, the data playback module comprises a playback configuration unit and a source code reading unit;
a playback configuration unit configured to configure configuration information of the playback configuration unit;
the source code reading unit reads the data source codes from the file path file in the configuration information at fixed time according to the parameters set by the configuration information, and adds the data source codes into the data queue for the data analysis module to use.
Compared with the prior art, the invention has at least one of the following technical effects:
the LabVIEW-based serial data receiving, analyzing and playing back method and system provided by the invention meet different serial data analyzing requirements, can correctly cope with the abnormal situation of serial data, improve the software code utilization rate, and have the real data playing back function, and have the following beneficial effects:
(1) The invention meets the serial data analysis requirements of different communication protocols through configuration parameters, avoids repeated development and improves the software utilization rate.
(2) The abnormal data processing capability can rapidly locate and capture the correct data frame in the abnormal data stream, simultaneously provide statistics information of error frames and missed frames, and make statistics for the error frames and the missed frames, ensure the accuracy and the integrity of data analysis, and avoid the situation of misunderstanding the error frames or missed correct frames.
(3) The data receiving and the data playback are used as two data sources to put the data into the same queue in a time sharing way, and the data analyzing module reads the data from the queue to analyze, so that the data playback achieves the real effect, the difference between the actually received data and the played data is avoided, and the code utilization rate is also improved.
Drawings
In order to more clearly illustrate the technical solution of the embodiments of the present invention, the following description will briefly explain the drawings that are required to be used in the description of the embodiments:
FIG. 1 is a program flow diagram of a LabVIEW-based serial data receiving, parsing and playback method of the present invention;
FIG. 2 is a program flow diagram of each module in the LabVIEW-based serial data receiving, parsing and playback method of the present invention;
FIG. 3 is a system block diagram of a LabVIEW-based serial data receiving, parsing and playback system of the present invention;
FIG. 4 is a block diagram of the process of the present invention for grabbing a fixed length frame;
FIG. 5 is a block diagram of the process of the present invention for capturing frames of varying length;
FIG. 6 is a data frame format in embodiment 1 of the present invention;
fig. 7 is a block diagram of a data receiving module in embodiment 1 of the present invention;
FIG. 8 is a block diagram of the procedure for grabbing an indefinite length frame in example 1 of the present invention;
FIG. 9 is a block diagram of a procedure for grabbing a fixed length frame in example 1 of the present invention;
FIG. 10 is a partial flow chart of the data analysis module in the embodiment 1 of the present invention;
FIG. 11 is a block diagram showing a data playback module in accordance with embodiment 1 of the present invention;
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be further described in detail below with reference to the accompanying drawings and detailed description. It should be understood that the detailed description is presented by way of example only and is not intended to limit the invention.
Example 1
The invention provides a LabVIEW-based serial data receiving, analyzing and replaying method, which meets different serial data analyzing requirements, can correctly cope with abnormal situations of serial data, improves the utilization rate of software codes, has a real data replaying function, and comprises the following steps of,
step S1, a data receiving module configures interface parameters according to serial interface types, such as serial port number configuration, baud rate verification mode and the like; the network port configures network protocol type, IP address, port number, etc. After the serial interface works normally after configuration, circularly reading serial data, putting the serial data into a data queue, transmitting the data by adopting the data queue, and storing data source codes;
step S2, the data analysis module reads serial data from the data queue in the step S1, extracts a complete data frame according to the configured data frame format, restores corresponding various parameters according to parameter positions, types and other settings in the data frame format, judges the correctness and continuity of the data frame, analyzes the data frame, and displays and stores the result;
wherein the data frame format comprises:
frame header, string format, required items, typically 1-4 bytes;
frame length, shaping value, necessary item, usually 1-4 bytes, for fixed length frame, frame length value is constant; for an indefinite length frame, a frame length position, a frame length offset and the like are required to be set;
frame counting (time code), shaping numerical values (time code format), recommending items, needing to set frame counting positions and frame counting lengths, and judging whether frame missing conditions exist or not by judging the continuity of the frame counting (time code);
frame type, character string format, recommended item, usually 1-4 bytes, need to set frame type position, frame type length, characterize data frame type;
frame content, i.e. content to be analyzed, is generally divided into numerical value, state quantity, enumeration quantity and the like;
for the numerical value, parameters such as numerical value names, numerical value positions, numerical value lengths, numerical value data types, numerical value restoration formulas, numerical value display precision and the like are required to be set;
for the state quantity, parameters such as a state quantity name, a state quantity position, a state quantity color and the like are required to be set;
for the enumeration volume, an enumeration volume name, an enumeration volume position, an enumeration volume length, each enumeration value of the enumeration volume and a corresponding enumeration state are required to be set;
checksum, shaping numerical value, recommended item, usually 1-2 bytes, and parameters such as checksum position, checksum length, checksum type, checksum calculation data position and length can be set;
the end of frame, string format, recommended item, typically 1-4 bytes.
The data analysis module reads serial data from the data queue, and after splicing the serial data with the previous analysis residual data, the data analysis module extracts a complete data frame by grabbing a fixed-length frame, VI or grabbing an indefinite-length frame, VI.
The process of the VI is shown in fig. 4, a regular expression of "frame header … … frame end" is generated according to the frame header, frame length and frame end (if no blank character string), other data except the frame header and the frame end are replaced by "" (ASCII code 0x 2E), a matching mode (Match Pattern) VI is adopted to Match in the input character string, if matching is successful, a complete data frame is intercepted, and the rest data is input into a shift register to continue matching in the next cycle; and if the matching is unsuccessful, outputting the residual character string data with the length not greater than that of the regular expression.
The VI flow is shown in fig. 5, according to the frame head, the frame length position and the regular expression of the frame head … … from the frame head to the frame length, other data except the frame head are replaced by "" (ASCII code 0x 2E), a matching mode (Match Pattern) VI is adopted to Match in the input character string, the full frame length is restored according to the frame length position, the frame length and the frame length offset after the matching is successful, whether the character string length after the frame head is more than or equal to the frame length is judged, if yes, whether the frame tail is correct is continuously judged, if yes, the complete data frame is intercepted, and the rest data is input into a shift register for continuous matching in the next circulation; if not, deleting frame header data, and inputting the rest data into a shift register for continuous matching in the next cycle; if the character string length after the frame head is matched is less than the frame length, inputting the matched data into a shift register for continuous matching in the next cycle; and if the frame head and the frame length are not successfully matched, outputting the residual character string data with the length not greater than that of the regular expression.
After the full-frame data is obtained, if the checksum exists, calculating the checksum according to parameters such as the length of the checksum, the type of the checksum, the position and the length of the checksum calculated data and the like, comparing the checksum with the checksum in the full frame, and if the checksum is inconsistent, judging that the data frame is an error frame;
after the full frame data is obtained, if the frame count (time code) exists, whether the frame count (time code) is continuous or not can be judged by judging the continuity of the frame count (time code), whether the time code is within 1.5 periods or not is judged according to the frame frequency, and if the frame count (time code) is discontinuous, the frame leakage of the data frame is judged;
after the checksum is judged correctly (if not, the checksum is not judged), setting and restoring various parameters according to parameter names, positions, types and the like in the frame format:
the numerical parameter is set according to the numerical name, the numerical parameter source code is intercepted according to the numerical position and the numerical length, the numerical parameter source code is converted into an original numerical value according to the numerical data type, the numerical parameter source code is converted into an actual numerical value according to a numerical reduction formula, and the actual numerical value is displayed according to the numerical display precision;
state quantity parameters, setting parameter names according to the state quantity names, extracting corresponding data bits according to the state quantity positions, wherein 0 is false,1 is true, and displaying the state of the indicator lamp according to the state quantity colors;
setting parameter names according to enumeration quantity names, intercepting enumeration quantity parameter source codes according to enumeration quantity positions and enumeration quantity lengths, converting the enumeration quantity source codes into enumeration values, comparing the enumeration values, and displaying corresponding enumeration states in a consistent mode.
The numerical parameters are converted into character strings according to the display precision, the state quantity is converted into character strings according to 0 and 1, the enumeration quantity is converted into character strings according to the enumeration state, the analysis time and the verification result are added, and the character strings are stored in the electronic table through writing in the electronic table with separator and VI.
The data playback module opens the data file according to the set playback data file path, reads the data source code of the corresponding position at regular time according to the set playback speed and playback position, and puts the data source code into a queue for the data analysis module to use. According to the operation of the user, the data can be started, paused, continued and stopped.
And step S3, the data playback module receives and reads the data source codes in the step S1 according to the configured playback parameters, and places the read data source codes into a data queue in the step S1 according to the set playback speed, playback position and other parameters to analyze the data in the step S2, and displays and stores the result.
Further, in step S1, the data is transmitted by using a data queue, the data receiving module and the data playback module time-share put the data into the same data queue, and the data analysis module reads the data from the data queue for analysis and playback, so that the data playback achieves a real effect.
Further, in step S2, the configured data frame format is defined by a configuration file, and the data parsing module reads the complete data frame extracted by the configuration file; and analyzing corresponding data extracted from the data frames according to the parameters, providing error frames and miss-needle statistics, and meeting the analysis requirements of different data frames.
Further, in step S2, when extracting the data frame, the character string is searched by using a preset regular expression and through a matching Pattern (Match Pattern) VI, the fixed-length frame and the non-fixed-length frame are processed, and the correct data frame is found by fast reading in the abnormal data.
Example 2
Based on the same inventive concept, the invention also provides a LabVIEW-based serial data receiving, analyzing and playing back system, referring to FIG. 3, performing the above method for receiving, analyzing and playing back serial data, which is characterized by comprising
The data receiving module configures interface parameters according to the type of the serial interface, circularly reads serial data, puts the serial data into a data queue and stores data source codes;
the data analysis module reads serial data from the data queue, extracts complete data frames according to the configured data frame format, restores corresponding parameters according to the settings in the configured data frame format, judges whether the data frames are correct and continuous, analyzes the data frames, displays the storage result,
and the data playback module is used for reading the data source codes of the data receiving module, extracting the data source codes according to the set playback parameters including playback speed and playback position, and putting the data source codes into a data queue for the data analysis module to use.
Further, the data receiving module comprises a receiving configuration unit, an interface management unit, a data reading unit, a data caching and storing unit;
the receiving configuration unit is used for setting parameters of the serial interface; the method comprises the steps that for a serial port, a receiving configuration unit sets parameters including a serial port number and a baud rate verification mode; for a network port, the setting parameters include a network protocol type, an IP address, and a port number.
Interface management unit: and managing and maintaining whether the state of the serial interface is normal or not, and ensuring the normal operation of the interface.
A data reading unit: when the interface management unit works normally, the serial data received by the serial interface are circularly read through the parameters set by the receiving configuration unit; until the interface is closed or the module is stopped;
data caching and storage unit: the read serial data is put into a data queue to carry out the next data analysis; meanwhile, the data source codes are stored, and the next step of data playback is performed.
Further, the data analysis module comprises an analysis configuration unit, a data reading unit, a data frame extraction unit, a data frame processing unit and a data display storage unit;
the analysis configuration unit configures a data frame format through a configuration file, wherein the data frame format comprises a frame head, a frame length and a frame tail;
a data reading unit for reading serial data from the data queue according to the configured data frame format;
and the data frame extraction unit searches the character string according to a preset regular expression and through a matching mode VI, processes the fixed-length frame and the non-fixed-length frame, and quickly reads and finds out the correct data frame from abnormal data.
The data frame processing unit comprises checksum frame missing judging processing, and is responsible for calculating and comparing the checksum when the data frame comprises the checksum, so that the integrity and the accuracy of the data frame are ensured; when the data frame contains frame count; the continuity of the frame count is judged to detect whether a missing frame exists in the data frame.
A data display storage unit; and restoring parameters in the data frame according to the configured data frame format and the type of the parameters, wherein the parameters comprise numerical values, state quantities and enumeration quantities, and displaying and storing the results.
Further, the data playback module comprises a playback configuration unit and a source code reading unit;
a playback configuration unit configured to configure configuration information of the playback configuration unit;
the source code reading unit reads the data source codes from the file path file in the configuration information at fixed time according to the parameters set by the configuration information, and adds the data source codes into the data queue for the data analysis module to use.
Example 3
To assist those skilled in the art in understanding the present invention, a serial data receiving, analyzing and playing back method based on LabVIEW of the present invention will be described below by taking serial communication of a navigation product as an embodiment:
the serial interface adopts an RS232 serial interface, the serial port number is COM1, the baud rate is 115.2kbps, and the data transmission format is as follows: 1-bit start bit, 8-bit data bit, no parity check, 1-bit stop bit; the data frame format is shown in fig. 6.
In the data receiving module, the serial number is configured to be COM1, the baud rate is configured to be 115.2kbps, the checking mode is that no parity check exists, and the stop bit is 1 bit; after the serial port is initialized, all received serial data are circularly read, and are put into a queue and stored with data source codes, and a LabVIEW program block diagram is shown in FIG. 7;
the data frame format is configured according to fig. 6:
frame header, string format, EB90,2 bytes;
frame length, shaping value, 1 byte, for fixed length frames, frame length value is constant 66; for an indefinite length frame, the frame length position is set to 2, the frame length is set to 1, and the frame length offset is set to 0;
the frame count position is set to 3, and the frame count length is set to 2;
frame type (ID), string format, 0xaa,1 byte;
the numerical quantities in the frame content include:
numerical quantity name 1: time, numerical quantity position 1:7, numerical value length 1:4, numerical data type 1: u32, numerical quantity reduction formula 1: x, numerical value display precision 1:0;
numerical quantity name 2: pitch angle, numerical value position 2:11, numerical value length 2:4, numerical data type 2: i32, numerical quantity reduction formula 2: x is 0.01, and the numerical value shows the precision 2:2;
numerical quantity name 3: yaw angle, numerical value position 3:15, numerical value length 3:4, numerical data type 3: i32, numerical quantity reduction formula 3: x is 0.01, and the numerical value shows the precision 3:2;
numerical quantity name 4: roll angle, numerical position 4:19, numerical length 4:4, numerical data type 4: i32, numerical quantity reduction formula 4: x is 0.01, and the numerical value display precision is 4:2;
numerical quantity name 5: x-direction position, numerical value position 5:23, numerical length 5:4, numerical data type 5: i32, numerical quantity reduction formula 5: x, numerical value display precision 5:0;
numerical quantity name 6: y-direction position, numerical value position 6:27, numerical value length 6:4, numerical data type 6: i32, numerical value reduction formula 6: x, numerical value display accuracy 6:0;
numerical quantity name 7: z-direction position, numerical value position 7:31, numerical value length 7:4, numerical data type 7: i32, numerical quantity reduction formula 7: x, numerical value display accuracy 7:0;
numerical quantity name 8: temperature 1, numerical value position 8:35, numerical value length 8:1, numerical data type 8: and I8, numerical quantity reduction formula 8: x, numerical value display precision 8:0;
numerical quantity name 9: temperature 2, numerical quantity position 9:36, numerical value length 9:1, numerical data type 9: and I8, numerical quantity reduction formula 9: x, numerical value display accuracy 9:0;
numerical quantity name 10: temperature 3, numerical value position 10:37, numerical value length 10:1, numerical data type 10: i8, numerical quantity reduction formula 10: x, numerical value display precision 10:0;
numerical quantity name 11: radial angle, numerical position 11:38, numerical length 11:2, numerical data type 11: i16, numerical quantity reduction formula 11: x is 0.1, and the numerical value display precision is 11:1, a step of;
numerical quantity name 12: axial angle, numerical position 12:40, numerical length 12:2, numerical data type 12: i16, numerical quantity reduction formula 12: x is 0.1, and the numerical value display precision is 12:1, a step of;
numerical quantity name 13: binding azimuth angle, numerical quantity position 13:53, numerical length 13:2, numerical data type 13: u16, numerical quantity reduction formula 13: x is 0.1, and the numerical value display precision is 13:1, a step of;
numerical quantity name 14: binding the mounting angle, numerical quantity position 14:55, numerical length 14:2, numerical data type 14: u16, numerical quantity reduction formula 14: x is 0.1, and the numerical quantity display precision is 14:1, a step of;
numerical quantity name 15: binding longitude values, numerical position 15:57, numerical length 15:2, numerical data type 15: i16, numerical quantity reduction formula 15: x is 0.01, and the numerical value display precision is 15:2;
numerical quantity name 16: binding latitude value, numerical value position 16:59, number length 16:1, numerical data type 16: i8, numerical quantity reduction formula 16: x is 0.1, and the numerical value display precision is 16:1, a step of;
numerical quantity name 17: binding latitude value, numerical value position 17:59, numerical length 17:1, numerical data type 17: i8, numerical quantity reduction formula 17: x is 0.1, and the numerical value display precision is 17:1, a step of;
the state quantity in the frame content includes:
state quantity name 1: carrier indication, state quantity position 1:6.0, state quantity color 1: bright green (red 100, green 255, blue 0) on, dark green (red 30, green 75, blue 0) off;
state quantity name 2: power indication, state quantity position 2:6.1, state quantity color 2: bright green (red 100, green 255, blue 0) on, dark green (red 30, green 75, blue 0) off;
state quantity name 3: control state, state quantity position 3:52.0, state quantity color 3: bright green (red 100, green 255, blue 0) on, dark green (red 30, green 75, blue 0) off;
state quantity name 4: power amplifier is powered on, state quantity positions 4:52.1, and state quantity colors 4: bright green (red 100, green 255, blue 0) on, dark green (red 30, green 75, blue 0) off;
state quantity name 5: component state 1, state quantity position 5:47.0, state quantity color 5: bright green (red 100, green 255, blue 0) on, dark green (red 30, green 75, blue 0) off;
the state quantity 6-68 are named as component states 2-32, component powers 1-32, the state quantity position is set according to the byte and bit sequence number, and the color setting is the same as the component state 1.
The enumeration amount in the frame content includes:
enumeration amount name 1: fault diagnosis, enumeration quantity position 1:42, enumeration quantity length 1:2, enumeration state 1-0: no fault, enumeration state 1-1: fault 1, enumeration state 1-2: fault 2, enumeration status 1-3: fault 3, enumeration status 1-others: nonsensical.
Checksum location: 64, checksum length: 1, checksum type: accumulating, checking and calculating the data position: 2, checksum calculation data length: 62.
end of frame, string format, 0xae,1 byte.
The data analysis module reads serial data from the queue, and after splicing the serial data with the previous analysis residual data, the complete data frame is extracted by grabbing an indefinite length frame VI, and a LabVIEW flow chart is shown in FIG. 8.
In this embodiment, the frame is a fixed-length frame, or a fixed-length frame may be used, and VI extracts the complete frame, and the LabVIEW flow chart is shown in fig. 9. In general, it is recommended to use a frame with an indefinite length as much as possible.vi extracts a complete data frame in order to cope with a change in the communication protocol unless the data frame format does not contain frame length information.
After acquiring the full-frame data, calculating a checksum and comparing the checksum with the checksum in the full frame, and if the checksum is inconsistent, carrying out frame error statistics +1; judging whether the difference value between the frame count and the last frame count is 1, if not, carrying out frame missing statistics +1;
after the checksum is judged to be correct, various parameters are set and restored according to the parameter names, positions, types and the like set in the frame format, the analysis result, the analysis time and the verification result are added, and the electronic form with the separator is written in and stored in the electronic form. The data analysis module part LabVIEW flow chart is shown in FIG. 10.
The data playback module opens the original frame of the data file XXXX series stored by the data receiving module, dat,
setting the playback position to 0 (from the head), the playback speed to 1 kbyte/second (adjustable according to the requirement), clicking to start, and putting 100 bytes read from the data file every 100ms into a queue by software, wherein the data analysis module starts to analyze the data normally. Clicking to pause, and stopping the software from reading the data; clicking for continuing, and recovering the read data by the software; click stop, software terminates this playback, labVIEW flow chart as shown in FIG. 11.
Although the present invention has been described with respect to the preferred embodiments, it is not intended to be limited thereto, and any person skilled in the art can make any possible variations and modifications to the technical solution of the present invention using the method, system and technical matters disclosed herein without departing from the spirit and scope of the present invention.
Claims (8)
1. A LabVIEW-based serial data receiving, analyzing and playing back method is characterized in that:
step S1, a data receiving module configures interface parameters according to serial interface types, circularly reads serial data, puts the serial data into a data queue, adopts the data queue to transmit data, and stores data source codes;
step S2, a data analysis module reads the serial data from the data queue in the step S1, extracts a complete data frame according to a configured data frame format, restores corresponding parameters according to settings in the data frame format including parameter positions and types, judges whether the data frame is correct and continuous, analyzes the data frame, and displays and stores a result;
and step S3, the data playback module receives and reads the data source codes in the step S1 according to the configured playback parameters, puts the read data source codes into the data queue in the step S1 according to the configured playback parameters including playback speed and playback position, analyzes the data in the step S2, and displays and stores the result.
2. The method according to claim 1, wherein in step S1, the data is transmitted using the data queue, the data receiving module and the data playback module time-share the data into the same data queue, and the data parsing module reads the data from the data queue for parsing and playback.
3. The method of serial data reception, parsing and playback according to claim 1, characterized in that in said step S2, the configured data frame format is defined by a configuration file, and said data parsing module reads the data frame extracted completely by said configuration file; analyzing the corresponding data extracted according to the parameters in the data frame, and providing error frames and miss statistics.
4. A method of serial data reception, parsing and playback according to claim 3, characterized in that in step S2, when extracting the data frames, the character strings are searched by using a preset regular expression and by matching pattern VI, fixed length frames and non-fixed length frames are processed, and the correct data frames are found out by fast reading in the abnormal data.
5. A LabVIEW-based serial data receiving, parsing and playback system for performing the serial data receiving, parsing and playback method as claimed in claims 1 to 4, comprising
The data receiving module configures interface parameters according to the type of the serial interface, circularly reads serial data, puts the serial data into a data queue and stores data source codes;
a data analysis module for reading the serial data from the data queue, extracting the complete data frame according to the configured data frame format, restoring the corresponding parameters according to the configuration in the data frame format, judging whether the data frame is correct and continuous, analyzing the data frame, displaying the storage result,
and the data playback module reads the data source codes of the data receiving module, extracts the data source codes according to the set playback parameters including playback speed and playback position, and puts the data source codes into a data queue for the data analysis module to use.
6. The system for serial data reception, parsing and playback according to claim 5, wherein the data receiving module comprises a receiving configuration unit, an interface management unit, a data reading unit, a data buffering and storing unit;
the receiving configuration unit is used for setting parameters of the serial interface; the receiving configuration unit sets parameters including serial numbers and baud rate verification modes for serial ports; for a network port, setting the parameters including a network protocol type, an IP address and a port number;
the interface management unit: whether the state of the serial interface is normal is managed and maintained, so that the interface is ensured to work normally;
the data reading unit: when the interface management unit works normally, the serial data received by the serial interface are circularly read through the parameters set by the receiving configuration unit; until the interface is closed or the module is stopped;
the data caching and storing unit: the read serial data is put into one data queue to carry out the next data analysis; meanwhile, the data source codes are stored, and the next step of data playback is performed.
7. The system for serial data reception, parsing and playback according to claim 6, wherein the data analysis module comprises an analysis configuration unit, a data reading unit, a data frame extraction unit, a data frame processing unit, a data display storage unit;
the analysis configuration unit configures the data frame format through a configuration file, wherein the data frame format comprises a frame head, a frame length and a frame tail;
the data reading unit reads the serial data from the data queue according to the configured data frame format;
the VI searches character strings according to a preset regular expression and a matching mode, processes fixed-length frames and non-fixed-length frames, and quickly reads and finds correct data frames in abnormal data;
the data frame processing unit comprises checksum frame missing judging processing, and is responsible for calculating and comparing the checksum when the data frame comprises the checksum, so that the integrity and the accuracy of the data frame are ensured; when the data frame comprises a frame count; judging the continuity of the frame count to detect whether a missing frame exists in the data frame;
a data display storage unit; and restoring the parameters in the data frame according to the configured data frame format and the type of the parameters, wherein the parameters comprise numerical values, state quantities and enumeration quantities, and displaying and storing results.
8. The system for serial data reception, parsing and playback according to claim 7, wherein the data playback module includes a playback configuration unit and a source code reading unit;
the playback configuration unit configures configuration information of the playback configuration unit;
the source code reading unit reads the data source codes from the file path file in the configuration information at fixed time according to the parameters set by the configuration information, and adds the data source codes into the data queue for the data analysis module to use.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311268994.0A CN117215988A (en) | 2023-09-27 | 2023-09-27 | LabVIEW-based serial data receiving, analyzing and playing back method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311268994.0A CN117215988A (en) | 2023-09-27 | 2023-09-27 | LabVIEW-based serial data receiving, analyzing and playing back method and system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117215988A true CN117215988A (en) | 2023-12-12 |
Family
ID=89035185
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311268994.0A Pending CN117215988A (en) | 2023-09-27 | 2023-09-27 | LabVIEW-based serial data receiving, analyzing and playing back method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117215988A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN119960848A (en) * | 2024-12-30 | 2025-05-09 | 中国船舶重工集团公司第七〇五研究所 | A dynamically configurable data analysis and playback method based on labview |
-
2023
- 2023-09-27 CN CN202311268994.0A patent/CN117215988A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN119960848A (en) * | 2024-12-30 | 2025-05-09 | 中国船舶重工集团公司第七〇五研究所 | A dynamically configurable data analysis and playback method based on labview |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP1560121A1 (en) | Data relay device and data management system using the same | |
CN112350989A (en) | Log data analysis method | |
CN117215988A (en) | LabVIEW-based serial data receiving, analyzing and playing back method and system | |
CN118337516B (en) | Network security situation awareness and early warning method based on big data analysis | |
CN117155831A (en) | Network protocol fuzzy test method, device, equipment and medium based on source code | |
CN114338850A (en) | Message checking method and device, terminal equipment and computer readable storage medium | |
CN120017736A (en) | A power equipment data acquisition and processing system and method | |
CN114979307A (en) | Communication protocol analysis method, intelligent terminal and storage medium | |
JP5250505B2 (en) | Mobile communication device test system and test method | |
CN109101354B (en) | Fault information monitoring method and device | |
CN113138906A (en) | Call chain data acquisition method, device, equipment and storage medium | |
CN118132084A (en) | Configurable interface control dynamic analysis system | |
CN117687851A (en) | Server hardware testing method and device, electronic equipment and storage medium | |
CN106294132A (en) | A kind of method and device managing daily record | |
CN111858781B (en) | Simulation method and device based on preset communication protocol | |
CN111831698B (en) | Data auditing method, system and electronic equipment | |
CN115576831A (en) | Test case recommendation method, device, equipment and storage medium | |
CN108667805A (en) | The analytic method and its device and computer readable storage medium of data | |
CN115658783A (en) | Method and device for analyzing log data of LCU (logical control Unit) system based on python and mysql | |
CN115964203A (en) | Method, server and storage medium for tracking microservice abnormity | |
CN109062639B (en) | A method and system for displaying upgrade information of a substation SCD file | |
CN119959811B (en) | Battery data processing method, system, device, medium and program product | |
US7533004B2 (en) | Automatic detection of production and manufacturing data corruption | |
CN117113932B (en) | Multi-source valuation table data analysis method and system | |
CN119094395B (en) | LED sending card network port data anomaly detection method, device, equipment and medium |
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 |