Flexible EV Energy Consumption Estimation Approach

Calculating the Energy Consumption of Electric Vehicles for a given track, independent of coordinate system and distance metric.

Mohammed El Batya
comsystoreply
15 min readMay 13, 2024

--

This article is about calculating the energy consumption of an electric vehicle on a given track. More precisely, it is about calculating the energy consumption based on recorded or predicted waypoints with attached timestamps.

Introduction

My approach will be agnostic to the coordinate system of the waypoints. The recordings could originate from a real vehicle or from a virtual vehicle moving in a simulated world. Since this method is also independent
of the initial coordinate system, it does not matter if the recordings are using GPS, a Cartesian coordinate system, or something else.

The only requirement is to be able to calculate the distance between two waypoints. A distinct feature of this method is its ability to take mass into account. This is especially interesting for trucks and public transport vehicles, since they will load/unload cargo and passengers along their path, which can heavily impact energy consumption.

Though the fundamental principles are very well understood, applying them in a coordinate-system-agnostic way can be challenging. All the necessary calculations and underlying assumptions will be explained so that this method can be easily implemented in an arbitrary programming language for any kind of system.

The Waypoints

The main goal is to create a method that does not depend on where the data comes from. To ensure this level of independence, it is important to separate the basic physics calculations from the specifics of the data source.

For this reason, the waypoints will be limited to just a few essential attributes. Enough to allow an accurate calculation of energy consumption — nothing more. The calculations will not need to know anything about the original coordinate system, the exact way distances are measured, or the precise positions of waypoints.

This is a key decision because positions are closely associated with the coordinate system they’re measured in. Therefore, location-specific attributes like latitude, longitude, or three-dimensional coordinates (x, y, z) will not be used.

Instead, the focus will be on the attributes that directly impact energy consumption, such as time, distance, altitude, and vehicle mass, as they change from waypoint to waypoint.

I will assume that the waypoints were recorded or predicted in a previous step, which is outside the scope of this article. In essence, this might be achieved by recording a GPS track of a moving vehicle, or by predicting the track of a vehicle with a route planning system.

Waypoint attributes

The waypoints are expected to have the following attributes:

travel time (t)
Relative time since departure in seconds.

distance (s)
Relative distance traveled since departure in meters. This is a recording of how far the vehicle has
gone since it started moving.

height (h)
Relative altitude difference compared to the altitude at departure. This is important for correct calculations when driving uphill or downhill. If there is no height information available, like in a 2D simulation
with an x-y-coordinates system, just set it to 0.

mass (m)
Total vehicle weight in kg. This can change during the ride, e.g., due to (un)loading cargo or letting passengers in/out.

Waypoint indices

The waypoints and their attributes are indexed chronologically, starting at zero. I will assume that one waypoint will be recorded about every second.

Shorter time intervals would increase the resolution, improving the accuracy. Longer intervals will lead to decreased accuracy.

It depends on the use case what resolution fits best. It is not relevant for the outlined approach, though.

For simplification, the time is encoded in the indices. This means functions will be written like F_i = m a_i instead of F(t_i) = m a(t_i).

The first waypoint has the index 0 and the last one is indexed with n.

The Distance

Although the traveled distance at each waypoint is needed, this approach is independent of the actual distance metric. Not being concerned with how the distance is measured is a great advantage. Various methods exist to
calculate distances, like the Manhattan Distance [1], Haversine [2], or Euclidean Distance [3]. This method works, regardless of which metric is used. The distance could even be calculated from a graph of distances between nodes [4], not using a conventional coordinate system at all.

Energy Calculation

The goal is to calculate the battery charge difference ∆B from arrival to departure. This is done by breaking down the journey into segments, from one waypoint to the next, and calculating the small changes in battery charge for each segment ∆B_i, where the index i indicates the waypoint where the segment ends.

This method needs to process two segments before it can calculate the first battery delta. Therefore, the first available battery difference is ∆B_2.

The battery charge for electric vehicles is commonly given in kilowatt-hours (kWh).

It is worth mentioning that ∆B_i can be either positive or negative. The reason is that an electric vehicle can consume and produce energy. Energy production happens through recuperation (also known as regenerative braking) [5], which converts kinetic energy from braking into stored energy.

Work, Energy, Efficiency

I will focus on the vehicle’s movement and ignore other factors like energy consumption from a HVAC (heating, ventilation, and air conditioning) system.

A running motor is doing work in the physical sense. That work requires energy coming from the battery. Work (and energy) is commonly given in Joules, but can easily be converted to kWh when needed [11].

Battery-to-Wheel Efficiency

A considerable amount of energy gets lost on its path from within the battery, over the powertrain, through the wheels, to the road. This loss needs to be accounted for.

Modern EVs do have a Battery-To-Wheel (BTW) efficiency of about 75% (ηBTW = 0.75) [7] [5]. This is much better than typical cars with conventional engines, which are around 30% efficient [6] [5].

With ηBTW , the battery drain for a segment can be calculated, based on the motor’s energy consumption E_motor_i.

Recuperation Efficiency

There is also a recuperation efficiency factor to account for. It is impossible to recover all the kinetic energy from regenerative braking. Modern EVs seem to have a recuperation efficiency of 70% to 90% e.g., ηG = 0.7 [5]. The remaining braking energy will mainly dissipate as heat.

Recuperation works by switching the motor’s operation mode to become effectively a generator. The generated electrical energy can also be expressed in kWh. Therefore, it can be easily translated to a battery charge gain.

Energy In-/Out-Flow

An electric motor can either consume energy, or generate energy by acting as a generator. But it can’t do both at the same time. Therefore, it can be considered a single abstract component that either generates energy or consumes energy. E_motor will represent both operation modes. A positive value indicates that the motor is consuming energy. A negative value indicates that the motor is producing energy.

Calculating E_motor_i

To calculate E_motor_i, the following reasoning will be applied.

Since the only available spatial information is distance and height, the waypoints are considered to exist in a two-dimensional space, which will be called distance-height-space, short d/h-space. Generating those 2d-waypoints from recordings in an arbitrary coordinate system is basically a projection into that two-dimensional d/h-space.

Following this thought, an additional one-dimensional space will be introduced by dropping the height dimension from d/h-space, retaining the distance dimension. It will be named d-space. The waypoints will be projected from d/h-space into the d-space accordingly. This is done to promote the distance (s) attribute from being a scalar in d/h-space to a one-dimensional position vector in d-space, which is an important property for our upcoming calculations.

With position vectors and corresponding waypoint times, the average velocity v_i in d-space between two waypoints can be determined [8]. The index i indicates the end point of the corresponding segment.

It is essential to understand that this velocity vector v_i only exists in the d-space, not in the initial coordinate system of the waypoints. The direction of v_i twill be always positive since it is based on the traveled distance, which can never decrease, while the actual vehicles’ velocity could point in any kind of direction in accordance with its original coordinate system.

Next, the vehicle’s total kinetic energy at the waypoint i can be calculated, based on v_i [9].

Knowing the total kinetic energy for every waypoint, the difference in kinetic energy between two successive waypoints can be calculated.

The change in kinetic energy ∆E_kin_i from one waypoint to the next might have been caused by acceleration from the motor, but could also be explained by other factors, like simply rolling downhill.

It is, however, certain that one or a combination of multiple forces must have caused this change in kinetic energy.
Although the individual forces are still unknown, their total magnitude |F_total_i| can be already determined [9] [10].

In d-space, the vectors F_total_i and ∆s_i are collinear. Therefore, θ (which is the angle between the two vectors) is either 0 or 180 degrees. Thus, cos(θ) will be either 1 or -1.

Therefore, based on whether the kinetic energy has increased or decreased since the last waypoint, the value of cos(θ) can be determined.

To put F_total_i into d-space, it still needs a direction. It will be given a general forward direction, where it will be pointing backwards when ∆E_kin_i becomes negative. Simply put, F_total_i will point backward when the vehicle slows down and forward when the vehicle speeds up, in the given segment.

We can assume that rotational forces when driving around corners should not have much effect on energy consumption and will be ignored.

Since two waypoints are needed to determine the first velocity value and two velocities are needed to calculate the first value for ∆E_kin, the first calculable total force will be F_total_2. This is acceptable, since skipping the first ~2 waypoints of a route usually will not matter much (assuming a resolution of 1 waypoint per second and the vehicle standing at the beginning). Alternatively, two artificial “standing” waypoints can be added at the beginning, assuming the actual journey also starts with a standing vehicle.

Now it is time to look at the individual forces contributing to F_total_i.

The forces of 1) air drag, 2) gravitation on a slope, 3) rolling resistance of the wheels, 4) the motor’s accelerating force, and 5) the motor’s decelerating resistance (recuperation) will be considered. This is not a complete representation of the real-world physics, but a good enough approximation.

All mentioned forces can be independently calculated based on the already available information, apart from F_motor_i, which is needed to calculate E_motor_i further down. But when calculating the other forces, F_motor_i also reveals itself.

All the forces mentioned in a segment are more or less aligned on a common axis along the vehicle movement path from one waypoint to the next. This will hold true for any kind of initial coordinate system and distance metric.

Since the forces are aligned, we can simply put them into our d-space. Their magnitude stays the same, and their direction will be decided based on whether they are a primarily resisting or accelerating force.

Please note that the motor force and the slope force can switch directions. The motor force switches directions when it is used for recuperation. The slope force, assumed to be a primarily resisting force, switches direction
when driving downhill.

Finally, E_motor_i can be calculated, based on F_motor_i [12].

The next segments will explain how to calculate the missing forces: F_drag_i, F_slope_i and F_rr_i.

Air drag

If an object moves fast enough through the air, it will experience considerable air resistance, known as drag. The drag grows disproportionately with increasing speeds and heavily impacts the energy consumption at higher speeds [16].

The following calculations will not account for any headwinds or tailwinds.

F is the drag force in Newton.
ρ is the fluid density of air in kg/m³.
v is the object velocity in m/s, relative to the fluid.
A is the cross-sectional area of the object.
C_drag is the drag coefficient. This is a dimensionless number, based on the shape of the object, approximating its aerodynamic properties.

The negation is needed to represent its resisting direction in the d-space.

Coming up with a very accurate drag coefficient can get involved. Fortunately, this has already been done for most vehicle shapes and can easily be found online. Buses, for example, do have a C_drag of about 0.6 [13] while the Tesla Model 3 has an impressively low C_drag of 0.219 [14].

Gravity on a Slope

As long as the vehicle drives on a flat ground, its velocity is not directly affected by gravity. This, however, changes as soon as there is a slight slope [15]. The vehicle will have to actively work against that force, trying to maintain its target speed when driving uphill. When driving downhill, the vehicle might need to actively decelerate to maintain its speed.

Decelerating is usually done by using brakes or just not accelerating until the vehicle slows down on its own, caused by resisting forces. We will assume that the vehicle always makes full use of regenerative braking for maximal energy recovery when engaging the brakes. Real electric vehicles, however, do seamlessly transition between regenerative and conventional braking based on different factors like speed. If the parameters and rules of this transition behavior are known, the presented calculations could be potentially adapted to reflect it. This is not in the scope of this article, though.

With an increasing incline, more energy is needed to maintain the speed. With increasing decline, more energy can be recovered. Gravity can’t pull the vehicle straight downwards, unless it is in an unfortunate free fall. Instead, the car will be pulled with a fraction of the full gravitational force downhill along the sloped road. The other fraction is still pulling the vehicle perpendicular toward the ground, ensuring that its wheels stay firmly on the ground.

Splitting up the gravitational force into these two forces is key to our calculations. As you can see in the diagram, F_gravity_i can be split up into F_slope_i and F_normal_i.

F_slope_i is the force the bus needs to overcome when driving uphill. When driving downhill, it is the force that needs to partially counteracted by braking.

F_normal_i is the force pushing the vehicle’s mass through the tires onto the ground. It heavily affects the vehicle’s rolling resistance.

Considering the forces diagram and the contained triangles, F_slope_i and F_normal_i can be calculated if the slope’s angle α_i and F_gravity_i is known.

The angle α will change along the traveled path. Similar to the velocity, it is only possible to calculate the average angle α_i for a segment. The idea is to build a triangle with the distance ∆s_i and the height difference ∆h_i of a
segment.

With basic trigonometry, the slope’s angle α_i can be calculated.

There is, however, a corner case to be aware of. If the vehicle is not moving (∆s_i = 0), there will not be an angle to calculate. In that case, the last known angle can be used instead, assuming the ground is not tilting while the vehicle is standing still.

Please note that sin(α_i) can become negative when driving downhill. With sin(α_i), F_slope_i can be calculated and pointed to the correct direction in d-space.

Rolling Resistance

The last missing force is the rolling resistance of the wheels. This resistance is influenced by numerous factors like the involved materials, the road surface, temperature, and wetness. All of those factors are being commonly hidden behind a single coefficient, the so-called rolling resistance coefficient C_rr [17].

Again, the resulting force vector is to be seen in the context of our d-space, pointing “backwards”, thus being negative.

F_normal_i is the force pulling the vehicle perpendicular onto the ground by gravity, and can be determined from the previous force triangle on a slope.

Like with the drag coefficient, it can get quite involved to come up with an accurate C_rr. Fortunately, there are comprehensive tables of C_rr values widely available. Bus wheels, for example, do have a C_rr of about 0.008 on dry asphalt. Depending on the use-case, it might also be worth considering to dynamically adapting the C_rr per section C_rr_i to changing weather and underground conditions during the ride.

Since the formula for F_rr does not depend on the velocity, it is important to remember that the rolling resistance force won’t move the vehicle on its own. As soon as F_rr overpowers all opposing forces, it stops applying any additional force, even if it had the capacity to do so. Otherwise, the bus would start rolling backwards. This doesn’t happen because F_rr also opposes itself as soon as the wheel isn’t rolling anymore, equally resisting to both directions at the same time.

Therefore, F_rr is considered to be “switched on” as soon as the vehicle starts moving and “switched off” as soon as the vehicle stops.

This was the last missing piece for calculating ∆Bn_i thus ∆B_2_n, which is the journey’s aggregated energy consumption.

Summary

This is a method for calculating the energy consumption of electric vehicles based on waypoints, each characterized by travel time, travel distance, height, and mass. The method is designed to be coordinate-system-agnostic and capable of handling dynamically changing vehicle masses. A feature particularly relevant for trucks and public transportation. It breaks down a journey into segments between waypoints and computes the energy changes for each, accommodating both energy consumption and recuperation through regenerative braking.

The energy calculations exclude factors such as HVAC systems, focusing solely on movement-related parameters extracted from projections in a 2D distance/height space (d/h-space) and a 1D distance space (d-space). It outlines the mechanics of determining total kinetic energy changes, air drag, gravity effects on slopes, and rolling resistance. These are synthesized into total force vectors associated with each segment, revealing the motor force and the vehicle’s energy interactions.

In summary, it is a flexible and versatile algorithm for energy computation for electric vehicles that can be adapted for a wide range of applications, enhancing route planning, vehicle simulation, and energy management systems for electric mobility solutions.

Disclaimer

As of writing this article, the outlined approach is in a conceptual state and has not yet been validated against real-world vehicle data. In a simulated environment, the results look very plausible, though.

I’m also no physicist, and therefore, don’t blindly trust my assumptions and calculations, although they already passed a first internal review.

Feedback and contact

Please let me know if you would like me to write more about e-mobility and smart charging topics. Positive or constructive feedback in the comments section is always welcome, and leave a few claps if you liked it.

Want to work with me and my colleagues on smart charging solutions? Just contact me or visit smartgrid-comsystoreply.de!

References

[1] Manhatten Distance,https://en.wikipedia.org/wiki/Taxicab_geometry
[2] Haversine Formula,https://en.wikipedia.org/wiki/Haversine_formula
[3] Euclidean Distance,https://en.wikipedia.org/wiki/Euclidean_distance
[4] Distance (graph theory),https://en.wikipedia.org/wiki/Distance_(graph_theory)
[5] Regenerative Braking, https://en.wikipedia.org/wiki/Regenerative_braking
[6] Where the Energy Goes: Gasoline Vehicles, https://www.fueleconomy.gov/feg/atv-ev.shtml
[7] Where the Energy Goes: Electric Cars, https://www.fueleconomy.gov/feg/atv.shtml
[8] Velocity, https://en.wikipedia.org/wiki/Velocity
[9] Kinetic Energy, https://en.wikipedia.org/wiki/Kinetic_energy
[10] Dot Product, https://en.wikipedia.org/wiki/Dot_product
[11] Joule, https://en.wikipedia.org/wiki/Joule
[12] Work (physics), https://en.wikipedia.org/wiki/Work_(physics)
[13] The experimentally and numerically determination of the drag coefficient of a bus model, https://
dergipark.org.tr/tr/download/article-file/579107
[14] Tesla Model 3, https://en.wikipedia.org/wiki/Tesla_Model_3
[15] Inclined Plane, https://en.wikipedia.org/wiki/Inclined_plane
[16] Drag Equation,https://en.wikipedia.org/wiki/Drag_equation
[17] Rolling resistance,https://en.wikipedia.org/wiki/Rolling_resistance

--

--