It is shared that middleware, implementation method and service are shared in vehicle-mounted net service based on OSGi
Method
Technical field
Field is shared the present invention relates to vehicular ad hoc network service, and in particular to a kind of vehicle-mounted net service based on OSGi
Shared middleware, implementation method and service sharing method.
Background technology
Interconnected with vehicle the vehicular ad hoc network to be formed (Vehicular Ad-hoc Network, referred to as VANET,
Also referred to as vehicle-mounted net and car networking) be self-organizing network (Ad-hoc Network) one kind, in vehicle-mounted net, vehicle is equipped with nothing
Line communication module, they can carry out data exchange within mutual communication range, without infrastructure.
Vehicle-mounted net has many applications, including vehicle collision reminder application, traffic-information service and other amusements or safety should
With etc..In such applications, the service between vehicle is shared as the popularization of application there is provided effective help.Each vehicle can be with
Shared local data (such as sensing data and content of multimedia), resource (such as memory space and access Internet) or service
(realizations of such as some algorithms etc.) are to other vehicles in network.The heterogeneous network equipment that different vehicle is used causes " car car
Be connected " realization become particularly difficult, and appearances of middleware enables that heterogeneous device carries out letter to unify general interface
Breath interaction, wherein the Middleware Model based on service architecture due to its lower coupling, expansible, flexibility is high the features such as, by very
The concern of many researchers.
Service-oriented design model is intended to by the general interface of unification, by different functional units with a kind of lower coupling
Mode link together, the task that different functional units can be independent co-operating can also complete various change is needed
Ask.In service-oriented architecture (Service-Oriented Architecture), service be in application system each
Different functional units.OSGi (Open Service Gateway Initiative) is an open mark set up for 1999
Quasi- alliance, it is intended to set up an open service regulation, on the one hand, set up the mark for opening to provide service to equipment by network
Standard, on the other hand, for various embedded devices provide general software running platform, with shielding device operating system and hardware
Difference.
DssOSGi (Distributed Service Sharing OSGi) is the distributed extension of OSGi, is used
The service discovery of centralized service catalogue, is provided with public shared clothes in the gateway node (or SINK nodes) of sensing layer
Business registration center.Be encapsulated in corresponding Bundle for the infrastructure service of offer by embedded awareness apparatus root, and is registered to public
Service register center, while the service that can also dynamically obtain the offer of other awareness apparatus by public service registration center is simultaneously
Carry out service binding and information exchange.Existing research only have studied that the service based on middleware is shared to ask in legacy network
Topic, and solve the problems, such as that its service is shared there is presently no ready-made scheme in vehicular ad hoc network.Service-oriented car
The various functions virtual abstraction that contained network middleware provides vehicle detecting equipment is network service, realizes application and equipment decoupling,
To service shared offer Unified Data Interchange Platform between car and car.
Therefore, it is necessary to design a kind of brand-new service-oriented vehicle-mounted net middleware, shared for the service between vehicle.
The content of the invention
The technical problem to be solved in the present invention is to provide a kind of shared middleware of vehicle-mounted net service based on OSGi, realizes
Method and service sharing method, by vehicle detecting equipment provide various functions virtual abstraction be network service, realize application with
Equipment is decoupled, and is that shared offer Unified Data Interchange Platform is serviced between car and car.
The present invention provide technical scheme be:
Middleware, including the shared mould of awareness apparatus module, Distributed Services are shared in a kind of vehicle-mounted net service based on OSGi
Block, application module, service catalogue election module and service discovery module;
The awareness apparatus module is connected with vehicle-mounted awareness apparatus, for the function of providing the vehicle-mounted awareness apparatus of isomery
It is packaged into the service with the general outside access interface of unification;Be packaged into vehicular applications with unified logical by the application module
The service of outside access interface, realizes service with equipment decoupling;
Encapsulation refers to function to be realized into details packaging, is stashed, and the extraneous access to built-in attribute can only be by providing
Interface realize.Do so can both realize the protective effect to built-in attribute, and the maintainability of software systems can be improved again.
As long as the interface for externally providing does not change, the change of any package interior causes shadow all without the other parts to software systems
Ring.Bibliography:http://baike.baidu.com/view/125370.htmFr=aladdin.
Service catalogue election module jumps communication range according to the communication capacity of vehicle, stability and connectedness in one
Service catalogue vehicle is elected in interior neighbours' vehicle, the neighbours' vehicle of the service catalogue vehicle adds its member's vehicle stock
Table, the service catalogue vehicle is referred to as the local service catalogue vehicle of its member's vehicle;Service catalogue vehicle sets up service concordance list,
For the information on services of storage service provider, information on services includes ISP ID, service effective time and Service Properties;
The service catalogue election module also carries out the maintenance of service catalogue vehicle;
The Distributed Services sharing module is used for the clothes that will be encapsulated in the awareness apparatus module and application module of this vehicle
Business is issued as remote network services;And information on services is registered on local service catalogue vehicle, for other vehicle queries;Vehicle
Between pass through Distributed Services sharing module wireless connection;
When service requester has service request, by the service discovery module of local service catalogue vehicle in service catalogue
Required service is inquired about between vehicle;
After service of the local service catalogue vehicle query required for, information on services is replied to service requester, serviced
ISP ID in the information on services that requestor will reply is called as destination address by Distributed Services sharing module
The service of the ISP.
Further, the vehicle-mounted awareness apparatus include GPS, camera and sensor.
A kind of implementation method of the shared middleware of vehicle-mounted net service based on OSGi, the vehicle-mounted net service based on OSGi
Include awareness apparatus module, Distributed Services sharing module, application module, service catalogue election module and service hair in the middle of shared
Existing module;
The awareness apparatus module is connected with vehicle-mounted awareness apparatus, for the function of providing the vehicle-mounted awareness apparatus of isomery
It is packaged into the service with the general outside access interface of unification;Be packaged into vehicular applications with unified logical by the application module
The service of outside access interface, realizes service with equipment decoupling;
Service catalogue election module jumps communication range according to the communication capacity of vehicle, stability and connectedness in one
Service catalogue vehicle is elected in interior neighbours' vehicle, the neighbours' vehicle of the service catalogue vehicle adds its member's vehicle stock
Table, the service catalogue vehicle is referred to as the local service catalogue vehicle of its member's vehicle;Service catalogue vehicle sets up service concordance list,
For the information on services of storage service provider, information on services includes ISP ID, service effective time and Service Properties;
The service catalogue election module also carries out the maintenance of service catalogue vehicle;
The Distributed Services sharing module is used for the clothes that will be encapsulated in the awareness apparatus module and application module of this vehicle
Business is issued as remote network services;And information on services is registered on local service catalogue vehicle, for other vehicle queries;Vehicle
Between pass through Distributed Services sharing module wireless connection;
When service requester has service request, by the service discovery module of local service catalogue vehicle in service catalogue
Required service is inquired about between vehicle;
After service of the local service catalogue vehicle query required for, information on services is replied to service requester, serviced
ISP ID in the information on services that requestor will reply is called as destination address by Distributed Services sharing module
The service of the ISP.
Further, the vehicle-mounted awareness apparatus include GPS, camera and sensor.
Further, the service catalogue vehicle of electing is specifically included:
A) neighbor discovery process:The neighbours' vehicle of vehicle n is found, the number of degrees d of vehicle n is obtainedn;The number of degrees of vehicle n refer to
The number of the neighbours' vehicle of vehicle n;
B) vehicle n number of degrees differences D is calculatedn=| dn- M |, wherein M is the preferable number of degrees;The definition of the preferable number of degrees is:Due to wireless
Network channel feature, in order to ensure the validity of MAC protocol, an afforded greatest member's number of service catalogue vehicle is that have
Limitation, claim this to be limited to the preferable number of degrees.Bibliography:CHINARA S,RATH S K.A survey on one-hop
clustering algorithms in mobile AdHoc networks[J].Journal of Network and
System Management,2009。
C) relative mobility of vehicle n and its neighbours' vehicle is calculated:Mn=∑i|Vi-Vn|, wherein VnRepresent the speed of vehicle n
Degree, ViRepresent the speed of the neighbours' vehicle i of vehicle n;
D) vehicle number of being serviced catalogue covering in the neighbours' vehicle of vehicle n and the difference L of the preferable number of degrees are calculatedn=|
ln- M |, wherein M is the preferable number of degrees;The vehicle of being serviced catalogue covering refers to by the member of other service catalogue vehicles
The vehicle that vehicle list is included;
E) vehicle n synthesis weights are calculated:In=c1×Dn+c2×c4×Mn+c3×Ln;Wherein c1、c2、c3It is weight,
c1+c2+c3=1, represent the relative importance of the communication capacity, stability and connectedness of service catalogue vehicle, c4For correction because
Son, is used to adjust the order of magnitude difference with other indexs;
If f) the comprehensive weights of vehicle n will be small than the comprehensive weights of all immediate neighbor vehicles, n turns into service catalogue
Vehicle, the neighbours' vehicle of vehicle n adds member's vehicle list of the service catalogue vehicle;Two service catalogue vehicles can be received to disappear
The vehicle of breath turns into gateway vehicle, is responsible for the communication between service catalogue vehicle;
G) repeat a) to belong to member's vehicle of certain service catalogue vehicle or originally as clothes until all vehicles to f) step
Business catalogue vehicle;
The maintenance of the service catalogue vehicle is specifically included:
I. calculate vehicle v and local service catalogue vehicle n apart from d;If d turns ii when being more than positive radius of communication;If d is small
In positive radius of communication, and vehicle v comprehensive weights IvLess than the comprehensive weights I of its local service catalogue vehiclen, then iii is turned;
Ii. vehicle n finds new service catalogue vehicle:If finding new service catalogue vehicle, the service catalogue is added
Member's vehicle list of vehicle;Otherwise carry out step a)-g) service catalogue vehicle election, terminate;
Iii. by monte carlo method, the acceptance probability for replacing service catalogue vehicle is calculated:And produce
One [random number r 0,1);The function Math.Random of the generation random number by being included in Java language developing instrument
(), calls Math.Random () function to return to the double values with positive sign, and the value is more than or equal to 0.0 and less than 1.0, i.e.,
Span be [0.0,1.0) a left side close right open interval, return value is a randomly selected number, within the range (approximate)
Even distribution.
If iv. r is more than p, vehicle v replaces former service catalogue vehicle n turns into service catalogue vehicle, former service catalogue vehicle
Switch to member's vehicle;Otherwise, service catalogue vehicle is constant.
Vehicle v and local service catalogue vehicle n is that the data based on vehicle GPS collection are calculated apart from d, and its principle is:
The earth is a spheroid for intimate standard, and its equatorial radius is 6378.140 kms, and polar radius is 6356.755 kms, is put down
The equal km of radius 6371.004.If we assume that the earth is a perfect spheroid, then its radius is exactly the flat of the earth
Equal radius, is designated as R.If on the basis of 0 degree of warp, then the longitude and latitude according to earth surface any two points can just be calculated
The surface distance of this point-to-point transmission.If the longitude and latitude of the first point A is (LonA, LatA), the longitude and latitude of second point B for (LonB,
LatB), according to 0 degree of benchmark of warp, east longitude degree of learning from else's experience on the occasion of (Longitude), west longitude degree of learning from else's experience negative value (-
Longitude), north latitude takes 90- latitude values (90-Latitude), and south latitude takes 90+ latitude values (90+Latitude), then by upper
State at 2 points after treating to be counted as (MLonA, MLatA) and (MLonB, MLatB).Assuming that be applied to the Northern Hemisphere, then only to warp
Degree makees positive and negative treatment, without making 90-Latitude treatment to latitude, then derived according to triangle, can obtain calculating at 2 points
Apart from Distance (units:Km) formula:
C=sin (MLatA) * sin (MLatB) * cos (MLonA-MLonB)+cos (MLatA) * cos (MLatB)
Distance=R*arccos (C) * Pi/180.
Further, the M is 10.
Further, the c1And c2It is 0.35, c3It is 0.3, c4It is 0.1.
Further, radio connection is DSRC or WLAN between vehicle.
A kind of service sharing method of the shared middleware of the vehicle-mounted net service based on OSGi, it is characterised in that:Including following
Step:
Step one:Service registry;
Step 2:Service request;
Step 3:Service is replied;
The step one is specifically included:The information on services of the service S of oneself is registered to local service mesh by ISP P
Record vehicle D, D storing service information and record the information of ISP P, storage field is as follows:<ISP ID, effectively
Time, Service Properties, local service catalogue ID>;
Wherein ISP ID refers to the ID of the vehicle for providing service;Effective time refers to the effective time of the service,
The information on services can be deleted from service concordance list more than effective time D;Service Properties refer to that service name is with the service
No is real time service;Local service catalogue ID refers to the ID of local service catalogue vehicle;
The step 2 is specifically included:Required service describing R is sent to local service catalogue vehicle D by vehicle Q, service
Description R, i.e. request message field is as follows<Service requester ID, life span, Service Properties>;
Wherein service requester ID refers to the vehicle ID of request service;Life span refers to the life span of service request,
More than life span, the service request is just no longer propagated;Service Properties refer to service name and whether the service is real time service;
The step 3 is specifically included, and D matches registered information on services, if D stores corresponding not out of date clothes
Business information, then D reply the log-on message to Q;
If being not matched to corresponding information on services, D by with service catalogue vehicle as summit, catalogue vehicle and gateway
Link between vehicle is side, and service describing R is carried out multicast by the multicast tree of establishment, and service describing is that service request vehicle sends
To the message of local service catalogue vehicle, for describing required service.Multicast message is that local service catalogue vehicle passes through
Multicast tree is sent to the message of other service catalogue vehicles, not only includes required service describing, is also added into multicast jump
Transmission hop count of the number for control message.Multicast message field is as follows:<Source directory ID, life span, multicast hop count, service category
Property>;
Wherein service requester ID refers to the ID of the vehicle of request service;When life span refers to the existence of service request
Between, more than life span, the service request is just no longer propagated;Multicast hop count refers to the hop count by setting multicast, can control multicast
The transmission hop count of message;Service Properties refer to service name and whether the service is real time service;
The catalogue vehicle for obtaining multicast message is matched to service describing R, the service that will be matched if the match is successful
To D, D stores the information on services and replys the information on services to Q information-reply, and Q proposes the service in the information on services of reply
Donor ID calls the service of the ISP by Distributed Services sharing module as destination address;
Otherwise, D is replied without request service message when the multicast message life cycle is expired to Q, and Q cancels this time service please
Ask.
Further, in the form of lease, ISP P needs periodically to arrive local for the information on services registration
Service is carried out at service catalogue vehicle D and continues lease, D more new demand servicing concordance lists;If P does not continue lease, then D can be by P
All information on services from service concordance list on delete.
Further, the information on services on the service catalogue vehicle is obtained by the registration of the ISP in a jump
, also obtained by recording feedback information between service catalogue vehicle during search service.
Beneficial effect:
(1) the shared middleware of the vehicle-mounted net service based on OSGi that the present invention is provided, implementation method and service sharing method,
The various functions virtual abstraction that vehicle detecting equipment is provided is network service, realizes application and equipment decoupling, shields different cars
The heterogeneous device of type bottom, is that shared offer Unified Data Interchange Platform is serviced between car and car.
(2) distributed directory is set up and maintenance mechanism, chooses communication capacity, mobility and the connective conduct service of vehicle
The important indicator of catalogue election, makes service catalogue that stabilization is kept in dynamic vehicle-mounted net environment, and realize service hair on a large scale
It is existing.Distributed directory maintenance mechanism is optimized using the tolerance strategy of Monte Carlo thought to the competition of service catalogue vehicle, with
Improve the stability of algorithm.
(3) service discovery mechanisms based on Distributed Services catalogue cause that vehicle in dynamic environment, enters at any time in vehicle
It still is able to effectively and in time carry out service discovery in the case of entering or leaving network, searches out the related letter of ISP
Breath.
Brief description of the drawings
Fig. 1 is the general frame figure of the shared middleware (VssOSGi) of vehicle-mounted net service of the present invention based on OSGi;
Fig. 2 is service discovery framework of the present invention based on Distributed Services catalogue;
Fig. 3 is present invention service issue and discovery procedure schematic diagram;
Fig. 4 is the shared middleware application scene graph of service of the invention.
Specific embodiment
The present invention is further described below in conjunction with the drawings and specific embodiments:
Embodiment 1:
First, the general frame of the shared middleware (VssOSGi) of the vehicle-mounted net service based on OSGi
The general frame design of the shared middleware (VssOSGi) of vehicle-mounted net service of the present invention based on OSGi is as shown in Figure 1:
VssOSGi middleware platforms are based on OSGi framework, and 4 layers of Bundle are extended from the bottom to top, are respectively Device
Bundle, DSD Service Discovery Bundle, DssOSGi Bundle and App Bundle (i.e. awareness apparatus mould
Block, Distributed Services directory service discovery module, Distributed Services sharing module and application module).
Vehicle-mounted embedded type awareness apparatus such as GPS, camera, sensor etc., according to respective function or network role by its
The infrastructure service of offer is encapsulated in corresponding Device Bundle, and middleware platform can directly be controlled by these Bundle
Relevant device processed.The logic of business functions such as vehicular applications are encapsulated in App Bundle, can be issued as long-range clothes by DssOSGi
Business, is then registered on local service catalogue vehicle, shares to other vehicles.
DSD Service Discovery Bundle(Distributed Service Directory Service
Discovery) Distributed Services directory service finds Bundle, can pass through Service Directory Election modules
(i.e. service catalogue election module) elects Distributed Services catalogue vehicle, while Service Discovery
Mechanism modules (i.e. service discovery module) are responsible for carrying out service discovery between service catalogue vehicle.Each car in network
Service catalogue vehicle or member's vehicle are can serve as, member's vehicle notes local device aware services by upper strata DssOSGi
Volume on local service catalogue vehicle, while vehicular applications can also be by the DSD Service of local service catalogue vehicle
Discovery Bundle obtain on other service catalogue vehicles chartered shared service, so as to realize vehicle between service altogether
Enjoy.
Pass through DssOSGi wireless connections between vehicle.DssOSGi is called and in local service catalogue with remote service
Carry out the function of service discovery.Therefore, elections of the DssOSGi according to DSD Service Discovery Bundle service catalogues
Result decides whether for this vehicle to be set to local service catalogue vehicle.Meanwhile, vehicular applications can locally taken by DssOSGi
The service of other vehicles offer is provided on business catalogue vehicle and is carried out service binding and is called, so as to be serviced altogether between completing vehicle
Enjoy.
2nd, the service discovery method based on Distributed Services catalogue:
The service of certain car offer is other vehicle to share to other vehicles, an important premise in vehicle-mounted net
Which vehicle the supplier for needing to know this service is, therefore service discovery is the shared important foundation of service.
Vehicular ad hoc network is that self-organizing is formed, and vehicle may be added or leave network at any time, be easily caused service
It was found that failure, reduces the efficiency of service discovery.In order to adapt to dynamic network environment, realize large-scale service discovery and drop
The purpose of low communication expense, the present invention takes the service discovery framework of Distributed Services catalogue to adapt to vehicle vehicle-mounted from group
Service discovery under knitmesh network, as shown in Figure 2.
Service catalogue is the individuality of shared service information in storage and maintenance network.ISP notes on service catalogue
Volume the service description information of oneself, when service requester sends service request to service catalogue, service catalogue can be by looking into
Local service description information is looked for answer.Distributed Services catalogue is each place that service catalogue node spreads to network,
Each service catalogue stores some services in network, when a service catalogue node cannot answer certain service request
Wait, can be forwarded to this service request on other service catalogues to complete global service discovery by it.
1) vehicle elects a vehicle as service catalogue vehicle in the neighbours' vehicle that one is jumped in communication range, the clothes
The neighbours' vehicle of business catalogue vehicle adds its member's vehicle list, while receiving the vehicle that two service catalogue vehicles have message
As gateway vehicle.Catalogue vehicle is responsible for caching available shared service information, and the discovery of service is entered between service catalogue vehicle
OK, the communication between gateway vehicle is responsible for service catalogue vehicle, compared with traditional service discovery mode without service catalogue, this patent
Member's vehicle do not need buffer service information, without flooding service request information in network, the discovery of service is also independent of
Routing Protocol.
2) service issue and discovery need to be respectively service registrys by three processes, and service request is replied with service.
First, ISP P needs for the information on services of the service S of oneself to be registered to local service catalogue vehicle D, clothes
In the form of lease, P needs to arrive periodically the service of being carried out at D and continues lease, and service updates also to be carried out at the moment for business registration.Such as
Fruit P does not carry out continuity lease to the service of oneself, then D can delete all information on services of P from service concordance list.
Service registration information can both be obtained by the registration of the ISP in a jump, can be searched by between service catalogue vehicle again
Record feedback information is obtained when rope is serviced.Also the information of ISP P is recorded while D storing service informations, field is stored
It is as follows:<Service provides ID, effective time, Service Properties, local service catalogue ID>
On the other hand, vehicle Q is if service request, and request message field is as follows<Service requester ID, life span,
Service Properties>, required service describing R is sent to the information of local service catalogue vehicle D, D matching registration, if D is stored
Corresponding not out of date log-on message, then D reply the log-on message to Q;If being not matched to relevant information, D is by taking
Business catalogue vehicle is summit, and the multicast tree that the link between catalogue vehicle and gateway vehicle is set up for side is by R multicasts, multicast message
Field is as follows:<Source directory ID, life span, multicast hop count, Service Properties>.The catalogue vehicle for obtaining multicast information is carried out to R
Service describing is matched, and match information is replied into D if the match is successful, and D stores the log-on message and replys the information to Q,
Otherwise D is replied without request service message when the multicast message life cycle is expired to Q.Due to all being entered using tree construction between catalogue
Row multicast, so avoid flooding, while having saved the network bandwidth, service issue and discovery procedure are as shown in Figure 3.
3rd, Distributed Services catalogue is set up and maintenance mechanism design:
Conventional Distributed Services catalogue selection algorithm does not make full use of car mainly for mobile ad-hoc network proposition
Carry the advantage and feature of self-organizing network.For vehicle mobility in vehicular ad hoc network, set forth herein one kind towards steady
Distributed directory selection algorithm (the Stability And Sharing-oriented based on weights of fixed and sharing
Weight-based Algorithm, SSWA), the connection by vehicle with respect to the mobility of neighbours' vehicle and with other service catalogues
Property as service catalogue elect important indicator, and devise the tolerance strategy based on Monte Carlo thought to service catalogue compete
Optimize to improve the stability of algorithm.
1) calculating of comprehensive weights
To ensure the communication capacity of selected service catalogue vehicle, comprehensive weights are with the number of degrees of vehicle n and the difference of the preferable number of degrees
Value | dn- M | as one-component.Kept within the specific limits due to being limited car speed by traffic rules, relative mobility is low
Vehicle serve as the stability that service catalogue vehicle is conducive to algorithm, therefore introduce relative mobility index, i.e. vehicle and all neighbours
Occupy the mould sum of car speed phasor difference.Further, since gateway vehicle is the bridge communicated between service catalogue, service catalogue possesses
Gateway vehicle mean connective stronger, more conducively improve the ability of service discovery, therefore in neighbours' vehicle vehicle n
Being serviced catalogue covers the difference of vehicle number and the preferable number of degrees | In- M | as one-component.It is assumed herein that vehicle is equipped with fixed
Position and guider, can be with direct access position and velocity information.
Consider communication overlay ability, the relatively mobility and vehicle of neighbours' vehicle and other service catalogues of vehicle
Connectedness, the comprehensive weights for defining vehicle n are as follows:
In=c1×Dn+c2×c4×Mn+c3×Ln
Wherein:MnRepresent the relative mobility of vehicle n, Mn=∑i|Vi-Vn|, i is n neighbours' vehicles, DnRepresent vehicle n's
The number of degrees are poor, Dn=| dn- M |, LnRepresent the vehicle number and the preferable number of degrees of being serviced catalogue covering in the neighbours' vehicle of vehicle n
Difference, Ln=| ln- M |, the I of vehicle nnValue is smaller, is more suitable as service catalogue vehicle.c1、c2、c3It is weight, c1+c2+
c3=1, represent the relative importance of indices, different conditions (vehicle communication radius, car according to vehicular ad hoc network
Speed) take different values.C in formula4It is correction factor, is used to adjust the order of magnitude difference with other indexs.
2) formation of service catalogue vehicle
In the formation stages of service catalogue, service catalogue vehicle election is mainly carried out.Vehicle is broadcasted first, will
Oneself state (such as ID, speed, position) informs neighbours' vehicle, after neighbor discovery process, according to resulting local message, meter
Calculate the comprehensive weights of each vehicle and inform neighbours' vehicle.The step of service catalogue vehicle is elected is as follows:
A) neighbor discovery process:The neighbours' vehicle of vehicle n is found, the number of degrees d of vehicle n is obtainedn;
B) each vehicle n number of degrees difference D is calculatedn=| dn- M |, M is the preferable number of degrees
C) relative mobility of each vehicle n and its neighbours' vehicle is calculated:Mn=∑i|Vi-Vn|, i is n neighbours' vehicles
D) vehicle number of being serviced catalogue covering in the neighbours' vehicle of each vehicle n and the difference L of the preferable number of degrees are calculatedn
=| ln- M |, M is the preferable number of degrees
E) vehicle n synthesis weights are calculated:In=c1×Dn+c2×c4×Mn+c3×Ln
If f) the comprehensive weights of vehicle n will be small than all immediate neighbor vehicles, n turns into service catalogue vehicle, the neighbour of n
Occupy member's vehicle list that vehicle adds the service catalogue vehicle;Two vehicles of service catalogue vehicle message can be received as net
Cut-off, be responsible for carrying out the communication between service catalogue vehicle;
G) repeat a) to f) step until service catalogue vehicle sets up process completion.All vehicles belong to certain service catalogue
Member's vehicle or sheet of vehicle are as service catalogue vehicle.
3) maintenance of service catalogue vehicle
The renewal of service catalogue vehicle is to be caused communications status to change by vehicle movement and triggered.Member's vehicle is supervised always
The signal intensity of service catalogue vehicle is controlled, when the distance between vehicle and service catalogue vehicle are increased to beyond efficient communication scope
When, vehicle will add neighbours' service catalogue vehicle, service catalogue vehicle replacement member's vehicle list.If there is certain car
Cannot be covered by any service catalogue vehicle, then trigger service catalogue vehicle election process.
When certain vehicle is moved in the communication range of service catalogue vehicle, and weights want hour than service catalogue vehicle,
Produce the competition of service catalogue vehicle.Under wireless communications environment, there is unstability such as multiple tracks decay, interference in wireless channel in itself
Deng the unstable of communications status causes the shake of vehicle weights.It is excellent by Monte Carlo when two vehicle weights are more or less the same
Change, select to replace by small probability, so as to the destabilizing factor avoided due to radio network information channel causes the frequent of service catalogue
Substitute, can so strengthen the stability of service catalogue.
Monte carlo method be change local search algorithm in decline rule obtained by a kind of method, its basic thought be with
Certain probability receives a comparatively worse state.In the maintenance phase of service catalogue vehicle, as service catalogue vehicle n
Meet with the competition I of vehicle vn> IvWhen, service catalogue replacement is carried out according to probability (1-p), define acceptance probability:Receive the big service catalogue vehicle of weights with Probability p to continue to serve as service catalogue vehicle role.Exponential function y
=exThe monotonic increase when independent variable x is less than 0, and functional value y levels off to 0 when independent variable x is infinitely small.Acceptance probability p is determined
Justice is exponential function, differs bigger with v weights so as to meet n, and replacement probability is bigger, works as In=IvWhen, p=1.Service catalogue car
The step of safeguarding is as follows:
I. vehicle v and affiliated service catalogue vehicle n is calculated apart from d.If d turns ii when being more than positive radius of communication;If d is small
In positive radius of communication and vehicle v weights IvLess than its affiliated service catalogue vehicle weights InTurn iii;
Ii. vehicle n finds new demand servicing catalogue vehicle.If finding new demand servicing catalogue, the service catalogue is added;Otherwise carry out
Service catalogue is elected, and is terminated.
Iii. the acceptance probability for replacing service catalogue is calculated:And produce [random number a r 0,1);
【Java language developing instrument includes the function for producing random number, calls this Math.Random () function to return to band just
Number double values, the value more than or equal to 0.0 and less than 1.0, i.e., span be [0.0,1.0) a left side close right open interval, return
It is a randomly selected number to return value, and (approximate) is uniformly distributed within the range.]
If iv. r is more than p, vehicle v replaces former service catalogue n turns into service catalogue vehicle, and former service catalogue vehicle switchs to
Member's vehicle.
Embodiment 2:
Core of the invention is to provide a various functions virtual abstraction by vehicle detecting equipment for network service, real
The platform that service between existing vehicle is shared:
1) VssOSGi middlewares are disposed on the vehicle-mounted embedded type gateway per chassis, vehicle-mounted embedded type awareness apparatus are such as
GPS, camera, sensor etc., are encapsulated in accordingly according to the infrastructure service that respective function or network role are provided
In Device Bundle, middleware platform can directly control relevant device by these Bundle.The business such as vehicular applications are patrolled
Function package is collected in App Bundle.Pass through DSRC between vehicle【That is Dedicated Short Range
Communications (DSRC technology)】Or WLAN is connected with each other.
2) vehicle sends the information such as geographical position and speed (by specific by intervals to neighbours' vehicle in motion
Vehicle-mounted network routing protocol determine), local message of the vehicle according to obtained by, comprehensive weights simultaneously inform neighbours' vehicle, synthetic weights
Value it is small automatically become service catalogue;The neighbours' vehicle of service catalogue adds the members list of the vehicle;Receive two service mesh
The vehicle for recording vehicle message turns into gateway vehicle, is responsible for carrying out the communication between service catalogue vehicle.
3) when vehicle has service request, local service catalogue vehicle is transmitted the request to, by the service between service catalogue
It was found that finding ISP's IP address, finally, service requester successfully calls it to service by the IP address of ISP,
Realize that the service between vehicle is shared.
Fig. 4 is by realizing that VssOSGi middleware platforms carry out the shared example of the service under vehicular ad hoc network network.Vehicle 9
The request once to service S is initiated, local service catalogue vehicle 1 is sent the requests to first, whether the inquiry of vehicle 1 local memory
There is service S, because such information on services is not stored in vehicle 1, therefore, vehicle 1 will be serviced by the gateway vehicle in figure please
Message is asked to be transmitted to other service catalogue vehicles 2,3,4,5,6,7,8.Because vehicle 10 is in its local service catalogue vehicle 4
Upper registration service S, therefore 4 check that local memory finds to have the information on services of matching, then by this feedback of the information carriage return 1, car
1 obtains the log-on message by this information Store, and this message then is sent into 9, and service of the vehicle 9 again to vehicle 10 is tied up
Determine and call, so far service shared completion.