<<

energies

Article Modelling the Effect of Driving Events on Electrical Vehicle Energy Consumption Using Inertial Sensors in Smartphones

David Jiménez 1,* ID , Sara Hernández 2, Jesús Fraile-Ardanuy 3 ID , Javier Serrano 1, Rubén Fernández 2 ID and Federico Álvarez 1 ID

1 Grupo de Aplicación de Telecomunicaciones Visuales (GATV), IPTC, Universidad Politécnica de Madrid, 28040 Madrid, Spain; [email protected] (J.S.); [email protected] (F.Á.) 2 Grupo de Aplicaciones de Procesado de Señales (GAPS), IPTC, Universidad Politécnica de Madrid, 28040 Madrid, Spain; [email protected] (S.H.); [email protected] (R.F.) 3 Grupo de Sistemas Dinámicos, Aprendizaje y Control (SISDAC), IPTC, Universidad Politécnica de Madrid, 28040 Madrid, Spain; [email protected] * Correspondence: [email protected]; Tel.: +34-913367344

Received: 15 November 2017; Accepted: 7 February 2018; Published: 10 February 2018

Abstract: Air pollution and climate change are some of the main problems that humankind is currently facing. The electrification of the transport sector will help to reduce these problems, but one of the major barriers for the massive adoption of electric vehicles is their limited range. The energy consumption in these vehicles is affected, among other variables, by the driving behavior, making range a value that must be personalized to each driver and each type of electric vehicle. In this paper we offer a way to estimate a personalized energy consumption model by the use of the vehicle dynamics and the driving events detected by the use of the smartphone inertial sensors, allowing an easy and non-intrusive manner to predict the correct range for each user. This paper proposes, for the classification of events, a deep neural network (Long-Short Time ) which has been trained with more than 22,000 car trips, and the application to improve the consumption model taking into account the driver behavior captured across different trips, allowing a personalized prediction. Results and validation in real cases show that errors in the predicted consumption values are halved when abrupt events are considered in the model.

Keywords: energy consumption; electric vehicle; smartphone; sensors; driving behavior

1. Introduction The technology behind the design of electric vehicles is continuously improving and the European Union (E.U.) predicts that these vehicles could be in mass production by 2020 [1,2]. By developing a completely new way of using information from location and smartphone sensors, refined models of energy consumption can be simulated enabling further studies on the impact of user behavior on mobility and, subsequently, on other main topics related to electrical mobility and electricity distribution networks. The aim of this paper was the characterization of the behavior of drivers using only the sensors in a smartphone, avoiding the installation of additional hardware and allowing the prediction of the energy consumption of the user considering the captured driving style. Although most driver monitoring methods make use of extra in-vehicle hardware, connected to the vehicle Electronic Control Unit, typically known as On-Board Diagnostics (OBD) devices, systems that replace this capture on-board approach with a simple smartphone are becoming ever more frequent. Since smartphones

Energies 2018, 11, 412; doi:10.3390/en11020412 www.mdpi.com/journal/energies Energies 2018, 11, 412 2 of 23 are easily accessible, widely available and low cost, these devices can be used to collect, process and Energies 2018, 11, x FOR PEER REVIEW 2 of 24 analyze driving data as well as detect maneuvers and classify aggressive driving behaviors. Inprocess this work,and analyze users’ driving driving data habits as well are as characterized detect maneuvers on the and basis classify of the aggressive Drivies driving application (Figurebehaviors1) from. PhoneDrive S.L. [ 3] a successful spin-off of Telefonica, the main telecommunications provider inIn this Spain. work, This user app,’s driving which habits canbe are freely characterized installed on in the devices basis of with Drivies Android application and IOS(Figure operating 1) systems,from allowsPhoneDrive the captureS.L. [3] a ofsuccessful this sensor spin- dataoff of (inTelefonica, particular, the main accelerometer telecommunications and gyroscopes) provider and providesin Spain. information This app, aboutwhich can how be and freely where installed you in drive. devices Exploiting with Android this and sensor IOSdata operating to model system, driving behaviorallows requires the cap someture of sophisticated this sensor data algorithmic (in particular, processing accelerometer and machine and gyroscopes) learning techniquesand provides to cope information about how and where you drive. Exploiting this sensor data to model driving behavior with phone orientation changes, different type of phone sensor characteristics, road type, and more. requires some sophisticated algorithmic processing and machine learning techniques to cope with A deepphone learning orientation framework changes, (neural different networks) type of phone is used sensor in thischaracteristics, work, due road to thetype, good and performancemore. A that itdeep has learning demonstrated framework in this(neural kind networks) of activities is used and in forthis thiswork, kind due of to signalsthe good [4 performance]. This approach that has also twohas demonstrated main advantages. in this kind Firstly, of activit avoidsies and the for time-intensivethis variety of signals process [4]. ofThis designing approach has handcrafted also features,two main as convolution advantages. filters Firstly are it is trained avoiding during the time supervised-intensive process training of of designing the model. handcrafted The second advantagefeatures, is its as higher convolution accuracy filters compared are trained to during the common supervised approach training of inputtingof the model. engineered The second features into aadvantage discriminative is its higher classifier accuracy (i.e., compared Support to the Vector common Machines). approach Anotherof inputting key engineered benefit offeatures using this kindinto of algorithma discriminative is related classifier to (i.e. the, Support signals Vector that are Machines). generated Other by key the benefit sensors of using on mobilethis kind devices. of Thesealgorithm measurements is related are to very the noisy, signals being that are hard genera to findted a by distribution sensors on able mobile to model, devices. in These practice, measurements are very noisy, being hard to find a distribution able to model, in practice, with high with high accuracy that noise. Neural networks have proven to be extremely effective to accommodate accuracy that noise. Neural Networks have proven to be extremely effective to accommodate diverse diversesensor sensor noise noise patterns patterns [5]. [5].

FigureFigure 1.1. Drivies app app..

For modelling of energy consumption, a model was developed, considering the prediction of Forenergy modelling consumption the energywith different consumption, variablesa intervening model was in developed, the vehicle dynamics, considering and the adding prediction the of energyeffect consumption of the driving with behavior different der variablesived from intervening smartphone in sensors,the vehicle captured dynamics, using and Drivies adding app. the In effect of theparticular, driving behavior it takes into derived account from the smartphone type of driving sensors, maneuver captured (turns, using accelerations the Drivies and app. brakes) In particular, and it takeswhether into accountthey are abrupt the type or ofnot. driving The model maneuver has developed (turns, a accelerations completely new, and and braking) highly detailed, and whether theytime are abrupt-space approach or not. The based model on the has use developed of vast quantities a completely of data new,from andthe location highly and detailed, smartphone time-space approachsensors. based on the use of vast quantities of data from the location and smartphone sensors. Global Navigation Satellite Systems (GNSS) and Inertial Measurements Units (IMU) are two Global Navigation Satellite Systems (GNSS) and Inertial Measurements Units (IMU) are two key keys features of smartphones that have been increasing in the last years. These are two essential featuresinnovations of smartphones for Location that-Based have Services been increasing (LBS) and user in use activity in the monitoring last years. applications. These are The two most essential innovationsdeveloped for domain Location-Based is the analysis Services of driving (LBS) behavior and user for activityinsurance monitoring telematics, obtaining applications. data from The most developedsmartphone domain sensors is the [6,7]. analysis of driving behavior for insurance telematics, obtaining data from smartphone sensors [6,7]. Energies 2018, 11, 412 3 of 23

However, these systems still show performance problems, specially related to the battery consumption. The high battery cost of activating geopositional systems such as Global Positioning System (GPS) is the main challenge identified in [6]. The authors in [8] proposed an intelligent procedure to reduce battery cost of geolocation systems based on triggering the location with regard to specific activities, by using tridimensional accelerometer data. One of the existing solutions, proposed in [9], suggests enabling smartphone accelerometer signals in order to manage the activation of geolocation depending on the activity of the user. Another solution, following the same direction, is proposed in [10], taking into account the motion/rest condition of the device to activate (or not) the geolocation system. To improve the accuracy of the model, as a smartphone can be freely installed inside a vehicle, not only in a random position but in a non-fixed position, an orientation correction is compulsory. Thus, the device could be placed anywhere inside the vehicle, and the position can even change during the recordings without interfering with the result. Basir et al. [11] proposed a method to correct the orientation of a freely installed device with accelerometers in a vehicle in two steps. Firstly, obtaining a gravity vector with the vehicle stopped and, secondly, obtaining a driving directional vector and correcting it by a Principal Component Analysis (PCA) approach. Other authors try to use a fixed Inertial Measurement Unit on the vehicle [12] or they use a smartphone in a fixed and calculated position in [13,14]. A solution to possible changes of position of the device during the records is presented in [15], where manipulation events are detected in order to restart the procedure. In addition, an algorithm to detect and classify acceleration and turn driving events based on smartphone accelerometer and gyroscope signals is described. In our experiments, the model will be based on this patent. Other works have tried to characterize the behavior of drivers using smartphones [16], correlating driving style with fuel consumption. In [17] its authors developed an algorithm to characterize driver aggressiveness and calculate the consumption and environmental impact in diesel vehicles using a set of specific features obtained from the vehicle Electronic Control Unit (ECU). Nevertheless, smartphones are used to provide real-time information, but needing additional hardware such as the OBD to provide information regarding speed, acceleration, revolutions per minute or intake air temperature, among others. Several models of battery consumption for electric vehicles have been published in the literature, considering the longitudinal dynamic model (LDM) of the car [18–21]. A sensitivity analysis for this dynamic model is presented in [21], providing a parameter prioritization that allows quantifying their impact on the accuracy of the energy demand estimation. The two most critical parameters that affect this energy estimation are the uncertainty in the rolling friction coefficient and the uncertainty of vehicle efficiency. A combined dynamic generic model with some high-level technical specifications of the main components of the electric vehicle has been used in [22] to estimate the vehicle’s energy demand. The authors proposed a variable speed-dependent regeneration factor. Unfortunately, the proposed model is only validated comparing its results with the results obtained from a more complex simulation model (called Future Automotive Systems Technology Simulator-FASTSim, which is a high-level vehicle powertrain model developed by National Renewable Energy Laboratory [23] over different driving cycles (no over real data provided by a GPS). A similar LDM is presented in [24], where a variable speed-dependent regeneration factor and constant load-efficiency curve are used. The variable regenerative factor is assumed to be an exponential function of the negative acceleration and, again, the validation is done using different types of driving cycles. Calibration using real world data instead of standard driving cycles have been also proposed in the literature. In [25] a LDMs of three different electric quadricycles, which are calibrated using real world data (speed, acceleration and slope), sampled at 1 Hz rate is proposed. In this case, authors evaluate the vehicle specific power (an estimation of the power per mass unit), assuming constant Energies 2018, 11, 412 4 of 23 rolling resistance and no regeneration factor. Zhang and Yao [26] also proposed a second-by-second LDM model, calibrated with real data, but they included a variable-speed regeneration factor. Big Data modeling has been used to estimate the driving range of an electric vehicle (EV) more accurately,Energies based 2018, 11 on, x FOR battery PEER REVIEW pack data and EV operating data. With this information it was4 of 24 possible to estimate the long-term battery performance and degradation and the estimated range and driving behaviorto [estimate27]. the long-term battery performance and degradation and the estimated range and driving Thebehavior reminder [27]. of this paper is organized as follows: Section2 presents the electric vehicle model The reminder of this paper is organized as follows. Section 2 presents the electric vehicle model used for the consumption calculations. In Section3 we present the data validation procedure to extract used for the consumption calculations. In Section 3 we present the data validation procedure to extract the neededthe needed measures. measures. In Section In Section4, 4, results results areare described described with with conclusions conclusions presented presented in Section in 5. Section5.

2. Electric2. Electric Vehicle Vehicle Consumption Consumption Model Model This sectionThis section describes describes the the modeling modeling of of the the electricelectric vehicle vehicle (EV) (EV) developed developed to estimate to estimate its energy its energy consumption.consumption. The Themodel model is based is based on on the the direct direct application application of of the the Newton’s Newton’s second second law for law the for the longitudinallongitudinal dynamics dynamics of the of vehicle,the vehicle, as as it it is is shown shown in Figure Figure 2.2 .

FigureFigure 2. Free 2. Free body body diagram diagram of of the the different different longitudinal longitudinal forces forces acting acting on the on vehicle the vehicle..

According to the principle of force balance presented in (1), the traction force, Ft, generated by Accordingthe electric to motor, the principlemust overcome of force the sum balance of all presentedresistive forces in Equationacting on the (1), vehicle: the traction the rolling force, Ft, generatedresistance by the force electric of the motor, wheels, must Frr; the overcome hill climbing the force, sum F ofhc (which all resistive is the component forces acting of the on vehicle the vehicle: weight, Fg, that acts along the slope); the aerodynamic drag, Faero and the inertial force, Fi. the rolling resistance force of the wheels, Frr; the hill climbing force, Fhc (which is the component of the vehicle weight, Fg, that acts along the퐹푡 slope);= 퐹푖 + 퐹 thehc + aerodynamic퐹rr + 퐹aero drag, Faero and the inertial(1) force, Fi: The aerodynamic drag is given by (2): Ft = F + F + Frr + Faero (1) i hc 1 퐹 = sign(푣 + 푣 ) 휌AC (푣 + 푣 )2 (2) aero wind 2 푑 wind The aerodynamic drag is given by Equation (2): where A is the front area of the vehicle (in m2), Cd is the aerodynamic drag coefficient, ρ is the air density of dry air (in kg/m3) and v and vwind are the velocity1 of the vehicle and the headwind speed F = sign(v + v ) ρAC (v + v )2 (2) respectively [20]. In this work,aero it is assumed thatwind wind2 speedd is negligiblewind compared to the vehicle’s speed, therefore, vwind = 0 as it was also proposed in other previous works [21–25]. The rolling resistance forces are acting in2 all tires, as it is shown on the left side of Figure (2). The where A is the front area of the vehicle (in m ), Cd is the aerodynamic drag coefficient, ρ is the air resultant rolling resistance3 force, Frr = Frr_front + Frr_rear, is given in (3): density of dry air (in kg/m ) and v and vwind are the velocity of the vehicle and the headwind speed respectively [20]. In this work, it is assumed퐹rr = sign(푣 that)(푀car wind+ 푀푝 speed)푔cos(훼 is)푐rr negligible compared to the(3) vehicle’s speed, therefore,where crr definedvwind the= 0 tire as itrolling was resistance also proposed coefficient, in other Mcar is previous the mass worksof the vehicle, [21–25 M].p is the mass Theof rollingthe people resistance in the vehicle forces (driver are plus acting passengers), in all tires, g is the as gravity it is shown acceleration on the (9.81 left m/s side2) and of α is Figure 2. the angle of the driving surface (in rad). The rolling resistance coefficient depends on the tire pressure, The resultant rolling resistance force, Frr = Frr_front + Frr_rear, is given in Equation (3):

F = sign(v)M + M g cos(α)c (3) rr car p rr Energies 2018, 11, 412 5 of 23

where crr defined the tire rolling resistance coefficient, Mcar is the mass of the vehicle, Mp is the mass of the people in the vehicle (driver plus passengers), g is the gravity acceleration (9.81 m/s2) and α is the angle of the driving surface (in rad). The rolling resistance coefficient depends on the tire pressure, the road surface type, the road conditions, the vehicle tire type and the linear velocity. In this work, this coefficient is approximated by Equation (4) according to [24]:  v  c = 0.01 1 + (4) rr 100 Equation (5) defines the hill climbing force which represents the force required to drive the vehicle up the slope:  Fhc = Mcar + Mp g sin(α) (5) Finally, Equation (6) represents the inertial force of the vehicle, representing the force required to accelerate the vehicle, where a is its linear acceleration. An additional correction factor, Ci0, must be included in this equation to consider the force needed to provide angular acceleration to the rotating parts. In this work, this value is 0.05 as it is suggested in other similar references [18–20]:  Fi = Ci0 Mcar + Mp a (6)

The mechanical tractive power at the wheels, Pt, required to drive the vehicle at speed v is given by Equation (7): Pt = Ftv (7) The output power of the battery is computed as:

Pt Pbat = + Paux (8) ηgear·ηmotor where Paux represents the variable auxiliary loads (heating, air conditioning, radio, lights, etc.), ηgear is the driveline efficiency and ηmotor is the electric controller-motor efficiency [18,19,27]. This output power of the battery is evaluated at each time step. During normal forward driving (traction mode), Pt > 0 and Pbat > 0 during a time interval ∆t and the energy (defined by Pbat·∆t) is extracted from the battery, flowing to the wheels. During the breaking process, EVs recover a significant fraction of the breaking energy, recharging the battery. The input power injected in the battery, Pbat < 0, during this period will depend on the regenerative braking factor, k, as follows:

Pbat = kηgear·ηmotorPt + Paux (9)

Note that, in this braking mode, Pt < 0 and:

kηgear·ηmotorPt > |Paux| → Pbat < 0 (10)

The regeneration factor, k, which determines the percentage of the total braking power which can be practically recovered is speed-dependent function as it is shown in the following equation [22,24]: ( 0.5·v v < 5m/s k = (11) 0.5 + 0.015(v − 5) v ≥ 5m/s

The total energy demand of a trip can by computed by:

1 Z tend Etrip = Pbat·dt (12) ηbat t0 Energies 2018, 11, 412 6 of 23

where ηbat is the battery efficiency and t0–tend are the initial and final times of the trip. In this work, the input data for the model are vehicle trajectories (second-by-second vehicle speed and position that were recorded by the GPS receiver installed in the smartphone), therefore Equation (12) is discretized as follows: 1 N Etrip = ∑ Pbat[k]·∆t (13) ηbat k=1 where ∆t is the time span between two consecutive position samples and N is the number of recorded position samples. The model under study is a Nissan Leaf (2016 version). This vehicle is powered by an 80 kW synchronous motor with a nominal 30 kWh lithium ion battery pack. The values of the main parameters of this model are summarized in Table1.

Table 1. Vehicle characteristics.

Description Symbol Value Cross sectional area (m2) A 2.3316 Curb weight (kg) Mcar 1521 Driver and passengers’ weight (kg) Mp 160 (1 driv. + 1 pass.)–230 (1 drv. + 2 pass.) Nominal battery capacity (kWh) Cnom 30 Driveline efficiency (%) ηgear 0.95 Controller and motor efficiency (%) ηmotor 0.98 Battery efficiency (%) ηvat 0.98 Auxiliary power load (kW) Paux 0.2

Model Extension to Include Significant Driving Events In order to derive a more accurate consumption model, small variations in the previous longitudinal dynamics model (defined by Equations (1)–(13)) are proposed. Two available inertial sensors in the smartphones are used in this work: accelerometers and gyroscopes. The first type of sensor measures linear acceleration of movements along the x, y and z axes (including gravity), while the gyroscope measures the rotational velocity (the rate of rotation) around the x, y and z axes. The linear acceleration is directly used in the longitudinal dynamics model through Equation (6), but the information provided by the gyroscopes is not directly included in the previous model. This information is critical to evaluate different driving behaviors and it will have a direct influence in the energy demanded by the EV. For that reason, in this work the modification of Equations (4) and (6) to include this effect is proposed. When the vehicle is subjected to abrupt turns, the friction between the tire and the road increases, therefore, it is proposed to modify the weight of the rolling resistance coefficient defined in Equation (4), weighting it by the energy content included in the rotation signal, named E[event] and a constant coefficient K1 which it is calibrated using Least Squares Method (LSM). The more energetic the turn is, the more friction will occur, increasing the losses: h  v i c = 0.01 1 + K E[event] (14) rr_mod 100 1 Similarly, when making abrupt movements with the vehicle, the effective moment of inertia of the vehicle will change, increasing the effort to be rotated and increasing the inertial force. This effect will be included by the modification of the additional correction factor, Ci0 in Equation (6), weighting it by the energy content of the rotational signal and a constant coefficient K2:

Ci = K2Ci0E[event] (15) Energies 2018, 11, 412 7 of 23

3. Data Acquisition, Detection, Classification and Validation

3.1. Data Acquisition and Preprocessing This method relies on inertial sensors signals, such as accelerometer signals or gyroscope signals. These sensors are obtained from a smartphone, which can be placed anywhere inside the vehicle and may change its position during the recordings with no impact on the accuracy of the results as it will be explained . As the hardware for each device is different, we will follow the recommendations given in [15] in order to sample inertial signals at 5 Hz. The devices installed in smartphones are very heterogeneous, therefore, signals could have empty samples. To overcome this limitation, signals are linearly interpolated. These signals are low-passed filtered by using a third order Butterworth filter, in order to erase spurious samples or high-frequency samples not related to driving maneuvers. In this Energies 2018, 11, x FOR PEER REVIEW 7 of 23 filtering, accelerometer signals are filtered using a cutoff frequency of 1 Hz, whereas gyroscope signals arein order filtered to erase using spurious a cutoff samples frequency or high of‐frequency 0.25 Hz samples since with not gyroscopesrelated to driving we aremaneuvers. less interested In in fast variations.this filtering, accelerometer signals are filtered using a cutoff frequency of 1 Hz, whereas gyroscope Accelerometersignals are filtered data using is affected a cutoff by frequency Earth’s gravityof 0.25 Hz force. since This with effectgyroscopes is estimated we are less and interested removed from in fast variations. the signals, as explained in [15], by applying a decomposition of the 3-dimensional signal into a vertical Accelerometer data is affected by Earth’s gravity force. This effect is estimated and removed projection,from where the signals, the effectas explained of the in gravity [15], by applying is estimated, a decomposition and another of the projection 3‐dimensional onto signal the into horizontal plane, wherea vertical signals projection, must where be affected the effect only of the by gravity driving is events.estimated, These and another two projections projection onto are the presented in Figurehorizontal3 for a given plane, segment.where signals In themust upper be affected plot, only the verticalby driving projection events. These is shown, two projections where theare signal representspresented the vertical in Figure force 3 for as, a given for instance, segment. In the the gravity upper plot, force. the Itvertical is remarkable projection thatis shown, the signalwhere has an offset atthe 9.8 signal m/s2 representsbecause gravity the vertical force force is constant, as, for instance, variations the gravity around force. this It offset is remarkable represent that the the incidence signal has an offset at 9.8 m/s2 because gravity force is constant, variations around this offset represent of otherthe vertical incidence forces of other (potholes, vertical forces bumps, (potholes, etc.). Inbumps, the bottom etc.). In the plot, bottom the horizontal plot, the horizontal plane projectionplane is represented,projection where is represented, all forces related where all to forces driving related events to driving are present. events Onare thispresent. horizontal On this horizontal plane projection there inplane no offset projection because there no in constantno offset because force affects no constant the deviceforce affects measurement. the device measurement.

(a)

(b)

Figure 3. Decomposition of 3‐dimensional accelerometer signal: (a) vertical projection. (b) horizontal Figure 3. Decomposition of 3-dimensional accelerometer signal: (a) vertical projection. projection. (b) horizontal projection. 3.2. Events Detection As smartphone devices are not in a fixed position, manipulations of the devices are possible. These manipulations could mask the signals referring to simple driving events. In order to clean these from the signal, manipulations are detected when the gyroscope signal is too strong to be a driving maneuver. These uncontrolled movements are removed from the signal and, then, the system is recalibrated since the position of the device has changed, and the projections depicted in previous section are obtained again.

Energies 2018, 11, 412 8 of 23

3.2. Events Detection As smartphone devices are not in a fixed position, manipulations of the devices are possible. These manipulations could mask the signals referring to simple driving events. In order to clean these from the signal, manipulations are detected when the gyroscope signal is too strong to be a driving maneuver. These uncontrolled movements are removed from the signal and, then, the system is recalibrated since the position of the device has changed, and the projections depicted in previous section are obtained again. For gyroscopes, once the manipulation events have been removed, and after verifying that there are no stationary signals affecting them, the sum of the filtered energy is obtained as representative of driving behavior. Once the signal is clean, it is assumable that all high energy events are related to driving events so a threshold over the driving noise level, being this noise level the signal when the car is moving straight without accelerating nor braking, is set up. The calculation of noise threshold has been made by means of the median. This threshold is selected in both horizontal plane projections of accelerometers and total energy of gyroscopes, as explained in [15]. Once the horizontal plane projection signal of accelerometer or the total energy of gyroscopes exceed the threshold, an event has been detected.

3.3. Events Classification To categorize the driving style, we discover the existence of maneuvers, then we establish what kind of maneuvers are performed and, finally, if these maneuvers are abrupt or not. Every event detected is classified according four main categories: left turns, right turns, accelerations and braking; although the types of maneuvers could be divided into more subcategories. Other classification techniques could be used, but neural networks have proved to be one of the most useful tools to classify activities with sensors. One of the important decisions for the training of the network is to decide which input signals are to be used, selecting those ones coming from the smartphone sensors, with the exception of GPS signal because it could increase considerably the battery consumption of the device. To translate one driving event into one of the four maneuvers mentioned above, we decided to simplify the model and use only six input signals; the components [X, Y, Z] of the accelerometers and the components [X, Y, Z] of the gyroscope. In Figure4 an example of a driving maneuver is presented. The upper plot depicts the accelerometer signals and the lower plot the gyroscope signals. The Z axis on accelerometer signals represents the vertical component, besides integrating the offset from the gravity force. The X and Y axes define the horizontal plane, thus variations of the signal on this place imply that there is a driving event to be taken into account. The lower plot shows a variation on the Z axis of the gyroscope, meaning that the car is turning around the vertical axis: a turn event is taking place. First of all, we will begin with a database of signals previously labeled as left and right turns, accelerations and braking. This database will be used as training input for a neural network of some dense layers, with a fully connected layer and a softmax regression layer to the output to return probabilities of the four previously mentioned categories. For the training of the network, as “ground truth”, we use data from a set of car trips with additional information from an OBD device installed in the car. This tool accurately recreates a vehicle trip and analyzes user’s driving incidents measuring precisely accelerations to notify of drivers’ harsh braking, acceleration and turn events. With this event information coming from the OBD, we have been able to correctly classify and synchronize the maneuvers detected by means of the analysis of signals from the smartphone, determining events of different length and type, according to the aforementioned categories. Between the different neural network options, we have decided to use a recurrent neural network (RNN), in particular a Long-Short Time Memory (LSTM). These types of networks are appropriate for time series modeling as is the case of accelerometer signals. Energies 2018, 11, x FOR PEER REVIEW 8 of 23

For gyroscopes, once the manipulation events have been removed, and after verifying that there are no stationary signals affecting them, the sum of the filtered energy is obtained as representative of driving behavior. Once the signal is clean, it is assumable that all high energy events are related to driving events so a threshold over the driving noise level, being this noise level the signal when the car is moving straight without accelerating nor braking, is set up. The calculation of noise threshold has been made by means of the median. This threshold is selected in both horizontal plane projections of accelerometers and total energy of gyroscopes, as explained in [15]. Once the horizontal plane projection signal of accelerometer or the total energy of gyroscopes exceed the threshold, an event has been detected.

3.3. Events Classification To categorize the driving style, we discover the existence of maneuvers, then we establish what kind of maneuvers are performed and, finally, if these maneuvers are abrupt or not. Every event detected is classified according four main categories: left turns, right turns, accelerations and braking; although the types of maneuvers could be divided into more subcategories. Other classification techniques could be used, but neural networks have proved to be one of the most useful tools to classify activities with sensors. One of the important decisions for the training of the network is to decide which input signals are to be used, selecting those ones coming from the smartphone sensors, with the exception of GPS signal because it could increase considerably the battery consumption of the device. To translate one driving event into one of the four maneuvers mentioned above, we decided to simplify the model and use only six input signals; the components [X, Y, Z] of the accelerometers and the components [X, Y, Z] of the gyroscope. In Figure 4 an example of a driving maneuver is presented. The upper plot depicts the accelerometer signals and the lower plot the gyroscope signals. The Z axis on accelerometer signals represents the vertical component, besides integrating the offset from the gravity force. The X and Y axes define the horizontal plane, thus variations of the signal on this place imply that there is a driving Energiesevent2018 ,to11 ,be 412 taken into account. The lower plot shows a variation on the Z axis of the gyroscope,9 of 23 meaning that the car is turning around the vertical axis: a turn event is taking place.

(b)

(a) (c)

Figure 4. (a) Example of a turn maneuver in a real driving detention. (b) Top plot represents signals Figure 4. (a) Example of a turn maneuver in a real driving detention. (b) Top plot represents signals from accelerometer sensor. (c) Bottom plot represents signals from gyroscope sensor. from accelerometer sensor. (c) Bottom plot represents signals from gyroscope sensor.

One of the main differences between a LSTM networks and a standard RNN, is that the nodes of the LSTM networks are memory cells. The memory cells have self-recurrent connections and three control gates: input gate (to write), output gate (to read) and forget gate (to reset). These gates are the ones that will allow updating states in each step of time, storing possible temporal relationships along time. Therefore, detected maneuvers, from the analysis of smartphone sensor data (see example Figure5), will be introduced into the LSTM network as inputs in raw data, without any type of preprocessing. In every time step t, a new input will be received to the network, at, and the memory will be updated, st. Each input, at, will be captured at the same time instant, t, along six channels, three coming from the accelerometers and three from the gyroscope. The memory will be updated through the cell state, by aggregating the old memory (forget gate) and the new memory (input gate): i.e., the forget gate will control what information will be kept (remembered) and what information will be skipped (forgotten), whereas the input gate will control what information of the input signal (in this time t) will be added. Finally, the output gate will decide what information will pass to the next time step (t + 1). In summary, in each time t, an output of the network will be provided, calculated upon the current input and previously processed information. We have chosen an LSTM network of two stacked layers, with the output sequence of one layer forming the input sequence for the next. Each LSTM layer has 64 neurons. When a large amount of data is available, the results can be greatly improved when the number of stacked layers is increased. However, this significantly increases the number of parameters and consequently the memory and processing capacity required. Therefore, although we have performed the processing on a computer equipped with a Nvidia Tesla K80 graphic card (instead of the smartphone), for practical reasons the layers have been limited to two and the neurons by layer to 64, offering good results with reasonable resource requirements. At the output of the recurrent network, there will be a fully connected feed forward-layer to classify the input maneuvers into our four classes (left turns, right turns, accelerations and braking) and a softmax layer, providing the probability in each time instant. To build the neural network we have used the open source software library TensorFlowTM with Python. To validate the results, cross-validation tests have been performed to ensure that the results are independent of the partition between training and testing. In particular, a k-fold cross-validation was performed, with a k = 3. Data in each iteration are divided into three subsets, using each subset as Energies 2018, 11, 412 10 of 23 testing and others as training successively; and the final error will be the average of the errors obtained. TheEnergies number 2018 of, 11 drivers,, x FOR PEER routes REVIEW and maneuvers used for such training is shown below (Table2).10 of 24

FigureFigure 5. Smartphone 5. Smartphone sensor sensor signals signals will will be inputbe input of a of neural a neural network network with with a fully a fully connected connect layered layer and a softmaxand a softmax layer like layer outputs like outputs to provide to provide probabilities probabilities associated associated to each to maneuver.each maneuver.

We have chosen an LSTM networkTable of 2. twoTraining stacked database. layers, with the output sequence of one layer forming the input sequence for the next. Each LSTM layer has 64 neurons. When a large amount of data is available, the results can beDescription greatly impoved when increasing Value the number of layers stacked. However, we significantly increase Driversthe number of parameters 68and consequently the memory and processing capacity required. TherefRoutesore, although we have performed 22,194 the processing on a computer with a Nvidia Tesla K80 graphicTotal card maneuvers (instead of the smartphone), 16,029 for practical reasons the layers have been limited to two andTotal the leftneurons turn maneuversby layer to 64, offering 4649 good results at reasonable resources requirements. At the outputTotal of the right recurrent turn maneuvers network, there will 4907 be a fully connected feed forward- layer to classify the input maneuversTotal braking into maneuversour 4 classes (left turns, 3498 right turns, accelerations and brakes) Total acceleration maneuvers 2975 and a softmax layer, providing the probability in each time instant. To build the neural network we have used the open source software library TensorFlowTM with Python. WithTo a validate total of 68the different results, cross drivers-validation and an average tests have of 326been routes performed by driver, to ensure we have that consideredthe results are that it isindependent a heterogeneous of the database partition forbetween the tests. training The and final testing. model In uses particular, an Adam a k- optimizerfold cross- forvalidation minimizing was the cross-entropyperformed, with loss a k function, = 3. Data backpropagatingin each iteration are the divided gradients into from3 subsets, the softmax using each layer subset through as testing to the inputand layers. others Finally, as training the validationsuccessively; accuracy and the hasfinal been error around will be 79%.the average of the errors obtained. The numberTherefore, of drivers, the raw routes signals and coming maneuvers from theused sensors for such of training mobile deviceis shown will below be captured, (Table 2) by. means of the process of detection of events suggested in the previous section we will capture events susceptible of being turns (left or right) or accelerationsTable or 2. braking, Training being database. braking an acceleration event but with an opposite sign. With the trained database weDescription will evaluate what kindValue a maneuver is. However, not all maneuvers are equally useful when mappingDrivers them in the model of energy68 consumption. Therefore, we are going to focus on the abruptness of theRoutes events without making22,194 any difference between left and right turns, and between acceleratingTotal or braking maneuvers events. To categorize16,029 the maneuvers according to their abruptness a value of abruptnessTotal is left given turn obtained maneuvers from the maximum4649 of accelerometer energy inside the event. Total right turn maneuvers 4907 Total braking maneuvers 3498 Total acceleration maneuvers 2975

Energies 2018, 11, 412 11 of 23

3.4. Events Validation In order to adjust the proposed mathematical model, several trips during 3 weeks where recorded using a 2016 Nissan Leaf. In Figure6 it is shown the installation of a Bluetooth On-Board Diagnosis II (OBDII) scanner which was plugged into the Leaf’s OBD port to register several pieces of information available from the CAR-CAN bus. A special software named LeafSpy Pro was used to analyze the data read from the vehicle and store it in a .CSV file. The main registered variables were the following:

1. “Date/Time” 2. “Latitude and Longitude” in the following format: dd mm.yyyy 3. “Elv” Elevation in meters. 4. “Speed” in the km/h. 5. “Gids”, which indicates the energy in the Nissan Leaf battery (current capacity = 80 Wh.Gids) 6. “SoC” State of Charge (SoC) of the Traction Battery. 7. AHr” Capacity of the Traction Battery. 8. “PackEnergies Volts” 2018 Traction, 11, x FOR PEER Battery REVIEW voltage 11 of 23 9. “Pack4. Amps” “Speed” Traction in the km/h. Battery amperage, which is positive when the current is extracted from battery5. (during “Gids”, which driving), indicates or negativethe energy whenin the Nissan Regen Leaf or battery charging. (current capacity = 80 Wh.Gids) 10. “Odo6. (km)” “SoC” Odometer State of Charge reading (SoC) inof the kilometers. Traction Battery. 7. AHr” Capacity of the Traction Battery. 11. “SOH”8. The “Pack State Volts” of Traction Health Battery of the voltage Battery in percent. 12. “epoch9. time”, “Pack Amps” where Traction one sample Battery representsamperage, which the timeis positive in seconds when the from current 1 Januaryis extracted 1970. from battery (during driving), or negative when Regen or charging. 13. “Motor Pwr (100 w)” Drive motor power. 10. “Odo (km)” Odometer reading in kilometers. 14. “Aux11. Pwr “SOH” (100 The w)” State Power of Health used of bythe theBattery auxiliary in percent. equipment (Lights, Radio, Navigation system, rear defroster12. “epoch . time”, . . ). where one sample represents the time in seconds from 1 January 1970. 15. ”A/C13. Pwr “Motor (250 Pwr w)” (100 Power w)” Drive used motor by the power. Air Conditioning System power. 14. “Aux Pwr (100 w)” Power used by the auxiliary equipment (Lights, Radio, Navigation system, 16. “Gear” “7”rear defroster…). Gear position (0 = not read yet; 1 = Park; 2 = Reverse; 3 = Neutral; 4 = Drive; 7 = B/Eco)15. ”A/C Pwr (250 w)” Power used by the Air Conditioning System power. 16. “Gear” “7” Gear position (0 = not read yet; 1 = Park; 2 = Reverse; 3 = Neutral; 4 = Drive; 7 = B/Eco)

(a) (b)

(c) (d)

Figure 6. (a) 2016 Nissan Leaf. (b) Location of the OBD port (c) Installation of the Bluetooth OBDII Figure 6. (scannera) 2016 (d Nissan) Smartphone Leaf. location (b) Location inside the ofvehicle the during OBD portthe trips. (c) Installation of the Bluetooth OBDII scanner (d) Smartphone location inside the vehicle during the trips. 4. Results The main results of this work are included in this section. Initially, a model validation based on one specific driving cycles: the EPA Urban Dynamometer Driving Schedule (UDDS) is presented. Then, all registered trips were classified using a k-means scheme, splitting them in three different categories representing: (1) smooth driving, (2) aggressive driving and (3) mild driving styles. The consumption results of three representative trips (one for each cluster) are also shown (selected as the closest trip to the cluster centroid).

4.1. Initial Model Validation

Energies 2018, 11, 412 12 of 23

4. Results The main results of this work are included in this section. Initially, a model validation based on one specific driving cycles: the EPA Urban Dynamometer Driving Schedule (UDDS) is presented. Then, all registered trips were classified using a k-means scheme, splitting them in three different categories representing: (1) smooth driving, (2) aggressive driving and (3) mild driving styles. The consumption results of three representative trips (one for each cluster) are also shown (selected as the closest trip to the cluster centroid). Energies 2018, 11, x FOR PEER REVIEW 13 of 24 4.1. Initial Model Validation 4.1. Initial Model Validation According to the official data [28], the nominal range of this vehicle is up to 107 miles (172.2 km) According to the official data [28], the nominal range of this vehicle is up to 107 miles (172.2 km) under the 2017 LA4 driving cycle. The estimated range by the proposed model under the same driving under 2017 LA4 driving cycle. The estimated range by the proposed model under the same driving cyclecycl is 170e is km.170 km. The In drivingFigure 7, profile the driving of the profile first of two the cyclesfirst two and cycles the and initial the initial evolution evolution of the of Statethe of ChargeState (SoC) of Charge are presented (SoC) is presented. in Figure 7.

Figure 7. EPA LA4 driving cycle consumption estimation. Figure 7. EPA LA4 driving cycle consumption estimation. 4.2. Real Trips Validation 4.2. Real Trip Validation To validate the results with real conditions, we performed a total of 50 trips, and classify them Tousing validate a simple the clustering results with scheme real ( conditions,k-means clustering) we performed which can a totallead to of three 50 trips, different and classifiedcategories: them usingsmooth a simple driving, clustering including scheme a reduced (k-means number clustering) of events (cluster which 1); can aggressive lead to driving three different including categories:a high smoothnumber driving, of events including (cluster a 2); reduced and mild number driving, of including events (clusteran average 1); number aggressive of events driving (cluster including 3). a high number ofAll events trips were (cluster done 2); using and the mild same driving, driving including setup in the an averagecar to avoid number driving of biases. events These (cluster trips 3). were made on the same circuit of 24 km (mix of city and roadways), varying the conditions of the All trips were done using the same driving setup in the car to avoid driving biases. These trips vehicle (increasing the weight) and the driving style. were made on the same circuit of 24 km (mix of city and roadways), varying the conditions of the After the clustering, we selected representative candidates of the clusters by selecting the ones vehiclewith (increasing closest distance the weight) to the centroid and the cluster, driving an style.d comparing the model with real results. Then, we Afterselected the three clustering, different werepresentative selected representative trips of the clusters. candidates These three of the trips clusters were made by selectingconsecutively, the ones with closeston the same distance circuit to of the 24 centroidkm, varying cluster, the conditions and comparing of the vehicle the model (increasing with the real weight) results. and Then, the we selecteddriving three style. different representative trips of the clusters. These three trips were made consecutively, on the sameIn order 24 km to evaluate circuit, only varying the influence the conditions of the driving of the behavior vehicle on (increasing the proposed the model, weight) the total and the drivingconsumption style. and the consumption of all auxiliary loads have been recorded. Then the power used Into orderpropel tothe evaluate vehicle has only been the obtained influence (subtract of theing driving the consumption behavior of on all the auxiliary proposed loads model, to the total the total consumption). consumption and the consumption of all auxiliary loads have been recorded. Then the power used to Figure 8a shows the total auxiliary loads during these three consecutive trips. This consumption propelhas the two vehicle different has components, been obtained the (subtractingfirst one is due the to consumptionthe conventional of allauxiliary auxiliary loads loads (navigation to the total consumption).systems, radio, etc.) and is kept almost constant around 0.2 kW. The second component is due to HVAC System. This system was disconnected during the experiment at it is observed in the figure, but the air conditioning was suddenly connected/disconnected during the second trip, to register this event, which is observed with a 0.25 kW peak at 3018 s. Figure 8b shows the traction power and the total auxiliary loads. It is observed that the traction power is variable depending on the driving conditions.

Energies 2018, 11, 412 13 of 23

Figure8a shows the total auxiliary loads during these three consecutive trips. This consumption has two different components, the first one is due to the conventional auxiliary loads (navigation systems, radio, etc.) and it remained almost constant at around 0.2 kW. The second component is due to the HVAC System. This system was disconnected during the experiment at it is observed in the figure, but the air conditioning was suddenly connected/disconnected during the second trip to register this event, which is observed as a 0.25 kW peak at 3018 s. Figure8b shows the traction power and the total auxiliary loads. It is observed that the traction powerEnergies is variable 2018, 11, x depending FOR PEER REVIEW on the driving conditions. 13 of 23

0.4 Power [kW] for Auxiliary Loads (radio, lights, etc.) Auxiliary power [kW] (HVAC)

0.2

0.2

0.1

0 0 0 1000 2000 3000 4000 5000 6000 Time [s] (a)

10000 Power [kW] for TRACTION 0.5 Auxiliary power [kW] (HVAC+auxiliary loads Power [kW] Power

0 0 0 1000 2000 3000 4000 5000 6000 7000

(b)

Figure 8. (a) Total auxiliary loads (b) Traction power and Auxiliary power (in [kW]) for the three Figure 8. (a) Total auxiliary loads (b) Traction power and Auxiliary power (in [kW]) for the three consecutive trips. consecutive trips. Figure 9 presents the different events detected by the app. Blue stems represents acceleration/braking events, orange‐brown stems indicate turn events (to the left or to the right) and finally, green stairs shows the stop periods. All stems signals are weighted by their total energy, therefore, the longer the stem, the greater the contained energy and the higher their abruptness.

Energies 2018, 11, 412 14 of 23

Figure9 presents the different events detected by the app. Blue stems represents acceleration/braking events,Energies orange-brown 2018, 11, x FOR PEER stems REVIEW indicate turn events (to the left or to the right) and finally, green15 of 24 stairs shows the stop periods. All stems signals are weighted by their total energy, therefore, the longer the stem,finally, the greater green thestairs contained shows the energy stop periods. and the All higher stems their signals abruptness. are weighted by their total energy, therefore, the longer the stem, the greater the contained energy and the higher their abruptness.

(a)

(b)

Figure 9. (a) Detected events of the three representative trips. (b) Zoom over an area with events. Figure 9. (a) Detected events of the three representative trips. (b) Zoom over an area with events.

Energies 2018, 11, 412 15 of 23

4.2.1. Cluster 1 (Smooth Ride) Representative Trip

This initial trip was performed with a driver and a single passenger (Mp = 160 kg). Figure 10 shows the detected events (Figure 10a) and the speed and elevation profile (Figure 10b) for this first trip. Energies 2018, 11, x FOR PEER REVIEW 15 of 23

Events, 1st trip 6

5 Turn Abruptness Acceleration Abruptness 4

3

2

1

0 0 200 400 600 800 1000 1200 1400 1600 1800 2000 Time [s] (a)

(b)

Figure 10. (a) Detected events during Trip #1 (b) Speed and elevation profiles during Trip #1. Figure 10. (a) Detected events during Trip #1 (b) Speed and elevation profiles during Trip #1.

The results are presented in Figure 11, where the elevation profile is considered in both simulations.The results Figure are presented 11a presents in Figure the result 11, where of the the first elevation simulation profile scenario, is considered where the in bothdriving simulations. events Figurewere 11 nota presents initially theconsidered result of in the the first model. simulation It is observed scenario, that where the energy the driving consumed events by werethe simulation not initially consideredmodel is in2.497 the model.kWh while It is observedthe real energy that the consumption energy consumed registered by the was simulation 2.5575 kWh. model The is 2.497average kWh whileconsumption the real energy simulated consumption was 102.9539 registered Wh/km, was while 2.5575 the kWh. average The average consumption consumption registered simulated was 105.4008 Wh/km. The mean square error was 0.4182. Figure 11b presents the result of the simulation considers both driving events (acceleration and turning events). It is observed that the energy consumed by the simulation model is 2.588 kWh while the real energy consumption registered was 2.5575 kWh. The average consumption simulated was

Energies 2018, 11, x FOR PEER REVIEW 17 of 24

Energies 2018The, 11 , results 412 are presented in Figure 11, where the elevation profile is considered in both16 of 23 simulations. Figure 11a presents the result of the first simulation scenario, where the driving events were not initially considered in the model. It is observed that the energy consumed by the simulation was 102.9539model is Wh/km,2.497 kWh while while the the average real energy consumption consumption registered registered was was 105.4008 2.5575 kWh. Wh/km. The average The mean squareconsumption error was 0.4182. simulated was 102.9539 Wh/km, while the average consumption registered was Figure105.4008 11 Wh/km.b presents The mean the result square of error the simulation was 0.4182. considers both driving events (acceleration and turning events).Figure 11b It is presents observed the thatresult the of energythe simulation consumed considers by the both simulation driving events model (acceleration is 2.588 kWh and while the realturning energy events). consumption It is observed registered that the energy was 2.5575 consumed kWh. by Thethe simulation average consumption model is 2.588 kWh simulated while was 106.6572the real Wh/km, energy while consumption the average registered consumption was 2.5575 registered kWh. The was avera 105.4008ge consumption Wh/km. simulated The mean was square error106.6572 was 0.191. Wh/km, while the average consumption registered was 105.4008 Wh/km. The mean square error was 0.191.

(a)

(b)

Figure 11. Trip #1 (a) Driving events, shown in Figure 9, are not considered in this simulation (b) Figure 11. Trip #1 (a) Driving events, shown in Figure9, are not considered in this simulation Driving events are considered. (b) Driving events are considered.

4.2.2. Cluster 2 (Aggressive Driving) Representative Trip This trip included an additional passenger (incrementing the total weight of the car compared to the former trip, Mp = 230 kg). Figure 12 shows the detected events (Figure 12a) and the speed and elevation profile (Figure 12b) for this second trip). Energies 2018, 11, 412 17 of 23 Energies 2018, 11, x FOR PEER REVIEW 17 of 23

Events, 2nd trip 7 Turn Abruptness Acceleration Abruptness 6

5

4

3

2

1

0 0 200 400 600 800 1000 1200 1400 1600 1800 Time [s] (a)

(b)

Figure 12. (a) Detected events during Trip #2 (b) Speed and elevation profiles during Trip #2. Figure 12. (a) Detected events during Trip #2 (b) Speed and elevation profiles during Trip #2.

The results are presented in Figure 13, where again, the elevation profile has been considered in bothThe simulations. results are Figure presented 13a inpresents Figure the 13 ,results where of again, the first the simulation elevation profile scenario, has which been considereddoes not ininclude both simulations. the driving Figureevents, 13anda presents it is observed the results that the of energy the first consumed simulation by the scenario, simulation which model does is not include3.0054 the kWh driving while the events, real energy and it isconsumption observed that registered the energy was 3.565 consumed kWh. The by the average simulation consumption model is 3.0054simulated kWh whilewas 123.389 the real Wh/km, energy while consumption the average registered consumption was 3.565registered kWh. was The 146.3635 average Wh/km. consumption The simulatedmean square was error 123.389 was Wh/km, 0.44229. while the average consumption registered was 146.3635 Wh/km. The meanFigure square 13b error shown was the 0.44229. response of the proposed consumption model during the second simulationFigure 13 scenariob shown (including the response all detected of the proposed driving consumptionevents, shown model in Figure during 12a). the It is second observed simulation that scenariothe energy (including consumed all detected by the simulation driving events, model shown is 3.391 in kWh Figure while 12a). the It isreal observed energy thatconsumption the energy consumed by the simulation model is 3.391 kWh while the real energy consumption registered was

Energies 2018, 11, x FOR PEER REVIEW 19 of 24

include the driving events, and it is observed that the energy consumed by the simulation model is 3.0054 kWh while the real energy consumption registered was 3.565 kWh. The average consumption simulated was 123.389 Wh/km, while the average consumption registered was 146.3635 Wh/km. The Energiesmean2018 square, 11, 412error was 0.44229. 18 of 23 Figure 13b shown the response of the proposed consumption model during the second simulation scenario (including all detected driving events, shown in Figure 12a). It is observed that 3.565the kWh. energy The consumed average consumptionby the simulation simulated modelwas is 3.391 139.22 kWh Wh/km, while while the real the energy average consumption consumption registeredregistered was was 146.3635 3.565 kWh. Wh/km. The average The mean consumption square error simulated was 0.4422. was 139.22 Wh/km, while the average consumption registered was 146.3635 Wh/km. The mean square error was 0.4422.

(a)

(b)

Figure 13. Trip #2 (a) Driving events, shown in Figure 11, are not considered in this simulation (b) Figure 13. Trip #2 (a) Driving events, shown in Figure 11, are not considered in this simulation Driving events are considered. (b) Driving events are considered.

4.2.3. Cluster 3 (Mild Driving) Representative Trip

The initial condition of this trip is equal to the previous one, with the same number of passengers (one driver and two passengers, Mp = 230 kg). Figure 14 shows the detected events (Figure 14a) and the speed and elevation profile (Figure 14b) for this third trip). Energies 2018, 11, 412 19 of 23 Energies 2018, 11, x FOR PEER REVIEW 19 of 23

Events, 3rd trip 6 Turn Abruptness Acceleration Abruptness 5

4

3

2

1

0 0 200 400 600 800 1000 1200 1400 1600 1800 Time [s] (a)

(b)

Figure 14. (a) Detected events during Trip #3 (b) Speed and elevation profiles during Trip #3. Figure 14. (a) Detected events during Trip #3 (b) Speed and elevation profiles during Trip #3.

The final results are presented in Figure 15, where both simulation scenarios include the elevationThe final profile. results In are Figure presented 15a the in driving Figure events 15, where have both not simulationbeen considered, scenarios while include in Figure the 15b elevation all profile.driving In events Figure for 15 thea the third driving trip are events included have in the not model. been considered, It is observed, while in the in first Figure scenario 15b (without all driving eventsdriving for events), the third the tripenergy are consumed included by in the simulation model. It model is observed, is 2.7758 in kWh the while first scenario the real energy (without drivingconsumption events), registered the energy was consumed 3.1775 kWh. by The the average simulation consumption model is 2.7758simulated kWh was while 113.0258 the real Wh/km, energy consumptionwhile the average registered consumption was 3.1775 registered kWh. The was average 129.3805 consumption Wh/km. The simulatedmean square was error 113.0258 was 0.4731. Wh/km, while theDuring average the consumptionsecond scenario registered (considering was 129.3805all driving Wh/km. events shown The mean in Figure square 14a), error the was energy 0.4731. consumedDuring by the the second simulation scenario model (considering is 2.9812 kWh all while driving the eventsreal energy shown consumption in Figure registered14a), the energywas consumed by the simulation model is 2.9812 kWh while the real energy consumption registered

Energies 2018, 11, x FOR PEER REVIEW 21 of 24

The final results are presented in Figure 15, where both simulation scenarios include the elevation profile. In Figure 15a the driving events have not been considered, while in Figure 15b all driving events for the third trip are included in the model. It is observed, in the first scenario (without driving events), the energy consumed by the simulation model is 2.7758 kWh while the real energy consumption registered was 3.1775 kWh. The average consumption simulated was 113.0258 Wh/km, Energies 2018, 11, 412 20 of 23 while the average consumption registered was 129.3805 Wh/km. The mean square error was 0.4731. During the second scenario (considering all driving events shown in Figure 14a), the energy wasconsumed 3.1775 kWh. by the Thesimulation average model consumption is 2.9812 kWh simulated while the was real 121.3863 energy consumption Wh/km, while registered the average was consumption3.1775 kWh. registered The average was 129.3805 consumption Wh/km. simulated The mean was square 121.3863 error Wh/km, was 0.12482. while the average consumption registered was 129.3805 Wh/km. The mean square error was 0.12482.

(a)

(b)

Figure 15. Trip #3 (a) Driving events, shown in Figure 13, are not considered in this scenario (b) Figure 15. Trip #3 (a) Driving events, shown in Figure 13, are not considered in this scenario (b) Driving Driving events are considered in this scenario. events are considered in this scenario.

5.Conclusions Climate change is currently one of the main challenges facing the international community. It is a phenomenon whose environmental, economic and social causes and consequences, intimately linked with the current model of economic development, require new solutions that allow a better management of energy. The progressive introduction of electric vehicles is one of the key factors in the change of the energy model, and accurate information on consumption and use models, is essential to correctly assess its impact. Moreover, the application of Big Data techniques to this field leads to a Energies 2018, 11, 412 21 of 23 better comprehension of the context, so the acquisition of the greatest amount of information is a key process and smartphones are a perfect fit for this purpose. The use of smartphones sensors has resulted in a simple way to obtain info from the vehicle, including abrupt driver behavior events which are useful to improve the consumption model of electrical vehicles, and allow a personalized estimation of range without involving intrusive systems. They allow the solution to be universalized without being linked to specific hardware that represents a barrier to entry. Thus, an accurate, and efficient energy consumption model has been implemented providing information for real-time eco-driving systems that can enhance the energy efficiency of EVs. The proposed model can be easily integrated into richer modeling frameworks including different levels of transport electrification and traffic simulation. With the presented application and the training of the neural networks with more than 22,000 trips it was demonstrated that it is possible to classify abrupt events into left-right turn events, acceleration events and braking events. A value of abruptness can be also assigned to each event, which is useful for such personalized energy consumption models. In any case, it opens the field for future research regarding the impact of these kind of events and driving behaviors on the traffic flow. Concerning the validation with the real consumption, representative trips were chosen to be simulated by the proposed model. The results show that including the driving behavior in this model can improve the accuracy by up to 50%. Three different scenarios were simulated, corresponding to three driving behaviors. In the first scenario (smooth ride), the total error between the simulated consumption and the real registered was reduced from 2.36% (if the abrupt events were not considered) to 1% (if the events were considered). In the second scenario (aggressive ride), the total error was reduced from 15.7% to 4.8%. Finally, in the last scenario (mild ride), the total error was reduced from 12.6% to 6.17%. The accuracy of the model is reduced when the driving style become more aggressive. Even in this more aggressive condition, the simulation that includes the events modeling provides a better response than the model that does not include such events.

Acknowledgments: This work has been partially financed by the Spanish Ministry of Economy and Competitiveness and the European Union (FEDER) within the framework of the project DEMS: “Sistema distribuido de gestión de energía en redes eléctricas inteligentes (TEC2015-66126-R)” and DSSL: “Deep & Subspace Speech Learning (TEC2015-68172-C2-2-P)”. Author Contributions: Jesús Fraile-Ardanuy and David Jiménez have developed the consumption electric vehicle model, designing the validation experiments. Sara Hernández and Javier Serrano developed the neural network for the event processing. Ruben Fernández developed the classification model for the events with the training samples. Federico Álvarez performed the testing design and estimation of improvement of the model when considering the driving events. Conflicts of Interest: The authors declare no conflict of interest.

References

1. International Energy Agency. Global EV Outlook: Understanding the Electric Vehicle Landscape to 2020; International Energy Agency: Paris, France, 2013. 2. International Energy Agency. Global EV Outlook 2017; International Energy Agency: Paris, France, 2017. Available online: https://www.iea.org/publications/freepublications/publication/GlobalEVOutlook2017. pdf (accessed on 8 February 2018). 3. Drivesapp. Available online: www.driviesapp.com (accessed on 8 February 2018). 4. Plötz, T.; Hammerla, N.Y.; Olivier, P. Feature learning for activity recognition in ubiquitous computing. In Proceedings of the IJCAI, International Joint Conference on Artificial Intelligence, Barcelona, Spain, 16–22 July 2011; Volume 22, pp. 1729–1734. Energies 2018, 11, 412 22 of 23

5. Yao, S.; Hu, S.; Zhao, Y.; Zhang, A.; Abdelzaher, T. Deepsense: A unified deep learning framework for time-series mobile sensing data processing. In Proceedings of the 26th International Conference on World Wide Web, Perth, Australia, 3–7 April 2017; International World Wide Web Conferences Steering Committee: Geneva, Switzerland, 2017; pp. 351–360. 6. Giannotti, F.; Nanni, M.; Pedreschi, D.; Pinelli, F.; Renso, C.; Rinzivillo, S.; Trasarti, R. Unveiling the complexity of human mobility by querying and mining massive trajectory data. VLDB J. Int. J. Very Large Data Bases 2011, 20, 695–719. [CrossRef] 7. Wahlström, J.; Skog, I.; Händel, P. Driving Behavior Analysis for Smartphone-based Insurance Telematics. In Proceedings of the 2nd Workshop on Physical Analytics, Florence, Italy, 22 May 2015; ACM: New York, NY, USA, 2015; pp. 19–24. 8. Phan, T. Intelligent Energy-Efficient Triggering of Geolocation Fix Acquisitions Based on Transitions between Activity Recognition States. In Mobile Computing, Applications and Services; Springer International Publishing: Basel, Switzerland, 2013; pp. 104–121. 9. Oshin, T.O.; Poslad, A.; Ma, A. A method to evaluate the energy-efficiency of wide-area location determination techniques used by smartphones. In Proceedings of the IEEE 15th International Conference on Computational Science and Engineering, Nicosia, Cyprus, 5–7 December 2012; pp. 326–333. 10. Dunlap, S. Persistent Location Tracking on Mobile Devices and Location Profiling. Patent US 20130085861 A1, 4 April 2013. 11. Basir, O.A.; Jamali, S.H.; Miners, W.B.; Toonstra, J. Method of Correcting the Orientation of a Freely Installed Accelerometer in a Vehicle. Patent US 20130081442 A1, 4 April 2013. 12. Van Ly, M.; Martin, S.; Trivedi, M.M. Driver Classification and Driving Style Recognition using Inertial Sensors. In Proceedings of the IEEE Intelligent Vehicles Symposium (IV), Gold Coast, Australia, 23–26 June 2013. 13. Johnson, D.A.; Trivedi, M.M. Driving Style Recognition Using a Smartphone as a Sensor Platform. In Proceedings of the 14th International IEEE Conference on Intelligent Transportation Systems (ITSC), Washington, DC, USA, 5–7 October 2011; pp. 1609–1615. 14. Fazeen, M.; Gozick, B.; Dantu, R.; Bhukhiya, M.; González, M.C. Safe Driving Using Mobile Phones. IEEE Trans. Intell. Transp. Syst. 2012, 13, 1462–1468. [CrossRef] 15. Pozo, R.F.; Gomez, L.A.H.; Meco, D.L.; Vercher, J.B.; Muñoz, V.M.G. Method for Detecting Driving Events of a Vehicle Based on a Smartphone. Patent US 20160016590 A1, 21 January 2016. 16. Alvarez, A.D.; Garcia, F.S.; Naranjo, J.E.; Anaya, J.J.; Jimenez, F. Modeling the driving behavior of electric vehicles using smartphones and neural networks. IEEE Intell. Transp. Syst. Mag. 2014, 6, 44–53. [CrossRef] 17. Meseguer, J.E.; Toh, C.K.; Calafate, C.T.; Cano, J.C.; Manzoni, P. Driving styles: A mobile platform for driving styles and fuel consumption characterization. J. Commun. Netw. 2017, 19, 162–168. [CrossRef] 18. Larminie, J.; Lowry, J. Electric Vehicle Technology Explained, 2nd ed.; John Wiley & Sons: Chichester, UK, 2012; ISBN 978-1-119-94273-3. 19. Ehsani, M.; Gao, Y.; Gay, S.E.; Emadi, A. Modern Electric, Hybrid Electric, and Fuel Cell Vehicles: Fundamentals, Theory, and Design, 2nd ed.; CRC Press LLC: Boca Raton, FL, USA, 2016. 20. Schaltz, E. Electric Vehicles—Modelling and Simulations. In Electric Vehicles-Modelling and Simulations; Soylu, S., Ed.; InTech: London, UK, 2011; p. 487, ISBN 978-953-307-477-1. [CrossRef] 21. Asamer, J.; Graser, A.; Heilmann, B.; Ruthmair, M. Sensitivity analysis for energy demand estimation of electric vehicles. Transp. Res. Part D Transp. Environ. 2016, 46, 182–199. [CrossRef] 22. Genikomsakis, K.N.; Mitrentsis, G. A computationally efficient simulation model for estimating energy consumption of electric vehicles in the context of route planning applications. Transp. Res. Part D Transp. Environ. 2017, 50, 98–118. [CrossRef] 23. NREL (National Renewable Energy Laboratory). FASTSim: Future Automotive Systems Technology Simulator. 2014. Available online: https://www.nrel.gov/transportation/fastsim.html (accessed on 8 February 2018). 24. Fiori, C.; Ahn, K.; Rakha, H.A. Power-based electric vehicle energy consumption model: Model development and validation. Appl. Energy 2016, 168, 257–268, ISSN 0306-2619. [CrossRef] 25. Alves, J.; Baptista, P.C.; Gonçalves, G.A.; Duarte, G.O. Indirect methodologies to estimate energy use in vehicles: Application to battery electric vehicles. Energy Convers. Manag. 2016, 124, 116–129, ISSN 0196-8904. [CrossRef] Energies 2018, 11, 412 23 of 23

26. Zhang, R.; Yao, E. Electric vehicles’ energy consumption estimation with real driving condition data. Transp. Res. Part D Transp. Environ. 2015, 41, 177–187, ISSN 1361-9209. [CrossRef] 27. Lee, C.-H.; Wu, C.-H. A Novel Big Data Modeling Method for Improving Driving Range Estimation of EVs. IEEE Access 2015, 3, 1980–1993. [CrossRef] 28. Available online: https://www.nissanusa.com/electric-cars/leaf/versions-specs/ (accessed on 8 February 2018).

© 2018 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).