Bluetooth communication-based meter calibration method

文档序号:985857 发布日期:2020-11-06 浏览:14次 中文

阅读说明:本技术 一种基于蓝牙通讯的校表方法 (Bluetooth communication-based meter calibration method ) 是由 宋志刚 耿峻峰 于 2020-07-09 设计创作,主要内容包括:本发明提供一种基于蓝牙通讯的校表方法,所述方法包括:获取偏差值D;基于所述偏差值D对表计的脉冲信号R0进行校正。所述校表方法能够对校表脉冲信号进行高精度低误差并符合标准化的传递;对脉冲信号进行数字化采样,由BLE协议自带的传输保证机制避免了空中无线干扰对测试系统产生的数据丢失;对脉冲数据进行数据压缩,可大量减小传输的数据量,给数据重传空余出了时间,避免了传输过程中干扰所导致的数据延迟;对蓝牙芯片要求低,仅支持基础功能的BLE芯片即可完成校表功能,无需额外的数据传输通道,可提高用户芯片可选择范围,降低产品成本。(The invention provides a meter calibration method based on Bluetooth communication, which comprises the following steps: obtaining a deviation value D; the meter pulse signal R0 is corrected based on the deviation value D. The meter calibrating method can carry out high-precision low-error transmission on the meter calibrating pulse signal and accords with standardization; the pulse signals are digitally sampled, and a transmission guarantee mechanism of a BLE protocol avoids data loss of a test system caused by air wireless interference; the data compression is carried out on the pulse data, so that the transmitted data volume can be greatly reduced, time is left for data retransmission, and data delay caused by interference in the transmission process is avoided; the requirement on the Bluetooth chip is low, the BLE chip only supporting the basic function can finish the meter calibration function, an additional data transmission channel is not needed, the selectable range of the user chip can be increased, and the product cost is reduced.)

1. A meter calibration method based on Bluetooth communication is characterized by comprising the following steps:

obtaining a deviation value D;

the meter pulse signal R0 is corrected based on the deviation value D.

2. The method of claim 1, wherein the Bluetooth communication is used to calibrate the meter,

the pulse signal R0 is obtained by receiving a Bluetooth signal and restoring the Bluetooth signal.

3. The method of claim 1, wherein the Bluetooth communication is used to calibrate the meter,

the deviation value D is determined from the theoretical interval TD1 and the actual interval TD 2.

4. The method of claim 3, wherein the Bluetooth communication is performed in a Bluetooth communication-based manner,

the deviation value D satisfies: d is TD2-TD 1.

5. The method of claim 4, wherein the Bluetooth communication is used to calibrate the meter,

according to the time sequence, two pulses in the first pulse signal are S1 and S2, adjacent pulses in the Bluetooth signal are S3 and S4, pulses in the second pulse signal corresponding to the pulses S1 and S2 are S5 and S6 respectively, the falling edge of the pulse S1 corresponds to the rising edge of the pulse S3 at a time T1, the falling edge of the pulse S2 corresponds to the rising edge of the pulse S3 at a time T2,

then

The actual interval time TD2 is T2-T1;

the theoretical interval TD1 is a time difference between a time corresponding to a falling edge of the pulse S6 and a time corresponding to a falling edge of the pulse S5.

6. The method of claim 5, wherein the Bluetooth communication is used to calibrate the meter,

the first pulse signal is a clock source pulse signal of the Bluetooth sending equipment;

the second pulse signal is a clock source pulse signal of the Bluetooth receiving equipment.

7. The method of claim 1, wherein the Bluetooth communication is used to calibrate the meter,

the pulse signal R0 of the meter is an electrical pulse signal.

8. The method of claim 6, wherein the Bluetooth communication is used to calibrate the meter,

correcting the pulse signal of the meter includes:

the durations of the high level and the low level in the pulse signal R0 are increased or decreased by the duty ratio of the high level or the low level in the pulse signal R0.

9. A method for calibrating a meter based on Bluetooth communication according to any one of claims 1-8,

increasing or decreasing the duration of the high or low level comprises:

in one continuous period TT of the pulse signal R0, the high level duration increases by α × D, the low level duration increases by β × D,

wherein the content of the first and second substances,

a is the high-level duty ratio in one continuous period TT of the pulse signal R0;

beta is the low-level duty ratio in one continuous period TT of the pulse signal R0.

Technical Field

The invention belongs to the technical field of water meters, electric meters, gas meters and heat meters, and particularly relates to a meter calibration method based on Bluetooth communication.

Background

In the fields of water meters, electric meters, gas meters and heat meters (hereinafter referred to as four meters), the conventional meter calibration scheme is generally as follows: the electric meter to be measured continuously inputs a section of standard current such as 10 amperes, the electric meter continuously outputs a section of standard high-low pulse signal through an electric wire, then the pulse signal is transmitted in an optical or wireless mode, and then the duty ratio and the frequency of the section of pulse signal are acquired on a measuring side in a corresponding optical or wireless mode.

Due to the fact that a Bluetooth Low Energy (BLE) chip is installed on most of water meters supporting wireless meter reading, and the BLE chip is communicated based on 2.4G frequency points. Therefore, the current water and electricity meters supporting wireless transmission all adopt the BLE chip to perform a meter calibration function, and the specific method is to transmit the signals in a mode of transmitting private naked data in a 2.4G frequency band. The transmission method has the problems of serious wireless interference and low precision, and the transmission method has the problems of poor compatibility of different manufacturers and the like when different chips are adopted.

When the BLE chip is used for calibrating the meter, the meter end of the meter to be tested outputs a level pulse signal to a Bluetooth chip A, the pulse signal is converted into an original data code stream through high-precision numerical value sampling in the Bluetooth chip A, the original data code stream is compressed and packaged to form a data packet suitable for transmission, and the data packet is wirelessly transmitted through a standard Bluetooth protocol. The detection equipment end (generally, a four-meter special meter calibration table) is provided with a Bluetooth chip B, the Bluetooth chip B wirelessly receives the data packet, and then the original data code stream is obtained through unpacking and decompressing and is further restored into an output level pulse signal of the meter end of the meter to be detected and output.

In the transmission process of the signal data, a significant problem exists, namely the problem of inconsistency between the signal clocks of the meter to be measured and the detection equipment in actual work. The fundamental reason is that any crystal oscillator or clock has its precision, and the bluetooth chip is no exception. The sampling frequency of the Bluetooth chip at the meter end of the meter to be detected for sampling the pulse signals depends on the main frequency of the meter to be detected, and the waveform generation frequency of the Bluetooth chip at the detection equipment end for restoring the pulse signals depends on the main frequency of the detection equipment. When the dominant frequencies of the meter to be detected and the detection equipment are consistent, the pulse detection and the pulse generation are not abnormal. However, in practice, no matter the chip of the meter or the detection device to be detected adopts the off-chip crystal oscillator or the on-chip RC circuit as the clock source, the main frequency of the chip or the detection device has a problem of accuracy or error. According to the accuracy of the clock source (for example, the accuracy is 10ppm), it can be determined that the meter under test and the detection device act as both a transceiver within one second, and the master frequency of the two may cause an error of 20 microseconds at most, which is not acceptable in the meter calibration scheme. There is a need in the art to address the above-mentioned problems.

Disclosure of Invention

Aiming at the problems, the invention provides a meter calibration method based on Bluetooth communication.

The invention provides a meter calibration method based on Bluetooth communication, which comprises the following steps:

obtaining a deviation value D;

the meter pulse signal R0 is corrected based on the deviation value D.

Further, in the present invention,

the pulse signal R0 is obtained by receiving a Bluetooth signal and restoring the Bluetooth signal.

Further, in the present invention,

the deviation value D is determined from the theoretical interval TD1 and the actual interval TD 2.

Further, in the present invention,

the deviation value D satisfies: d is TD2-TD 1.

Further, in the present invention,

according to the time sequence, two pulses in the first pulse signal are S1 and S2, adjacent pulses in the Bluetooth signal are S3 and S4, pulses in the second pulse signal corresponding to the pulses S1 and S2 are S5 and S6 respectively, the falling edge of the pulse S1 corresponds to the rising edge of the pulse S3 at a time T1, the falling edge of the pulse S2 corresponds to the rising edge of the pulse S3 at a time T2,

then

The actual interval time TD2 is T2-T1;

the theoretical interval TD1 is a time difference between a time corresponding to a falling edge of the pulse S6 and a time corresponding to a falling edge of the pulse S5.

Further, in the present invention,

the first pulse signal is a clock source pulse signal of the Bluetooth sending equipment;

the second pulse signal is a clock source pulse signal of the Bluetooth receiving equipment.

Further, in the present invention,

the pulse signal R0 of the meter is an electrical pulse signal.

Further, in the present invention,

correcting the pulse signal of the meter includes:

the durations of the high level and the low level in the pulse signal R0 are increased or decreased by the duty ratio of the high level or the low level in the pulse signal R0.

Further, in the present invention,

increasing or decreasing the duration of the high or low level comprises:

in one continuous period TT of the pulse signal R0, the high level duration increases by α × D, the low level duration increases by β × D,

wherein the content of the first and second substances,

a is the high-level duty ratio in one continuous period TT of the pulse signal R0;

beta is the low-level duty ratio in one continuous period TT of the pulse signal R0.

The meter calibrating method based on Bluetooth communication can carry out high-precision low-error transmission on the meter calibrating pulse signal and accords with standardization; the pulse signals are digitally sampled, and a transmission guarantee mechanism of a BLE protocol avoids data loss of a test system caused by air wireless interference; the data compression is carried out on the pulse data, so that the transmitted data volume can be greatly reduced, time is left for data retransmission, and data delay caused by interference in the transmission process is avoided; the requirement on the Bluetooth chip is low, the BLE chip only supporting the basic function can finish the meter calibration function, an additional data transmission channel is not needed, the selectable range of the user chip can be increased, and the product cost is reduced.

Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.

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 introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.

Fig. 1 is a schematic diagram illustrating clock calibration of a bluetooth receiving device to obtain an offset value according to an embodiment of the present invention;

FIG. 2 is a diagram showing a configuration of a calibration system according to an embodiment of the present invention;

fig. 3 is a diagram illustrating a method for calibrating a meter based on bluetooth communication according to an embodiment of the present invention.

Detailed Description

In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

In the following, based on the bluetooth protocol interaction model, the signal processing and transmission process during the calibration of the meter is considered. As shown in fig. 1, the transmission clock signal in fig. 1 is a clock source signal (denoted as clock source signal 1) of the bluetooth transmission device, sampling the pulse signals of the four meters during meter calibration is performed with the clock source signal 1 as a reference, and the bluetooth transmission device samples the electric pulse signals output by the four meters through the clock source, processes the sampled data, converts the data into bluetooth signals, and wirelessly transmits the bluetooth signals. The receiving clock signal is a clock source signal (denoted as clock source signal 2) of the bluetooth receiving device, and the recovery of the four-meter pulse signal information contained in the bluetooth signal is also performed through the clock source signal 2. And the Bluetooth receiving equipment receives the Bluetooth signal and performs data signal processing, and performs reduction processing by taking the received clock signal as a reference to obtain pulse signals of the four meters to be detected. After communication connection is established between the Bluetooth sending equipment and the Bluetooth receiving equipment, the Bluetooth sending equipment sends Bluetooth data to the Bluetooth receiving equipment at intervals; when the Bluetooth sending device sends the Bluetooth signal, the wireless receiving function of the Bluetooth receiving device is started.

In fig. 1, S1 and S2 are pulses in the transmission clock signal, and S3 and S4 are adjacent pulses of the bluetooth signal. At time T1, the falling edge of pulse S1 corresponds to the rising edge of pulse S3, and at time T2, the falling edge of pulse S2 following pulse S1 corresponds to the rising edge of pulse S4. The bluetooth receiving device receives the pulses S3 and S4, records the times T2 and T1, and obtains the actual interval TD2, which is T2-T1, as the time interval when the bluetooth receiving device receives two consecutive adjacent bluetooth signals.

In an ideal case, that is, when the main frequencies of the meter to be tested and the main frequency of the detection device are the same, the receiving clock signal obtained through the reduction process should be the same as the sending clock signal, in fig. 1, the pulse S5 of the sending clock signal corresponds to the pulse S1, and the pulse S6 of the sending clock signal corresponds to the pulse S2, so in an ideal case, the times corresponding to the falling edges of the pulse S5 and the pulse S6 should be T1 and T2, respectively, but due to an error between clock sources in a chip of the meter to be tested or the detection device, the times corresponding to the falling edges of the pulses such as S2 and the corresponding falling edges of the pulse S6 are different. Assuming that the time interval between the timings corresponding to the falling edges of the pulse S5 and the pulse S6 in the received clock signal during actual operation is the theoretical interval time TD1, there is a deviation D between the actual interval time TD2 and the theoretical interval time TD1, where D is TD2-TD 1. Therefore, when the bluetooth transmitting apparatus samples the meter pulse with the transmission clock signal and the bluetooth receiving apparatus recovers the meter pulse with the reception clock signal, the deviation value existing in one continuous period of the bluetooth signal is also D, and as shown in fig. 1, the reception clock signal of the bluetooth receiving apparatus is 1/2 clock periods less than the transmission clock signal of the bluetooth transmitting apparatus, and let the clock period of the transmission clock signal of the bluetooth transmitting apparatus be T, TD2-TD1 is D/2.

Based on the signal processing and transmission process, the invention provides a clock calibration method, which comprises the following steps: and taking out the deviation value D, and increasing or decreasing the duration of the high level and the low level of the pulse signal (recorded as the pulse signal R0) obtained by restoring the Bluetooth signal according to the duty ratio (the duty ratio of the high level is alpha, and the duty ratio of the low level is beta) of the high level or the low level in the pulse signal R0 when restoring the pulse signal of the meter, so that the total pulse width (namely the total width of one adjacent high level signal and one low level signal in the pulse signal R0) of each continuous period in the pulse signal R0 is increased by a value D. Such as: if the pulse signal R0 has a high level of 1/3 (i.e., α is 1/3) and a low level of 2/3 (i.e., β is 2/3) in one continuous period (TT), the time of the high level in one continuous period TT of the pulse signal R0 increases to α × D (1/3) × (T/2) of T/6 (i.e., 1/6 clock periods T for transmitting clock signals) when the pulse is restored, assuming that the deviation is D/2 in fig. 1. Similarly, the time of the low level in one continuous period TT of the pulse signal R0 increases to β × D (2/3) × (T/2) ═ T/3 (i.e., 1/3 clock periods T of the transmission clock signal). In the above example, the high level is increased by a value of T/6 in 1 consecutive period TT, and the high level of one clock period T is generated in total in every 6 consecutive periods TT; similarly, in every 3 consecutive periods TT, a low level of one clock period T is generated in total, and clock calibration for the pulse signal R0 is realized.

Therefore, the problem of errors in restoring pulse signals of the four meters caused by the fact that clock frequencies of the Bluetooth transmitting device and the Bluetooth receiving device are different can be solved. The invention corrects the theoretical interval time TD 1by using the measured deviation value D, and can ensure that the restored pulse signal obtained by the detection equipment end is completely consistent with the pulse signal detected and collected by the meter end of the meter to be detected.

FIG. 2 shows a calibration system used in the present invention. As can be seen from fig. 2, the meter to be detected and the meter detection table are respectively connected to a BLE bluetooth chip 1 and a BLE bluetooth chip 2, and both the bluetooth chip 1 and the bluetooth chip 2 have pulse detection, generation and transmission functions; the Bluetooth chip 1 carries out high-precision digital sampling and coding on pulses PP1 output by a meter to be detected, such as an ammeter, and carries out numerical compression and data packaging, and then carries out wireless transmission and wireless transmission of data through standard BLE service; the Bluetooth chip 2 wirelessly receives data through a standard BLE service, unpacks, decompresses and decodes the data to obtain the high-precision pulse PP2, and finely adjusts the high-precision pulse PP 2by using the deviation value D recorded by the Bluetooth chip 2 according to the clock calibration method to really restore the pulse PP 1.

Referring to fig. 3, the method for calibrating a meter based on bluetooth communication of the present invention includes the following steps:

firstly, acquiring an original electric pulse signal (hereinafter referred to as P (t)) output by a meter to be measured by using a high-precision pulse sampling module, simultaneously carrying out digital processing on the P (t) to obtain a pulse signal after the digital processing, and then converting the time information of the electric pulse signal into a pulse data stream. As shown in fig. 3, the pulse output from the meter is continuously sampled with reference to the clock source of the current bluetooth transmission device. The high level in the collected pulse output by the meter is marked as 1 (occupying 1bit), the low level is marked as 0 (occupying 1bit), and the digital coding data stream corresponding to the pulse output by the meter, namely the pulse data stream, can be continuously obtained. The highest precision of the present digitization process is 0.04 uS. In the step, through digital sampling of the electric pulse signals, when wireless transmission is carried out later, a transmission guarantee mechanism of a BLE protocol avoids data loss caused by air wireless interference to the system.

And secondly, carrying out compression coding on the pulse data stream to obtain a compressed pulse data stream. The compressed pulse data stream is divided into a plurality of data blocks according to different contents (1 or 0) in the pulse data stream, each block only contains 1 or only 0, and the total value of 1 or 0 is recorded. As shown in fig. 3, the first block "0-3" from the left records the first 3 data messages of the burst data stream as "0" from the left to the right, the second block "1-3" from the left records the first 3 data messages of the burst data stream as "1" from the 4 th to the 6 th from the left to the right, and so on, and each data block represents a continuous "0" or a continuous "1". In the step, the pulse data stream is subjected to data compression, so that the transmitted data volume can be greatly reduced, enough time is prepared for data retransmission, and data delay caused by interference in the data transmission process is avoided.

And thirdly, performing data packet on the compressed pulse data stream. And encapsulating the compressed pulse data stream according to a data frame format for wireless transmission to form a transmission data packet suitable for short-distance wireless transmission. Each transmission data packet is used for transmitting information of a sampling point (sampling values of the high-level signal and the low-level signal are referred to as sampling values hereinafter) when the signal acquisition in the step one is performed in a corresponding connection interval (namely, a high-level signal and a low-level signal which are adjacent in the original electric pulse signal). Because the total number of sampling points is fixed, each segment of continuously identical sampling values in each data packet is placed in one data block, and because the sampling values of the sampling points represented by each data packet are not necessarily identical, the number of data blocks in each data packet is different, and may include one or more data blocks, such as: if all sampling points in a connection interval are at high level, in a first-step sampling result, values of all sampling points of a data packet corresponding to the connection interval are '1', namely '111111111111111111111111' (the sampling values are taken as 24 schematically), and all 24 continuous sampling values in the data packet are '1', and the data packet only contains one data block for expressing information of the sampling values in the data packet; if the first half of the sampled values in a connection interval is all '1' and the second half is all '0', i.e. "111111111111000000000000", then a packet contains two data blocks, the first data block is used to represent the information of the first 12 consecutive "1" samples and the second data block is used to represent the information of the last 12 consecutive "0" samples. Each data block is subjected to data storage in a 1Byte (8bit) or 2Byte (16bit) manner, the highest bit of the highest Byte represents the content of the data block identification value, the other bits represent the number of the data block identification value, if 1Byte is used to describe 10 consecutive 1 s, that is, the highest bit in the Byte is 1 (1 in binary), followed by 10 (0001010 in binary), and the Byte is 10001010 in binary, that is, 8a in hexadecimal. When each data block transmits a segment of data by using 1Byte (8bit), the high-low value of the level is placed at the highest bit or the first bit of the Byte, and the last 7 bits (15 bits in the 2Byte mode) of the Byte are used for transmitting the number of level sampling points. And each data packet only stores the information of a specific number of sampling points. For example: in fig. 3, each transport packet contains information of 76 sampling points, each transport packet contains nine data blocks, and in hexadecimal, the first data block 03 represents 3 low levels, the second, fourth, sixth, and eight data blocks 83 represent 3 high levels, the third, fifth, and seven blocks 10 represent 16 low levels, and the ninth block 0D represents 13 low levels.

And fourthly, carrying out data transmission by wireless Bluetooth transmitting equipment, namely the Bluetooth transmitting equipment, and carrying out wireless transmission on the transmission data packet. The transmission data packet needs to be wirelessly transmitted through a BLE protocol, so that the data packet normally reaches the receiving end. Reliability in data transmission is guaranteed by the BLE protocol bottom layer.

And fifthly, receiving data by the wireless Bluetooth receiving equipment through a BLE protocol. Retransmission may be performed due to interference of wireless transmission during the receiving process, and the retransmission mechanism is guaranteed by the wireless communication protocol.

And sixthly, unpacking the received data packet and recovering the data packet into a compressed pulse data stream.

And seventhly, decompressing the compressed pulse data stream into a normal pulse data stream.

And eighthly, restoring the pulse data stream, namely restoring the pulse signal, compensating the restored pulse signal through the clock calibration, thereby obtaining an electric pulse signal P (t) output by the meter to be tested, and outputting the electric pulse signal P (t).

The Bluetooth chip has low requirement on the Bluetooth chip, the BLE chip only supporting the basic function can finish the meter calibration function, a data transmission channel is not required to be additionally supported, the selectable range of the user chip can be increased, and the product cost is reduced.

Although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

10页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:多级船闸闸室水位监测系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!