GPS - Simulation & Boundary

Simulation of the fence.

To check that the fence coordinates are entered correctly and the GPSMAX value is set for the fence. There should be enough GPS_Array values to support the amount of GEO fence points (min GPSMAX +1). The GEO fence can then be simulated and ensures everything is setup 100% before going live.

 

To turn on the simulation change the Simulation_Mode value to 1 and ensure the correct Fence is selected.

 

For the simulation a NODEMCU board WIFI connection and the Blynk APP are required. Video shows the simulation of the GEO Fence on the golf course with 86 Geo Fence Points.

 

Boundary Condition - Special Cases

The Arduino sketch monitors the GEO Fence by calculating where the mowers position is (Lat & Long) compared to the theoretical line of the fence between the 2 nearest coordinates.  When the mower enters the zone of the 2 coordinates the software starts to compare the mowers coordinates to the projected line between the Geo points.  If the vehicle/mower crosses over the line between these 2 points the mower is reported as Out (0) of the fence.

 

Another way would be to calculate and create an array of all the possible GPS coordinates "IN" the fence and compare the vehicles/mowers position to this array.  This array however would/could be huge depending on the area being monitored and require a lot of processing power to manage, which we dont have available, or cant realistically afford or justify for these projects.

 
The equation based system allows large areas of terrain to be effectively monitored with relatively low processing power.
 

As this calculation is a triangular based equation the lower part of the projected fence line has a large area to report the mower as Out.  At the upper section of the detection zone the mower crosses the line and is almost immediately in the area again with no detection. (to the right of GEO point 0)

 

 

To give the software additional zone to detect that the mower has crossed the line (considering the accuracy of the GPS module reporting the vehicles position) , the detection zone can be extended out horzontally from the GPS Point 1 and 0 to infinity. This is done by setting the boundary condition to 1.

 

For a GPS fence with only outer perimeter fence coordinates this is a perfect solution to give a large Out zone for detection. The Arduino code automatically sorts the highest and lowest GPS points and also declares everything over or under these points as out.

For a GPS fence with only outer perimeter coordinates all the boundary settings can be 1 for each GPS pair.

 

For a perimeter boundaries that "cut back" we cannot use this condition.

As we always generate the GPS fence in a clockwise direction the boundary=1 always turns on the out zone to left of the direction of the line.

In the below example we would need to set the boundary as follows:

Line 2-3 : boundary = 1

Line 3-4 : boundary = 1

Line 4-5 : boundary = 2 (otherwise the infinity out zone would extend into line 6-7

Line 5-6 : boundary = 2

Line 6-7 : boundary = 2 (otherwise the infinity out zone would extend into line 4-5

Line 7-8 : boundary = 1

Line 8-9 : boundary = 1

 

So in the above example the "cut in" of the fence needs to be considered in the boundary conditions.  The line 4-5 needs to have a boundary condition of 0, otherwise the software would project an out zone to infinity which would also include some of the In zone in the area of 6,7,8 & 9.  The same is true for line 5-6.

Same is also true for line 6-7.  This would project an out zone into the In zone area of 2,3,4,5 & 6

The boundary condition 2 is only used for these special cases. 

As a rule of thumb, if you can project out from the 2 GPS fence coordinates in the Out X direction without crossing into the IN zone of another fence set, the boundary should be 1.

In the simulation above all 86 GPS fence boundary conditions were set at 1.

 

The simulation tool can ensure that all the boundary conditions are set correctly before going live.