A system and method for transmitting error data of electric energy meter calibration device
By introducing hardware flags and bubble sorting method into the electric energy meter calibration device, the problems of low error data transmission efficiency and poor system stability are solved, efficient and reliable error data transmission is achieved, and the real-time and accuracy of the data are ensured. .
Patent Information
- Application Number
- CN202110692514.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-22
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-06-22
AI Technical Summary
Existing energy meter calibration devices suffer from low efficiency, poor system stability, and crashes during the error data transmission process. This is mainly due to the reliability bottleneck problem in large-scale data transmission, resulting in untimely and inaccurate transmission.
By adding hardware flag bits between the host computer and the error machine, the bubble sorting method is used to determine the order of the error machines. The error data is only read when the hardware flag bit is low to avoid blind interruption of serial communication and ensure the effectiveness of communication. , and utilize the advantages of RS232 or RS485 to achieve data transmission.
It improves the transmission efficiency and reliability of error data, reduces the work interference of the error machine, ensures the real-time and accuracy of data, and achieves fast and efficient data transmission.
Smart Images

Figure CN113484816B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data transmission, and in particular relates to a transmission system and method for error data of an electric energy meter calibration device. Background Art
[0002] With the continuous promotion and application of smart energy meter calibration devices in power systems, in the process of monitoring multi-meter energy meter calibration devices, high real-time performance must be achieved, especially in serial communication, which requires real-time communication with the equipment, timely reading and processing of error data, and data feedback. Realizing the real-time control of multi-meter energy meter devices by computers through serial communication, the accuracy and safety and reliability of smart energy meter calibration devices in copying power metering data to computers, and the rapid and efficient reading of energy meter data from the calibration device to the corresponding computer background operating system have become an important task faced by relevant staff. Currently, the widely used calibration devices generally have defects such as long calibration cycle, low efficiency, poor system stability, and crashes occur from time to time. The fundamental reason is that the reliability bottleneck problem is encountered in the large-scale data transmission process.
[0003] Traditional transmission uses RS485 or RS232, and its advantages and disadvantages are as follows:
[0004] The advantages of RS485 communication are low hardware overhead and simple lines. The disadvantages are: ① RS485 is a quasi-bidirectional communication mode. When the host computer sends a read error command to a certain error machine, each error machine receives the same information. According to the 48-table position calibration device, the error machine will receive nearly 48 times the additional command volume, which may directly affect the accuracy of the error test of the lower microcontroller. The lower computer is "disturbed" too much and cannot tolerate it. ② For multi-table position devices, since there are too many nodes hanging under the RS485 bus, it may affect the accuracy of the data received by the host computer. Therefore, the error data sent by the lower computer must contain the check code and the table code, otherwise the upper computer cannot recognize it. In this way, the error data sent by the lower computer will increase by 3 bytes (2 bytes of table code and 1 byte of check code), which also increases the occupancy time of the lower computer serial port. ③ The command sent from the host computer to the error machine contains at least keywords and tokens, and the number of bytes must be greater than 2. However, the microcontroller serial port of the error machine has only one byte of buffer. When the microcontroller is in the serial port interrupt state, the receiving buffer can only save the last byte of the received command string. Therefore, the command may be lost, and even cause the microcontroller to crash or the communication to crash.
[0005] Without considering time and efficiency, the above problems can be solved by the following methods: ① The error machine turns off the serial port interrupt during the error test. After testing a new error value, stop the test, turn on the serial port interrupt, and wait for the host computer command; ② After the error data is sent, the error machine turns off the serial port interrupt and enters the next round of testing. It can be seen that efficiency is lost in waiting. According to the communication time of 0.05s per meter position, the longest waiting time for 48 meter positions is 2.8s, while the conventional constant of the electronic meter is 2000imp / (kW·h), the pulse frequency is about 1Hz at the rated voltage and current. If more than 2 errors occur during the above waiting time, the efficiency is reduced by about 50%.
[0006] The disadvantages of RS232 communication are slightly large hardware overhead and complex circuits. The advantages are: ① Using electronic switches to switch, point-to-point communication, good reliability, the table position number can be directly identified from the port, no check code and token are required, thereby shortening the length of instructions and data, and ultimately shortening the time of occupying the serial port. ② The command of the host computer is only transmitted to the specified error machine, and will not interrupt other error machines; ③ The command of the host computer can use a handshake signal of only one byte, and the serial port time is extremely short. The host computer receives the error data and can use the interrupt mode. It can also perform other tasks before receiving the error machine data. For the error machine, one byte of command data can be saved in the serial port receiving buffer and will not be lost. Once the serial port interrupt is opened, the handshake signal can be received. If there is new error data, it will be sent directly to the host computer; if not, a one-byte reply signal can be sent. There is no command loss. It can be seen that in the electric energy meter verification device, due to the real-time characteristics and reliability requirements of its error test, the serial communication method has obvious advantages.
[0007] As a further improvement of the above scheme, the above serial communication mode has the following problems in the multi-table system: ① The host computer has a certain degree of blindness when applying to "read" the error data of the error machine. Because in the cycle when the error machine generates a new error data, the host computer may have queried 3, 4 or even more times, but only one time is valid. In this way, the host computer wastes working time; the error machine is "disturbed" by multiple invalid interruptions, affecting the accuracy of the error test. ② In devices such as those with more than 48 tables, the query method of the host computer is to cycle from 1 to 48 tables in turn, and the appearance of error data is uncertain, and it is not generated from 1 to 48 tables in turn, so "reading" the error data is far from timely. Summary of the invention
[0008] In order to solve the technical problem of low efficiency of error data transmission of existing electric energy meter calibration devices, the present invention proposes a transmission system and method for error data of electric energy meter calibration devices. The specific scheme is as follows:
[0009] A transmission system for error data of an electric energy meter verification device comprises a host computer and a plurality of error machines on the electric energy meter verification device, wherein the I / O ports of the error machines are connected to the extended I / O ports of the host computer.
[0010] Specifically, the extended I / O port of the host computer is connected to the corresponding I / O port of the corresponding error machine via RS232 or RS485.
[0011] The method of using the above-mentioned system for transmitting error data of an electric energy meter verification device comprises the following steps:
[0012] S1. Add a connection line between the I / O port of the error machine and the extended I / O port of the host computer as a hardware flag. The host computer sets all the hardware flags to high in the initial state.
[0013] S2, the host computer determines the order of querying all error machines;
[0014] S3. Determine whether the error machine generates new error data. If so, the host computer sets the hardware flag to a low position. When the error machine has finished sending the error data, the host computer sets the hardware flag to a high position.
[0015] Specifically, step S2 is as follows:
[0016] S21, the upper computer queries the order of the error machines, and the initial priority is the same as the table position;
[0017] S22, enter step S3, when the error machine generates error data, after the host computer reads the epitope data, the priority of the epitope is reduced to the lowest, and the priority of the remaining epitopes is increased by 1 level. When no error data is generated, the priority of the corresponding epitope remains unchanged; the host computer queries the errors of all epitopes and repeats step S22.
[0018] The beneficial effects of the present invention are:
[0019] (1) The host computer does not need to query the error machine through the serial port to query the error data. It only needs to query the corresponding hardware flag bit through the extended I / O port. Only when the hardware flag bit is low, the direction error machine reads the error data.
[0020] (2) This method ensures that every communication between the host computer and the error machine is effective and can obtain the expected data, avoiding the blind "disturbance" of the error machine by ordinary serial communication methods, so that the error machine is always in a "quiet" working state.
[0021] (3) In step S2 of the method, the bubble sort method is used to read the error machine data. This is a fuzzy control method that is completely consistent with the time pattern of the data appearing in each error machine, so that the detection process can be completed in the shortest time, achieving high-efficiency transmission of error data.
[0022] (4) The error test of electric energy meter is actually the comparison and conversion between the pulse of the electric energy meter under test and the pulse of the standard electric energy meter. Generally, within the set time interval of N pulses of the measured meter, the counter accumulates and calculates the pulse of the standard meter, and transmits the error data to the host computer and the display buffer. This is a real-time detection system, and its task is completed by the single-chip microcomputer. In order to ensure the accuracy of the error data and the reliability of the working state, the single-chip microcomputer needs to use the serial port interrupt when accumulating the pulses of the standard meter and the pulse of the measured meter, calculating the error value and transmitting the error data to the host computer and the display buffer. After the error data is generated, it must be sent out within a certain time, otherwise the error buffer will be overwritten by the updated error data. The high-efficiency transmission method of error data of the electric energy meter calibration device of the present invention does not receive serial port interrupts during the detection process. When there is new error data, it is quickly transmitted to the host computer. It is an efficient and reliable data transmission method, which realizes the real-time, reliability and rapidity requirements of error data transmission in the electric energy meter calibration device. It not only speeds up the data transmission rate, but also improves the reliability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 This is the hardware communication structure diagram.
[0024] Figure 2 This is the flow chart of the bubble sort method for the eight-bit table system. DETAILED DESCRIPTION
[0025] like Figure 1 As shown, a transmission system for error data of an electric energy meter calibration device includes a host computer and multiple error machines on the electric energy meter calibration device, and the I / O port of the error machine is connected to the extended I / O port of the host computer. At this time, when the host computer queries the error data, it does not need to query the error machine through the serial port, but only needs to query the corresponding hardware flag bit through the extended I / O port. Only when the hardware flag bit is low, the error machine reads the error data. This structure ensures that each communication between the host computer and the error machine is effective and the expected data can be obtained, avoiding the blind "disturbance" of the error machine by the ordinary serial communication method, so that the error machine is always in a "quiet" working state.
[0026] Optimally, the extended I / O port of the host computer is connected to the corresponding I / O port of the corresponding error machine via RS232 or RS485. In this way, the advantages of traditional RS232 or RS485 can be used to realize data transmission.
[0027] The method of using the above-mentioned system for transmitting error data of an electric energy meter verification device comprises the following steps:
[0028] S1. Add a connection line between the I / O port of the error machine and the extended I / O port of the host computer as a hardware flag. The host computer sets all the hardware flags to high in the initial state.
[0029] S2, the host computer determines the order of querying all error machines;
[0030] S3. Determine whether the error machine generates new error data. If so, the host computer sets the hardware flag to a low position. When the error machine has finished sending the error data, the host computer sets the hardware flag to a high position.
[0031] Step S2 is specifically as follows:
[0032] S21, the upper computer queries the order of the error machines, and the initial priority is the same as the table position;
[0033] S22, enter step S3, when the error machine generates error data, after the host computer reads the epitope data, the priority of the epitope is reduced to the lowest, and the priority of the remaining epitopes is increased by 1 level. When no error data is generated, the priority of the corresponding epitope remains unchanged; the host computer queries the errors of all epitopes and repeats step S22.
[0034] Depend on Figure 2 It can be seen that: ① In the first round of query, the query priority is the same as the table position. Among them, table positions 3 and 7 have no error data, so in the second round of query priority, table positions 3 and 7 are upgraded to 1 and 2 respectively, and table positions 1, 2, 4, 5, 6, and 8 are reduced to 3~8 respectively; ② In the second round of query, table positions 5 and 8 have no error data, so in the third round of query priority, table positions 5 and 8 are upgraded to 1 and 2 respectively, and table positions 1, 2, 3, 4, 6, and 7 are reduced to 3~8 respectively. It can be seen that the query priority has been allocated most reasonably. Using the bubble sorting method to read the error machine data is a fuzzy control method, which is completely consistent with the time law of the data appearing in each error machine, so that the detection process can be completed in the shortest time, achieving high-efficiency transmission of error data.
[0035] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A method for transmitting error data of an electric energy meter calibration device, characterized in that: The method is applied to a transmission system of error data of an electric energy meter verification device, wherein the transmission system comprises a host computer and multiple error machines on the electric energy meter verification device, wherein the I / O port of the error machine is connected to the extended I / O port of the host computer; The extended I / O port of the host computer is connected to the corresponding I / O port of the corresponding error machine via RS232 or RS485; The method comprises the steps of: S1. Add a connection line between the I / O port of the error machine and the extended I / O port of the host computer as a hardware flag. The host computer sets all the hardware flags to high in the initial state. S2, the host computer determines the order of querying all error machines; S3, judging whether the error machine generates new error data, when it does, the host computer sets the hardware flag to a low position, when the error machine has finished sending the error data, the host computer sets the hardware flag to a high position; Step S2 is specifically as follows: S21, the upper computer queries the order of the error machines, and the initial priority is the same as the table position; S22, enter step S3, when the error machine generates error data, after the host computer reads the epitope data, the priority of the epitope is reduced to the lowest, and the priority of the remaining epitopes is increased by 1 level. When no error data is generated, the priority of the corresponding epitope remains unchanged; the host computer queries the errors of all epitopes and repeats step S22.
