Instrumentation and Dynamic Characterization of a Commercial Electric Vehicle for Rural Public Transport

This work presents the instrumentation, modeling, and parameterization of an electric vehicle used for public transport. The aim is to characterize the mathematical model for its application in control systems design. A system identification technique based on a gray box approach is used to estimate specific parameters of the longitudinal model that cannot be measured directly. For this purpose, a data acquisition system was designed using high-amperage current sensors and an Odroid XU4 embedded system that records the vehicle’s input current, displacement, and velocity. Additionally, a semi-automatic acceleration system was developed to introduce a pseudo-random binary-type acceleration signal to excite all possible vehicle frequencies to perform the parameter identification.


I. INTRODUCTION
In recent years, eco-taxis (also known as motorcycle taxis) have become popular in Taiwan, China, India, and Mexico. It emerges as a solution to public transport problems, mainly in small cities. The fact that it is a light vehicle, of small dimensions, and easy to park favors that they can travel relatively long distances in a short time at reduced costs. Their impact is such that, in small towns in the southeast of Mexico (40 000 inhabitants approx.), it is estimated that around a thousand vehicles of this type circulate. This scenario is repeated in other countries, where most of these vehicles use internal combustion motors and, to a lesser extent, are electric vehicles (EV).
The associate editor coordinating the review of this manuscript and approving it for publication was Mark Kok Yew Ng .
The INVEMEX company designs EVs with a charging system for the 120 [V] domestic electrical grid. A complete charge cycle ranges from 8 to 10 hours, producing a throughput of around 80 [km]. These EVs' advantages are clear since they do not consume gasoline, nor do they emit polluting and greenhouse gases into the atmosphere. However, despite government incentives to promote EVs, their limited autonomy has not allowed its preference among consumers.
EVs have attracted high interest in the scientific community, especially due to the popularity that vehicles such as Tesla or Prius have gained. Studies have been carried out on different types of EVs concerning their relationship between motor velocity and torque, as well as their traction effort [1], [2]. Most of the work focuses on its different components, such as batteries [3], [4] and new energy sources [5], [6], as well as different types of electric motors and their VOLUME 11, 2023 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ hybridization with internal combustion motors [7] including alternative fuels [8], DC-DC inverters and converters [9], fuel cells [10], among others. An important topic in these studies is the development of technological systems that improve EVs' autonomy. For this, it is necessary to have mathematical or behavioral models that represent the dynamic characteristics of the EV, terrain, and load, to design control and energy management systems [11], [12] that improve their performance.
In the literature, different works report advances in the modeling and optimization of electric vehicle propulsion systems, e.g. [13], [14]. And a detailed study on different propulsion systems can be consulted in [15]. EV control systems are designed for different dynamics, and therefore it is necessary to develop mathematical models that describe each of them. The most important dynamics are lateral (for autonomous navigation) and longitudinal (for energy-saving and cruise control). This work is focused on the longitudinal model. The problem is not trivial and has generated an important field of research. For example, in [16], a modelbased predictive control is proposed considering only the longitudinal dynamics at different operating conditions. In [17], a nonlinear predictive control technique is considered to control a four-by-four vehicle's lateral dynamics. However, as mentioned in [18], one problem when designing controllers based on the longitudinal model is its parameterization since some parameters cannot be measured directly. To obtain the model parameters, specialized instrumentation, dedicated equipment, or the use of system identification techniques are required.
To solve this problem in [19] a dynamic test method of electrical machines is proposed as an alternative to the traditional test bench where a torque sensor is required. It is shown that, with the measurement of velocity, current, and voltage, while accelerating and decelerating an electric motor, it is possible to dynamically estimate the torque and the characteristics of the flux linkage. The method proved to be quick, convenient, and accurate. The authors in [20] took up the model used by [21] and used system identification techniques to approximate the unknown parameters of the mathematical model of an EV and implemented a predictive controller for tracking a predefined trajectory. In [22], techniques for identifying EV Prius parameters are proposed considering a new data acquisition system and vehicle instrumentation with high-precision sensors such as highresolution GPS, velocity, and inclination sensors, among others, In general, there is a wide range of literature on modeling, controlling, and improving EV efficiency; nevertheless, the works focus on traditional vehicles. However, rural transport EVs are built with unconventional designs and lack information on their electrical, mechanical, and aerodynamic characteristics that limit their efficiency. Therefore, this work's main contribution is selecting and characterizing the mathematical model of a commercial EV of rural transport. For this, the EV is instrumented for data acquisition. Gray-box identification techniques are used to estimate the unknown model parameters that cannot be measured directly, such as the drag coefficient, the dynamic motor constant, the rolling coefficient, and the power converter's efficiency. Finally, different tests are carried out in real environments to validate the results.
The rest of the paper is divided as follows: Section II presents the EV model; Section III presents the EV instrumentation and the tests' experimental design; Section IV shows the results obtained; finally, in Section V, the conclusions are given. To complement the paper, the nomenclature used is summarized in the Appendix.

II. MATHEMATICAL MODELING OF THE ELECTRIC VEHICLE
The considered EV and its free-body diagram are shown in Figure 1. Taking into account Newton's second law of motion and the principle of translational equilibrium, the longitudinal dynamics can be represented by where η = I m /I bat is the efficiency of the power converter, The aerodynamic force is [21]: where ρ a [kg/m 3 ] is the density of the air, C d is the aerodynamic drag coefficient, and A f [m 2 ] is the frontal area of the EV. The rolling resistance force is modeled as where C r is the rolling resistance coefficient, g [m/s 2 ] is the acceleration due to gravity, and α [rads] is the inclination angle of the road. C r depends on many variables, the most important are the vehicle's velocity, the wheel's pressure, and the road conditions; this parameter can be considered constant [21]. The force exerted by gravity is calculated by [21]: Substituting the forces expressions (2)-(5) in (1), the following model is obtained In this model, internal frictions, the rotational inertia of the powertrain, and the electric motor's inertia are neglected as they are small compared to the EV's total mass. Finally, setting x 1 (t) equal to the EV position and x 2 (t) =ẋ 1 (t) = v(t), we obtain its space-state representation [23]: It is important to mention that, despite having the longitudinal model, parameterizing the equations is not a trivial task due to the difficulty of measuring parameters that require specialized equipment. For this reason, in this work, system identification techniques are considered, which require experimental data of the vehicle's current, velocity, and displacement, to identify the model parameters that are not possible to measure directly.

III. INSTRUMENTATION AND EXPERIMENTAL DESIGN
This section presents the description of the EV instrumentation, the development of the data acquisition system, and the tests' experimental design.

A. EV INSTRUMENTATION
The EV has a mass of 275 [kg]. According to the manufacturer's specifications, the vehicle reaches a maximum velocity of 12 [m/s]. The center of gravity is located over the symmetric axis of the vehicle, close to the rear wheels.  The schematic diagram of the EV is shown in Figure 2, which consists of the following: (i) an electronic speed controller (ESC) that regulates the EV's velocity through the vehicle's motor. Its inputs are signals from the motor's Hall Effect (HE) sensors, the accelerator, and the rotation direction

B. MONITORING AND DATA ACQUISITION SYSTEM
A data acquisition system was designed to monitor and keep a record of the current, displacement, and velocity information every 100 [ms]. The system is based on an Odroid XU4 board, its electronic diagram is shown in Figure 4. The data acquisition system's power supply is provided by a 12 to 5 [V] regulator. And, because it reaches peaks of current up to 4 [A], an MJ2955 power transistor is used. As it can be seen in Figure 4, the T201DCH100 transducer measures the current input to the ESC in a range of 0 − 100 [A], and the output it provides is an analog signal of 0 − 10 [V], proportional to the measured current. This transducer is powered by the 60 − 12 [V] regulator. The transducer's output signal is sent to a voltage divider to match the 0 − 1.8 [V] signal range, which is the analog read range of the Odroid XU4 development board.
The motor angular displacement is measured through three HE sensors that generate pulses that are sent to the ESC, which determines the magnitude of the current supplied to the motor. For practical purposes, only the signal from sensor 3 is considered for the data acquisition. Because the electric motor is 5-pole, the HE sensor sends 5 pulses for each revolution. To eliminate noise and undesired bounces from the signal, the pulses are filtered twice by a 74LS14 logic gate that has the function of negating the signal so that the filtering is of the Schmitt Trigger type. The pulses are sent to the Odroid XU4 board to be counted through the GPX2.5 pin. To where t is the discrete-time index, c 1 counts the pulses generated by the HE sensor 3. To obtain the displacement d c , the counter c 1 is divided by 5, obtaining the number of motor revolutions. Then, it is divided by 10 because the gear ratio

C. TIME CONSTANT OF THE ELECTRIC VEHICLE
To determine the EV time constant, a unit step input was applied to the system by accelerating to the maximum, and the output response was studied. Six experimental tests were carried out, and the results were averaged. The tests Step response of the electric vehicle.
were carried out on a straight, flat street with an inclination angle less than 3 • and without irregularities (no potholes, bumps, among others). The data acquisition system saves the measurements from the tests. The data is plotted and analyzed to determine its steady-state velocity and the time in which reaches the 63.2% of this velocity. Figure 5 shows the raw data of one of the test results. The raw data has to be prepared with a filter that averages the last five samples to reduce the noise in the measurements.

D. CONTROL SIGNAL GENERATION FOR IDENTIFICATION
In order to apply identification techniques, it is necessary to apply to the EV an input signal that meets the characteristics of persistent excitation, i.e., an input signal that has enough frequencies to excite all the response modes of the system to be identified. In this work, a pseudo-random binary signal (PRBS) dependent on the EV time constant was selected, this signal has the additional characteristics of being periodic, deterministic, and pseudorandom. The designed input signal is generated a priori in Matlab ® and a posteriori a PRBS-dependent control signal is generated through the Odroid XU4 computer as illustrated in Figure 6. The PRBS signal is saved in a file containing information of the generated pulses as a string of 1's and 0's that is sent by the Odroid XU4 as an electronic digital signal of 0 − 5 [V] through the GPX1.3 pin to the ESC. To do this, the signal passes through a power stage consisting of a 4N30 optocoupler with Darlington output. The signal entering the optocoupler collector comes from the EV's accelerator driven by the PRBS digital signal. The system sends the PRBS signal pulses one by one according to the programmed sampling time. As a result, the EV moves accelerating and decelerating according to the PRBS signal.

E. PARAMETER ESTIMATION
As mentioned before, the mathematical model (7)(8) is commonly used to represent the nonlinear dynamics of the vehicle. However, despite that the equations are wellknown, parametrization is a difficult task due to the fact that some parameters are not directly measurable with standard equipment, for example, the aerodynamics coefficient and the rolling resistance. Therefore, system identification techniques, considering a gray-box approach, were used for the mathematical model characterization. The procedure is provided with (i) the mathematical model of the system; (ii) the experimental data of the system's input and outputs; (iii) the initial conditions; and (iv) the parameters to be identified.
The main idea followed in parametric identification using a grey box model is to find a relationship between input and output measurements based on a given function (grey box model) by adjusting its parameters using an optimization criterion [24]. An appropriate selection of the parameters will make the model predict the future outputsŷ(t) of the system using past measurements of inputs u(t) and outputs y(t) of the system conveniently summarized on the set where N is the number of samples and for simplicity, it assumes a unitary sampling instant.
Also, consider a parametrized model of the form where f (·) and h(·) are smooth functions, θ is the parameter vector, and e(t) = y(t) −ŷ(t) is the prediction error. The method to estimate θ is to minimize the prediction error e(t), i.e.θ In order to obtain the solution of the minimization (12), the derivative of the criterion J (θ ) is with and dx(t)/dθ is defined by Equation (15) is a filter whose input is its last term which in turn depends on x(t) that must be obtained by the model itself (11). Then, to compute dŷ(t)/dt, both filters, (11) and (15), have to be applied. The parameter initialization θ 0 plays an important role in the final estimationθ as this value determines the local minimum J (θ ) will converge.
The minimization (12) can be successfully solved by efficient routines of optimization software, e.g. in Matlab ® .
In the case of the EV, the parametrized model is the EV model (7)(8) where the outputs are y(t) = [x 1 (t), x 2 (t)] T ; the parameters to be estimated are θ = [C d A f , C r , η, k t ] T with an initial guess θ 0 = [1, 0.01, 0.7, 0.2] T ; and initial condition of the system states x(0) = [0, 0] T .
Finally, the optimization software is supplied with the values of 1 × 10 −5 for the relative tolerance and 1 × 10 −6 for the absolute tolerance.

IV. RESULTS
This section presents the results obtained from the data acquisition system, the parameter estimation, and the mathematical model validation with the estimated parameters.

A. DATA ACQUISITION SYSTEM VALIDATION
In order to carry out the parameter identification, it is necessary to measure the data of the outputs and know the input that generates them. The input to the EV is the current to the ESC, while the outputs are its displacement and velocity.
The output values of the EV are calculated through the pulses generated by the HE sensor 3 using (10) for the traveled distance and (9) for the velocity. For the validation of the developed data acquisition system, its measurements were compared with those of the GPS Speedview application that measures the distance traveled and velocity providing the route traveled and saving the data in a file; this is done through a general-purpose high-precision GPS, with a maximum error of 3 [m] and 0.2 [m/s] of distance and velocity error, respectively. The results for the displacement are shown in Figure 7, while for the velocity are in Figure 8. For the displacement, the data acquisition system has a root mean square error (RMS) of 4.18 [m] and a mean absolute

B. PARAMETER IDENTIFICATION USING A GRAY-BOX APPROACH
The driving tests were in a straight line on a flat, unobstructed street. Several experimental tests were carried out, from which four data sets were obtained. One of the data sets is displayed in Figure 9, where the changes in electric current, velocity, and displacement resulting from applying the PRBS signal to the ESC are observed. Then, each data set is prepared using an averaging filter set to five previous data. The filtered data is fed into the identification process, which estimates the model parameters using a gray-box approach.
The identification process estimates the model parameters using the numerical method ode45; for this, it performs the necessary iterations until an acceptable fit between the estimated model and the experimental data is achieved. Finally, the results of the unknown parameters are obtained  as well as the MAPE of the data obtained with the model formed with the estimated parameters with respect to the experimental data.
The identification process is carried out on each data set, so the parameter values of the aerodynamic drag coefficient by the frontal area of the VE (C d A f ), the rolling coefficient (C r ), the power converter efficiency (η) and the motor constant (k t ), are found for each experiment. The results for each of the data sets are shown in Table 1.
The best results are obtained with the parameters found for the fourth set of data. The parameter values found using the fourth data set are C d A f = 16.53 [m 2 ], C r = 0.00609 [-], η = 0.72259 [-] and k t = 0.26522 [-]. With these parameters, RMS errors of 3.42 [m] and 0.64 [m/s] are obtained respectively, as well as a MAPE of 0.93% with respect to the displacement data and 10.08% with respect to the velocity data. The comparison of the model characterized by these values and the experimental data is shown graphically in Figure 10.

C. VALIDATION OF THE PARAMETER VALUES FOUND
To validate the parameters found in the identification process, the mathematical model using these parameters is simulated and compared with two new experimental data sets.
In the first test, the experimental data set is obtained with a different drive path and the same input signal as in the identification tests. Figure 11 shows the comparison of the simulation results with the experimental data. The RMS error for the displacement is 9.97 [m] and 0.699 [m/s] for the velocity, i.e. 4.81% and 11.03% of MAPE, respectively.
In the second test, the mathematical model system characterized by the parameters found is again compared with   a different data set than the one used for identification. But now, obtained with a different input than the one used in the identification process. The results are shown in Figure 12, where the displacement RMS error is 24 15.45%. Unsurprisingly, the error is higher because the route and the input are entirely different from those used in identification tests. However, the model represents the EV dynamics with acceptable precision. This second validation test is of particular interest because both the route and the input are entirely different from those used in identification tests, so this type of test tends to present more significant errors.

V. CONCLUSION
In this work, the instrumentation, modeling, and characterization of an EV for public transport of the eco-taxi type from the company INVEMEX was presented. The instrumentation consists of the implementation of a data acquisition system based on an Odroid XU4 board to measure the vehicle's displacement and velocity through pulses generated by a hall effect sensor installed in the vehicle motor. In addition, the instrumentation incorporates a transducer that measures the current with which the battery bank feeds the electronic speed control. Furthermore, the system can generate PRBS signals that are necessary for the use of identification algorithms. These algorithms were used to estimate the motor's dynamic constant, the rolling resistance coefficient, and the efficiency of the power converter. The validation was carried out in a real environment, so the discrepancies that exist between the numerical mathematical model results and the experimental data sets are due to certain wind conditions and terrain irregularities that are not possible to control. However, the model validation results demonstrate that the characterized EV model obtained is useful, with acceptable precision, to serve as the basis for the development of model-based control systems. It is important to mention that these EVs are quite popular in different countries, and due to their design and construction, they present areas of opportunity to improve them in different engineering aspects. Future work will include improving the battery charging system, fault detection in sensors, and redesigning the chassis materials to increase the vehicle's safety. Tables 2 and 3 show the variables used for the mathematical model and parameter estimation.