Summary of the invention
The present invention be directed to existing customer's end and get access to corresponding signal data from server end, thereby system all must copy to these metamessages the speed issue that each client on the network and service end influence network after each configuration finishes, the method of signal element information sharing in a kind of distributed network has been proposed, improved the speed of network, avoiding unnecessary safety problem, is a kind of automatic, efficient, safe information sharing method.
Technical scheme of the present invention is: the method for signal element information sharing in a kind of cloth formula network, be divided into client and service end according to function on the grid, each service end is in charge of several signals in the network, formed a meta information table, the meta information table of all service ends is combined and has just been formed total meta information table; Service end only need be safeguarded the meta information table of oneself, and each client is all held total meta information table of network system, and the client can obtain corresponding signal from corresponding service end by total meta information table on grid, finish monitoring function.
The step of total meta information table that described client is held network system is as follows:
Client is work earlier, and is online:
1) system configuration software is after configuration finishes, automatically according to equipment meta information table is divided into the fritter of regular length one by one, each fritter comprises the metamessage of some barss and unique index value is arranged, and downloads to corresponding service end, makes service end can carry out operate as normal;
2) service end is being received configuration, and after the operate as normal, the meta information table and the version number of broadcasting oneself on network, the notice on-line client is upgraded this part meta information table;
3) after on-line client is received metamessage broadcasting, if find that the version number of new meta information table is different with the version number of own existing meta information table, just delete the meta information table of existing this service end, then new meta information table is added total meta information table, renewal is finished.
Client is started working after service end:
(1) after client is reached the standard grade, monitors other client and the network state broadcast packet that sends of service end in several seconds;
(2) determined the service end that exists on the network and had the branch block message of meta information table after, to all client multicast application bags, apply for the index information of the meta information table fritter of the service end that they have;
(3) do not have any meta information table fritter if on-line client is all answered, then send application, require it to send meta information table to this service end;
(4) have the meta information table fritter and send the fritter index that it has if having more than or equal to a client answer, then to the meta information table fritter of these client applications, apply for fritter situation which fritter and application quantity are had by client and its busy extent come fixed, do not have but fritter that service end has for all clients, directly to the service end application;
(5) receive that other client and service end (if application) comprise the answer bag of meta information table fritter, they are bolted together forms complete meta information table.
Beneficial effect of the present invention is: the present invention is the method for signal element information sharing in a kind of distributed network, has proposed a kind of automatic, efficient, shared method of security information, helps to provide network speed and fail safe.
Embodiment
The system construction drawing of the method for signal element information sharing in the distributed network of the present invention as shown in Figure 1, we are divided into client 2 and service end 5 to them to the website that articulates on the grid 4 according to function, service end is from monitored object acquired information, client obtains real time data by network from service end, finish corresponding monitoring function, allow website 3 be service end be again client.Generally all dispose off-line configuration device 1 in the system, the structure of whole system, signal etc. are configured.
The signal that is monitored in the system all uses item (tag) to name, and item is the character string of one 32 byte length, is made up of letter, numeral and underscore, represented a temperature signal as T101, and P101 has represented a pressure signal, and item is unique in system, can not repeat.Except item, during configuration also some other attributes to signal define, following table has simply been listed some attributes that signal need define usually:
Sequence number |
Title |
Byte length |
Explanation |
1 |
TAG |
32 |
Item, |
2 |
TYPE |
2 |
Type |
3 |
STITLE |
32 |
Short explanation |
4 |
LTITLE |
64 |
Long explanation |
5 |
DEVICE |
1 |
The device address |
6 |
MODULE |
1 |
Module's address |
7 |
PORT |
1 |
Channel address |
8 |
HIRNG |
4 |
High range |
9 |
LORNG |
4 |
Lower range |
? |
...... |
...... |
Other some attributes |
These combinations of attributes of signal are at some, and we are referred to as the metamessage of signal.Each service end is in charge of several signals, has formed a meta information table, and the meta information table of all service ends is combined and just formed total meta information table.Service end only need be safeguarded the meta information table of oneself, and do not need to safeguard the meta information table of whole system, and each client all needs to hold the total meta information table of system, just can obtain corresponding signal from corresponding service end on grid by meta information table, finishes monitoring function.
Client obtain automatically the most direct method of meta information table be configuration finish download to service end after, directly to service end application meta information table, but because service end is being born the task of obtaining real time data from controlled device, be busy with one's work, when client terminal quantity is a lot, perhaps roll off the production line on the client when frequent, can influence the operate as normal of service end, the design's method has been avoided the generation of this situation.
Consider two kinds of situations, client is in the work and the work of reaching the standard grade after service end of reaching the standard grade before the service end.Fig. 2 has provided the flow chart that client was started working before service end, the treatment step of this situation is as follows:
A. with the node on the grid, according to being that client or service end are divided into two groups
B. system configuration software is after configuration finishes, and is that each service end generates a meta information table, and this meta information table is divided into several fritters according to the principle that several metamessages, total length are no more than the 1k byte again.This meta information table arrives service end by network download.
C. service end is being received configuration, and after the operate as normal, to the meta information table and the version number of all client multicasts oneself, the notice on-line client is upgraded this part meta information table on network.
D. after on-line client was received metamessage broadcasting, the metamessage (if having had legacy version) of unborn this service end of deletion added total meta information table with new meta information table then, and renewal is finished.
Fig. 3 has provided the flow chart that service end was started working, the processing of this situation before client
Step is as follows:
One, after client is reached the standard grade, monitors other client and the network state broadcast packet that sends of service end in several seconds, determine the service end that exists on the network to form the service end tabulation by the state bag that receives.All clients and service end per second kind be the state of broadcasting oneself on network all, the state bag comprises following message: the network address, type (service end or client), operating state, busy state (1 to 5 classification, 1 grade is the most idle, and 5 grades are the busiest), meta information table information (service end), meta information table version number (service end).
The client of two, newly reaching the standard grade to busy extent all client multicasts less than 5 grades, is applied for the situation that has of their meta information table on network, comprise the version number information of type and all service ends in the application bag.
Three, after other client is received request package,, then answer " NO ", skip to step 5 and continue to carry out if do not have any meta information table fritter or all do not meet with all version numbers of request; Otherwise answer " YES ", and answer the index (this client might not have whole meta information table fritters also in renewal) of meta information table fritter of the service end of version number's unanimity of oneself holding.
Four, one) if there is client to answer " YES ", then according to they busy extent and have metamessage fritter situation, the fritter that has to they of their application somes.
The quantity of application fritter is calculated with following formula:
Wherein, H represents the client terminal quantity that responds; N
iExpression is to the little number of blocks of i client application; K
iThe busy extent (1 to 4) of representing i client; M represents total little number of blocks.
Calculating is to the method for partition of client application fritter:
(1) situation of the metamessage fritter of sending according to all clients that has generates the metamessage fritter table that a following client of binary form has:
The fritter client |
P1 |
P2 |
...... |
Pm |
C1 |
1 |
1 |
? |
1 |
C2 |
?0 |
?1 |
? |
?1 |
…… |
? |
? |
? |
? |
Cn |
?0 |
?0 |
? |
?1 |
Wherein, on behalf of its clients corresponding, 0 do not have corresponding fritter, and on behalf of its clients corresponding, 1 have corresponding fritter; P1, P2 ..., Pm is the index value of fritter.
(2) to each the row summation in the form, and with these and value is that weight sorts from small to large to all fritters, and promptly the frequency that is had according to fritter sorts from small to large.Simultaneously, for each fritter, according to the client that has them according to busy extent value K
iThe ascending ordering.Ranking results described above is as shown in the table:
As seen from the above table, have fritter P
iClient C is arranged
j, C
kDeng, and busy extent C
j<C
k<....
(3) from P
1Begin fritters all in the formation is distributed (above table is an example): have P
1Have only client C
1, then choose C
1It is distributed the application fritter.To C
1The quantity of the fritter of application is
From next fritter P
2Begin to travel through the fritter formation, see that whether they are also by C
1Have, up to finding N
iTill the individual fritter, they are distributed to C
1After each the distribution fritter of having distributed is deleted from formation, still first fritter in the formation is repeated above process then.
When a fritter is had by a plurality of clients, search in the client formation first the client that was not assigned with at first in order, if clients all in the formation all were assigned with, then this fritter is distributed to the client (a promptly the most idle client) of head of the queue.
(4) after the branch block end, the metamessage fritter that new client is told according to the method described above to all client applications of answering " YES ".
(5) skipping to step 6 continues to carry out.
Two) do not have for all clients but fritter that service end has directly to the service end application, skips to step 6 then and continues to carry out.
Three) if all clients are all answered " NO ", then directly send out request package to all service ends, the application meta information table promptly skips to step 5 and continues to carry out.
Five, to all their meta information table of service end application.
Six, behind the meta information table fritter that receives any one client (or service end) transmission, the busy extent of oneself is changed to less than 5 grades, when receiving other client application meta information table, one's own meta information table information is sent, promptly prepare to send the meta information table that oneself receives to other client.After receiving the meta information table fritter that all clients and service end (if application) send, they are formed complete meta information table according to index value, and in this table, add version number's (from the broadcast packet of service end, obtaining) of all service end configuration infos.The client of so far, newly reaching the standard grade has obtained complete meta information table.