Report Fin

Download as pdf or txt
Download as pdf or txt
You are on page 1of 71

MACHINE LEARNING BASED METHOD FOR

REMAINING RANGE PREDICTION OF E-CYCLE

PROJECT REPORT

Submitted by

ARUNBALAJI S 211718104013
BALARAMAN K 211718104016
GOKUL K 211718104039
HARIHARAN S 211718104043

in partial fulfillment for the award of the degree

of

BACHELOR OF ENGINEERING
IN
COMPUTER SCIENCE AND ENGINEERING
RAJALAKSHMI INSTITUTE OF TECHNOLOGY
ANNA UNIVERSITY: CHENNAI 600 025

JUNE 2022

I
ANNA UNIVERSITY: CHENNAI 600 025

BONAFIDE CERTIFICATE

Certified that this project report “MACHINE LEARNING BASED


METHOD FOR REMAINING RANGE PREDICTION OF
ECYCLE” is the bonafide work of “ARUNBALAJI S
(211718104013), BALARAMAN K(2117181016), GOKUL K
(211718104039) and HARIHARAN S (211717104043)”, who carried
out the project work under my supervision.

SIGNATURE: SIGNATURE:
Dr. D.C JOY WINNIE WISE, Ms. M. RAMYA,
B.E., M.E., (Ph.D), B.Tech., M.E.,
HEAD OF THE DEPARTMENT, SUPERVISOR,
Dept. of Computer Science and Dept. of Computer Science and
Engg., Engg.,
Rajalakshmi Institute of Rajalakshmi Institute of
Technology, Technology,
Kuthambakkam Post, Kuthambakkam Post,
Chennai - 600 124 Chennai - 600 124

The University viva-voce is held on

___________________

INTERNAL EXAMINER EXTERNAL EXAMINER

II
ACKNOWLEDGEMENT

We express our sincere gratitude to our honorable Chairperson


Dr.(Mrs.)THANGAM MEGANATHAN, M.A., M.Phil., Ph.D., and
Chairman Thiru. S.MEGANATHAN, B.E., F.I.E., for their constant
encouragement to do this project and also during the entire course
period.

We thank our Principal Dr. P.K. NAGARAJAN and our Head of


the department Dr.D.C. JOY WINNE WISE, B.E, M.E, Ph.D., for
their valuable suggestions and guidance for the development and
completion of this project.

Words fail to express our gratitude to our Project coordinators


Dr. O.PANDITHURAI, M.E (Ph.D), Ms .S .UMA, M.E (Ph. D), and
Internal guide Ms. M. RAMYA, B.Tech M.E.,who took special interest
on our project and gave their consistent support and guidance during all
stages of this project.

Finally, we thank all the teaching and non-teaching faculty


members of the DEPARTMENT OF COMPUTER SCIENCE AND
ENGINEERING of our college who helped us to complete this project.

Above all we thank our parents and family members for their
constant support and encouragements for completing this project.

III
ABSTRACT

Limited driving range is one of the major obstacles to the


widespread application of electric vehicles. The limited range
together with the long charging time has been pointed out as
the main technical factors affecting the acceptance of electric
vehicles. A successful integration of electric vehicles into
future mobility concepts requires not only the development of
faster battery charging systems and facilities but also the
application of advanced driving assistance systems that support
the driver with reliable information regarding the vehicle’s
driving range. Accurately predicting the remaining driving
range can effectively reduce the range anxiety of drivers. A
blended machine learning model was proposed to predict the
remaining driving range of EVs based on weight of the person
and historical driving data. The blended model fuses two
advanced machine learning algorithms of Extreme Gradient
Boosting Regression Tree and Light Gradient Boosting
Regression Tree. The proposed model was trained to learn the
relationship between the driving distance and the proposed
features such as cumulative output energy of the motor and the
battery, different driving patterns, and temperature of the
battery). In addition, an anchor based strategy was proposed
and was seen to be able to effectively eliminate the unbalance
distribution of dataset. The results of experiments suggest that
our proposed anchor-based blended model has better
performances with a smaller prediction error range of [-0.8,
0.8] as compared with previous methods.

Keywords: Machine Learning, Remaining range prediction,


Electric Vehicle.

IV
TABLE OF CONTENTS

CHAPTER NO. TITLE PAGE NO.

ABSTRACT IV
LIST OF FIGURES VII
LIST OF ABBREVATIONS VIII

1 INTRODUCTION 1
1.1 INTRODUTION 1
1.2 AIM OF THE PROJECT 3
1.3 PROJECT DOMAIN 3
1.4 SCOPE OF THE PROJECT 3
2 LITERATURE SURVEY 20

3 PROJECT DESCRIPTION 24
3.1 EXISTING SYSTEM 24
3.2 PROPOSED SYSTEM 26
3.3 FEASIBILITY STUDY 27
3.3.1 ECONOMIC FEASIBILITY 27
3.3.2 TECHNICAL FEASIBILITY 28
3.3.3 STANDARDS FEASIBILITY 28
3.4 SYSTEM SPECIFICATION 29
3.4.1 HARDWARE REQUIREMENTS 29
3.4.2 SOFTWARE REQUIREMENTS 29

V
CHAPTER NO. TITLE PAGE NO.

4.3 UML DIAGRAM 31


4.3.1 USE CASE DIAGRAM 31
4.3.2 CLASS DIAGRAM 33

5 IMPLEMENTATION AND TESTING 34


5.1 INPUT AND OUTPUT 41
5.1.1 INPUT DESIGN 41
5.1.2 OUTPUT DESIGN 42
5.2 TYPES OF TESTING 43
5.2.1 UNIT TESTING 43
5.2.2 INTEGRATION TESTING 43
5.2.3 FUNCTIONAL TESTING 43
5.3.4 WHITE BOX TESTING 44
5.2.5 BLACK BOX TESTING 44

6 RESULTS AND DISCUSSIONS 45


6.1 EFFICIENCY OF THE PROPOSED 45
SYSTEM
6.2 ADVANTAGES OF PROPOSED SYSTEM 45
6.3 SAMPLE CODE 45

VI
CHAPTER NO. TITLE PAGE NO.

7 CONCLUSION AND 57
FUTURE ENHANCEMENT
8 REFERENCE 59

VII
LIST OF FIGURES

FIGURE TITLE PAGE NO.


NO.
1.1 Factors influencing range 2
1.2 Load Cell 5
4.1 Architecture Diagram 30
4.2 Data Flow Diagram 31
4.2.1 Use Case Diagram 32
4.2.2 Class Diagram 33
4.3 Sequence Diagram 34
5.1 Load cell sensor 37
5.2 Connecting Load cell with raspberry pi 38
5.3 Connecting raspberry pi with load cell and 39
mobile application

5.4 Home Screen 44


5.5 Available e-cycle screen 44
5.6 Scanner Screen 44
5.7 Navigation Screen 44

VIII
LIST OF ABBREVIATIONS

ML Machine Learning

EV Electric Vehicle

RDR Remaining Driving Range

GPS Global Positioning System

BDT Bagged Decision Tree

XGBoost Extreme Gradient Boost

MLR Multiple Linear Regression

IX
1
CHAPTER 1

INTRODUCTION

The remaining driving range (RDR) represents one of the main


obstacles for the success of electric vehicles. The limited range
together with the long charging time has been pointed out as the
main technical factors affecting the acceptance of electric vehicles.
A successful integration of electric vehicles into future mobility
concepts requires not only the development of faster battery
charging systems and facilities but also the application of advanced
driving assistance systems that support the driver with reliable
information regarding the vehicle‟s driving range. To accomplish
this, algorithms that accurately model the driving load of the road
ahead, and thereby better predict the RDR, are required.
Unfortunately future driving conditions are difficult to predict. The
driving style, road conditions or the traffic situation are some of
the factors that stochastically affect the RDR. The randomness of
these factors makes the RDR prediction problem difficult.
Nowadays, EV has a limited energy storage capacity and the range
is strongly dependently of the driver behavior. Consequently, and
due to the fact that the batteries cannot be quickly recharged during
a journey, it is essential that a precise range prediction is available
to the driver of the EV, in order to check if the desirable
destination is possible to be reached without charging, or even if to
reach this destination a driving optimization.
The EV with its main variables: the model of the vehicle mainly
their performance under different scenarios, taking into account the
speed and the acceleration, the chemical technology of the batteries

1
the batteries characteristics and the EV powertrain. All of these
variables of the EV will influence the SoC and consequently the
range prediction. The batteries SoC and others relevant parameters,
are provided to the main control system through CAN-bus
communication, and then these information is stored in a Data
Base, in order to predict the range available.
The driver behavior: speed and acceleration taken from EV
through the CAN-bus communication, the driver past behavior,
weight, and driving direction that is acquired based on the GPS
information.
Environment: current location, traffic conditions taken from a web
service, road information obtained through a distance graph,
weather information wind and temperature - taken from a web
service or from an EV sensor, altitude taken from the GPS device.

Fig 1.1 Factors influencing range

2
1.2 AIM OF THE PROJECT:

To predict the remaining range of the vehicle using load cell sensor
which is based on the weight of the user and also predict the range
based on historical driven data.

1.3 PROJECT DOMAIN:

The remaining range prediction is based is based on Machine Learning.


The algorithm XGBoost algorithm which boosts excellent performance
on most regression problem basically comes under ML.

DOMAIN INTRODUCTION

1.3.1MACHINE LEARNING (ML):

Machine learning (ML) is a type of artificial intelligence (AI) that allows


software applications to become more accurate at predicting outcomes
without being explicitly programmed to do so. Machine learning
algorithms use historical data as input to predict new output values.

Recommandation engines are a common use case for machine learning.


Other popular uses include fraud detection, spam filtering, malware
threat detection, business process automation (BPA) and Predictive
maintenance.

3
DIFFERENT TYPES OF MACHINE LEARNING

Classical machine learning is often categorized by how an algorithm


learns to become more accurate in its predictions. There are four basic
approaches:supervised learning, unsupervised learning, semi-supervised
learning and reinforcement learning. The type of algorithm data
scientists choose to use depends on what type of data they want to
predict.

 Supervised learning: In this type of machine learning, data scientists


supply algorithms with labelled training data and define the variables
they want the algorithm to assess for correlations. Both the input and
the output of the algorithm is specified.
 Unsupervised learning: This type of machine learning involves
algorithms that train on unlabeled data. The algorithm scans through
data sets looking for any meaningful connection. The data that
algorithms train on as well as the predictions or recommendations
they output are predetermined.
 Semi-supervised learning: This approach to machine learning
involves a mix of the two preceding types. Data scientists may feed
an algorithm mostly labeled training data, but the model is free to
explore the data on its own and develop its own understanding of the
data set.
 Reinforcement learning: Data scientists typically use reinforcement
learning to teach a machine to complete a multi-step process for
which there are clearly defined rules. Data scientists program an
algorithm to complete a task and give it positive or negative cues as it
works out how to complete a task. But for the most part, the
algorithm decides on its own what steps to take along the way.

4
1.3.2 LOAD CELL

Load cell is a sensor or a transducer that converts a load or force acting


on it into an electronic signal. This electronic signal can be a voltage
change, current change or frequency change depending on the type of
load cell and circuitry used.

Fig 1.2 Load Cell

There are many different kinds of load cells.

Resistive load cells work on the principle of piezo-resistivity. When a


load/force/stress is applied to the sensor, it changes its resistance. This
change in resistance leads to a change in output voltage when a input
voltage is applied.

Capacitive load cells work on the principle of change of capacitance


which is the ability of a system to hold a certain amount of charge when
a voltage is applied to it. For common parallel plate capacitors, the

5
capacitance is directly proportional to the amount of overlap of the
plates and the dielectric between the plates and inversely proportional to
the gap between the plates.

How does a resistive load cell works ?

A load cell is made by using an elastic member (with very highly


repeatable deflection pattern) to which a number of strain gauges are
attached.

In this particular load cell shown in above figure, there are a total of four
strain gauges that are bonded to the upper and lower surfaces of the load
cell.

When the load is applied to the body of a resistive load cell as shown
above, the elastic member, deflects as shown and creates a strain at those
locations due to the stress applied. As a result, two of the strain gauges
are in compression, whereas the other two are in tension as shown in
below animation.

When to use a load cell?


A load cell measures mechanical force, mainly the weight of objects.
Today, almost all electronic weighing scales use load cells for the
measurement of weight. They are widely used because of the accuracy
with which they can measure the weight. Load cells find their
application in a variety of fields that demand accuracy and precision.
There are different classes to load cells, class A, class B, class C &
Class D, and with each class, there is a change in both accuracy and
capacity.

6
Load Cell Types
Load cell designs can be distinguished according to the type of output
signal generated (pneumatic, hydraulic, electric) or according to the way
they detect weight (bending, shear, compression, tension, etc.)

Hydraulic load cells

Miniature load cellHydraulic cells are force -balance devices,


measuring weight as a change in pressure of the internal filling fluid. In
a rolling diaphragm type hydraulic force sensors, a load or force acting
on a loading head is transferred to a piston that in turn compresses a
filling fluid confined within an elastomeric diaphragm chamber.

As force increases, the pressure of the hydraulic fluid rises. This


pressure can be locally indicated or transmitted for remote indication or
control. Output is linear and relatively unaffected by the amount of the
filling fluid or by its temperature.

If the load cells have been properly installed and calibrated, accuracy
can be within 0.25% full scale or better, acceptable for most process
weighing applications. Because this sensor has no electric components,
it is ideal for use in hazardous areas.

Typical hydraulic load cell applications include tank, bin, and hopper

7
weighing. For maximum accuracy, the weight of the tank should be
obtained by locating one force sensor at each point of support and
summing their outputs.

Pneumatic load cells

Pneumatic load cells also operate on the force-balance principle. These


devices use multiple dampener chambers to provide higher accuracy
than can a hydraulic device. In some designs, the first dampener
chamber is used as a tare weight chamber.

Pneumatic load cells are often used to measure relatively small weights
in industries where cleanliness and safety are of prime
concern. Miniature load cell

The advantages of this type of load cell include their being inherently
explosion proof and insensitive to temperature variations. Additionally,
they contain no fluids that might contaminate the process if the
diaphragm ruptures. Disadvantages include relatively slow speed of
response and the need for clean, dry, regulated air or nitrogen.

8
Strain-gauge load cell
Strain gauge load cells are a type of load cell where a strain gauge
assembly is positioned inside the load cell housing to convert the load
acting on them into electrical signals. The weight on the load cell is
measured by the voltage fluctuation caused in the strain gauge when it
undergoes deformation.

The gauges themselves are bonded onto a beam or structural member


that deforms when weight is applied. Modern load cells have 4 strain
gauges installed within them to increase the measurement accuracy. Two
of the gauges are usually in tension, and two in compression, and are
wired with compensation adjustments.

When there is no load on the load cell, the resistances of each strain
gauge will be the same. However, when under load, the resistance of the
strain gauge varies, causing a change in output voltage. The change in
output voltage is measured and converted into readable values using a
digital meter.

Piezoresistive load cell

Similar in operation to strain gauges, piezoresistive force sensors


generate a high level output signal, making them ideal for simple
weighing systems because they can be connected directly to a readout
meter. The availability of low cost linear amplifiers has diminished this

9
advantage, however. An added drawback of piezoresistive devices is
their nonlinear output. Miniature load cell

Inductive and reluctance load cells

Both of these devices respond to the weight-proportional displacement


of a ferromagnetic core. One changes the inductance of a solenoid coil
due to the movement of its iron core; the other changes the reluctance of
a very small air gap.

Magnetostrictive load cells

The operation of this force sensor is based on the change in permeability


of ferromagnetic materials under applied stress. It is built from a stack of
laminations forming a load-bearing column around a set of primary and
secondary transformer windings. When a force is applied, the stresses
cause distortions in the flux pattern, generating an output signal
proportional to the applied load. This is a rugged sensor and continues to
be used for force and weight measurement in rolling mills and strip mills.

10
1.3.3 RASPBERRY PI:

The Raspberry Pi is a low cost, credit-card sized computer that


plugs into a computer monitor or TV, and uses a standard keyboard and
mouse. It is a capable little device that enables people of all ages to
explore computing, and to learn how to program in languages like
Scratch and Python. It‟s capable of doing everything you‟d expect a
desktop computer to do, from browsing the internet and playing high-
definition video, to making spreadsheets, word-processing, and playing
games. It uses what's called a system on a chip(Opens in a new
window), which integrates the CPU and GPU in a single integrated
circuit, with the RAM, USB ports, and other components soldered onto
the board for an all-in-one package.

It doesn't have onboard storage, but it has an SD card slot you can use to
house your operating system and files. The Raspberry Pi is small,
doesn't use much power, and is relatively inexpensive.

Raspberry Pi, developed by Raspberry Pi Foundation in


association with Broadcom. From the moment you see the shiny green
circuit board of Raspberry Pi, it invites you to tinker with it, play with it,
start programming, and create your own software with it. Earlier, the
Raspberry Pi was used to teach basic computer science in schools but

11
later, because of its low cost and open design, the model became far
more popular than anticipated.

It is widely used to make gaming devices, fitness gadgets, weather


stations, and much more. But apart from that, it is used by thousands of
people of all ages who want to take their first step in computer science.

It is one of the best-selling British computers and most of the


boards are made in the Sony factory in Pencoed, Wales.

Generations and Models

In 2012, the company launched the Raspberry Pi and the current


generations of regular Raspberry Pi boards are Zero, 1, 2, 3, and 4.

Generation 1 Raspberry Pi had the following four options −

 Model A
 Model A +
 Model B
 Model B +

Among these models, the Raspberry Pi B models are the original


credit-card sized format.

On the other hand, the Raspberry Pi A models have a smaller and more
compact footprint and hence, these models have the reduced

12
connectivity options. Raspberry Pi Zero models, which come with or
without GPIO (general-purpose input output) headers installed, are the
most compact of all the Raspberry Pi boards types.

In this modern age when computers are sleek, Raspberry Pi seems alien
with tiny codes printed all over its circuit board. That‟s a big part of
Raspberry Pi‟s appeal. Let us have a look at what we can do with this
appealing circuit board.

1.3.1 RASPBERRY PI

USES OF RASPBERRY PI:

Like a desktop computer, you can do almost anything with the


Raspberry Pi. You can start and manage programs with its graphical
windows desktop. It also has the shell for accepting text commands.

We can use the Raspberry Pi computer for the following –

 Playing games
 Browsing the internet
 Word processing

13
 Spreadsheets
 Editing photos
 Paying bills online
 Managing your accounts.

The best use of Raspberry Pi is to learn how a computer works. You can
also learn how to make electronic projects or programs with it.

It comes with two programming languages, Scratch and Python.


Through GPIO (general-purpose input output) pins, Raspberry Pi can be
connected to other circuits, so that you can control the other devices of
your choice.

Retailers and Distributors

Some of the global retailers from whom you can buy your Raspberry Pi
computers are as follows. You can also refer to their respective websites
for details about the Raspberry Pi computers.

 Electronics manufacturing company, Pimoroni


 Electronics store, The Pi Hut
 U.S. based electronics company, Adafruit

14
You can also get it from the following Raspberry Pi‟s distributors
 Electronic components supplier, RS

 Electronic components distributor, Element14

Requirements

To use your Raspberry Pi board, you need to buy a few other bitsand
pieces. Following is the checklist of what else we might need

Monitor

The Raspberry Pi uses a high-definition multimedia interface


(HDMI) connection for video feed, and you can connect your monitor
directly with this interface connection, if your monitor has an HDMI
socket.

Television

In the similar way, if you have High Definition Television (HD


TV), you can also connect it to your Raspberry Pi using an HDMI
socket. It will give you a crisper picture.

USB hub

Depending on the model, Raspberry Pi has 1, 2, or 4 Universal


Serial Bus (USB) sockets. You should consider using powered USB to
connect other devices to your Raspberry Pi at the same time.

15
Keyboard and Mouse

Raspberry Pi only supports the USB keyboards and mouse. If you


are using keyboards and mouse with PS/2 connectors, you need to
replace them with Raspberry Pi.

SD or MicroSD card

As we know that the Raspberry Pi does not have a hard drive, so


we need to use SD cards or MicroSD cards (depending on the model) for
storage.

USB Wi-Fi adapter

If you are going to use model A and A+ then, you need to buy a
USB Wi-Fi adapter for connecting to the internet. This should be done
because these Raspberry models do not have an Ethernet socket.

External hard drive

If you want to share your collection of music and movies, you need
to use an external hard drive with your Raspberry Pi model. You can
connect the same by using a powered USB cable.

16
Speakers

The Raspberry Pi has a standard audio out socket. This socket is


compatible with headphones and speakers that use a 3.5mm audio jack.
We can plug headphones directly to it.

Power supply

For power supply, it uses a Micro USB connector. Hence theoretically, it


is compatible with a mobile phone and tablet charger.

Cables

Following are some of the cables, which you need for the connections to
the Raspberry Pi computer −

 HDMI cable
 HDMI-to-DVI adapter, if you are using a Digital Visual Interface
(DVI) monitor.
 RCA cable, if you want to connect to an older television.
 Audio cable
 Ethernet cable

Compatible and Incompatible Devices

17
To minimize the cost, the Raspberry Pi models are designed to be used
with whatever accessories we have. But, as we know that in practice, not
all the devices can be compatible.

You need to check for compatible and incompatible devices as


incompatible USB, keyboards and mouse can cause problems.

1.1.1 RASPBERRY PI-OPERATING SYSTEM:

Before you get started with your Raspberry Pi board, you need to
provide with an OS (operating system). Linux is the most frequently
used OS on the Raspberry Pi.

For using an OS, we need to create a Secure Digital (SD) or MicroSD


card with an OS on it. The prerequisite for setting up the SD or MicroSD
is a computer having an internet connection and the ability to write to
SD or MicroSD cards.

FEATURES OF RASPBERRY PI:

In terms of end use, it is important to note that the performance of the


new Raspberry Pi 4 Model B is equivalent to that of an entry-level x86
computer. Among the main features of this latest Raspberry Pi
computer, we can note:

18
 A high-performance 64-bit quad-core processor
 Dual display support with resolutions up to 4K via a pair of micro-
HDMI ports
 Hardware video decoding up to 4Kp60
 4 GB of RAM
 A connection to the dual-band wireless local area network 2.4/5.0
GHz
 Bluetooth 5.0 / Gigabit Ethernet / USB 3.0 / PoE features (via a
separate HAT PoE add-on module)

1.4 PROJECT SUMMARY:

The basic principle of the project is predicting the remaining range


of an E-Vehicle. Range prediction is done using the sensor named as
load with the help of the Mobile application which is integrated with
Raspberry pi using Bluetooth connectivity.

1.5 CHAPTER CONCLUSION:

The challenge in the development and deployment is taken into


action. The above-mentioned challenge is addressed by design and
Implementation of load sensor in e-cycle using Raspberry pi.

19
CHAPTER 2

LITERATURE SURVEY

[1] Modi, S., Bhattacharya, J., Basak, P.: Convolutional neural


network–bagged decision tree: A hybrid approach to reduce electric
vehicle’s driver’s range anxiety by estimating energy consumption
in real-time. Soft Comput.
25(3), 2399–2416 (2021)
To overcome range anxiety problem of electric vehicles (EVs), an
accurate real-time energy consumption estimation is necessary, which
can be used to provide the EV‟s driver with information about the
remaining range in real time. A hybrid CNN–BDT approach has been
developed, in which convolutional neural network (CNN) is used to
provide an energy consumption estimate considering the effect of
temperature, wind speed, battery‟s SOC, auxiliary loads, road elevation,
vehicle speed and acceleration. Further, bagged decision tree (BDT) is
used to fine-tune the estimate. Unlike existing techniques, the proposed
approach does not require internal vehicle parameters from manufacturer
and can easily learn complex patterns even from noisy data. The
comparison results with existing techniques show that the developed
approach provides better estimates with least mean absolute energy
deviation of 0.14.

20
[2] Tian, H.Y., Li, X.Y., Liu, F.: Prediction of continued driving
range of battery electric vehicle based on map information and
cyclic SVR model. Automot. Eng. 42(9), 1174–1182 (2020)

Accurately predicting the remaining mileage of electric


vehicles (EVs) can effectively alleviate user's mileage anxiety and
develop refinement of energy management strategy. However,
traditional prediction methods not only consume time and resources, but
also accumulate errors and lack interpretability. In this paper, we
proposed a model based on dimension expansion and model fusion
strategy, which uses the extreme gradient boosting (XGBoost) algorithm
to directly predict the remaining mileage of EVs. After pre-processing
the real running data of EVs, we constructed the field of remaining
driving range and analyzed the relationship between features and
remaining driving range, and then directly predicted the remaining
driving mileage. Compared with other machine learning methods,
XGBoost model has the highest accuracy. Then dimensional extended
data set was obtained based on prior knowledge and symbol conversion,
which improved the model performance. Finally, the model fusion
strategy was adopted to further improve the generalization ability and
stability of the model. The experimental results show that the Bootstrap
aggregating (Bagging) fusion model has the highest predictive
performance on the test set and outperformed other methods. The
maximum RAE is not more than 3.5%, RMSE is less than 3km .

21
[3] Y. Tao, M. Huang, Y. Chen, and L. Yang, ‘‘Orderly charging
strategy of battery electric vehicle driven by real-world driving
data,’’ Energy, vol. 193, 2020.
The work preprocessed the real-world driving data of 1000 battery
electric vehicles (BEVs) in Zhengzhou, China. Then a scheduling model
of electric vehicles on time dimension was established based on the
processed data. The mathematical model could meet the operation
requirements of grid side and user side. The grid-side optimization
minimized the system‟s equivalent load fluctuation, and the user-side
was optimized to maximize the charging capacity of electric vehicles.
The mathematical model was solved by the genetic algorithm toolbox in
Matlab software. Besides, we obtained the quantity distribution of BEV
access to the power grid, parking time distribution, parking duration
distribution and initial state of charge (SOC) distribution at the
beginning of charging by analyzing the real-world driving data. These
distribution curves were used to obtain the driving and charging habits
of BEV drivers. By comparing the optimized orderly charging strategy
with the random charging, in the case of meeting the user‟s demand for
charging power, the peak and valley difference and the equivalent load
fluctuation of the power grid were significantly reduced by 22 and
22.7%, respectively. It greatly improves the security and economy of the
grid.

22
[4] Y. Luo, G. Feng, S. Wan, S. Zhang, V. Li, and W. Kong,
‘‘Charging scheduling strategy for different electric vehicles with
optimization for convenience of drivers, performance of transport
system and distribution network,’’ Energy, vol. 194, 2020.
With the popularization of electric vehicles, large-scale electric
vehicle charging may negatively impact drivers, the power grid, and
traffic conditions. Currently, research conducted on the charging and
battery swap of electric vehicles is insufficient. The objective for
optimization and the type of electric vehicle proposed by other papers
are limited in scope. In order to achieve an overall optimization of the
whole system, the driver demands, the road traffic speed, the number of
vehicles in the charging station and the charging network load are
considered in the development of the charging scheduling strategy for
electric vehicles. Such a strategy can further enhance driver convenience
in terms of making decisions for charging and battery swap of electric
vehicles. Moreover, different types of electric vehicles are taken into
account for a more practical proposed scheduling strategy. Utilizing
MATLAB and MATPOWER, a simulation platform is established to
validate the strategy. Simulation results demonstrate that the proposed
scheduling strategy can relieve local traffic jams, smooth network load
curve, increase safety and economy of the power network, and decrease
the number of charging electric vehicles in station.

23
CHAPTER 3

PROJECT DESCRIPTION

3.1 EXISTING SYSTEM:

There are many solutions to relieve range anxiety. Some researchers


focused on accurately predicting the energy consumption rate of EV to
reduce the range anxiety.
Simulation-based methods usually need to establish a simulation model
through the specific vehicle and detailed internal vehicle parameters; so
it is hard to generalize. As a result, some researchers have turned their
attention to the data-driven method to predict the remaining driving
range.

Data-driven based methods have the merits of simplicity as they do not


need a physical model of vehicle. In the datadriven method, the constant
updating of driving data facilitates real-time prediction of the remaining
driving ran. Data-driven methods usually involve using a regression
model fitted to historical driving data to predict the remaining driving
range under the assumption of constant values of driving parameters, a
growing hierarchical self organizing map (GHSOM) was used to
perform clustering to obtain the relationship between vehicle

24
speed and energy efficiency; and then the accelerated battery aging
experiments were performed to obtain the battery capacity profile.
Data-driven based approaches are independent on physical models.
However, they require high-quality data preprocessing and feature
engineering, as the raw datasets may include a lot of irrelevant data

LIMITATIONS OF EXISTING SYSTEM

Data-driven based approaches are independent on physical models.


However, they require high-quality data preprocessing and feature
engineering, as the raw datasets may include a lot of irrelevant data.

Simulation-based methods usually need to establish a simulation model


through the specific vehicle and detailed internal vehicle parameters; so
it is hard to generalize.

25
3.2 PROPOSED SYSTEM

To overcome this issues the proposed system uses XGBoost machine


learning algorithm and installed with load cell to calculate the weight. In
working model The basic principle of the project is to predict the
remaining range of the e-vehicle based on user weight and previous
history data. A load cell converts the force such as tension pressure and
weight into an electrical signal that can be measured and standardised.A
touch sensor detects touch or near proximity without relying on physical
contact. Predict the range with the help of the Mobile application which
is integrated with Raspberry pi using Bluetooth connectivity.

3.2.1 OVERVIEW:
The below diagram consist of load cell sensor, raspberry pi, Bluetooth
module. The load cell sensor is connected with raspberry pi and it is
integrated with the mobile application. Sensor convert the physical
weight into electric signal to predict the range. The connectivity is
happening with the help of Bluetooth module. You can see the
remaining range in the mobile Application

26
Load cell Range
sensor Prediction

Mobile
Application

Raspberry Bluetooth
pi

Fig 3.2 System overview Diagram

3.3 FEASIBILITY STUDY:

Feasibility studies seek to objectively and logically identify the


strengths andweakness of the established business or proposed venture,
as well as the opportunities and risk given by the emvironment, the
resources required to proceed, and, ultimately, the propects for success.

3.3.1 ECONOMIC FEASIBILITY:

The evaluation is based on an outline design of system


requirements for input, processes , output, fields, programs, and
procedures.

27
3.3.2 TECHNICAL FEASIBILITY:

This study is carried out to determine the technical feasibility, or the


system‟s technical requirements. Any system that is created must not
place a heavy demand on the avaliable techniacal resources.

3.4 SYSTEM SPECIFICATION

3.4.1 HARDWARE REQUIRMENTS

 Raspberry Pi 4 - RAM - 4.00 GB


 RAM – 4.00 GB
 x64 Bit Version
 Hard Disk - 80 GB or above
 Sensor – Load Cell
3.4.2 SOFTWARE REQUIREMENTS
 Operating System – Linux
 IDE – Android Studio
 Language - Python
3.4.3 STANDARDS AND POLICIES:
The purpose of the study is to determine the user‟s level of acceptance
of the system. This includes the process of educating the useron how the
system effectively. The user should not be afraid of the system, but
rather accept it as a need.

28
CHAPTER 4

MODULE DESCRIPTION

4.1 GENERAL ARCHITECTURE

Fig 4.1 Architectute Diagram

In fig 4.1, The architecture overview of the proposed system is


represented.

The overall architecture explain about the enitre process of project.


Load cell is connected with e-cycle using Raspberry Pi and
connected with mobile application using bluetooth

29
4.2 DATA FLOW DIAGRAM

Fig 4.2 Data Flow Diagram

A dataflow diagram shows the way information flows through a process


or system. It includes data inputs and outputs, data stores, and the
various subprocesses the data moves through. DFDs are built using
standardized symbols and notation to describe various entities and their
relationship.

Data flow diagram visually represent systems and processes that


would be hard to describe in a chunk of text. You can use these
diagrams to map out an existing system and make it better or plan out a
new system for implementation. Visualizing each element makes it
easy to identify inefficiencies and produce the best possible system.

30
4.3 UML DIAGRAM

The Unified Modelling Language (UML) was created to forge


a common, semantically and syntactically rich visual modelling
language for the architecture design, and implementation of complex
software systems both structurally and behaviorally. UML has
applications beyond software development, such as process flow in
manufacturing.

It is analogous to blueprints used in other fields, and consists of


different types of diagrams. In the aggregate, UML diagrams describe
the boundary, structure, and the behavior of the system and the objects
within it.

UML is not a programming language but there are tools that can be
used to generate code in various languages using UML diagrams.
UML has a direct relation with object-oriented analysis and design.

4.3.1 USE CASE DIAGRAM

A use case is a list of steps that define interaction between an


actor (a human who interacts with the system or an external system)
and the system itself. Use case diagrams depict the specifications of a
use case and model the functional units of a system. These diagrams

31
help development teams understand the requirements of their system,
including the role of human interaction therein and the differences
between various use cases. A use case diagram might display all use
cases of the system, or just one group of use cases with similar
functionality.

1. To begin a use case diagram, add an oval shape to the center


of the drawing.

2. Type the name of the use case inside the oval.

3. Represent actors with a stick figure near the diagram, then


use lines to model relationships between actors and use
cases.

Fig 4.1 Use Case Diagram

32
4.3.2 CLASS DIAGRAM:

Class diagrams represent the static structures of a system,


including its classes, attributes, operations, and objects. A class
diagram can display computational data or organizational data in form
of implementation classes and logical classes, respectively. There may
be overlap between these two groups.

1. Classes are represented with a rectangular shape that is split


into thirds. The top section displays the class name, while
the middle section contains the class attributes. The bottom
section features the class operations (also known as
methods).

2. Add class shapes of your class diagram to model the


relationship between those objects.

Fig 4.2 Class Diagram

33
CHAPTER 5

IMPLEMENTATION AND TESTING

MODULE 1:

DATA PREPROCESSING

The raw traffic data gathered from various loop detector sensors is pre-
processed by this module. The sensors, as explained in the section
"Datasets," give real-time traffic data such as traffic flow, occupancy
rate, and speed, among other things. In this study, historical speed data
from a variety of sensors was used for trials. The pre-processing of raw
traffic data is described in depth in the subsections that follow.
Anomalies in traffic data gathered from various loop detector sensors
can include outliers owing to noise, missing values due to sensor
failures, and so on. As a result, data must be cleaned before being used
in research. As a result, data in this study was cleaned beforehand
utilising several data cleaning approaches. For example, it was
discovered that some loop detectors have a substantial number of
missing values in the dataset. As a result, such sensors were removed
from the dataset when the number of missing values exceeded a certain
threshold.

34
MODULE 2:

CONNECTING LOAD CELL SENSOR AND RASPBERRY PI

A load cell is a transducer which converts force into a measurable


electrical output. Although there are many varieties of load cells, strain
gage based load cells are the most commonly used type. Before the load
cell is connected to the HX711 weight sensor, it should be mounted on
the two plates. For this I made markings with a ballpoint pen on the
wooden boards, where the screws come in. With a drill I drilled the
holes and inserted the screws. Between the screw and the load cell, there
should be a nut, which serves as a protection to the board. The nuts
should be well tightened so that the screws do not slip off theboard.

Fig 5.1 Load Cell

35
If the construction is complete, we can go to the HX711. The four cables of
the Load Cell must be connected to the weight sensor. The green HX711,
however, has six connections, of which we only need four for the cables.
The connection is as follows:

 Red: E+
 Black: E-
 Green: A-
 White: A+

The pins labeled B+/B- remain empty. Apparently there are versions of the
sensor. Where the pins are labeled S+/S- instead of A+/A-.

Now you just have to connect the sensor to the Raspberry Pi. Since this
also has only four connections, the wiring is quite simple:

 VCC to Raspberry Pi Pin 2 (5V)


 GND to Raspberry Pi Pin 6 (GND)
 DT to Raspberry Pi Pin 29 (GPIO 5)
 SCK to Raspberry Pi Pin 31 (GPIO 6)

36
Schematically, the connection to a Raspberry Pi 4 then looks as follows:

Fig 5.2 Connecting load cell with raspberry pi

Raspberry Pi Weight Sensor Software


To measure the weight and to read out the value we use a Python library.
Although there are corresponding C ++ libraries First, we will clone the
project:

git clone https://github.com/tatobari/hx711py

It contains an example.py file which shows the function of the library


and can also be used. Before that, however, a few adjustments are
necessary.

First we will edit this file:

cd hx711py
sudo nano example.py

37
We are looking for the line in which the reference unit is set and
comment it out with a hashtag sign, so that the line looks as follows:

1 #hx.set_reference_unit(92)

Save it with CTRL+O and exit with CTRL+X. This reference unit is the
divisor, but we must first find it out in the next step. Meanwhile you can
run the example (abort with CTRL+C). The values should appear in the
range 0 to 200, but this is not important at this point.

sudo python example.py

E-Cycle

Fig 5.3 Connecting raspberry pi with load cell and appArchitecture

38
MODULE 3:
REMAINING RANGE PREDICTION

In this section, we have used three stages of experiments to


gradually explore the optimal prediction method. The workflow is as
follows: Frist, we perform data preprocessing on the original data set,
construct the remaining mileage label field, and get the initial feature
data set. Second, we build new features based on prior knowledge and
symbol conversion, and obtain a dimensional expanded data set. Finally,
on the basis of the dimensional expansion data, use the Bagging model
fusion method to train the XGBoost model, and then directly predict the
remaining driving range prediction.
The prediction of the remaining driving range of electric vehicles is
essentially a regression problem. We built a mapping relationship model
to predict the value of the unknown sample, the input is the feature
vector (independent variable) constituted by the key operating
parameters of the vehicle, and the output result is the remaining driving
range of the EVs (dependent variable). For this portion of our study,
different regression algorithms were used to predict the remaining
driving range. After algorithm research, we chose three machine
learning algorithms to preliminarily verify the prediction effect on the
initial feature data set.

39
XGBoost Algorithm
Extreme Gradient Boosting (XGBoost) is an open-source library
that provides an efficient and effective implementation of the gradient
boosting algorithm. Although other open-source implementations of the
approach existed before XGBoost, the release of XGBoost appeared to
unleash the power of the technique and made the applied machine
learning community take notice of gradient boosting more generally.
Shortly after its development and initial release, XGBoost became the
go-to method and often the key component in winning solutions for
classification and regression problems in machine learning competitions.
XGBoost is an implementation of Gradient Boosted decision
trees. XGBoost models majorly dominate in many Kaggle
Competitions. In this algorithm, decision trees are created in sequential
form. Weights play an important role in XGBoost. Weights are
assigned to all the independent variables which are then fed into the
decision tree which predicts results. The weight of variables predicted
wrong by the tree is increased and these variables are then fed to the
second decision tree. These individual classifiers/predictors then
ensemble to give a strong and more precise model. It can work on
regression, classification, ranking, and user-defined prediction
problems.

40
Gradient boosting refers to a class of ensemble machine learning
algorithms that can be used for classification or regression predictive
modeling problems.
Ensembles are constructed from decision tree models. Trees are added
one at a time to the ensemble and fit to correct the prediction errors
made by prior models. This is a type of ensemble machine learning
model referred to as boosting. Models are fit using any arbitrary
differentiable loss function and gradient descent optimization algorithm.
This gives the technique its name, “gradient boosting,” as the loss
gradient is minimized as the model is fit, much like a neural network.

5.2 INPUT AND OUTPUT


5.2.1 INPUT DESIGN

As the framework depends on Raspberry and load cell sensor the


input data is the physical weight, when there‟s pressure on the surface
of a load cell sensor, it converts into electrical signal which acts as
input of the system. Another input is fetched from the dataset to
perform prediction using XGBoost machine learning algorithm.

41
OUTPUT DESIGN

Fig 5.4 Home Screen Fig 5.5Available cycle page

Fig 5.6 Scanner Fig 5.7 Navigation

42
5. 2 TYPES OF TESTING

5.2.1 UNIT TESTING:

The primary goal of unit testing is to take the smallest piece of testable software in
the application, isolate it from the reaminder of the code, and determine it behabes
excatly as you except. Each unit is tested seperately before integrating them into
modules to test the interfaces between moduels. Unit testing has proven its value in
that large perentage of defects are identified is unit tested.

Here testing each model before freezing its already trained layers, taking images
for the dataset, traning the model for lesser epochs is also unit tested.

5.2.2 INTEGARTION TESTING:

Testing is done for each module. After testing all the modules are integrated and
testing of the final system is done with the test data, specially designed to show
that the system will operate successfully in all its aspects. Thus, the system testing
is a confirmation that all is correct and an opportunity to show the user that the
system works.

5.2.3 FUNCTIONAL TESTING:

Functional testing is a quality assurance (QA) process and a type of black box
testing that bases its test cases on the specifications of the software component
under test. Functions are tested by feeding them input and examining the output,
and internal program structure is rarely considered. Functional testing typically
invloves five steps.

43
1. The identification of functions that the software is expected to perform.

2. The creation of input data based on the function‟s specifications.

3. The determination of output based on the funciton‟s specifications.

4. The execution of the test case.

5. The comparison of actual and expected outputs.

5.2.4 WHITE BOX TESTING:

It is the vice versa of the Black Box testing. They do not watch the internal
variables during testing. This gives a clear idea about what is going on during
execution of the system. The point at which the bug occurs were all clear and were
removed.

5.2.5 BLACK BOX TESTING:

In this testing we give input to the system and test the output. Here I do not go for
watching the internal file in the system and what are the changes made on them for
the required output.

44
CHAPTER 6

RESULTS AND DISCUSSIONS

6.1 EFFICIENCY OF THE PROPOSED SYSTEM

The results of experiments suggest that our proposed model has


better performances with a smaller prediction error range of [-0.8, 0.8]
as compared with previous methods.

6.2 CODE

XGBoost Model

Xgboost_light.py

import numpy as np

import pandas as pd

import os

import utils.vis_function as vis_function

import utils.data_clean as data_clean

import xgboost as xgb

45
import model.ml as ml

trips_path = "/media/liang/aabbf09e-0a49-40b7-a5a8-
15148073b5d7/liang/mile_estimator/tijiaocode/origin_silce_plot/train_li
st_recover"

model_save_path = "/media/liang/aabbf09e-0a49-40b7-a5a8-
15148073b5d7/liang/range_prediction/output/models"

import joblib

from utils.common_function import rmse,mae,mape

if _name_ == '_main_':

xgboost_model_save_path = os.path.join(model_save_path, "xgboost.m"


)

train_list_recover = []

silces = np.random.randint(0, 2371, size=2371)

for num,i in enumerate(silces):

trip_i_path = os.path.join(trips_path,"{}.csv".format(i))

temp_values = pd.read_csv(trip_i_path)

46
if(len(temp_values)<15):

continue

train_list_recover.append(temp_values)

print("load %s" % str(i),num)

train_list_recover = data_clean.delet_stopping_trips(train_list_recove
r)

scaler_path = os.path.join(model_save_path,"scaler.m")

train_x,train_y,test_x,test_y = data_clean.train_test_perpare(train_list
_recover,scaler_model_path=scaler_path)

Train = xgb.DMatrix(train_x, label=train_y)

Test = xgb.DMatrix(test_x, label=np.array(test_y))

params = ml.get_parameters_xgb()

split = "training"

if split == "training":

xgbregressor = xgb.train(params, dtrain=Train, num_boost_round=


50000,

47
evals=[(Train, "train"), (Test, "test")], early_stopping
_rounds=1000)

joblib.dump(xgbregressor, xgboost_model_save_path)

else: xgbregressor = joblib.load(xgboost_model_save_path)

preds = xgbregressor.predict(Test)

endl_array = np.array([1]).repeat(test_y.size, axis=0)

test_y = np.array(test_y)

end_index = np.argwhere(np.array(test_y) > endl_array)

test_y = test_y[end_index]

preds = preds[end_index]

score_rmse = rmse(preds, test_y)

score_mae = mae(preds, test_y)

score_mape = mape(preds, test_y)

print("rmse-score:", score_rmse)

print("mae-score:", score_mae)

print("mape:", score_mape)

48
print("done")

print("done")

LightGBM Model
import numpy as np
import pandas as pd
import os
import utils.vis_function as vis_function
from utils import data_clean
import lightgbm as lgb
import model.ml as ml
trips_path = "/media/liang/aabbf09e-0a49-40b7-a5a8-
15148073b5d7/liang/mile_estimator/tijiaocode/origin_silce_plot/train_list_recover
"
model_save_path = "/media/liang/aabbf09e-0a49-40b7-a5a8-
15148073b5d7/liang/range_prediction/output/models"
import joblib
from utils.common_function import rmse,mae,mape

def light_params():
params = {}
params["tast"] = "train"
params["boosting_type"] = "gbdt"
params["objective"] = "regression"
params["metric"] = {"mae", "rmse"}
params["num_leaves"] = 6

49
params["eta"] = 0.05

params["min_child_weight"] = 0.5
params["bagging_fraction"] = 0.5
params["bagging_freq"] = 1
params['feature_fraction'] = 0.66
params["max_bin"] = 200
params["lambda_l2"] = 0.6571
params["lambda_l1"] = 0.4640
params["gamma"] = 0.0468
params["verbose"] = 1
return params

if _name_ == '_main_':
lightboost_model_save_path = os.path.join(model_save_path, "lightboost.m"
)

train_list_recover = []
silces = np.random.randint(0, 2371, size=2371)
for num,i in enumerate(silces):
trip_i_path = os.path.join(trips_path,"{}.csv".format(i))
temp_values = pd.read_csv(trip_i_path)
if(len(temp_values)<15):
continue
train_list_recover.append(temp_values)
print("load %s" % str(i),num)

50
train_list_recover = data_clean.delet_stopping_trips(train_list_recover)
scaler_path = os.path.join(model_save_path,"scaler.m")
train_x,train_y,test_x,test_y = data_clean.train_test_perpare(train_list_recove
r,scaler_model_path=scaler_path)

Train = lgb.Dataset(train_x, label=np.array(list(train_y)))


Test = lgb.Dataset(test_x, label=np.array(test_y))

params = light_params()
split = "training"
if split == "training":
lgbm_regressor = lgb.train(params=params, train_set=Train,
num_boost_round=50000, valid_sets=[Train,Test],
early_stopping_rounds=1000)

joblib.dump(lgbm_regressor, lightboost_model_save_path)
else:
lgbm_regressor = joblib.load(lightboost_model_save_path)
preds = lgbm_regressor.predict(test_x)
endl_array = np.array([1]).repeat(test_y.size, axis=0)
test_y = np.array(test_y)
end_index = np.argwhere(np.array(test_y) > endl_array)
test_y = test_y[end_index]
preds = preds[end_index]
score_rmse = rmse(preds, test_y)
score_mae = mae(preds, test_y)

51
score_mape = mape(preds, test_y)
print("rmse-score:", score_rmse)
print("mae-score:", score_mae)
print("mape:", score_mape)
print("done")
print("done")

Blended Model

import numpy as np
import pandas as pd
import os
import utils.vis_function as vis_function
import utils.data_clean as data_clean
import xgboost as xgb
import model.ml as ml
trips_path = "/media/liang/aabbf09e-0a49-40b7-a5a8-
15148073b5d7/liang/mile_estimator/tijiaocode/origin_silce_plot/train_list_recover
"
model_save_path = "/media/liang/aabbf09e-0a49-40b7-a5a8-
15148073b5d7/liang/range_prediction/output/models"
import joblib
from utils.common_function import rmse,mae,mape
from trainer.lightgbm_model import light_params
import lightgbm as lgb

52
if _name_ == '_main_':
xgboost_1_model_save_path = os.path.join(model_save_path, "xgboost_1.m
")
xgboost_2_model_save_path = os.path.join(model_save_path, "xgboost_2.m
")
lightboost_1_model_save_path = os.path.join(model_save_path, "lightboost_
1.m")
train_list_recover = []
silces = np.random.randint(0, 2371, size=14)
for num,i in enumerate(silces):
trip_i_path = os.path.join(trips_path,"{}.csv".format(i))
temp_values = pd.read_csv(trip_i_path)
if(len(temp_values)<15):
continue
train_list_recover.append(temp_values)
print("load %s" % str(i),num)
train_list_recover = data_clean.delet_stopping_trips(train_list_recover)
scaler_path = os.path.join(model_save_path,"scaler.m")
anchor_based = False
if anchor_based == True:
train_x,train_y,test_x,test_y,anchor_train,anchor_test = data_clean.train_te
st_perpare(train_list_recover,
scaler_model_path=
scaler_path,

53
using_anchor_based
=anchor_based)
train_y = train_y - anchor_train
test_y = test_y-anchor_test
else:
train_x, train_y, test_x, test_y= data_clean.train_test_perpare(train_list_rec
over,scaler_model_path=scaler_path)
#xgboost data
Train = xgb.DMatrix(train_x, label=train_y)
Test = xgb.DMatrix(test_x, label=np.array(test_y))
params = ml.get_parameters_xgb()
#lightgbm data
Train_lgb = lgb.Dataset(train_x, label=np.array(list(train_y)))
Test_lgb = lgb.Dataset(test_x, label=np.array(test_y))
light_parameters = light_params()
split = "training"
if split == "training":

xgb_1 = xgb.train(params, dtrain=Train, num_boost_round=50000,


evals=[(Train, "train"), (Test, "test")], early_stopping_rounds
=1000)
joblib.dump(xgb_1, xgboost_1_model_save_path)
lgbm_1 = lgb.train(params=light_parameters, train_set=Train_lgb,
num_boost_round=50000, valid_sets=[Train_lgb, Test_lg
b],
early_stopping_rounds=1000)

54
joblib.dump(lgbm_1, lightboost_1_model_save_path)
output_1 = xgb_1.predict(Train)
output_2 = lgbm_1.predict(train_x)
features_for_second_layer = np.concatenate([output_1[...,np.newaxis],outp
ut_2[...,np.newaxis]],axis=1)
xgb_2 = xgb.train(params, dtrain=Train, num_boost_round=50000,
evals=[(Train, "train"), (Test, "test")], early_stopping_rounds=1000)
joblib.dump(lgbm_1, xgboost_2_model_save_path)
else:
xgb_1 = joblib.load(xgboost_1_model_save_path)
xgb_2 = joblib.load(xgboost_2_model_save_path)
lgbm_1 = joblib.load(lightboost_1_model_save_path)
output_1 = xgb_1.predict(Test)
output_2 = lgbm_1.predict(Test_lgb)
features_concat = np.concatenate([output_1[...,np.newaxis],output_2[...,np.ne
waxis]],axis=1)
features_concat = xgb.DMatrix(features_concat, label=test_y)
preds = xgb_2.predict(features_concat)
if anchor_based:
preds = preds+ anchor_test
test_y = test_y + anchor_test
endl_array = np.array([1]).repeat(test_y.size, axis=0)
test_y = np.array(test_y)
end_index = np.argwhere(np.array(test_y) > endl_array)
test_y = test_y[end_index]
preds = preds[end_index]

55
score_rmse = rmse(preds, test_y)
score_mae = mae(preds, test_y)
score_mape = mape(preds, test_y)
print("rmse-score:", score_rmse)
print("mae-score:", score_mae)
print("mape:", score_mape)
print("done")
print("done")

56
CHAPTER 7
CONCLUSION
Accurate prediction of the remaining driving range is important
to EV drivers. In this paper, a two-stage framework for the remaining
driving range prediction of EVs has been proposed by merging two
advanced machine learning algorithms of XGBoost and LightGBM. The
results of experiments show that the blended model has a smaller error
range of [−0.8, 0.8] and a lower RMSE of 0.75 as compared to the error
range of [1.4, 1.4] in previous works. Besides, we use the cumulative
output energy of the motor and the batteries to reflect the battery
degradation, and use driving patterns related features to represent the
energy consumption level. These features, which are proposed for the
first time in our method, can effectively improve the accuracy of
remaining driving range prediction. Adding the cumulative output
energy of the motor and the batteries to the blended model can decrease
the MAPE by 5.27%. Anchor-based strategy was proposed for the first
time in our method, which converts the true label (driving distance) to
the residual values between the baseline and the true label for training.
Anchor-based strategy adopted in remaining driving range prediction
can solve the unbalance distribution of training data and achieve high
performance (i.e. low error range of [-0.8, 0.8]) on the testing data that
follows different distribution from training data.

57
FUTURE ENHANCEMENTS

In future we aim to investigate new methods for speeding up the


prediction time so that to improve the efficiency of system, it should
based on many factors like environment, topography and road condition,
wind, driving style, also we aim to investigate new methods for speeding
up the prediction time so that a real time application can be integrated in
our test vehicle. It is also of high importance to investigate methods for
describing the driving profile in a parametric form.

58
CHAPTER 9

REFERENCES
[1] Modi, S., Bhattacharya, J., Basak, P.: Convolutional neural network–
baggeddecision tree: A hybrid approach to reduce electric vehicle‟s
driver‟s range anxiety by estimating energy consumption in real-time.
Soft Comput.25(3), 2399–2416 (2021).

[2] Li S, Zhang H, Tan H, Zhong Z, Jiang Z (2021) An attention-based


model for travel energy consumption of electric vehicle with traffic
information. Adv Civ Eng 2021:1–10

[3] Tian, H.Y., Li, X.Y., Liu, F.: Prediction of continued driving range
of battery electric vehicle based on map information and cyclic SVR
model. Auto_x0002_mot. Eng. 42(9), 1174–1182 (2020)

[4] Y. Tao, M. Huang, Y. Chen, and L. Yang, „„Orderly charging


strategy of battery electric vehicle driven by real-world driving data,‟‟
Energy, vol. 193, Feb. 2020.

59
[5] Moawad A, Gurumurthy KM, Verbas O, Li Z, Islam E, Freyermuth
V, Rousseau, A (2021) A Deep Learning Approach for Macro-scopic
Energy Consumption Prediction with Microscopic Quality or Electric
Vehicles (nov 2021). arXiv:2111.12861.

[6] Zheng C, Fan X, Wang C, Qi J (2020) GMAN: A Graph Multi-


Attention Network for Traffic Prediction. Proceedings of the AAAI
Conference on Artificial Intelligence 34(01):1234–1241,2020.

[7] Y. Luo, G. Feng, S. Wan, S. Zhang, V. Li, and W. Kong, „„Charging


scheduling strategy for different electric vehicles with optimization for
convenience of drivers, performance of transport system and distribution
network,‟‟ Energy, vol. 194, Mar. 2020.

[8] H. A. Yavasoglu, Y. E. Tetik, and K. Gokce, „„Implementation of


machine learning based real time range estimation method without
destination knowledge for BEVs,‟‟ Energy, vol. 172, pp. 1179–1186,
Apr. 2020, doi:10.1016/j.energy.2020.02.032.

[9] Wei, H., He, C., Li, J.Q., Zhao, L.Q.: Study on method for online
estimating driving range of battery electric vehicle based on actual
driving cycle. J.Highway Transp. Res. Dev. 37(12), 149–158 (2020)

60
[10] Chen, T.H., Wang, X.G., Chu, Y., et al.: T4SE-XGB: Interpretable
sequence-based prediction of type IV secreted effectors using eXtreme
gradient boosting algorithm. Front. Microbiol. 11, 580382 (2020).

[11] Iora, P.; Tribioli, L. Effect of Ambient Temperature on Electric


Vehicles‟ Energy Consumption and Range: Model Definition and
Sensitivity Analysis Based on Nissan Leaf Data. World Electr. Veh. J.
2019, 10.

[12] Bi, J., Wang, Y., Sai, Q., et al.: Estimating remaining driving range
of battery electric vehicles based on real-world data: A case study of
Beijing, China. Energy. 169, 833–843 (2019)

[13] Mercadier, M., Lardy, J.P.: Credit spread approximation and


improvement using random forest regression. Euro. J. Operat. Research.
277(1), 351–365 (2019)

61

You might also like