Fuel Theft Alarm
GpsGate Server can help you to detect possible fuel theft, loss or leakage by using a script in your Event Rules. You can setup alerts when a significant loss of fuel is detected in your vehicles.
- A GPS device capable of fuel level reading (check here for compatible devices by searching by the keyword fuel).
- Latest Plugins installed in the server
- Privilege _EditScriptExpression enabled in Privileges and Features of the application you want to implement this feature.
- The Fuel device signal (input) mapped to the variable Fuel level in the Device Mapper
How it works
The script saves 8 consecutive fuel level measures and calculates the mean for the first 4 values and also the mean of the last 4 values.
If the difference is larger than the threshold specified, it would indicate if there was abnormal fuel consumption.
By default the script has a threshold of 3 (the difference between both means in liters). This value can be modified according to the Fuel level signal inputs you receive from your device (liters/gallons). If you receive the Fuel level input in voltage check this guide to covert that to liters.
- Note: These calculations relies on the values sent from the device. This method cannot assure 100% that you are actually getting fuel theft. There could be another causes for the alarm to be triggered: fuel leackage, bad readings from the fuel sensor, wrong Theresold value, etc. The most accurate the values you receive, the more efficient the script will be.
Create your Event Rule
In your application go to Admin > Event Rules and create a new rule.
Select your settings and in 4. Expressions select Script Expression
Then click on Edit
Paste the following script in the editor:
- Note: when copy-paste from this blog to the script editor, make sure the characters <i> get replaced by [i]
The result should be like in the image. Notice that in the right of the screen you can add variables to test the script in case you want to introduce modifications.
In the step 5. Notifications you can add, for example, an Icon to see on screen when the script returns “True”.
To test the script you can either test directly on the Event Rule script as snown in the image above or you can use SimOne
When submitting Fuel Level values to your application, if the fuel consumption surpasses the threshold, you should get an alert as shown in the picture:
You can combine this Script Event with any other Expression in your rule, for example if Ignition signal is Off.
As a notification, you can use, for example, an SMS notification to know inmediately when this event occured:
- Note: you can add the Map Link variable to your SMS notification to know exactly where the event happened and visualize it in the map with your default map application.
- Fuel Report (daily)
- Fuel Report (detailed)
- Fuel Report (refill)
- Non linear mapping of device variables
- How to combine Custom variables and Device mapper scripting
Discuss this blog post on the forum please