Method and device for improving 485 channel meter searching efficiency of acquisition terminal and medium
By introducing a prequery mechanism in the acquisition terminal, using wildcards to quickly judge the effectiveness of the combination of specification types and baud rate, the problem of limited search function of RS485 channel is solved, and the search efficiency and accuracy are significantly improved.
Patent Information
- Application Number
- CN202510180902.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-19
- Publication Date
- 2025-06-03
AI Technical Summary
In the prior art, the meter search function of the RS485 channel is limited by the half-duplex communication protocol, and cannot process the data returned by multiple power meters at the same time, resulting in data collisions and communication delay problems, seriously affecting the acquisition efficiency and accuracy.
The acquisition terminal uses wildcards to replace the address of the energy meter to perform pre-query, record the time difference between the energy meter reception and transmission, effectively judges the effectiveness of the combination of the specification type and baud rate, and uses the maximum time difference recorded by the pre-query as the waiting time when searching the table.
The pre-query mechanism quickly eliminates invalid combinations, avoids unnecessary broadcast queries, significantly shortens the overall search time, and improves the success rate and accuracy of the query.
Smart Images

Figure CN120091237A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of communication technologies, and particularly relates to a method, device, and medium for improving the meter search efficiency of the 485 channels of a collection terminal. Background Art
[0002] In a power system, a power meter collection terminal communicates with multiple power meters through RS485 channels to achieve data collection and transmission. However, the current RS485 meter search function is limited by the half-duplex communication protocol and cannot process the data returned by multiple power meters simultaneously, resulting in frequent data collisions and communication delays, seriously affecting the collection efficiency and accuracy. Traditional methods rely on broadcasting query frames in combinations of various protocol types, baud rates, and meter addresses, and waiting for the data to be returned to determine the meter address information. This method not only takes a long time but is also easily affected by communication delays, making it difficult to guarantee the accuracy and integrity of the query results. In addition, a large number of invalid combinations of protocol types and baud rates increase the unnecessary query waiting time, wasting valuable communication bandwidth and device resources. Summary of the Invention
[0003] To solve the problems existing in the above-mentioned prior art, the present invention provides a method for improving the meter search efficiency of the 485 channels of a collection terminal, including the following steps: Step S1, for the combination of protocol type and baud rate, the collection terminal performs a pre-query by using a wildcard to replace the meter address of the power meter. The number of pre-queries is multiple times, and the time difference between the power meter receiving and sending is recorded. The maximum time difference is denoted as T. Step S2, when the collection terminal receives the data returned by the pre-query, the combination of this protocol type and baud rate is valid, and the collection terminal performs a normal meter search. If no data is returned after the pre-query ends, a pre-query is performed on the next combination of protocol type and baud rate. Step S3, for the valid combination of protocol type and baud rate, the collection terminal sends a query frame and receives a data frame, and T is used as the waiting time for the normal meter search. Step S4, the meter addresses of the power meters found are matched with the issued meter files, and the meter address format is temporarily stored.
[0004] Based on the above solution, in step S1, the number of pre-queries is 10 times, T is the maximum value among the 10 recorded time differences received by the collection terminal, and when T < 1.5s, let T = 1.5s.
[0005] Based on the above solution, in step S1, the waiting time for the collection terminal to send data each time is set to 6 seconds. If the response time of the pre-query exceeds 6 seconds and no data is received, it is considered that this query is invalid, and the next pre-query is continued until 10 pre-queries are completed.
[0006] Based on the above solution, step S3 further includes that the acquisition terminal performs retransmission verification on the received complete data frame, and the retransmission verification is to perform a re-send - wait for response operation on this address.
[0007] Based on the above solution, the number of times of retransmission verification is set to 2 times. If the three response data are exactly the same, it is confirmed that the corresponding electricity meter is found on the 485 channel. If the three response data are inconsistent, perform reduced-bit meter search to reduce the number of wildcards until a response from a single electricity meter is obtained.
[0008] Based on the above solution, when matching the electricity meter table address found in step S4, if there is no matching record, an unknown electricity meter event is generated and reported.
[0009] The present invention also provides a device for improving the efficiency of searching for electricity meters on the 485 channel, including: A pre-query module, which is used to perform multiple pre-queries for the combination of protocol type and baud rate by using wildcards to replace the electricity meter table address, and record the time difference between electricity meter reception - transmission, and the maximum time difference is denoted as T; A judgment module, which is used to determine that the combination of this protocol type and baud rate is valid when receiving the data returned by the pre-query; if no data is returned after the pre-query ends, trigger the pre-query unit to perform a pre-query on the next combination of protocol type and baud rate until all combinations of protocol type and baud rate are traversed; A meter search module, which is used to send a query frame and receive a data frame based on the valid combination of protocol type and baud rate, where T is used as the waiting time for normal meter search; A matching module, which is used to match the electricity meter table address found with the issued table file and temporarily store the table address format.
[0010] Based on the above solution, the meter search unit further includes a retransmission verification unit and a reduced-bit meter search unit. The retransmission verification unit is used to perform retransmission verification when receiving a complete data frame, and the retransmission verification includes performing a re-send - wait for response operation on this address; when the data frame received by the reduced-bit meter search unit is abnormal or the table address changes during retransmission verification, perform a reduced-bit meter search operation until the meter search unit obtains a response from a single electricity meter.
[0011] The present invention also provides a terminal device for improving the efficiency of searching for electricity meters on the 485 channel, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor is used to implement the steps of the method for improving the efficiency of searching for electricity meters on the 485 channel of the acquisition terminal as described above when executing the computer program.
[0012] The present invention also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of a method for improving the meter search efficiency of the 485 channels of a collection terminal as described above are implemented.
[0013] Compared with the prior art, the present invention has the following beneficial effects: 1. By introducing a pre-query mechanism and using wildcards to quickly determine the validity of protocol types and baud rate combinations, a large amount of invalid query waiting time is skipped, invalid combinations can be quickly excluded, unnecessary broadcast queries are avoided, and thus the overall meter search time is significantly shortened; 2. By adopting a retransmission verification mechanism, the complete frames that have been returned are retransmitted and verified multiple times to ensure the accuracy and consistency of the data; 3. By dynamically adjusting the timeout time and setting a reasonable timeout time according to the response time of different electric energy meters, the influence caused by communication delay is further reduced, and the success rate and accuracy of the query are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 It is a flowchart of the pre-query process of the present application; Figure 2 It is a flowchart of the formal meter search process of the present application; DETAILED DESCRIPTION OF THE EMBODIMENTS The RS485 channel is limited by the protocol type and cannot handle the situation of returning data from multiple electric energy meters simultaneously during the meter search process. Therefore, it can only broadcast query frames in the way of arranging and combining multiple protocol types, baud rates and meter addresses, and wait for the data to be returned to determine the meter address information. This method has low acquisition efficiency and its accuracy is easily affected by communication delay. Therefore, in view of the above problems, the present invention provides a method and system for improving the meter search efficiency of the 485 channels of a collection terminal. Before formally searching for meters for each protocol type and baud rate combination, wildcards are used to replace the meter address for pre-query to quickly determine the validity of a specific combination.
[0015] In the communication between the electric energy meter and the collection terminal: the protocol type specifies the specific rules for communication between the electric energy meter and the collection terminal; the baud rate defines the communication speed. By combining different protocol types and baud rates, the collection terminal can adapt to a variety of electric energy meter devices and quickly find matching communication parameters during the meter search process.
[0016] The invention will be further described below in conjunction with specific embodiments.
[0017] The present invention provides a method for improving the meter search efficiency of the 485 channels of a collection terminal, including the following steps: As Figure 1As shown in the figure, when the acquisition terminal starts the 485-channel meter search, it first traverses the list of protocol type P and baud rate B combinations. For each PB combination, the acquisition terminal uses the wildcard AAAAAAAAAAAA to replace the electricity meter address for pre-query. If no data is returned, this PB combination is invalid.
[0018] Considering that there will be a long communication delay when the distance between the electricity meter and the terminal is too far, the waiting time for each query is extended from the default time of 1.5s to 6s. Multiple query frames are continuously sent under each PB combination. If a response is received during a certain query, record the time difference between the electricity meter response and the query frame transmission; if there is no response, determine that this PB combination is invalid. According to the present application, extending it to 6s greatly increases the query time, which not only ensures the reliability of the meter search time but also avoids long waiting times.
[0019] Preferably, the number of pre-queries is set to 10 times to reduce the possibility of misjudgment caused by accidental communication failures, and it can be fine-tuned according to the actual application scenario. For example, in a relatively stable communication environment, the number of pre-queries can be appropriately reduced to improve efficiency; conversely, in a poor communication environment, the number of pre-queries can be increased.
[0020] According to the present application, combined with the actual on-site use environment and by statistically recording the read response time of electricity meters of different batches and models, record the time difference between the electricity meter response and the query frame transmission, and select the maximum value among the time differences recorded in multiple queries, denoted as T. If T < 1.5 seconds, set it to 1.5 seconds to ensure the shortest query time and avoid omission.
[0021] When the acquisition terminal receives the data returned by the pre-query, the combination of this protocol type and baud rate is valid, and the acquisition terminal performs a normal meter search. If no data is returned after the pre-query ends, perform a pre-query on the next combination of protocol type and baud rate. When all combinations of protocol type and baud rate have been traversed, the meter search ends.
[0022] The present application significantly improves the meter search efficiency by skipping the query waiting time for invalid protocol type and baud rate combinations, as Figure 2 shown. For valid combinations of protocol type and baud rate, the acquisition terminal sends a query frame and receives a data frame, and T is used as the waiting time for normal meter search.
[0023] Specifically, a query frame is sent. The query address includes i and the value information of the i-th bit. If it is the first execution in this round, the query address is all AA, the value of the i-th bit is 0, and i is 1. Frame grouping and sending are performed based on this query address, and the timeout is the maximum time difference T recorded. The value of the i-th bit is incremented successively from the incoming value (or default value) to 99. If there is a data frame (or data fragment) response after a certain query address is sent, data format verification is performed. If there is no data response and the value of i is 1, a reduction and fallback operation is executed, that is, the value of the i-th bit of the table address is changed from 99 to AA, and i = i - 1.
[0024] According to the present application, the maximum time difference T recorded during pre-query is used as the waiting time during formal table search, and the timeout is dynamically adjusted to improve the accuracy of table search.
[0025] Furthermore, in order to improve the accuracy of table search, a retransmission verification mechanism is adopted during data format verification to avoid missing situations caused by communication fluctuations. The specific steps of the data format verification are as follows: If the acquisition terminal receives a complete data frame, retransmission verification is performed; if the received data frame cannot be normally parsed, it may be because multiple response data overlap in time, so a reduction table search operation is executed.
[0026] According to the present application, in order to avoid the influence of extreme situations such as communication interference and delay on the integrity of table search, retransmission verification needs to be performed on the returned complete frames. Specifically, if a complete response frame is received in the address format under a certain PB combination, a re-sending - waiting for response operation is performed for this address. According to one embodiment, considering conditions such as terminal performance, table search efficiency, and the integrity of table search results, and combining the actual on-site test results, the number of retransmission verifications is set to 2 times to obtain the most ideal effect. Compare the response data sent 3 times. If they are all the same complete data frame, it is considered that the electric energy meter X is found on the 485 channel; if there is a situation where the received frame format is abnormal or the parsed table address has changed, a reduction table search operation is executed.
[0027] The reduction table search operation makes the query address more accurate by reducing the number of wildcards AA, and through multiple iterations, the purpose of having only one electric energy meter reply to a single query is achieved. When only one electric energy meter replies, the table address format is temporarily stored.
[0028] According to one embodiment, there are Table 1: 000000000112 and Table 2: 000000000212. When the search address during table search is AAAAAAAAAA12 (at this time, i equals 1 and the value of the i-th bit is 12), both Table 1 and Table 2 meet the conditions, and the reply is likely to be an abnormal frame. Therefore, it is necessary to perform bit reduction table search: i = i + 1, and the new i-th bit is changed from AA to 00. Starting from AAAAAAAA0012 to AAAAAAAA9912 for traversal. When the sending frame is AAAAAAAA0112, the first table responds; when the sending frame is AAAAAAAA0212, the second table responds. Through the above steps, the accurate Table 1 and Table 2 can be found respectively.
[0029] Further, after the bit reduction table search, the query address becomes AAAAAAAAxx12, that is, the traversal changes from the original first bit to the second bit. When xx traverses from 00 to 99, it indicates the end of this combination, and a bit reduction rollback operation is required: xx becomes AA, i changes from 2 to 1, and it changes from AAAAAAAAxx12 to AAAAAAAAAA13, and then continues to traverse until AAAAAAAAAA99.
[0030] When the acquisition terminal finds an electric energy meter through the 485 channel, it matches the found electric energy meter address with the issued table file to determine whether it is an unknown electric energy meter outside the table file. If there is no matching item, it matches the found electric energy meter address with the table information in the table search result set to determine whether this table address has been found and reported for the 3303 unknown electric energy meter event through carrier wave or other channels. If there is no matching record, it generates an unknown electric energy meter event and reports it to the master station. If there is a match, it temporarily stores the table address format and continues to query the next electric energy meter.
[0031] According to one embodiment, a 485 main meter is connected to the 485 channel of the acquisition terminal. In actual use, it is found that the table search efficiency can be increased by 81.3% under extreme working conditions, which can effectively improve the table search efficiency.
[0032] It should be noted that this application can be applied to other types of meter devices or intelligent terminals, not limited to the search for electric energy meters only. As long as the target device adopts a compatible communication protocol and baud rate configuration, the method of this application can efficiently realize the identification and connection of the device through steps such as pre-query, validity judgment, normal table search, and address matching. In addition, in actual applications, parameters can be adjusted according to the specific characteristics of different devices (such as response time, address format, etc.) to further improve the adaptability and scope of application.
[0033] The present invention also provides a device for improving the meter search efficiency of the 485 channel. This device can be used to execute the steps performed by the acquisition terminal provided in the above method embodiment. This function can be implemented by hardware, or by software or hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
[0034] Specifically, it includes: A pre-query module, which is used to perform multiple pre-queries for the combination of protocol type and baud rate by using wildcards to replace the meter address of the electric energy meter, and record the time difference between the reception and transmission of the electric energy meter. The maximum time difference is denoted as T. A judgment module, which is used to determine that the combination of the protocol type and baud rate is valid when receiving the data returned by the pre-query. If no data is returned after the pre-query ends, it triggers the pre-query unit to perform a pre-query for the next combination of protocol type and baud rate until all combinations of protocol type and baud rate are traversed. A meter search module, which is used to send a query frame and receive a data frame based on the valid combination of protocol type and baud rate, where T is used as the waiting time for normal meter search. A matching module, which is used to match the searched meter address of the electric energy meter with the issued meter file and temporarily store the format of the meter address.
[0035] The meter search unit further includes a retransmission verification unit and a reduced-bit meter search unit. The retransmission verification unit is used to perform retransmission verification when receiving a complete data frame. The retransmission verification includes performing a retransmission-waiting for response operation on this address. When the data frame received by the reduced-bit meter search unit is abnormal or the meter address changes during retransmission verification, it performs a reduced-bit meter search operation until the meter search unit obtains the response of a single electric energy meter.
[0036] Based on the same technical concept, the present invention also provides a terminal device for improving the meter search efficiency of the 485 channel, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor is used to implement the steps of the method for improving the meter search efficiency of the 485 channel of the acquisition terminal as described above when executing the computer program.
[0037] Among them, the memory is connected to the processor. The memory may include one or more computer-readable storage media, and the computer-readable storage media may be non-transitory. The memory may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash storage devices. The processor may include one or more processors, and the processor may be implemented in at least one hardware form of a digital signal processor, a field programmable gate array, or a programmable logic array. The processor may also include a main processor and a coprocessor. The main processor is a processor for processing data in the wake state, also known as the central processing unit; the coprocessor is a low-power processor for processing data in the standby state.
[0038] The present invention also provides a computer-readable storage medium having a computer program, and when the computer program is executed by a processor, the steps of the method for improving the search table efficiency of the 485 channel of the acquisition terminal as described above are implemented.
[0039] It can be understood that if the method in the above embodiments is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and executes all or part of the steps of the methods described in the various embodiments of the present invention. The foregoing storage media include: various media such as USB flash drives, mobile hard disks, read-only memories, random access memories, magnetic disks, or optical discs that can store program codes.
[0040] The foregoing are only the preferred embodiments of the present application and are not used to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
[0041] Although the specific implementation manners of the present invention are described above, they do not limit the protection scope of the present invention. Those skilled in the art should understand that, based on the technical solution of the present invention, various modifications or deformations that can be made without creative efforts by those skilled in the art are still within the protection scope of the present invention.
Claims
1. A method for improving the efficiency of searching the table of 485 channels of a collection terminal, characterized in that: The following steps are involved: Step S1, for the combination of protocol type and baud rate, the acquisition terminal performs pre-query by replacing the electric energy meter address with a wildcard, the pre-query is performed multiple times, and the time difference between receiving and sending of the electric energy meter is recorded, and the maximum time difference is recorded as T; Step S2, when the acquisition terminal receives the data returned by the pre-query, the combination of the protocol type and the baud rate is valid, and the acquisition terminal searches the table normally. If no data is returned after the pre-query is completed, the next combination of the protocol type and the baud rate is pre-queried; Step S3, for a valid combination of protocol type and baud rate, the acquisition terminal sends a query frame and receives a data frame, and T is used as a waiting time for normal table search; Step S4, matching the searched electric energy meter address with the issued meter file, and temporarily storing the meter address format.
2. A method for improving the efficiency of searching the table of 485 channels of a collection terminal according to claim 1, characterized in that: The number of pre-queries in step S1 is 10 times, T is the maximum value of the 10 time difference records received by the acquisition terminal, and when T < 1.5s, T = 1.5s.
3. A method for improving the efficiency of searching the table of 485 channels of a collection terminal according to claim 2, characterized in that: In step S1, the waiting time for the collection terminal to send data each time is set to 6 seconds. If the response time of the pre-query exceeds 6 seconds and no data is received, the query is considered invalid and the next pre-query is continued until 10 pre-queries are completed.
4. A method for improving the efficiency of searching the table of 485 channels of a collection terminal according to claim 1, characterized in that: The step S3 also includes the acquisition terminal performing retransmission verification on the received complete data frame, and the retransmission verification is to perform a retransmission-waiting response operation on the address.
5. A method for improving the efficiency of searching the table of 485 channels of a collection terminal according to claim 4, characterized in that: The number of retransmission verifications is set to 2. If the three response data are completely consistent, it is confirmed that the 485 channel has searched the corresponding electric energy meter. If there is inconsistency in the three response data, a reduced search is performed to reduce the number of wildcards until a response from a single electric energy meter is obtained.
6. A method for improving the efficiency of searching the table of 485 channels of a collection terminal according to claim 1, characterized in that: When matching the electric energy meter address searched in step S4, if there is no matching record, an unknown electric energy meter event is generated and reported.
7. A device for improving the efficiency of 485 channel table search, characterized in that: include: A pre-query module, which is used to perform multiple pre-queries for the combination of protocol type and baud rate by replacing the electric energy meter address with a wildcard, and record the time difference between the electric energy meter receiving and sending, with the maximum time difference being recorded as T; A judgment module, the judgment module is used to determine whether the combination of the protocol type and the baud rate is valid when receiving the data returned by the pre-query; if no data is returned after the pre-query is completed, the pre-query unit is triggered to pre-query the next combination of the protocol type and the baud rate until all the combinations of the protocol type and the baud rate are traversed; A table search module, the table search module is used to send a query frame and receive a data frame based on a combination of a valid protocol type and a baud rate, wherein T is a waiting time for a normal table search; The matching module is used to match the searched electric energy meter address with the issued meter file and temporarily store the meter address format.
8. The device for improving the efficiency of 485 channel table search according to claim 7, characterized in that: The table search unit also includes a retransmission verification unit and an abbreviated table search unit. The retransmission verification unit is used to perform retransmission verification when a complete data frame is received, and the retransmission verification includes resending the address and waiting for a response. When the data frame received by the abbreviated table search unit is abnormal or the table address changes during retransmission verification, the abbreviated table search operation is performed until the table search unit obtains a response from a single electric energy meter.
9. A terminal device for improving the efficiency of 485 channel table search, comprising: A memory, a processor, and a computer program in the memory and executable on the processor, wherein the processor is configured to implement the steps of the method according to any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, the computer-readable storage medium having a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.