Kelly-Real Time
Kelly-Real Time
BY
© Copyright 2016
by
Abdul Aziz, 2016
i
CERTIFICATION OF APPROVAL
By
Approved:
__________________________
Mr. Saiful Azrin Bin Mohd Zulkifli
Project Supervisor
January 2016
ii
CERTIFICATION OF ORIGINALITY
This is to certify that I am responsible for the work submitted in this project, that the
original work is my own except as specified in the references and acknowledgements,
and that the original work contained herein have not been undertaken or done by
unspecified sources or persons.
_______________________________
Abdul Aziz Bin Mustaffa Kamal Basha
iii
ABSTRACT
iv
ACKNOWLEDGEMENT
v
TABLE OF CONTENTS
vi
3.4 PROJECT ACTIVITIES & KEY MILESTONES ....................... 23
3.5 GANTT-CHART .......................................................................... 24
3.6 TOOLS.......................................................................................... 26
3.6.1 Software ................................................................................ 26
3.6.2 Hardware ............................................................................... 26
CHAPTER 4 RESULT AND DISCUSSION ............................................................ 27
4.1 Verification of existing Real-Time scan mode program .............. 27
4.1.1 Instantaneous fuel consumption (ml/s) and total fuel
consumption (ml) ............................................................................. 27
4.1.2 Vehicle speed (km/h) and Engine RPM ................................ 29
4.1.3 Data Acquisition ................................................................... 31
4.1.4 Front Panel ............................................................................ 32
4.1.5 Verification of data ............................................................... 33
4.2 Translation of existing Real-time Scan mode program to FPGA
mode ...................................................................................................... 35
4.2.1 Data acquisition and calculation in FPGA mode .................. 35
4.2.2 Data interfacing in Real-time programming ......................... 41
4.3 FPGA program for CAN bus communication between the EMS
and MCU controller ................................................................................ 44
4.3.1 Kelly Controller setup ............................................................. 44
4.3.2 Connection between Kelly Controller, EMS controller and PC
............................................................................................... 48
4.3.3 EMS control program for MCU ............................................ 51
4.4 Graphical Driver Interface (GDI) development............................ 55
CHAPTER 5 CONCLUSION .................................................................................... 56
REFERENCES........................................................................................................... 57
APPENDICES ........................................................................................................... 59
APPENDIX A LABVIEW FPGA BLOCK DIAGRAM ........................ 59
APPENDIX B LABVIEW FPGA FRONT PANEL ............................... 60
APPENDIX C LABVIEW REAL-TIME BLOCK DIAGRAM ............. 61
APPENDIX D LABVIEW REAL-TIME FRONT PANEL ................... 62
vii
LIST OF TABLES
viii
LIST OF FIGURES
ix
Figure 28: DIO0 is initialized to sense falling edges ................................................. 36
Figure 29: The pulse reading time to be execute for every 500ms ............................ 36
Figure 30: Fuel-flow measurement in FPGA mode ................................................... 37
Figure 31: Both DIO1 and DIO2 is initialized to read time of falling edge .............. 37
Figure 32: Vehicle speed measurement in FPGA mode ............................................ 38
Figure 33: Engine RPM measurement in FPGA mode .............................................. 38
Figure 34: USB to RS-232 and RS-232 extension cable ........................................... 44
Figure 35: Connection between Kelly controller and PC .......................................... 45
Figure 36: Kelly Controller setting step 1 [21] .......................................................... 45
Figure 37: Kelly Controller setting step 2 [21] .......................................................... 46
Figure 38: Kelly Controller setting step 3 [21] .......................................................... 46
Figure 39: Kelly Controller setting step 4 [21] ......................................................... 47
Figure 40: Kelly Controller setting step 5 [21] .......................................................... 47
Figure 41: Kelly Controller setting step 5 [21] .......................................................... 48
Figure 42: CAN bus topology [19] ............................................................................ 49
Figure 43: RS-232 pins schematics [19] .................................................................... 49
Figure 44: Kelly J2 pins schematics [20] ................................................................... 49
Figure 45: Example of 120 Ohm cable termination ................................................... 50
Figure 46: CAN bus cable .......................................................................................... 50
Figure 47: Overall hardware connection for CompactRIO, Kelly Controller and PC 51
Figure 48: CAN data acquisition in FPGA programming ......................................... 52
Figure 49: Data interfacing in front panel in Real-time programming ...................... 52
Figure 50: Front panel for end user ............................................................................ 53
Figure 51: NI 9853 data rate setting ........................................................................... 54
x
LIST OF ABBREVIATIONS
xi
CHAPTER 1
INTRODUCTION
The automotive industry nowadays mainly depends on fossil fuel as energy for the
prime mover of the vehicle. This natural resource utilization has contributed to critical
environmental pollution in recent years. Hence, the world nowadays tries to shift their
reliance on fossil fuel to relatively cleaner energy. However, cleaner energy such as
solar, wind, biomass and etc. require high cost of implementation, which makes the
fossil fuel more suitable for use in vehicle.
Since the automotive industry is a sector that greatly depend on this fossil fuel,
revolutionizing the way this natural resource is utilized will effectively aid in reducing
the environmental pollution problem.
The automotive industry today tries to come up with the eco-friendly
automobile such as electric and hybrid electric vehicle. The electric vehicle is designed
to use an electric motor to propel the vehicle, but for hybrid vehicles, it utilizes two
engines propulsion sources, which is the internal combustion engine and the electric
motor. The electric vehicle is a zero pollution energy source, but with the downside of
long charging time since it utilizes battery to store the energy. Meanwhile, for hybrid
electric vehicles it still need to rely on fossil fuel as its energy source. Both these types
of eco-friendly vehicle are relatively expensive. Despite that, it is a great move by
automotive industry in helping to resolve environmental pollution issue.
Therefore, to support the awareness of reducing the reliance on fossil fuel, this
FYP project will support the new approach in building the hybrid vehicle by
converting a conventional vehicle into a hybrid electric vehicle. This conversion
involves conversion components retrofitted in to the internal combustion engine
(ICE)-based vehicle.
1
1.1 Background of project
The Hybrid Electric Vehicle (HEV) for split-parallel drivetrain enables propulsion
power to be provided to both the front and rear axles of a vehicle. As for normal
conventional vehicle, the propulsion power from Internal Combustion Engine (ICE) is
applied only on the front axle. This type of vehicle can be converted into HEV of split-
parallel configuration with minimal modification to its system. This will enable the
vehicle to reduce its fuel consumption. It can be done by replacing the rear wheels with
in-wheel motors (IWM). These IWM require a controller to control and monitor its
operation called Motor Drive/Controller Unit (MCU). The same situation goes to ICE
where its own controller is called Engine Control Unit (ECU). The power from both
MCU and ECU will be synergized, controlled and monitored by an Energy
Management System (EMS) Controller to achieve optimum efficiency in energy
utilization of HEV split-parallel axle architecture. [3, 4] The figure below shows the
configuration of this split-parallel architecture.
In-Wheel Motor
In-Wheel Motor
2
(CAN) module of the EMS controller (NI 9853) can only function in FPGA mode
ONLY. or the EMS controller to communicate with MCU, the EMS controller needs
this specific module (NI 9853). Therefore, this can be solved by converting the existing
program in the EMS controller communicate with the MCU using FPGA program.
Thus, the existing EMS control program needs to be converted from the Real-Time
Scan Mode program to the FPGA program to enable communication between the EMS
and MCU controllers. This program conversion is the first aim of this project. Both
programming modes are based on the National Instruments LabVIEW software
LabVIEW., while the controller hardware is CompactRIO cRIO-9076.
For this split-parallel architecture, the other desired design is to enable the
vehicle driver to control and monitor the data attained from the EMS controller. EMS
controller basically will read the signal status of vehicle’s engine revolutions per
minute (rpm), velocity and speed (km/h) and also its fuel consumption [4]. These data
will be channelled to Graphical Driver Interface (GUI) in a tablet PC and connected to
the CompactRIO cRIO-9076 via a web service protocol. This tablet PC utilizes a
Windows operating system. For GUI interface, whenever web browser receive signal
content from EMS controller, the Hypertext mark-up language (HTML) will render
the content into the GUI web page interface [6] . This GUI development in windows
tablet PC is the second aim of this project.
The HEV motor controller offers many parameters that can be monitored through CAN
communication. Some parameters are also controllable in real time. However, CAN
bus communication is incompatible with the existing LabVIEW Real-Time Scan Mode
program of the EMS controller. This project implements LabVIEW FPGA
programming on the CompactRIO, to enable integration of the EMS controller with
the HEV motor controller.
3
1.3 Objectives
4
records.[7] Hence, a conventional car converted into a hybrid vehicle certainly
has impact on its resale value.
4. Infrastructure Availability: With hybrid EMS conversion kit retrofitted into a
conventional car, the benefits of flexible vehicle fuelling for the user is
realized. They can now charge their HEVs at home, workplace or public
charging stations. They can also continue to fill up their car with gasoline. [8]
This gives users the option on location that they can refuel their car.
The time frame to complete this project is within two semesters of Universiti
Teknologi PERTONAS (UTP) academic calendar. The first semester is planned to
understand LabVIEW software and program, get familiar with the all the tools and
hardware, connections between hardware and also finalizing overall project planning.
The first objective is expected to finish in the first semester. While in the second
semester, the second and third objectives are expected to be finished, aside from
prototype building and fine tuning.
5
CHAPTER 2
LITERATURE REVIEW
Common configurations of Hybrid Electric Vehicle (HEV) are of the series, parallel
or power-split HEV configurations [9]. These configurations have the ICE and EM
deliver propulsion power to the same drive axle – either the front or rear axle of the
car. These types of hybrid vehicle are expensive and are designed specifically for a
certain car (OEM vehicles). However, one hybrid vehicle architecture which enables
a conventional ICE vehicle to be converted into a hybrid automobile is called a split-
parallel hybrid where ICE will propel the front axle and EM will propel the rear axle.
This type of drivetrain is currently being developed in Universiti Teknologi
PETRONAS. This system requires an Energy Management System (EMS) to
synergize the TWO power sources, which are ICE and EM and also an on-board
battery pack [3, 4]. The present EMS controller is programmed in National
Instruments’ embedded CompactRIO- modelcRIO-9076, using LabVIEW software
[3]. The split-parallel drivetrain also utilizes re-generative breaking system of IWM
hardware to boost HEV power efficiency and energy savings [4].
The following are detailed explanation of the HEV architecture, EMS controller,
CompactRIO, LabVIEW, IWM System and re-generative breaking.
1) Parallel hybrid: In this configuration, both ICE and EM will work in tandem to
deliver the propulsion power to the front axle [10]. This single parallel hybrid
transmission system, rely on ICE as main prime mover with EM functions as an
additional power source. Hence it will perform very well during high speed than the
series hybrid system [11]. This EM also will work as a generator to recharge the
vehicle. Aside from that, parallel hybrid also normally utilize regenerative braking to
generate the energy and enhance its hybrid system efficiency [10].
6
Figure 2: Parallel hybrid architecture [9]
7
Figure 4: Power-split hybrid architecture [9]
The general purpose of EMS controller is to reduce vehicle fuel intake aside from self-
sustaining battery. Specifically for the split-parallel hybrid architecture, the EMS is
8
connected to ECU and MCU which enable it to read the input of throttle and vehicle
speed, engine rpm and also the battery SOC [4]. Then based on these inputs, the EMS
controller will plan the power management strategy to dictate the best operation of this
TTR-IWM drivetrain [5]. All the inputs from ECU and MCU later, will be controlled
and monitored by EMS controller and will synchronized this input data to the
Graphical User Interface (GUI) in Windows-based tablet PC. This GUI will be
developed using National Instruments’ software LabVIEW. The GUI implementation
will allow the vehicle driver to monitor and control the specific car parameters
according to their desire [6]. For this project, all the algorithm development of EMS
controller program will be done using Field Programmable Gate Array (FPGA) where
it will run in National Instrument CompactRIO, cRIO-9076. For GUI development,
the web service protocol will be use in the development.
There are three controls strategy for HEV which are normally use in HEV [21]:
1. Parallel Electric Assist; ICE acts as key propulsion power and electric motor
acts as secondary source. Based on certain control strategy the Battery State of
Charge (SoC) will be conserved at certain level.
2. Fuzzy Logic; It utilize “load levelling” idea. The electric motor use as a backup
power to ICE. Meanwhile, the ICE is run at full efficiency. This system
determines the vehicle power requirement and compute circulation among ICE
and electric motor.
3. Adaptive Control; A complex control approach that monitors the systems in
real time. It takes into account both fuel consumption and emission level which
resulted in better EMS strategy control decision.
Therefore, in this project it is more suitable to implement the parallel electric assist
control strategy due to its simpler and flexible nature. Since the electric motor require
seamless integration with ICE, it need to work in certain routine;
Motor controller will only operate when driving torque lower than certain
minimum speed
To charge battery during regenerative braking
9
Electric motor will act as the key propulsion for vehicle. This is when engine
ICE is very low. In this situation the ICE will be turn off
During low battery State of Charge (SOC) – Motor will be charged by excess
torque from ICE
10
2.3.1 cRIO-9076
The cRIO-9076 is a hardware that will be use to execute for EMS control program for
this project. This hardware contains 400 Mhz real-time processor, 4 slot chassis with
and embedded and configurable LX45 FPGA chip. The other hardware features are as
of figure below:
2.3.1.1 MODULE
In this project, there are only TWO modules that will be used which are NI 9401 and
NI 9853.
2.3.1.1.1 NI 9401
This module is a bidirectional input and output module with 8 channel where each of
it compatible with 5V/TTL. This hardware can response to digital signal in about
100ns. It usually being utilized in program that require input or output of high speed
counter or timers, digital communication protocols, pulse generation and a lot more.
[15] This module can run on both Real-time Scan Mode or in FPGA program.
11
2.3.1.1.2 NI 9853
This module is a high-speed Control Area Network (CAN) module which has one port
for internally powered and other port for externally powered. This module has ability
to transfer or transmit signal at 100% bus load up to 1 Mbit/s. This module capable to
synchronize with any NI CompactRIO input and output module at 25ns resolution.
[16] This module can only run in FPGA program ONLY.
FPGA are made of silicon chip with unconnected logic gates. This gates can be wired
together using software where it can be compiled into bit stream configuration file.
The FPGA will takes different “personality” once it reconfigures its gates. It is useful
in an application where time and cost of developing and fabricating application-
specific integrated circuit (ASIC) is prohibitive. This ASIC is different from FPGA
since its functionality is fixed according to the design. While for FPGA, it is design
and execute in hardware without operating system. This FPGA offers; [17]
1) Flexibility – FPGA can be configured according to current needs and
reconfigure according to future demand. There is no need to go through the
long fabrication process as ASIC. Hence, it will save time to build the desired
program.
2) Performance – FPGA is control by programmable interconnects of gates, hence
it can implement parallel task to run the program simultaneously and
12
independence of each other. The LabVIEW FPGA run on up to 120 Mhz
clocks. Hence, it can run and accomplish more executions per clocks. With
default clock rate for about 40 Mhz, it can response to digital signal for about
25ns.
3) Reliability - FPGA utilized deterministic hardware which is dedicated to every
task and its parallelism ability reduce the reliability concern.
4) Offload Processing – FPGA can free up the CPU on host computer by get rid
the exhaustive processing.
5) Cost – FPGA is programmable silicon which neglected the fabrication cost of
component circuitry assembly in contrast of ASIC.
When LabVIEW IV is compiled into FPGA hardware by LabVIEW FPGA module, the
LabVIEW IV itself is converted into test-based VHDL code. Based on this code, then
the Xilinx ISE Compiler create the hardware circuit realization of the related LabVIEW
design in term of bit file. This bit file then is loaded to FPGA chip and reconfigure the
gate array logic (Refer figure 10 Below).
As of the third objective of this project, is to build the GUI in windows-based tablet
PC to implement the in-car real time monitoring, control and data acquisition form the
EMS controller. In this case, the EMS controller program is built in CompactRIO,
cRIO-9076. This communication pattern between CompactRIO and windows-based
tablet PC will be done in ‘client-server model’. The CompactRIO act as an embedded
server and windows-based tablet PC act as the client or human-machine interface
(HMI) (Refer figure 11 below). [6]
14
Windows-based Tablet PC [1] CompactRIO
(Client/HMI) (Embedded Server)
If the embedded server comprehends the client request, then it will reply with a
response. If not then, it will reply with an error. Both of these hardware must speak the
same language called Hypertext Transfer Protocol (HTTP) to mutually understand
each other request and response. The program in the embedded server that is able to
communicate over HTTP is termed as ‘web service’. It basically handles the client
request and reply with a response according to the developer program. Meanwhile, the
program in the client computer is called ‘client application’. Its task is basically
interpreting the response of web service according to developer programme. [6]
This data of request and response is called content. The examples of content
are image, sounds, text and a lot more. Each of this content have their own standard.
When the web service gives a response to web server, this web server will interpret
this content into web page. This process is called rendering. [6]
The content itself can be categorized by static and dynamic content. For ‘static
content ‘it is a not-executed and just transmitted content such as of plain text, image
and XML file. While the ‘dynamic content’ is generated by executing programming
code. Hence for this project the FPGA programming data execution is categorized as
the ‘dynamic content’. [6]
Before the full usage of internet, the communication between HMI and
embedded server is done using TCP/IP which is a custom protocol or Modbus which
is an industrial standard. This custom protocol has higher cost of maintenance and low
interoperability while industrial standard is lack or security or scalability. [6] Hence,
because of that the web service technology is being created and has more merit than
custom protocol and industrial standard. The following is the advantage of web service
technology.
15
1) Cross Platform – The embedded target that utilize web service can support
most HMIs.
2) Connection management – The HTTP language enables persistence connection
and termination to the point.
3) Multi-client – It can operate multi HTTP at the same time.
4) Security – This web service can encrypt the transmitted content and also have
ability to verify the party operate the server throughout authentication process
which require user name and password.
To enhance the efficiency of power distribution and energy saving for hybrid vehicle,
the re-generative braking system sourced from Kelly Motor Controls is applied in this
split-parallel hybrid design. This system is a combination of mechanical braking and
electrical re-generative braking. It will enable the kinetic energy loss during braking
to be captured and converted into electrical energy. This captured electrical energy
will be stored in the battery bank. [4]
This system occurs at the braking pedal of the car. When the pedal is pressed for the
first 30% of initial pedal position, the electrical energy is harvested from IWM. This
harvested energy will still be depended on battery SOC. The re-gen breaking will be
little when the battery is nearly full. This will affect the effectiveness of RBS.
Meanwhile, for the remaining 70% of the pedal travel zone, the mechanical breaking
16
is used. This mechanical braking will utilize OEM braking mechanism for safety
purpose and maximum breaking performance. [4]
Figure 14: Brake pedal that will be integrated with re-gen breaking system [4]
17
CHAPTER 3
METHODOLOGY
START
FYP 1
Learning of LabVIEW software programming
FYP 2
Trial Run
Final report
END
18
3.2 Implementation Concept
19
3.2.3 Input/ Output List
The project starts by investigating the background of the project such which are the
crucial topics that are related for this project. Then, the research on the literature of
each topic are made for better understanding of the overall project content itself. The
crucial topics are HEV architecture, EMS, CompactRIO and the modules used in this
project, FPGA, web service, IWM and RBS. Then, the step-by-step procedure is
planned to achieve the objectives of this project.
The overall learning process is a self-learning process with supervision from FYP
supervisor. It starts with the installation of LabVIEW software in the PC and in the
CompactRIO, the connection between hardware and the software configuration to
prepare the CompactRIO and PC so that everything is working fine during the next
process later on. For the Real-time Scan mode program, the learning is assisted by the
example from the National Instrument web site itself, and the LabVIEW training
20
module. Most of the time the learning process is done throughout the internet and
National Instrument forum.
The verification of existing program is done to test the understanding toward existing
Real-time (RT) Scan mode algorithm. It is basically the remake of this program. This
step also is crucial for the author to get familiar with the LabVIEW type of
programming.
The learning process of FPGA program also is a self-learning process with supervision
from FYP supervisor. As of Real-time (RT) Scan mode program, the learning is
assisted by the example from the National Instrument web site itself, and the LabVIEW
training module and most of the time the learning process is done throughout the
reading from internet, the National Instrument forum and trial and error. There are
some difficulties in constructing the FPGA that is noticeable than the construction of
program in Real-time Scan mode.
i. The pallet in FPGA program is more lesser than in RT scan mode. Some
important pallet that is found in RT mode cannot be found in FPGA panel.
ii. The compilation time of FPGA program is roughly more than 9 min and
has the tendency to fail rather than success. This failure is mainly due to
the very long unfinished and unusual compilation time where the
compilation is mainly got stuck during the translation process.
iii. The input taken from the module need to be program not as RT mode
where, it has special digital configuration depending on the type of module.
For example, in RT mode, the input can be configured to be a counter,
counter driven output, PWM or quadrature. Meanwhile, for FPGA mode
the user need to program himself to get the certain configuration.
The FPGA program required the deep understanding toward the type of usage of each
pallet itself before it can be easily use. Luckily, the National Instrument training
21
module and internet provided the example need to understand the application of the
related pallet.
The translation process of the existing program to FPGA mode still uses the same
formula and method as of in Real-time Scan mode program. The translation of the
program involving TWO process. First is the data acquisition and processing in FPGA
programming. Second is data interfaced for end-user front panel in real-time
programming.
All the data is obtained and calculated in FPGA mode. This is because this
FPGA mode clock is faster the real-time mode clock. Therefore, all the data can be
obtained and calculated faster. These processed data are then transferred to real-time
programming throughout FIFO function for end-user data display interface. This
transfer is done due several reasons as below;
In FPGA mode, for everything that are modified even for as small
modification in the block diagram arrangement or wire, it require the whole
program to be compile back and this takes a lot of time which is normally
for about 15 minutes. This is really troublesome because trial and error
require a lot of modification to be done.
In real-time programming the program can be compiled faster than in the
FPGA mode for about half a second. Hence, all the trial and error process
regarding the program algorithm is done in real-time mode.
The trial runs are performed for verification of existing program to ensure the
understanding towards current algorithm is perfect and also for every objective
completed. As of the first objective, the result from FPGA algorithm is being compared
to Real-time Scan mode program to ensure the result is comparable. It is not done to
increase accuracy of the reading.
22
3.4 PROJECT ACTIVITIES & KEY MILESTONES
FYP 1
No. Activities Start Date End Date
1. Project topic selection 21/9/15 4/10/15
2. Initial research work & literature review 28/9/15 1/11/15
3. Submission of extended proposal 30/10/15 30/10/15
4. Learning of LabVIEW software programming 26/10/15 27/12/15
5. Proposal defence 18/11/15 18/11/15
Conversion of EMS control program from
6. 23/11/15 27/12/15
Real-time Scan mode to FPGA programming
7. Writing of interim report 10/12/15 17/12/15
8. Submission of draft interim report 17/12/15 17/12/15
9. Submission of interim report 24/12/15 24/12/15
FYP 2
23
3.5 GANTT-CHART
FYP 1
Week
No. Project Activities / Milestones
1 2 3 4 5 6 7 8 9 10 11 12 13 14
5. Proposal defence
Week
No. Project Activities / Milestones
1 2 3 4 5 6 7 8 9 10 11 12 13 14
6. Trial run
25
3.6 TOOLS
3.6.1 Software
1. LabVIEW 2013
2. LabVIEW run-time engine 2013
3. LabVIEW FPGA module 2013
4. LabVIEW Real-time module 2013
5. Microsoft Office
3.6.2 Hardware
26
CHAPTER 4
RESULT AND DISCUSSION
The verification of existing program only involves FOUR parameters which are
instantaneous fuel consumption (ml/s), total fuel consumption, vehicle speed (km/h)
and Engine RPM. All these parameters formula made by following the existing
program data as reference.
4.1.1 Instantaneous fuel consumption (ml/s) and total fuel consumption (ml)
The input of for both of these parameters comes from fuel meter called ‘FUEL_VIEW
DFM 50C-K’ which give the normally high output voltage which is 12V. Whenever
the fuel is consumes by car, this output voltage will be lower down to 0.7V for amount
of 80ms.
This means for every fuel consumption pulse is generated throughout falling edge.
One falling edge is considered as one pulse. In CompactRIO, this pulse will be read by
digital input module which is 9401. Both instantaneous and total fuel consumption will
use the same digital input/output pins of this module. The pin for instantaneous and
total fuel consumption is set to be DIO0 and is initialized as below.
27
I. Initialization I/O pin
This DIO0 is set to count the falling edge of fuel meter output pulse as
below. Note that, the CTR0 = DIO0.
The input filter is set to be 256us due to the analyzation of fuel meter
to output where one pule is equivalent to 5ml of which in produce in
the range of second minimum. The variation outside of this time frame
will be ignored. Hence, the input filter must me much faster than the
pulse production. This change is considered as noise.[2]
The reading of the pulse is design to be taken for every 500ms. This
pulse is counted by calculating the difference of previous and current
counter. This pulse count now is considered as pulse per 500ms.
28
Figure 20: Setting the pulse reading time to be execute for every
500ms
Since, one pulse is equivalent to 5ml and which has the minimum
consume time of a second, therefore the current pulse need to be
multiply with 5 to make the pulse in millilitre reading and multiply
again by 2 to make it into millilitre per second (ml/s). This ml/s is the
instantaneous fuel consumption.
Meanwhile, for total fuel consumption is a measurement of
accumulation of fuel consumption. This accumulation can be made by
calculating the addition of current millilitre litre reading to previous
millilitre reading. The total fuel consumption is calculated in ml. The
program for both instantaneous and total fuel consumption parameters
are as below.
The input of the vehicle speed and engine RPM is read by tapping the
wire from the dashboard of car itself to read the frequency of both
parameters. This frequency still will be read by NI 9401 module. Due
to limitation of NI 9401 where it can only read the frequency above
29
500Hz, so there is possibility that the frequency will be infinite. This
problem happens because the frequency measurement depended on the
pre-set sampling time of the module but not the period measurement
configuration. Hence, the pin DIO1 and DIO2 is set to read the period
from both vehicle speed and engine RPM. Therefore, both of this pins
need to set to period measurement configuration. Note that
DIO1=CTR1 and DIO2=CTR2.
Figure 22: Both DIO1 and DIO2 is initialized to read time period
The time period for each of the vehicle speed and engine RPM later is
convert into frequency by the formula of frequency = 1 / Period.
Since, the pin is set to read period from both vehicle speed and
engine RPM, there is a possibility that the period value to be zero which
will cause the frequency to be infinite. Hence, the value 839000 is
chosen to give negligibe vehicle speed value if the program detect the
zero period value. (((1/839000)x1000000)x1.487)-1.7628 = 0.0095
km/h [2]. The other calculation is just follow the linear regression
formula that is made based on signal conditioning linear regression
equation for vehicle speed below made by Kurniawan, Y. (2013).
30
For, engine RPM the program is perform in similar manner and
is made by following the linear regression equation for engine RPM
below.
The data from FOUR parameters of instantaneous fuel consumption (ml/s), total fuel
consumption (ml), vehicle speed (km/h) and engine RPM need to be recorded for
further analysis. There are TWO type of data acquisition implemented in this program.
First, is saving the data in CompactRIO drive and second is data tabulation in front
panel purpose.
31
Figure 25: Saving data in CompactRIO memory program
This front panel enables all the related parameters data to be monitor. The data check
column in yellow box is for monitoring the overall parameters data. The gauge in green
box will display the vehicle speed and engine ROM data in real time. The table in red
box will tabulate the engine RPM, vehicle Speed, instantaneous and total fuel
consumption data. While, the charts in blue box are used to tabulate the related data.
32
Figure 27: : The user interface of related parameters measurement
The data obtain need to be verify to ensure the reliability of existing program before
translating the existing program to FPGA mode. The verification is done by comparing
the testing results with the data obtained by Kurniawan, Y. (2013) which is only
limited to vehicle speed and engine RPM. The verification between both data is
compared throughout the error measurement formula where, [Error %= ((Original
Value – Measured Value)/Original Value) x 100]. The data is considered valid as long
as long as the error percentage is less than 20%. Note that, the all the value calculated
and displayed is converted into TWO decimal place.
For the below error calculations, the original value is the engine RPM
value obtained by Kurniawan, Y. (2013) and the measured value is the
testing result value.
33
Table 6: RPM vs
Frequency [2]
As of above results, all the percentage of errors for all the engines’ RPM
values are less than 20%. Therefore, the testing result value are
accepted.
For the below error calculations, the original value is the vehicle speed
(km/h) value obtained by Kurniawan, Y. (2013) and the measured value
is the tested result value.
34
Table 7: Vehicle
Speed vs
Frequency [2]
As of above results, all the percentage of errors for all the vehicle speed
(km/h) values are less than 20%. Therefore, the testing result values are
accepted.
The translation process of the existing program to FPGA mode still uses the same
formula and method as of in Real-time Scan mode program. Therefore, the result of
this translation is comparable to the existing program. For this conversion step, the
data will be obtained and calculated in FPGA mode. Then these data will be transferred
to Real-Time program for end user interface.
4.2.1.1 Instantaneous fuel consumption (ml/s) and total fuel consumption (ml)
Since the input of the Instantaneous fuel consumption (ml/s) and total fuel
consumption (ml) sill comes from ‘FUEL_VIEW DFM 50C-K’. It means that the fuel
35
consumption pulse is generated throughout falling edge. Therefore, the input
initialization for this parameters need to be the falling edge counter.
Figure 29: The pulse reading time to be execute for every 500ms
Since, one pulse is equivalent to 5ml and which has the minimum
consume time of a second, therefore the current pulse need to be
multiply with 5 to make the pulse in millilitre reading and multiply
36
again by 2 to make it into millilitre per second (ml/s). This ml/s is the
instantaneous fuel consumption.
Meanwhile, for total fuel consumption is a measurement of
accumulation of fuel consumption. This accumulation can be made by
calculating the addition of current millilitre litre reading to previous
millilitre reading. The total fuel consumption is calculated in ml. The
program for both instantaneous and total fuel consumption parameters
are as below.
The same with the real-time scan mode program the DIO1 and DIO2
need to be configured for the period counting. Bu utilizing the frame
sequence pallet, the timer will count the falling edge time and by using
the shift register the current timer value will be compared the previous
one to find the actual time of period.
37
II. Data processing
The time period for each of the vehicle speed and engine RPM later is
convert into frequency by the formula of frequency = 1 / Period. Then,
all the formula is exactly follow the real-time scan mode program
formula.
This front panel can only be seen by the author. This front panel will only be use to
check and verify the data with existing program. These data later will be transfer and
display in end user’s front panel using Real-time program. For the following front
panel, the data check column in yellow box is for monitoring the overall parameters
data. The gauge in green box will display the vehicle speed and engine ROM data in
38
real time. While the chart in blue box represent the accumulate fuel consumption (ml),
vehicle speed (km/h) and engine RPM.
The data obtained need to be verified with the data obtained by Kurniawan, Y. (2013)
of which is only limited to vehicle speed and engine RPM. The verification between
both data is compared throughout the error measurement formula where, [Error %=
((Original Value – Measured Value)/Original Value) x 100]. The data is considered
valid as long as long as the error percentage is less than 20%. Note that, the all the
value calculated and displayed is converted into TWO decimal place.
39
For the below error calculations, the original value is the engine RPM
value obtained by Kurniawan, Y. (2013) and the measured value is the
testing result value.
Table 8: RPM vs
Frequency [2]
As of above results, all the percentage of errors for all the engines’
RPM values are less than 20%. Therefore, the testing results values are
accepted.
For the below error calculations, the original value is the vehicle speed
(km/h) value obtained by Kurniawan, Y. (2013) and the measured value
is the testing result value.
40
Table 9: Vehicle
Speed vs
Frequency [2]
As of above results, all the percentage of errors for all the vehicle speed
(km/h) values are less than 20%. Therefore, the testing result values are
accepted.
The data transfer from FPGA to real time program utilized the FIFO read function.
Then, these data are displayed in front panel in with charts. Only vehicle speed and
engine RPM utilized an additional gauge dial function display. The algorithm of this
data transfer is as follow;
41
Figure 34: Saving data in CompactRIO drive program
42
Figure 36: Tabulation of data program
This front panel enables all the related parameters data to be monitor. The data check
column in yellow box is for monitoring the overall parameters data. The gauge in green
box will display the vehicle speed and engine RPM data in real time. The table in red
box will tabulate the engine RPM, vehicle Speed, instantaneous and total fuel
consumption data. While, the charts in blue box are used to tabulate the related data.
All the data is displayed, according to original data. Hence, the program conversion is
a success.
43
4.3 FPGA program for CAN bus communication between the EMS and MCU
controller
To setup the controller, the MCU need to be connected to windows PC using USB to
RS232 cable. In this case the extension cable will be connected to this USB to RS-232
cable to increase the cable length. The Kelly Motor need to be stop first before this
connection is made because it will cause the cable to getting hot. The connection of
this hardware are as follow.
44
Figure 35: Connection between Kelly controller and PC
The setting of the Kelly Controller is as in the following figure from step 1 until step
6. This step is a standard given by manufacturer of Kelly Controller.
45
Figure 37: Kelly Controller setting step 2 [21]
46
Figure 39: Kelly Controller setting step 4 [21]
47
Figure 41: Kelly Controller setting step 5 [21]
After all these steps already been follow, the Kelly Controller setting is complete. Now
the USB to RS-232 cane can be disconnected from PC and Kelly controller. The Kelly
Controller now is ready to be connected with CompactRIO. The steps to connect the
controllers will be discussed in the following chapter.
To connect Kelly Controller to CompactRIO, it requires wire that has end to end of
RS-232 socket with Kelly J2 Cable. Since this cable is not usual in market, the cable
itself need to be build. The building process will be explain as followed.
This CAN bus cable is built based on the CAN bus topology below. The CAN Nodes
at both side left and right of this cable in this case are RS-232 socket and Kelly J2
socket.
48
Figure 42: CAN bus topology [19]
The CAN_H (Pin 10) of Kelly J2 need to be soldier so that it is connected to CAN_H
(Pin7) of RS-232 socket. Meanwhile, The CAN_L (Pin 11) of Kelly J2 n need to be
soldier so that it is connected to CAN_L (Pin2) of RS-232 socket. Kindly refer to the
following figures for schematics both sockets’ pins.
After all the cable at both nodes is already been solider, this cable requires termination
resistor of 120 Ohm to prevent communication error, since CAN bus is bidirectional.
49
This termination resistor need to be placed at the end of CAN_H connection to CAN_L
connection at both of the cable. The cable build as of in the following figure.
The CAN bus cable is tested with connectivity function of multimeter and is found
that all the connections are corrected. Now, the CompactRIO is ready to be connected
to Kelly controller and PC.
50
4.3.2.2 Overall hardware connections
The Kelly Controller, CompactRIO and PC are connected as if the following figure.
Figure 47: Overall hardware connection for CompactRIO, Kelly Controller and
PC
As of above figure, the CompactRIO is connected to Kelly Controller using the CAN
bus cable meanwhile, the LAN cable is use to connect the CompactRIO and PC. Now,
the EMS control program for MCU controller can be executed.
Same as the translation of existing program to FPGA mode, the FPGA programming
will only be use to acquire the data from the controller. These acquired data later will
be transferred into Real-time program.
The input pin of CAN0 of NI 9853 will be use CAN data acquisition for MCU
controller. The following FPGA program will be use to acquire data from Kelly
Controller.
51
Figure 48: CAN data acquisition in FPGA programming
The data in FPGA is read by using the FPGA open pallet (Red box). This function will enable
the data in FPGA programming to be read in Real-time programming. These data will be read
the Read/write control pallet and output it to front panel (Purple Box). The ID in yellow box,
here will enable the user to key in the ID of the CAN bus data in front panel.
52
The ID of this CAN bus data is given by manufacturer, in the Kelly Motor Controller User’s
Manual. This ID is in hexadecimal. For this project there are only several parameters will be
read by the EMS controller. These parameters are summarized as follow;
Bil. Parameters ID
1. Kelly Motor Phase Current 26
2. Controller temperature 51
3. Kelly Motor Speed RPM 55
4. Current throttle switch status 66
5. Re-generative Braking status 67
The following front panel is the example of whet user will see. Since the program is still in
the testing process, the ID in the red box is not being fix yet. Once, the every this is completed
the ID will be fix and the data for the related parameters will be display. Meanwhile, the
green box will show the error occur if any in the data reading process.
53
4.3.3.4 Result
The current program is still being tested. The data of the related ID is still failed to be
display. There are several reasons on why, this data is failed to be display.
The Kelly controller has CAN data rated of about 1Mbit/s. Therefore, the
CompactRIO reading clock must be set faster than the Kelly Controller clock.
For this program, the CAN module NI 9853 is set to run at 1kb/s. Therefore,
since the reading clock is faster than the Kelly Controller out data, the data
should be display.
However, there are possibilities that the reading data is set too fast that make
the data unable to be display. This possibility takes time to be tested because,
since the data acquisition is done in FPGA mode, any changes will result the
whole program need to be compile again. This compile time normally will take
a long time, for about 15-30 minutes and sometimes the compilation got stuck
due to unknown issue. Hence, this possibility remains unsolved.
54
2. Due to the faulty of CAN bus cable
The CAN bus cable is a self-made cable based on the internet, this cable is only
being tested with multimeter connectivity function to see whether the CAN_H
or CAN_L between CAN Nodes are connected or not. If it is connected, the
multimeter will be beeping. This cable is never being tested to transfer the CAN
data. Therefore, this be the one that contributed to this issue.
The program is made based on the understanding on the certain graphical pallet
function, however throughout experience using this software, some of the
pallet can only be use for certain hardware only. For example, DAQmx type of
program, is made for simple data acquisition which can only be use for certain
controllers. National instruments had produced a lot of controllers, such as
sbRIO, CompactRIO, PCIe, PXIe, Ni Elvis II and etc. All these controllers can
use both Real-time Scan Mode program and FPGA program. However, there
are certain function that in both of this program that can only be use for specific
controller. For this DAQmx case, sbRIO and CompactRIO are not supported
to use this function, but is fully supported for PCIe and PXIe and NI Elvis II
controller. Since the author did not receive any training to use this software,
there are possibility that this issue comes from this cause.
Since, there is some faulty issue in CAN bus data display and also time constraint, this
GDI development is unable to be done.
55
CHAPTER 5
CONCLUSION
All data obtained in ems control program in FPGA mode is compared and verified
with existing results of real-time scan mode program. The implementation of program
conversion has been successful. The completion of ems control program will enable
the HEV to achieve certain control strategy for efficient energy distribution and energy
storage through re-generative braking, in order to reduce fuel consumption while
maintaining acceleration and other performance requirements. This control strategy is
a project which is currently ongoing in University of Technology PETRONAS (UTP)
entitled “Design and Development of Split-parallel Through-the-road Retrofit Hybrid
Electric Vehicle with In-wheel Motors”. This FYP project will partially complete this
UTP research project.
56
REFERENCES
57
20. Kelly KBL Brushless Motor Controller User’s Manual. n.d.
21. Kelly KBLI/KHB/HP Controllers Configuration Program . n.d.
22. A. Bedir, "Design of a Stand-Alone Control Strategy For Retrofit Hybrid
Electric Vehicles," Tennessee Technological University, 2010.
58
APPENDICES
APPENDIX A
LABVIEW FPGA BLOCK DIAGRAM
59
APPENDIX B
LABVIEW FPGA FRONT PANEL
60
APPENDIX C
LABVIEW REAL-TIME BLOCK DIAGRAM
61
APPENDIX D
LABVIEW REAL-TIME FRONT PANEL
62