activate the hardware actuator in order to reduce the
amount of emissions. The Raspberry Pi embedded
system is composed of System on a Chip (SoC) with
ARM architecture and Linux based operation system
– Raspbian. VehicleAgent application is deployed on
it. The VehicleAgent application is implemented
using Java programming language and runs on Java
Virtual Machine.
The VehicleAgent application uses the Pi4J and
WiringPi libraries, which are used for implementing
the hardware serial communication between the
Raspberry Pi and Arduino embedded systems. The
wireless communication with the cloud platform is
provided by 802.11n WiFi adapter connected to one
of the USB ports of the Raspberry Pi. It can
communicate to the cloud platform via several
application layer protocols: HTTPS or MQTT,
depending on the supported protocol by the cloud
platform. The application has a modular architecture
and enables extension with other protocols. If the
wireless network is faulty and the communication to
the cloud platform is constrained, the application
stores the last data in the local storage. After
successful connection with the cloud platform, the
locally stored data is sent to the cloud platform. The
application consumes configuration file
(config.xml), which is located into the local file
system and contains identification strings for the
vehicle, sensors and type of the communication with
the cloud platform (HTTPS, MQTT). The
configuration file should be filled by the driver or by
operator, who registers the vehicle into the system.
3.2 Cloud Applications
The EcoLogic consists of several cloud applications,
namely Controller application, Adapters applications
and Web user interface.
3.2.1 Controller Application
The Controller application is the main cloud
application, which handles all vehicles with their
hardware modules with sensors, calculates data,
stores data into database, analyze the data and
provides HTTP REST API. It is implemented using
the Java Enterprise Edition programming language
on top of JPA and Apache CXF services framework.
The Controller application has the following
functionality:
Represents the data model by users, vehicles,
sensors and measurements. Each user has
vehicles, each vehicle has sensors, each sensor
has measurements of physical parameters.
Manages the lifecycle of all users, vehicles,
sensors and measurements.
Stores the data into relational database, which
is provided as a backing service by the cloud
platform. The application is platform
independent and can work with any relational
database, which provides Java connectivity.
The database contains four tables: User,
Vehicle, Sensor and Measurement.
Calculates the mass of the carbon dioxide
emissions exposed into the air by vehicles.
Handles the state of each vehicle: optimal
(eco) state and not optimal (not eco) state.
Communicates with Analytics application,
which make anomaly detection – vehicles
which have not optimal amount of carbon
dioxide emissions.
Exposes HTTP REST API which is consumed
by the Adapter applications and web user
interface.
3.2.2 Adapter Applications
The Adapter applications are cloud applications,
which adapt the data coming from the vehicle
hardware modules to the Controller cloud
application. They are implemented using the Java
programming language. There are two types of
Adapter applications that handle different types of
network protocols: ControllerAdapterHttps and
ControllerAdapterMqtt for HTTPS and MQTT
protocols respectively. ControllerAdapterMqtt
application communicates with MQTT broker. The
MQTT broker can be: Mosquitto, HiveMQ, Mosca
or other. The MQTT broker and the Adapter
applications have public URLs and can be accessed
by the vehicle hardware modules. The cloud
platform routes the traffic to the appropriate
application depending on the application layer
protocol that is used. In case of HTTPS traffic, the
cloud platform routes the traffic to the
ControllerAdapterHttps application. In case of
MQTT traffic, it routes the traffic to the MQTT
broker. This routing capabilities of the cloud
platform are based on TCP routing. TCP routing
enables cloud platforms to support applications,
which communicate with different non-HTTP
protocols. Cloud Foundry platform is an industry
standard cloud platform and it is a typical example
for platform, which uses TCP routing (Cloud
Foundry).
The lifecycle of the MQTT traffic is the
following: when a new vehicle is created, the
Controller application registers a topic with name