Database Reference
In-Depth Information
Fig. 5.
The EPN used for detecting a trac jam.
presented queries have been slightly modified for the sake of readability. Other
trac jams detection methods (using the loop detector sensors) are described in
the following paper: [
18
].
It had been considered that a certain crossroad is prone to trac jams. One
method to detect if a trac jam has occurred is to count the number of cars that
have reported positions in the surrounding area of the crossroad. If the result of
cont is bigger that a threshold (
TRAFFIC JAM THRESHOLD
) then a tra
c
jam event is generated for that crossroad.
The trac jam area is considered to be a circle with the radius
TEST AREA
RADIUS
, centred on the crossroad (which has the following GPS coordinates
CROSSROAD LAT
and
CROSSROAD LONG
).
The statement from Listing 1 selects all the car GPS position events, that
are reported in the surrounding area of the crossroad. The Euclidian distance
had been used to determine if the car is located inside the circle with the radius
TEST AREA RADIUS
.
insert into
CurrentCrossroadCars
select
∗
from
CarPosition
1
where
((( CarPosition . Latitude
−
CROSSROD LAT)
∗
(
CarPosition . Latitude
−
CROSSROD LAT) + (CarPosition .
Longitude
−
CROSSROD LONG)
∗
(CarPosition . Longitude
−
CROSSROD LONG) )
<
TEST AREA RADIUS
∗
TEST AREA RADIUS)
Listing 1.1.
Selects all the car GPS position events, that are reported in the surro-
unding area of the crossroad.
After that, at each
REPORTING PERIOD
seconds a complex event is gen-
erated which contains the number of cars reported in the surrounding area of
the crossroad from the last count reporting (see Listing 2).
insert into
CrossroadCarsNumber
select count
(
∗
)
as
numberOfCars
from
CurrentCrossroadCars : win .
time
(
REPORTING PERIOD s e c o n d s )
1
output
every REPORTING PERIOD
seconds
Listing 1.2.
Counts the cars from the surronding area of the crossroad.
A trac jam event is generated for the crossroad when the result of the count
is bigger than
TRAFFIC JAM THRESHOLD
(see Listing 3).
Search WWH ::
Custom Search