**3. Real-time model analysis**

To develop an analysis tool able to replicate as close as possible the behavior of a real electric urban vehicle, it is clear that using complex simulation developments for the electrical assemblies will not be enough. However, building the mechanical models using advanced mathematical tools is highly time consuming and would require a lot of expertise and education in this direction. Hence, a wise solution is to engage a software created for such simulations, like Simcenter Amesim from Siemens.

In order to highlight the previously mentioned application with a practical example, an urban vehicle's mechanical model is developed. The vehicle is an electrical tricycle used for cargo delivery purposes. Its main specifications are presented in **Table 3**.

In **Figure 13**, the Amesim model is depicted, observing that none electrical assemblies are included in the model. Those are modeled in Matlab/Simulink as it will be presented in the following sections. The link between the two models will be performed using National Instruments VeriStand software, able to create an integrated project that runs a co-simulation on a real-time processor for the complete vehicle.

The Matlab/Simulink model for the electrical assemblies is built putting together all the components detailed in Section 2 based on the hierarchy depicted in **Figure 12**. It has to be mentioned that the pictograms cannot be exactly replicated in Simulink as the inputs are on the left and the outputs always on the right. However, the organization is the same as it can be observed in **Figure 14**.

Having all the models above presented, the goal is to create a virtual simulation platform that allows simple transition hardware in the loop (HiL) testing. The latter


**Table 3.** *Tricycle specifications.* *Powerful Multilevel Simulation Tool for HiL Analysis of Urban Electric Vehicle's… DOI: http://dx.doi.org/10.5772/intechopen.98532*

**Figure 13.** *The mechanical assemblies' Amesim model.*

**Figure 14.** *The urban vehicle's EMR in Matlab/Simulink.*

is the ultimate goal of testing any electromechanical system. It allows users to test certain physical assemblies while the rest of the system is virtual, running as simulation on a real-time target. This must ensure enough computation power and speed to cope with the demands of the actual hardware. National Instruments have in their portfolio hardware (NI PXIe embedded controller) and software (NI VeriStand) that are able to integrate into one real-time simulation all the above detailed models. The PXI computer, via its onboard field programable gate array (FPGA) enables the connection of the virtual model with the testbench using analog and digital IOs.

In **Figure 15**, the main components of the analysis platform are depicted. One can observe that VeriStand software that integrates the Amesim and Simulink models runs on the PXI and using the FPGA channels communicates with the actual

**Figure 15.** *The platform's hardware/software architecture.*

hardware. The user has the possibility to run the virtual model and in parallel the actual hardware in a bidirectional communication network, performing as an entire entity. The real-time processor also features the possibility to run only the simulation of the entire vehicle, without any hardware connected to it. The difference between such a simulation and one running on a PC is that the latter would take tens of hours for a road cycle of 30 minutes while on the real-time computer it will take the elapsed 30 minutes.

Both scenarios will be presented in detail in the following section, comparing the results and discussing them.

## **4. System validation via urban scenario**

Taking advantage of the flexibility of the above presented analysis platform one can perform a study using only simulation, hence a virtual vehicle or can combine virtual elements (mechanical assemblies) with real ones (the propulsion motor). For a robust simulation model, it is important to ensure that using it as reference will return results that mimic closely the actual hardware. In doing so, the platform depicted in **Figure 15** was initially tested only for simulation, the complete system being entirely virtual and running on the PXIe under VeriStand software. The latter ensured the continuous communication of the Simulink model (running all electrical assemblies) with Amesim (running all mechanical systems).

It has to be mentioned that the chosen simulation used the most complex model assemblies from those presented in Section 2. In order to avoid redundancy, results for the rest of the levels are not presented in the chapter, however during the presentations in Section 2, the main differences between the models were already presented.

The second step was to keep in the virtual level the mechanical assemblies (in Amesim) and the battery model (in Simulink). The rest of the virtual electrical assemblies (the inverter, the motor and the controller) were replaced with their laboratory homologs. These remained however connected to the simulator via the analog/digital IOs presented earlier.

The outcome of this comparative analysis was more than satisfactory. Firstly, the reference torque was plotted versus the simulated and the measured ones. It can be observed that the agreement is very good proving the accuracy of the simulator.

*Powerful Multilevel Simulation Tool for HiL Analysis of Urban Electric Vehicle's… DOI: http://dx.doi.org/10.5772/intechopen.98532*

**Figure 16.** *The comparative analysis of the torque (right) and q current component (left).*

**Figure 17.** *The comparative analysis of the speed (right) and its zoomed section (left).*

Knowing that in a PMSM the q current component is responsible for the torque production, for both measured and simulated cases this was recorded and depicted in **Figure 16**-right. The same conclusions as for the comparative analysis of the torque characteristics can be considered. In order to avoid redundancy, the d currents were not depicted as those values are forced to 0 at all times.

The slight differences between the values plotted in **Figure 16** are more due to measurements error and noise. No filtering was used what's so ever in order to avoid any unnecessary postprocessing (**Figure 17**).

The slight differences between the values plotted in **Figure 16** are more due to measurements error and noise. No filtering was used what's so ever in order to avoid any possible influence over the quality results.

Smoother results can be reached if certain data sampling time or other such procedure is considered. However, the interest in this entire work was to prove that one can reach very accurate results when building responsible simulation programs. Also using a real-time processor can benefit the study with fast analysis and reliable results as well.

#### **5. Conclusions**

When it comes to develop simulation tools wise enough to reach the expectations of the fast-growing industry in the field of engineering, one needs to consider solutions that become hands-on. These must be flexible to changes, simple to implement and accurate when it comes to results. Using real-time processors to run these simulations offers reduced analysis time, accurate results and close to real

study. The same processors when engaged, ease the transition from simulation to HiL testing, simply by replacing virtual components with real ones. Choosing between the complexity levels of the virtual models, allows the user to select the accuracy and the necessary time invested in the development. The system under analysis being compound of several assemblies, more complex models can be considered for those that are of interest, while the rest can be ideal ones.

In the present chapter the main assemblies of an electrical urban vehicle's traction system are presented, offering the choice of complexity, mathematical description and EMR organization. The latter is introduced as graphical method for representing the elements of any simulation program by respecting the actual action/reaction physical and natural laws.

It has to be mentioned that the nature of the present chapter is more towards a review than of an academic lecture, hence the reader is encouraged to consult the indicated references that are guidance and complementary information to the one described in the previous pages.
