A kind of distributed alarm regulation engine design method
Technical field
The present invention relates to vessel traffic service field, especially a kind of distributed alarm regulation engine design method.
Background technique
The essence of ship traffic management system is to provide safe navaid service for local shippping traffic.Thunder at present
Reach, the multiple sensors equipment such as AIS, CCTV has obtained in ship traffic management system commonly used, and continue to provide
A large amount of ship moves static data in real time.Real-time exhibition of the static data on electronic chart is moved by these, is updated, watch
Member will appreciate that water surface situation and do corresponding situation judgement, to provide navaid service for shippping traffic.
Alarm is an important function in ship traffic management system, reflects the journey of system intelligent level
Degree.System effectively monitors the behavior of key area, emphasis ship, for example anchored vessel drags of anchor, is dangerous in navigation channel in anchorage
Meeting chance of ship etc., can perceive in time and push alarm prompt in real time.But in current ship traffic management system
Alarm function does not make full use of the dynamic static data of ship generally also, and perception judgement is also very limited.Traditional ship is handed over
The subscription thought of user is not accounted in logical management system, the shared a alarm data of all clients is unable to specific aim
Ground pushes alarm data according to actual needs.Simultaneously as ship real time data is more and more, the intelligent level of system requires to get over
Carry out the performance requirement higher, the processing capacity of system cannot support various rules, business to judge.
For the trend for adapting to maritime affairs intelligence supervision, lifting system passes through the processing capacity and sensing capability of big data
Big data analysis strengthen the system is to the validity and accuracy for paying close attention to ship alarm judgement, distributed alarm regulation engine
Seem more there is an urgent need to.
Summary of the invention
In view of the above-mentioned deficiencies of the prior art, the technical problem to be solved by the present invention is to provide a kind of distributed alarms
Regulation engine design method, which is able to achieve mentions according to the practical subscription demand of user
It for alerting service function, and can be distributed according to the dynamic equalization of user's online quantity adjustment alarm load, realize big data, more
The alerting service of user.
In order to solve the above technical problems, the technical solution adopted by the present invention is that:
A kind of distributed alarm regulation engine design method, includes the following steps.
Step 1, alarm type Database: according to mathematical statistics, establishing alarm type database, the alarm type number
It include the cpu resource consumption value of occupancy needed for various alarm types and every kind of alarm type according to library.
Step 2, user's subscription management system is established: user's subscription management system server is established with each booking reader
Communication protocol, the current online booking reader's number of moment maintenance;Multiple alarming processings are laid in user's subscription management system to draw
It holds up.
Step 3, user subscribes to region and region alarm regulation is established: each booking reader can establish according to self-demand
Subscribe to region and each alarm regulation subscribed in region.
Step 4, user's subscription management includes the following steps.
Step 41, user subscribes to region and the load of region alarm regulation: user's subscription management system automatic identification is ordered online
User is read, and calls the subscription region and alarm regulation information for loading that each on-line subscription user is established by data-interface.
Step 42, single on-line subscription user cpu resource consumption value calculates: according to needed for every kind of alarm type in step 1
The cpu resource consumption value of occupancy, in all subscription regions that each on-line subscription user is established needed for all alarm types
The cpu resource consumption value of occupancy is added, to calculate corresponding on-line subscription user cpu resource consumption value.
Step 5, alarming processing engine distributes: user's subscription management system is according to the on-line subscription number of users and meter of identification
The single on-line subscription user cpu resource consumption value obtained, all on-line subscription users are distributed to multiple alarming processings and are drawn
In holding up.
Step 6, alarming processing engine thread is opened up: each alarming processing engine, is used according to the on-line subscription that step 5 is distributed
The loading condition at family opens up corresponding processing number of threads, carries out the judgement and message push of alarm regulation.
Step 7, ship real time data receives and distributes: user's subscription management system real-time reception Ship dynamic situation tracking data
And be distributed in multiple alarming processing engines.
Step 8, alarm regulation judges: the processing thread in each alarming processing engine, according to the Ship dynamic situation received
Tracking data carries out each real-time calculating for subscribing to all alarm regulations in region, and pushes the warning information of generation to corresponding
On-line subscription user;Meanwhile the warning information of generation is stored in warning information database.
It further include step 9, online according to booking reader, offline and newly-increased situation subscribes to the increasing of region and/or alarm regulation
Subtract situation, repeats step 3 to step 8, various alarm regulations in all subscription regions of all on-line subscription users are sentenced in realization
Disconnected and function serving information.
In step 42, the calculation method of single on-line subscription user cpu resource consumption value U is as follows.
Step 42a), it is assumed that the number of alarming processing engine is S, then n current on-line subscription user collection are combined into { 12 ...
I ... n }, i < n;Wherein, the m subscription regional ensemble that i-th of booking reader is established is { ai1 ai2 … aiy … aim,
Y < m;Y-th of cpu resource consumption collection for subscribing to h alarm regulation in region is combined into { cy1 cy2 … cyh}。
Step 42b), i-th y-th of the booking reader cpu resource consumption for subscribing to h alarm regulation in region calculates such as
Under:
aiy=cy1+cy2+…+cyh
In formula, cy1、cy2……cyhOccurrence obtained by being searched in the alarm type database established from step 1.
Step 42c), i-th of on-line subscription user m total cpu resource consumption value U subscribed in regioniIt calculates as follows:
Ui=ai1+ai2+…aiy+…+aim
In formula, ai1、ai2……aimCalculation method and aiyCalculation method it is same.
In step 5, using double vernier sliding scale is used, all on-line subscription users are distributed to multiple alarming processing engines
In.
In step 5, double vernier sliding scale includes the following steps.
Step 51, it current all on-line subscription user cpu resource consumption value sequences: is calculated according to step 42 single online
Booking reader's cpu resource consumption value, by current all on-line subscription user cpu resource consumption values according to descending sequence into
Row sequence, and be identified with filling the length of rectangular strip;The filling longer expression on-line subscription user's cpu resource of rectangular strip disappears
Consumption value is bigger.
Step 52, alarming processing engine rest processing capacity sorts: to the rest processing capacity of all alarming processing engines
Assess and be ranked up according to sequence from big to small, is equally identified with the length for filling rectangular strip;Herein, it fills
Rectangular strip is longer, and the rest processing capacity for indicating alarming processing engine is bigger.
Step 53, sliding in the both ends opposite direction of all on-line subscription user cpu resource consumption values sequence respectively by double vernier
Dynamic mode distributes on-line subscription user to each alarming processing engine, until all distribution terminates all on-line subscription users.
In step 2, the communication protocol of user's subscription management system server and each booking reader foundation uses heartbeat machine
System is guaranteed.
In step 41, user's subscription management system is called by Webservice data-interface loads each on-line subscription use
The subscription region and alarm regulation information that family is established.
In step 3, the subscription region of foundation includes point, straight line, broken line, circle, ellipse, rectangle and closed polygon.
In step 3, the alarm regulation of foundation include calculated at a distance from fixed point, pass through linear area's behavior, into or from
Opening and closing closes region behavior, collision alarm, can meet alarm, overtake one of alarm and field break alarm or a variety of.
The invention has the following beneficial effects: the present invention to provide alerting service function according to the practical subscription demand of user
Can, and can be distributed according to the dynamic equalization of the online quantity adjustment alarm load of user, realize the alarm clothes of big data, multi-user
Business, main innovative point is that alarm complexity and user's subscription is combined to propose distributed warning concept, and passes through user point
The Push Service of alarm is realized with mechanism reasonable utilization computing resource.
Detailed description of the invention
Fig. 1 shows a kind of flow diagram of distributed alarm regulation engine design method of the present invention.
Fig. 2 shows the communication mode of user's subscription management system server Yu each booking reader.
Fig. 3 shows the schematic diagram of the alarm regulation type of foundation.
Fig. 4 shows current all on-line subscription user cpu resource consumption value sequence schematic diagrames.
Fig. 5 shows alarming processing engine rest processing capacity sequence schematic diagram.
Fig. 6, which is shown, is distributed multiple on-line subscription users to the signal of alarming processing engine using double vernier sliding scale
Figure.
Specific embodiment
Xia Mianjiehefutuhejuti compare Jia Shishifangshiduibenfamingzuojinyibuxiangxishuoming.
As shown in Figure 1, a kind of distributed alarm regulation engine design method, includes the following steps.
Step 1, alarm type Database.
According to mathematical statistics, establish alarm type database, the alarm type database include various alarm types and
The cpu resource consumption value occupied needed for every kind of alarm type.Such as based on the average value obtained on the basis of a large amount of counting statistics, make
For the cpu resource consumption value of occupancy needed for every kind of alarm type.
Step 2, user's subscription management system is established.
User's subscription management system server and each booking reader establish communication protocol, as shown in Figure 2, it is preferred to use
Heartbeat mechanism is guaranteed that the moment safeguards current online booking reader's number;Multiple announcements are laid in user's subscription management system
Alert processing engine (also referred to as alarm engine).Wherein, booking reader's number is much larger than the number of alarming processing engine.
Step 3, user subscribes to region and region alarm regulation is established.
Each booking reader can establish according to self-demand and subscribe to region and each alarm regulation subscribed in region.
As shown in figure 3, the subscription region established includes that point, straight line, broken line, circle, ellipse, rectangle and closed polygon etc. are each
Kind shape.Shape is different, and the set of point is then variant.
Separately as shown in figure 3, the alarm regulation established includes to calculate at a distance from fixed point, pass through linear area's behavior, enter
One of or leave enclosed region behavior, collision alarm, alarm can be met, overtake the alarm types such as alarm and field break alarm
Or it is a variety of.Certainly, alarm regulation of the invention is not limited to the alarm type in Fig. 3.
Step 4, user's subscription management includes the following steps.
Step 41, user subscribes to region and the load of region alarm regulation: user's subscription management system automatic identification is ordered online
User is read, and by data-interface, such as Webservice data-interface, what each on-line subscription user of calling load was established is ordered
Read region and alarm regulation information.
Step 42, single on-line subscription user cpu resource consumption value calculates: according to needed for every kind of alarm type in step 1
The cpu resource consumption value of occupancy, in all subscription regions that each on-line subscription user is established needed for all alarm types
The cpu resource consumption value of occupancy is added, to calculate corresponding on-line subscription user cpu resource consumption value.
The calculation method of single on-line subscription user's cpu resource consumption value U is preferably as follows.
Step 42a), it is assumed that the number of alarming processing engine is S, then n current on-line subscription user collection are combined into { 12 ...
I ... n }, i < n;Wherein, the m subscription regional ensemble that i-th of booking reader is established is { ai1 ai2 … aiy … aim,
Y < m;Y-th of cpu resource consumption collection for subscribing to h alarm regulation in region is combined into { cy1 cy2 … cyh}。
Step 42b), i-th y-th of the booking reader cpu resource consumption for subscribing to h alarm regulation in region calculates such as
Under.
aiy=cy1+cy2+…+cyh
In formula, cy1、cy2……cyhOccurrence obtained by being searched in the alarm type database established from step 1.
Step 42c), i-th of on-line subscription user m total cpu resource consumption value U subscribed in regioniIt calculates as follows:
Ui=ai1+ai2+…aiy+…+aim
In formula, ai1、ai2……aimCalculation method and aiyCalculation method it is same.
In addition, user's subscription management further includes distribution to online user, to destruction of offline user etc..
Step 5, alarming processing engine distributes.
User's subscription management system is used according to the on-line subscription number of users of identification and the single on-line subscription being calculated
Family cpu resource consumption value, and preferably distributed all on-line subscription users to multiple alarms using double vernier sliding scale is used
It manages in engine.
Above-mentioned double vernier sliding scale, preferably includes following steps.
Step 51, current all on-line subscription user cpu resource consumption value sequences (also referred to as booking reader sorts).
It, will current all on-line subscription users according to the single on-line subscription user cpu resource consumption value that step 42 calculates
Cpu resource consumption value is ranked up according to descending sequence, and is identified with filling the length of rectangular strip, such as Fig. 4 institute
Show, wherein the filling longer expression on-line subscription user's cpu resource consumption value of rectangular strip is bigger.
Step 52, alarming processing engine rest processing capacity sequence (also referred to as alarming processing engine sorts).
The rest processing capacity of all alarming processing engines assess and be ranked up according to sequence from big to small,
It is equally identified with the length for filling rectangular strip, as shown in figure 5, the longer residue for indicating alarming processing engine of filling rectangular strip
Processing capacity is bigger.
Step 53, as shown in fig. 6, by double vernier respectively in the sequence of all on-line subscription user cpu resource consumption values
The mode of both ends opposite direction sliding distributes on-line subscription user to each alarming processing engine.Since the number of normal booking reader is wanted
It is far longer than the number of alarming processing engine, so can repeatedly give processing engine distributing user during vernier slide, i.e.,
All engines can all be assigned to user in 1 sliding process of vernier, and then the subsequent sliding of vernier can be from the maximum engine of processing capacity
Start successively distributing user again, logic loops execute distribution task according to this, and the same principle of vernier 2 is ordered online until all
Readding user, all distribution terminates.It is the distribution that the smallest allocation unit carries out load balancing with on-line subscription user in the present invention,
Do not consider single user to be carried out to be assigned in multiple alarm engine processing units.
Step 6, alarming processing engine thread is opened up: each alarming processing engine, is used according to the on-line subscription that step 5 is distributed
The loading condition at family opens up corresponding processing number of threads, carries out the judgement and message push of alarm regulation.
Step 7, ship real time data receives and distributes: user's subscription management system real-time reception Ship dynamic situation tracking data
And be distributed in multiple alarming processing engines.
Step 8, alarm regulation judges: the processing thread in each alarming processing engine, according to the Ship dynamic situation received
Tracking data carries out each real-time calculating for subscribing to all alarm regulations in region, and pushes the warning information of generation to corresponding
On-line subscription user;Meanwhile the warning information of generation is stored in warning information database.
Step 9, online according to booking reader, offline and newly-increased situation subscribes to the increase and decrease feelings of region and/or alarm regulation
Condition repeats step 3 to step 8, realize it is all to all on-line subscription users subscribe in regions the judgement of various alarm regulations and
Function serving information.
In conclusion present invention focuses on the sides that the calculation method of each alarm regulation complexity and user resources are distributed
Method, including determine that single region resource consumes according to alarm regulation computation complexity, and be generalized to the consumption of single user's cpu resource
Calculation method, finally according to alarm engine computing capability reasonable distribution user, reach preferable alerting service function.Separately
Outside, with the increase of subsequent multi-sensor data amount and the growth of number of users, the design of distributed warning regulation engine guarantees
Each processing engine load reaches relative dynamic equilibrium, it is ensured that lasting customization alerting service is provided for online user.
The preferred embodiment of the present invention has been described above in detail, still, during present invention is not limited to the embodiments described above
Detail a variety of equivalents can be carried out to technical solution of the present invention within the scope of the technical concept of the present invention, this
A little equivalents all belong to the scope of protection of the present invention.