RabbitMQ Car Counter

Car Counting service

Car counting service processes data from car counters. Car counters are devices that have special car counting firmware.

NB: During installation and setup process Car counters should also be bound to positions in groups of “Stand-alone Car Counter” type.


This service can correct raw sensor data and provides total count of cars that crossed the sensor over. This provides a protection against partial message loss, each message has the full data by a given timestamp.

In order to provide a better balance balance between the frequency of reporting and battery life counters have two modes of operation - Standard (max delay 20min) and Faster updates (max delay 5 minutes).

Please refer to the tables below for more details on the updates schedule in each mode:

Standard updates

Number of events

Minimum time between previous and new counter updates

Number of events

Minimum time between previous and new counter updates

1..2

20 minutes

3..4

10 minutes

5..9

5 minutes

10 and more

3 minutes

Faster updates

Number of events

Minimum time between previous and new counter updates

Number of events

Minimum time between previous and new counter updates

1..2

5 minutes

3..4

4 minutes

5..6

3 minutes

7..9

2 minutes

10 and more

1 minute

API details

Every car counting data object has the following format:

{ "type": "sa_car_counter", "sensor_id": "31777", "timestamp": 1615211864, "counter": 652, "errors": null, "msg_version": 2, "trace_id": "8d386f23-1172-27bb-55d9-5389a5fbf72e" }

Fields description:

  • "type": "sa_car_counter" - always has the same value

  • "sensor_id" - sensor hardware ID in hex format

  • "timestamp" - Unix-timestamp of event

  • "counter" - number of detected cars. The maximum value is greater than 2 billion. This should be enough for most cases.

  • "errors" - list of errors or null. Supported error list can be different for different firmwares

  • "msg_version" - data protocol version

  • "trace_id" - message trace ID which can be used for development and debugging

 

So in the most simple case with one Entry (ingress) and one Exit (egress) lane the service receives two incrementing counters and subtracts Exit counter from Entry counter to calculate the number of vehicles in the parking perimeter.