Background
In recent years, with the further popularization of the construction work of the national smart grid, the electricity utilization information acquisition system is widely applied and obtains better effect. However, the system still has the problems of low acquisition success rate and low efficiency, which not only has the limitations of communication technology, but also has the constraints of system management level. The disordered platform area archives are still an important factor influencing the acquisition success rate, and the indexes of automatic account rate, line loss qualification rate and the like are also influenced. Most of the current file management and maintenance of the power distribution area have the problems of manual intervention, immature related supporting technologies, low file synchronization efficiency between a main station and a terminal and the like.
The file synchronization of the electricity utilization information acquisition system mainly comprises the following contents in the following aspects: master station file synchronization, terminal file synchronization and electric energy meter file synchronization. After corresponding file change is carried out in the marketing system, a debugging process needs to be initiated in the marketing system, and after a master station of the acquisition system receives a debugging work order, corresponding adjustment can be carried out on related files according to the content of the work order; on the other hand, the master station can further combine the terminal to report information actively to realize accurate file maintenance and update. The current terminal file synchronization generally adopts the following method: the master station and the terminal respectively calculate MD5 values of the archive information of the master station and the terminal, and then the terminal reports the MD5 values; the master station confirms whether the value of MD5 reported by the terminal is consistent with the value of self file information MD5, if so, the file updating is not carried out on the terminal, otherwise, the file information of the terminal is integrally updated. The electric energy meter file comes from a file issued by a terminal, and in addition, the synchronization basic principle is that whether the file information of the electric energy meter is abnormal or not is firstly confirmed, if the file information is abnormal, the file information is reported to the terminal, and if not, the file information is not processed. The electric energy meter judges the address of the main node to which the main station belongs according to the collection task, compares the addresses of the main nodes identified by the district identification technology to determine whether the addresses of the main nodes are consistent, if not, the main station considers that the self district file is abnormal in attribution and reports the abnormal, and the main station can determine whether to update the file according to the abnormal report and the marketing system file, and realizes the file synchronization with the concentrator on the basis of the file update and further realizes the file synchronization of the electric energy meter.
Therefore, the file synchronization between the master station and the concentrator is a key factor influencing the file synchronization efficiency of the power information acquisition system.
Disclosure of Invention
Aiming at the problems, the invention provides an efficient electric power archive synchronization scheme by combining the characteristics of the archive of the power consumption information acquisition system, greatly reduces the synchronous data volume issued by the main station to the terminal side archive through the improvement of the algorithm, greatly improves the archive synchronization efficiency, and is beneficial to improving the user experience of the power consumption information acquisition system.
The technical scheme of the invention is as follows: a high-efficiency electric power archive synchronization method suitable for a power utilization information acquisition system comprises the following steps:
the master station and the terminal sort the electric energy meter file information according to the meter address size respectively to obtain a master station side ascending order set M1Terminal side ascending order set M2(ii) a The terminal groups the sorted electric energy meter files, and the grouping scale N is an even number and the size is reasonably selected according to the scale of the platform area;
the terminal calculates the check value of each group based on the electric energy meter address of each group: firstly, carrying out bitwise XOR on N addresses of each group to obtain a full information abstract I of the groupbit_iBecause the high bytes of the electric energy meter addresses belonging to the same terminal are basically consistent, the I of the full information abstract is extractedbit_iDeleting high byte 00H to obtain compressed full information abstract Ibit_i_com(ii) a Then calculates its supervisory bit Cbit_iObtaining the check value C of each groupiThe check value set of all the packets is denoted as C;
the terminal reports the check value set C to the master station, the master station determines whether the uploaded information is completely correct according to the supervision bit, if not, the master station records the group index with transmission error, and requires the terminal to upload the check value of the corresponding group again; if yes, obtaining the grouping according to the file sorting result and calculating the compression full information abstract I of the groupingbit_temp_com(ii) a And comparing the set with a terminal side compressed full information summary set B obtained based on the check value set C; thereby obtaining a master station-terminal file difference set X and filesA set of no differences R;
and the master station issues the electric energy meter file information in the difference set X and the non-difference set R, and the terminal realizes the synchronization with the master station file according to the issued information.
If M is2The number of the middle electric energy meters cannot be divided by N, namely when the last group of addresses is less than N, the rest addresses are replaced by addresses with high bytes as the address of the station area and low bytes as all 0, and each group is guaranteed to contain N data after the grouping is finished.
The supervision position Cbit_iAnd each packet check value CiThe calculation method comprises the following steps of obtaining a compressed full information abstract Ibit_i_comPerforming CRC-16 check coding to obtain a supervision bit Cbit_i(ii) a Supervision position Cbit_iAttached to compressed full message digest Ibit_i_comThen, a check value C is obtainedi。
The invention has the technical effects that: the file synchronization process only issues the difference table information and the set R. Compared with a file all-issuing method, the scheme greatly reduces the file issuing amount, and the smaller the difference between the master station and the terminal file is, the smaller the set N is, and the more obvious the advantages of the scheme are; the set R only contains packet sequence numbers, and the information quantity of the transmission non-differential set is minimum at the moment; on the other hand, when the check value is calculated, the characteristic that the high bytes of the electric energy meter address in the same station area are the same is fully utilized, the check value is compressed, the uploading data volume is further reduced, and the efficiency is improved. The field operation result shows that the proposed file synchronization method has high efficiency, low implementation complexity and good practical application and popularization values.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more clearly and completely apparent, the technical solutions in the embodiments of the present invention are further clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention, and it is obvious that the described embodiments are one, 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.
Firstly, the terminal and the master station sort all the files according to the size of the table address. In the electricity consumption information acquisition system, the addresses of the terminal and the electric energy meter are compressed BCD codes with the length of 6 bytes, the terminal and the master station finish ascending order arrangement of archive information of the terminal and the electric energy meter based on a quick ordering algorithm to obtain a master station side ascending order set M1Terminal side ascending order set M2. After the sorting is completed, the terminal side files are partitioned according to the size N (N is an even number and N can be optimized according to the size of the station area), that is, each N blocks of electric energy meter addresses are divided into one group, and if the addresses are totally divided into N groups, the method is expressed as follows:
if M is consistent due to the high byte of the electric energy meter address in the same region2When the number of the middle electric energy meters cannot be divided by N, namely the nth group is less than N addresses, the rest addresses are replaced by addresses with high bytes as the address of the station area and low bytes as all 0, and each group is ensured to contain N data after the grouping is finished. As shown in fig. 1.
And secondly, grouping the terminal side files and calculating a grouping check value. After the grouping is completed, the terminal side calculates M2The check value of each group finally forms a terminal archive check value set
C={c1,c2,L,cn}.
Check value ci(i is more than or equal to 1 and less than or equal to n) is calculated in two steps:
(1) n addresses in each group are subjected to bitwise XOR to obtain a full information abstract I of the groupbit_i(48 bit). Because the high bytes of the electric energy meter addresses belonging to the same terminal are basically consistent, the I of the full information summary can be extractedbit_iThe 00H deletion of the high byte is,thereby obtaining a compressed full message abstract Ibit_i_com(40bit)。
(2) For I obtained in the previous stepbit_i_comPerforming CRC-16 check coding to obtain a supervision bit Cbit_i(ii) a After the parity bits are appended to the compressed full message digest, a result of 56 bits is obtained as the check value c for this packeti。
And thirdly, the master station compares the files by using the check value sent by the terminal side to determine a file difference set. The method comprises the following steps:
(1) the terminal transmits C and the packet size N to the master station. The master station resolves the C and judges each C based on the check bitiWhether or not transmission is correct, if each ciIf the transmission is correct, the supervision bits are removed in sequence to obtain a compressed full information summary set B ═ Ibit_1_com,Ibit_2_com,L,Ibit_n_comAnd entering the step (2); otherwise, recording the packet number with the error check, sending a retransmission request to the terminal side, and requesting to retransmit the packet information with the error transmission; until the reception is correct.
(2) The master station sorts the self file information into a set M1And (3) performing operation, and comparing the operation result with the terminal file compressed full information abstract set B, wherein the process is as follows:
① get M1N electric energy meters of {1,2, …, N } form a file set DtempAnd calculating the XOR value of the N addresses according to the second check value calculating step (1) to obtain the I of the groupbit_temp_com。
② mixing Ibit_temp_comIn contrast to the elements in set B, as shown in fig. 2.
If it is
Ibit_temp_comE.g. there is I so that Ibit_temp_com=Ibit_i_com
Then explain M1The {1,2, …, N } block table of (A) already exists in the terminal archive, records the grouping index value i at this time to the set R of no difference; and the serial number of the grouped electric energy meters is shifted backwards by N to obtain a new electric energy meter group, namely the Mth electric energy meter group is taken1The { (N +1), (N +2), …,2N } electric energy meters form a new file set DtempAnd meterCalculating new Ibit_temp_com(thereafter only the same as I in Bbit_i+1_comAnd subsequent value comparisons).
If it is
Record D temp1 to a difference set X; and the serial numbers of the grouped electric energy meters are shifted backwards by 1 to obtain a new electric energy meter group, namely M is taken1The {2,3, (N +1) } electric energy meters form a new file set DtempAnd calculate new Ibit_temp_com(thereafter, I corresponding to the maximum value maxR among R is requiredbit_maxR_comValue comparison thereafter).
③ and so on, repeat step ② until M1The electric energy meters in the system are all taken out.
Step four, obtaining a non-difference set R and a difference set X of the electric energy meter through the steps, and if X is empty, the synchronization is not needed; if X is not empty, the master station only needs to issue the corresponding electric energy meter file in the X set and the index value in the R. The terminal side analyzes the master station to send file updating messages, and can realize the reservation of the same file information group and the deletion of different file information groups according to the information in the non-difference set R; based on the information in the difference set X, updating of the difference file can be achieved, as shown in FIG. 3.
As can be seen from the synchronization process, the archive synchronization process only issues the difference table information and the set R. Compared with a file all-issuing method, the file issuing amount is greatly reduced by the scheme, and the smaller the difference between the master station and the terminal file is, the smaller the set X is, and the more obvious the advantages of the scheme are; the set R only contains packet sequence numbers, and the information quantity of the transmission non-differential set is minimum at the moment; on the other hand, when the check value is calculated, the characteristic that the high bytes of the electric energy meter address in the same station area are the same is fully utilized, the check value is compressed, the uploading data volume is further reduced, and the efficiency is improved. The field operation result shows that the proposed file synchronization method has high efficiency, low implementation complexity and good practical application and popularization values.
Although embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present application, and that variations, modifications, substitutions and alterations may be made to the above embodiments by those of ordinary skill in the art within the scope of the present application.