Fleet backend–frontend architecture
Connected fleets in data-driven engineering, MMS210
Vehicle engineering and autonomous systems
Mechanics and maritime sciences
Chalmers
1
The connected fleet
We will now start looking at the connected fleet and how
data flows throughout the system.
2
First: Data within one vehicle
Modern vehicles
In all modern vehicles, data and internal data transmission is
crucial to its normal operation. How is data handled within a
vehicle?
3
The data bus, for low volume data
• Marine: NMEA
• Rail: WTB, MVB, ETB
• Automotive: CAN, FlexRay
• Aerospace: ARINC429, AFDX
4
The data bus, for low volume data, format
Data format
All above examples except NMEA are binary formats. NMEA is
designed to be robust and easy to integrate in multi-vendor
environments.
5
The data bus, for low volume data, format
Data format
All above examples except NMEA are binary formats. NMEA is
designed to be robust and easy to integrate in multi-vendor
environments.
$GNGSA , A , 3 , 7 9 , 6 9 , 8 8 , 6 8 , 7 0 , 7 8 , 8 1 , 8 7 , , , , , 1 . 3 , 0 . 6 , 1 . 1 * 2 9
$GNGSA , A , 3 , 1 1 4 , , , , , , , , , , , , 1 . 3 , 0 . 6 , 1 . 1 * 1 C
$GPRMC , 2 2 5 9 3 0 . 0 0 , A , 3 6 1 7 . 5 5 9 7 2 2 0 1 , N , 0 9 7 1 8 . 5 2 2 7 1 2 5 6 ,W, 1 . 1 5 0 , 2 7 1 . 9 2 8 , 1 0 0 3 1 6 , 9 9 9 . 9 0 0 0 , E , D * 13
$GPGLL , 3 6 1 7 . 5 5 9 7 2 2 0 1 , N , 0 9 7 1 8 . 5 2 2 7 1 2 5 6 ,W, 2 2 5 9 3 0 . 0 0 , A , D * 78
$GNGNS , 2 2 5 9 3 0 . 0 0 , 3 6 1 7 . 5 5 9 7 2 , N , 0 9 7 1 8 . 5 2 2 7 1 ,W, DDD , 2 1 , 0 . 6 , 3 2 1 . 5 , − 2 6 . 0 , , * 2 3
$GPGNS , 2 2 5 9 3 0 . 0 0 , , , , , , 8 , , , , 3 . 0 , 1 3 5 * 4 E
$GLGNS , 2 2 5 9 3 0 . 0 0 , , , , , , 8 , , , , 0 . 0 , 1 3 5 * 5 1
$BDGNS , 2 2 5 9 3 0 . 0 0 , , , , , , 1 , , , , 0 . 0 , 1 3 5 * 5 5
$GPGGA , 2 2 5 9 3 1 . 0 0 , 3 6 1 7 . 5 5 9 7 3 6 3 9 , N, 0 9 7 1 8 . 5 2 3 1 0 0 0 3 ,W, 2 , 2 1 , 0 . 6 , 3 2 1 . 4 8 3 , M, − 2 5 . 9 6 4 ,M, 5 . 0 , 0 1 3 5 * 7 7
$PTNL , GGK , 2 2 5 9 3 1 . 0 0 , 0 3 1 0 1 6 , 3 6 1 7 . 5 5 9 7 3 6 3 9 , N, 0 9 7 1 8 . 5 2 3 1 0 0 0 3 ,W, 5 , 2 1 , 1 . 3 , EHT295 . 5 1 9 ,M* 61
$GNGST , 2 2 5 9 3 1 . 0 0 , 9 . 3 8 0 , 0 . 3 7 4 , 0 . 3 2 6 , 5 5 . 4 , 0 . 3 4 2 , 0 . 3 5 9 , 0 . 8 6 3 * 7 1
5
NMEA explained, example, $GPGGA
$GPGGA , 2 2 5 9 3 1 . 0 0 , 3 6 1 7 . 5 5 9 7 3 6 3 9 , N, 0 9 7 1 8 . 5 2 3 1 0 0 0 3 ,W, 2 , 2 1 , 0 . 6 , 3 2 1 . 4 8 3 , M, − 2 5 . 9 6 4 ,M, 5 . 0 , 0 1 3 5 * 7 7
1. $GPGGA: NMEA header
2. 225931.00: UTC time (hhmmss.ss)
3. 3617.55973639: Latitude (DDmm.mm)
4. N: Latitude direction (N = North, S = South)
5. 09718.52310003: Longitude (DDDmm.mm)
6. W: Longitude direction (E = East, W = West)
7. 2: GNSS quality indicators
8. 21: Number of satellites in use
9. 0.6: Horizontal dilution of precision
10. 321.483: Antenna altitude above/below mean sea level
11. M: Units of antenna altitude (M = metres)
12. -25.964: Undulation, WGS84 ellipsoid
13. M: Units of undulation (M = metres)
14. 5.0: Age of correction data (in seconds)
15. 0135: Differential base station ID
16. 77: NMEA check sum
6
Point-to-point, for high volume data
• All: Ethernet
7
Preparing data on the vehicle
• Standardization (unified formats)
• Serialization (into binary)
• Compression (lossy or lossless)
8
Data formats, to send to a backend server
• Plain text (ASCII), for example:
• JSON
• CSV
• Binary, for example:
• Protobuf
• MessagePack
9
Transmitting data to the backend
When the data is collected and prepared, the next step is to
transmit it to the backend (company server, cloud).
There are several common methods, for example:
• MQTT
• REST (HTTPS)
• SSH
• WireGuard
• Raw point-to-point
10
MQTT
11
MQTT
• A popular Internet-of-things (IoT) communication library
• Includes client and server implementations
• The server is called a broker
• Publish–subscribe
• A client can listen or post to a topic
• Includes authentication: password, or SSL certificate
• Secure connection, insecure subscribe logic
11
MQTT, example (C++)
m q t t C l i e n t . connect ( ” mqtt . example . com ” , 1 8 8 3 ) ;
while ( true ) {
mqttClient . poll ( ) ;
f l o a t v al ue = sensorRead ( ) ;
m q t t C l i e n t . beginMessage ( ” some_topic ” ) ;
m q t t C l i e n t . p r i n t ( val ue ) ;
m q t t C l i e n t . endMessage ( ) ;
s l e e p ( dt ) ;
}
12
REST interfaces
13
REST interfaces
• A loosly defined pattern for IoT and APIs
• Plenty of client and server implementations
• Runs on top of conventional HTTPS
• Authentication needs to be implemented
• Secure connection, possibly insecure access logic (GET
commands)
13
REST, example (C++)
while ( true ) {
f l o a t v alu e = sensorRead ( ) ;
w e b C l i e n t . connect ( ” h t t p s : / / r e s t . example . com/SOMEVEHICLEID/ some_topic / ” + value ) ;
s l e e p ( dt ) ;
}
14
SSH
15
SSH
• A general secure terminal connection
• Includes client and server implementations
• Includes authentication: password, or SSL certificate
• Secure connection
15
SSH, example (bash)
while true
do
c a t /dev/ sensor > / opt / l o g F i l e . l o g
s l e e p dt
done
scp / opt / l o g F i l e . l o g ssh . example . com : ~ /
16
What do choose?
• Cybersecurity
• MQTT is popular, but has shown weaknesses
• Scalability
• SSH may be the most secure, but how does it scale?
• WireGuard has shown to scale better, but requires more
design work
17
Reminder, data volume
• 8 bit = 1 byte
• 1024 bytes = 1 KB
• 1024 KB = 1 MB
• 1024 MB = 1 GB
• 1024 GB = 1 TB
Note: Volume is measured in bytes, transfer speeds are
measured in bits/s.
18
Reminder, data types and notations
• int8: 1 byte
• int64: 8 byte
• float: 4 byte
• double: 8 byte
19
Uplink on the vehicle
In most cases, vehicles can safely use a cellular connection.
Exceptions include aerospace and some marine applications.
20
Cellular connection
In most populated areas in Sweden 4G can be used,
realistically giving 10 Mbit/s = 1.25 MB/s.
5G is also very common, but the range is a problem.
21
Data volume in one vehicle
When designing the fleet data offloading one needs to start
by looking at each signal from one vehicle, and then scale up
from there.
• Since we consider potentially millions of connected
products we need to consider every byte of data
22
Data volume in one vehicle, typical examples, GNSS
10 Hz GNSS data
• timestamp (int64)
• latitude (double)
• longitude (double)
10×(8 + 2×8) = 240 byte/s
23
Data volume in one vehicle, typical examples, IMU
100 Hz IMU data
• timestamp (int64)
• acceleration (3×float)
• orientation (3×float)
100×(8 + 3×4 + 3×4) = 3,200 byte/s
24
Data volume in one vehicle, typical examples, video
24 Hz low-res RGB video (uncompressed)
• timestamp (int64)
• pixel value, red (320×280×int8)
• pixel value, green (320×280×int8)
• pixel value, blue (320×280×int8)
24×(8 + 320×280×3) = 6,451,392 byte/s = 6,300 KB/s = 6 MB/s
25
Data volume in one vehicle, typical examples, compressed video
24 Hz low-res RGB video (h.264 compressed; lossy)
• timestamp (int64)
• pixel value, red (320×280×int8)
• pixel value, green (320×280×int8)
• pixel value, blue (320×280×int8)
Motion rank ’2’:
24×(8 + 320×280×2×0.07/8) = 37,824 byte/s = 37 KB/s
Motion rank ’4’:
24×(8 + 320×280×4×0.07/8) = 75,456 byte/s = 74 KB/s
• 99% volume reduction, with some loss in quality
• Read more here:
https://issuu.com/konu/docs/h264_primer
26
Data volume for the entire fleet
When the data volume for one vehicle has been determined,
the volume for entire fleet can be estimated.
• We then need to consider the usage profile of each
vehicle.
27
Usage profiles
• When are vehicles typically used?
• In what time zones are vehicles used?
Can be estimated, or measured from a representative sub-set
of the fleet itself.
28
Fleet total data volume
From the vehicle data volume and the usage profiles, a total
expected per hour fleet data volume can be estimated.
29
Scaling the backend
• A typical 10 GbE connection can handle 1250 MB/s
• How many servers will be needed to serve the entire fleet?
• Do we have efficient load balancing in place?
• What is the most cost efficient way of managing the
servers?
30
Post-processing
• When data arrives, it’s typical to apply post-processing
• Sensor fusion
• Machine learning
• Any post-processed data should be kept separated from
raw data
• The raw data should be kept as-is, the duplicated data is
an OK price to pay for data integrity
31
Data end-users
Finally, we need to consider the end-users of the data.
• Varies a lot between businesses
• Should be loosely connected to the fleet (read-only
databases)
32
Note
• The frontend–backend architecture is mirrored between
the fleet and the data users
• The interface and data format differs
• Machine–machine communication favors: Binary formats
to reduce volume, scalable and well-used (secure)
transmission protocols
• Human–machine communication favors: Text formats to
increase readability (if possible), well-used (portable)
transmission protocols
33
EOL
Questions?
34