 Research Article
 Open Access
 Published:
A signal hardwareintheloop model for electric vehicles
ROBOMECH Journal volume 3, Article number: 29 (2016)
Abstract
Recently, researches on electric vehicle are focused on motion control and state estimation. These works require a model that imitate a real vehicle as close as possible. We propose in this paper a signal hardwareintheloop model of electric vehicles that includes driving system and vehicle model running in realtime in dSPACEDS1103 control card. All the required states of the electric vehicle are monitored in Matlab/Simulink environment. The model is validated by implementing representative test cases. Results of this paper can be a useful tool for further electric vehicle researches.
Background
In order to enhance safety, efficiency and sustainability of a vehicle, driver support systems and fully automated intelligent transport systems are focused in various researches. Extensive development and testing process are necessary to ensure that these systems are safe and reliable. Until now, real road test on a real vehicle have been expensive, timeconsuming and sometimes dangerous. So, developing control algorithm on a simulation model [1, 2] is a reasonable substitution. However, not only describing exactly characteristic of the vehicle, the model has to simulate driver’s behavior which is a very complicated task. Driver’s manipulation simulation needs a combination of several actions at the same time and normally it depends on experience of the driver. In such demands, testing platform based on a hardwareintheloop (HIL) model is a significant solution. HIL simulation is a technique that replaces physical parts of an electric vehicle by their mathematical representation or vice versa. Many platforms are found not only for electric vehicle [3, 4] but also for hybrid vehicles [5, 6] and general automotive application [7]. Nonetheless, these models has a common disadvantage that is still expensive since they require various hardware systems of both power electronics and control boards.
Inheriting research work in [2], in this paper, we propose a signal HIL model of an electric vehicle that combines hardware of driving system and simulation model. This model has several prominent features such as: (1) applicable for all kind of 4wheelcontrolled vehicles, (2) cost effective, (3) drivable by human through hardware system, (4) fast implementation. The paper is organized as follows. "Hardwareintheloop simulation" section allocates the studied objective among types of introduced HIL model and proposes the configuration of the system. In "Vehicle dynamic and kinematic modelling" section, the dynamic and kinematic relationship in a vehicle is modeled. In "Drivetrain modeling" section, model of drivetrain is investigated. "Hardware and system design" section describes the design of the whole hardware in the loop system. "Experimental results" section illustrates the validation results and discusses about the advantages of the model. Finally, some conclusions are given in "Conclusions" section.
Hardwareintheloop simulation
Classification
Hardwareintheloop simulation plays an important role in research of many fields, such as robotics, transportation, electric drive, aerospace, etc. Other than software simulation which is used to check control performance, by replacing one or several real devices for mathematical model, the HIL simulation is used for evaluation of realtime embedded system before implementation on real process. Depending on which parts are replaced as well as the objective of the research, HIL model can be divided into 3 types [8].

Signal HIL model as shown in Fig. 1a. In this type of model, the entire system model is simulated in realtime simulation environment while the controller is implemented in hardware. Only control and measurement signal are managed in the model. Therefore, this model is called signal HIL simulation.

Power HIL model splits the whole system into subsystems which will be designated as tested objects or simulation ones. In this type of model, both power and signal are managed as illustrated in Fig. 1b. This model gives the most accurate test results since it uses actual subsystems as a part of experiment.

Reducedscaled HIL model. Its principal is similar to that of power HIL model but the tested power parts are replaced by equivalent subsystems with reduced power. And of course, the replaced subsystems must have the same characteristic with the original ones.
This paper deals with the signal HIL model because of its simplicity and application ability. This kind of model emphasizes in evaluating performance of controller and estimation algorithm in realtime. Various tests can be repeated as many times as needed without any effect to the real system. In EV research, the signal HIL control system can be built as illustrated in Fig. 2. The model of the EV is compiled to run in realtime simulation environment while controller and measurement (or estimator) are implemented by using microcontrollers, DSPs or FPGAs which depend upon user’s demands. For motion control or parameters estimation of an EV, the system’s inputs may come from a driver’s behavior collector that gathers driver’s commands. In the middle of the control/measurement block and model of the EV, a signal conditioner is needed to harmonize signals exchanged between these 2 blocks. Generally, this conditioning circuit is called interface system. To be applicable to different studies, research of this paper focuses on driver’s behavior and signal HIL model of an EV. Due to user’s study interest, diverse hardware of controller can be inserted into this model which shows the flexibility of the solution.
System configuration
A vehicle moving in three dimension space can be seen as a rigid body with 6 degree of freedom (DOF). However, to reduce complexity of the model as well as to increase computational performance, the following assumptions are made:

The vehicle moves on the flat surface.

Effect of roll and pitch motion are neglected.
The model is now simplified to 3 DOF including longitudinal, lateral and yaw motion as shown in Fig. 3a. System configuration is illustrated in Fig. 3b. There are two main parts in this configuration, hardware and software. The hardware of the system includes dSPACEDS1103 for hardware interface and driving system with accelerator pedal, brake pedal and steering wheel. The software is the model of the electric vehicle that simulates drivetrain, vehicle dynamic and kinematic. The models are compiled and implemented in dSPACEDS1103 to obtain vehicles states, such as longitudinal velocity, lateral velocity, yaw rate, etc. These information is then passed to Matlab/Simulink which is used as host environment for monitoring whole system.
Vehicle dynamic and kinematic modelling
Vehicle kinematic
Figure 3a shows the vehicle model with fixbody frame at the center of gravity (COG) which is used as the reference coordinate frame. As in [9], the kinematic relationships among velocities, yaw rate and accelerations of the vehicle are written as follows:
where \(a_x\) and \(a_y\) are the longitudinal and lateral acceleration of vehicle COG, \(v_x\), \(v_y\) and r are longitudinal velocity, lateral velocity and yaw rate of the vehicle respectively.
Force model
The forces applied to the moving vehicle can be listed as:

Tireroad contact forces include longitudinal forces \(F_{xi}\) and lateral forces \(F_{yi}\), \(i=1\ldots4\) with respect to frontleft, frontright, rearleft, rearright wheels

Air resistance force \(F_{air}\)
Assume that rolling resistance is small and can be neglected. The force balance in longitudinal, lateral direction and the torque balance around the vertical axis are given by:
where \(c_W\) is the aerodynamic drag coefficient, A is the frontal area of the vehicle, \(\rho\) is the air density, \(b_f\) and \(b_r\) are the front and rear track width, \(l_f\) and \(l_r\) are the distance from front and rear axles to the COG of the vehicle, \(\delta\) is the steering angle of driven wheels, m and \(J_z\) denote vehicle’s total mass and moment of inertia around vertical axis respectively.
Tire model
In order to solve Eq. (2) to obtain acceleration in 3 DOF, the tireroad forces must be determined. However, these forces are nonlinear and depend on many parameters, e.g. road condition, tire quality, slip ratio, side slip angle. Their nonlinearity are illustrated in the Fig. 4a, b corresponding to longitudinal and lateral direction. In [10, 11], Pacejka has proposed tire formula (called Magic Formula) based on semiempirical tire model to calculate longitudinal forces as follows:
in which \(\lambda _i\) is the slip ratio of the ith wheel, B, C, D, E, \(Sh_i\) and \(Sv_i\) are the variables that are functions of coefficients \(b_n\), with \(n=0\ldots10\) as:
where \(F_{zi}\) are the normal force of the ith wheel.
The lateral forces is also written as follows:
where \(\alpha _i\) is the sideslip angle of the ith wheel, \(\gamma\) is the camber angle that is set to zero in this model. The coefficients \(b_n\) in (5) and \(a_n\),\(n=0\ldots14\) in (7) have fixed values depend on the tire and the road conditions. If the vehicle is parked on level pavement, the normal forces depend only on gravitational acceleration, total mass and geometric features of the vehicle. When speeded up with an acceleration, the normal forces under front and rear wheels are written as [9]:
where:
in which, g is the gravitational constant, \(l=l_f+l_r\) is the wheelbase and h denotes the height of COG of the vehicle with respect to the ground. The coefficients \(k_{rx}\), \(k_{fx}\), \(k_x\), \(k_{ry}\), \(k_{fy}\) in (9) are constants and can be calculated once at the beginning of the program to improve computational performance.
Sideslip angle and slip ratio
Sideslip angle and slip ratio play important roles in controlling vehicles. They must be determined to complete Pacejka’s tire model. The slip ratio is the difference between wheel velocities \(R_{eff}\omega _i\) and longitudinal velocity \(v_x\) when the vehicle is moving.
where \(R_{eff}\) is the effective radius of tire. It is can be assumed that slip ratio of all wheels are the same when the vehicle moving straight since angular velocities of all wheels are equal. However, when cornering, the lateral motion takes into account and this makes the difference in velocity between wheels. In such a case, the cornering radius must be obtained to determine the slip ratio. As in [12], when the vehicle moves in corner with steering angle \(\delta\), its COG will draw a circle with radius that can be written as:
Therefore, the angular velocity of individual wheels can be calculated from angular velocity of the shaft \(\omega\) as follows:
From (10)–(12), the slip ratio of all wheel of the vehicle can be obtained.The sideslip angle of tires are given by:
Drivetrain modeling
Drivetrain of a vehicle is series of component that dispatches power to driving wheels. In internal combustion engine vehicles (ICEV), the main parts of drivetrain may include traction engine, clutch, transmission with gear, shafts and wheels. On the other hand, electric vehicle is simplified with electric motor(s), transmission with fixed ratio (also called overall reduction ratio) and wheels [13, 14]. Figure 5 shows the typical configuration of electric vehicle.
As illustrated, the electric motor rotates and generates torque on its shaft to deliver power to wheels through transmission and differential. In general, differential mechanism basically allows each wheel to spin freely of the other while providing power to both. Differential plays an important role in case of front wheel drive or rear wheel drive vehicles but it is absent in 4wheel motor drive electric vehicle since the rotation of wheels of such kind of vehicle can be controlled independently. The model of differential can be described by (12).
Transmission of an electric vehicle is responsible for transferring torque from motor shaft to differential with fixed ratio \(K_i\). Torque outputs from transmission can be written as below:
where \(T_e\) is the torque that is generated by motor. The torque balance around the transmission shaft is [15, 16]
where \(F_{total}=\sum _{i=1}^{4} F_{xi}\) is the total longitudinal force on all wheels of the vehicle that is converted back to shaft of transmission, \(J_x\) is the moment of inertia of the vehicle and \(T_b\) is the brake torque that is proportional to brake command of the driver.
One of the major advantages of electric vehicle is the quick torque response of the electric motor compared to the internal combustion engine of conventional cars. Therefore, the motor drive system can be considered as a 1st order transfer function as illustrated in Fig. 6, where the \(K_m\) is the gain and \(T_m\) is the time constant.
Hardware and system design
Simulating driving action can be done by many simulation softwares, e.g. Matlab/Simulink. However, imitating behavior of the driver is not as easy as draganddropping some unit steps or signal builders since it requires combination of many complex actions. In this paper, a racing wheel Betop 3181 is utilized as the driving system which has steering wheel, accelerator and brake pedals. Basically, racing wheels are connected to computer by USB protocol with manufactures driver and it is impossible to decrypt data transfered through USB port of this device. Therefore, a hardware modification is made to extract signal from potentiometers that are attached to each part of the racing wheel. These signals are analogous and then assigned to the inputs of dSPACEDS1103 control board. On the computer side, the dSPACEDS1103 control board is selected as the realtime simulation environment that runs the vehicle model. The inputs from the racing wheel are defined in the Matlab/Simulink and connected to appropriate inputs of the vehicle model. Figure 7 shows the description of whole hardware system and Fig. 8 illustrate the complete model in Matlab/Simulink. The model in Fig. 8 contains the vehicle dynamic block which is written in Sfunction block, vehicle kinematic block, drivetrain and the dSPACEDS1103 Input/Output Interface.
Experimental results
Validation scenarios
In order to validate the HIL model, two test cases are implemented. In the first test, the vehicle model is controlled to run straight with random speed. This can evaluate the performance of accelerator and brake pedal as well as the simulation model in the longitudinal direction. The second test is to evaluate responses of the system when the car is driven in periodic cornering. According to this test, the vehicle at first is accelerated to a given speed, then the steering wheel is turned in clockwise and anticlockwise periodically. As the result, the car should turn right and left, respectively.
The system parameters used in the model are based on the Electric Vehicle iMiEV by Mitsubishi and listed in Table 1.
Results
The realtime data from the dSPACEDS1103 can be saved and monitored in Matlab/Simulink environment as illustrated in Fig. 3. Figure 9 shows the first test results when the vehicle runs straight. Normally, accelerator and brake pedal are not allowed to be pushed at the same time. This is illustrated in Fig. 9a for accelerator pedal position and Fig. 9b for brake pedal position. When the accelerator is pushed, longitudinal velocity increases and so as acceleration. The deeper position of the pedal, the higher velocity and acceleration. Considering the time interval (0–20 s), the Fig. 9 can be interpreted as follows. When the accelerator pedal is pushed in the first 14 s, the car is sped up with the acceleration of about 2.5 \(\rm{m/s^2}\) (Fig. 9c) maximum, as the car reaches the velocity of 24 \(\rm{m/s^2}\) (Fig. 9d). At t = 14 s, the accelerator pedal is released as the brake pedal is pushed, the car is quickly slowed down to 12 \(\rm{m/s^2}\) with deceleration as much as −4 \(\rm{m/s^2}\) at the instant t = 20 s. The remained wave forms of this test can be explained similarly. In this model, position of the acceleration pedal is limited at 90% and as can be seen, when the pedal is pushed at 84%, the velocity reaches to 29 \(\rm{m/s^2}\) (104 km/h). This approximately equals to specification of iMiEV (128 km/h at top speed [17]).
The second test’s results are illustrated in Fig. 10. As shown in Fig. 10a, the steering angle is turned from zero to negative and positive values periodically. This results in the change of yaw rate of the vehicle accordingly in Fig. 10c. Also, the longitudinal velocity varies with this change. For the purpose of explanation, let’s have a close look at the first 10 s, for example, while the vehicle is driven at velocity of about 7 m/s, the vehicle is turned right as the steering angle is changed from zero (at t = 3 s) to about 0.13 rad maximum (at t = 6 s). This makes the car rotating around its vertical axis with the yaw rate of about 0.17 rad/s maximum. After that, at t = 8 s, the steering angle is changed to a negative value of −0.08 rad causing the car turning left, the yaw rate also changes to −0.17 rad/s. As the steering angle is turned clockwise and anticlockwise, the velocity in Fig. 10b of the vehicle is oscillated from 2.5 m/s minimum to 11 m/s maximum. This is caused by the centripetal effect as mentioned in (1). At the end of simulation, when the steering wheel turns back to zero, yaw rate and longitudinal are returned to their steady states.
Discussion
It is worth to point out the specific features and the advantages of the proposed HIL model.

Modeling with Sfunction. The vehicle model is built on Simulink with Sfunction blocks (Fig. 8), which allow to extract more state variables of studied system for estimation, observation or control purpose. This can be done easily by adding required variables to the output field of the function callback definition.

Role of the interface system. After recompiling the model, the output signals presenting the variables are available digitally. In order to proceed further, they must be assigned to the DAC outputs of DS1103. A conditioning interface system is required (Fig. 2) for different EV model and peripheral hardware, as DS1103’s DAC outputs have ±10 voltage range.

Realtime performance evaluation and other capabilities. For the sake of applications of proposed Signal HIL model, electronic control unit (ECU) design scheme, for instance, the controller is developed on basis of a hardware platform, such as DSP, FPGA or MCU. Beside processing measurement signals of state variables as mentioned above, these platforms must reserve inputs for driving system (accelerator and brake pedal positions, steering angle). The estimation or control algorithm will be implemented and applied a set of control value to the outputs of the platform, i.e. drive motor’s torque command, applied brake torque or steering angle. This control set will then be sent to the HIL model through the interface system. When running the whole control system, it can be seen that, both signal HIL model and driving system are implemented in realtime and obviously, the controller will be tested in realtime. This can evaluate the accuracy and performance of control/estimation algorithm as well as stability of hardware design since the test can be repeated and expanded as needed. Furthermore, by utilizing ability of simulating critical situations, this HIL solution can assess the controller in different modes, especially in fault operation.

Costeffective and fast implementation. The HIL model in this paper utilizes only regular equipments. There are 2 main parts of the model, the dSPACEDS1103 and the driving system, in which, the DS1103 or similar simulation platform is the minimum requirement for almost all HIL model. The driving system is the low cost racing wheel that can be found easily. In addition, since all the vehicle model is built on Simulink with Sfunction blocks and transfer functions and the connections of the system are really simple, the researcher can develop very fast their own platform for their studies.
Conclusions
This paper has proposed the design of a signal hardwareintheloop model for electric vehicle. In this system, the hardware is a racing wheel with all functions of a real driving system, the model of electric vehicle including drivetrain, dynamic and kinematic model is built based on Magic Formula of tireroad contact relationship. The performance of system is validated by two representative testing scenarios which are monitored in Matlab/Simulink environment.
The proposed HIL system has been developed in our laboratory and it is shown to be a good tool for studies on motion control and state estimation of electric vehicle. The other purposes, such as energy management or autonomous control are under progress. In addition, the accuracy of the HIL model will be evaluated by comparing with a commercial software and/or experimentation on a real electric vehicle system.
References
 1.
Schaltz E (2011) Electrical vehicle design and modeling. In: Soylu S (ed) Electric vehicles—modelling and simulations, 1st edn. p 1–24
 2.
VoDuy T, Ta MC (2015) A universal dynamic and kinematic model of vehicles. Proceeding of the IEEE vehicle power and propulsion conference (VPPC), p 1–6. doi:10.1109/VPPC.2015.7352889
 3.
Poon JJ, Kinsy MA, Pallo NA, Devadas S, Celanovic IL (2014) Hardwareintheloop testing for electric vehicle drive applications. Proceeding of the applied power electronics conference and exposition (APEC), p 2576–2582
 4.
Tabbache B, Ayoub Y, Marouani K, Kheloui A, Benbouzid M (2012) A simple and effective hardwareintheloop simulation platform for urban electric vehicles. Proceeding of the IEEE international conference on renewable energies and vehicular technology, p 251–255
 5.
Dufour C, Ishikawa T, Abouridal S, Belangerl, J (2007) Modern hardwareintheloop simulation technology for fuel cell hybrid electric vehicles. Proceeding of the IEEE vehicle power and propulsion conference, p 432–439
 6.
Maxwell T, Patil K, Bayne S, Gale R (2011) Hardwareintheloop testing of gm twomode hybrid electric vehicle. IEEE workshop on control and modelling for power electronics (COMPEL), p 1–5
 7.
Schulte T, Kiffe A, Puschmann F (2012) Hil simulation of power electronics and electric drives for automotive applications. Electronics 16(2):130–135
 8.
Bouscayrol A (ed) (2011) Hardwareintheloop simulation. Industrial electronics handbook, 2nd edn, tome 3, Chapter M35. Taylor and Francis, Chicago
 9.
Kiencke U, Nielsen L (2000) Automotive control systems. Springer, Berlin
 10.
Bakker E, Nyborg L, Pacejka HB (1987) Tyre modelling for use in vehicle dynamics studies. SAE 870421
 11.
Pacejka HB (2006) Tyre and vehicle dynamics. ButterworthHeinemann, Amsterdam
 12.
Jazar RN (2009) Vehicle dynamics: theory and application. Springer, Berlin
 13.
Newsroom O (2014) 2014 mitsubishi imiev: most affordabilityprice 100% electric powered production vehicle available in america. media.mitsubishicars.com
 14.
Corporation MM (2014) Mitsubishi motors to bring newgeneration ev imiev to market. ASTROMAN magazine
 15.
Fujimoto H, Amada J, Maeda K (2012) Review of traction and braking control for electric vehicle. Proceeding of the IEEE vehicle power and propulsion conference, p 1292–1299
 16.
Suzuki T, Fujimoto H (2010) Slip ratio estimation and regenerative brake control without detection of vehicle velocity and acceleration for electric vehicle at urgent braketurning. The 11th IEEE international workshop on advanced motion control, p 273–278
 17.
Wikipedia: Mitsubishi imiev. Wikipedia.org. Accessed 24 Oct 2016
Authors' contributions
This work is carried out by the first author in his PhD. program under the supervision of the second author. Both authors read and approved the final manuscript.
Acknowledgements
This study was supported by the State granted Project KC03.08/1115: Design of Control System and Drive for Electric Vehicles.
Competing interests
The authors declare that they have no competing interests.
Author information
Affiliations
Corresponding author
Rights and permissions
Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.
About this article
Cite this article
VoDuy, T., C. Ta, M. A signal hardwareintheloop model for electric vehicles. Robomech J 3, 29 (2016). https://doi.org/10.1186/s4064801600689
Received:
Accepted:
Published:
Keywords
 Magic formula
 Pacejkas tire model
 Drivetrain model
 Dynamic model
 Kinematic model
 Hardwareintheloop model
 Electric vehicle