Virtual vehicles consist of a system-level model that captures the physics and control behaviors of a vehicle. Using virtual vehicles with longitudinal dynamics, you can assess range, fuel economy, acceleration, and towing capabilities. Virtual vehicles with lateral dynamics let you focus on braking, suspension, and steering attributes. You can use these models to optimize energy consumption and thermal performance while enhancing ride, handling, and driver comfort. The models help you set targets, size components, develop control algorithms, validate software, and test virtually, reducing the need for physical prototypes. Once vehicles are in operation, you can use streaming data to build data-driven models or digital twins and test further enhancements using these models before deploying updates.
Using Simulink for Virtual Vehicle Simulations
Create Vehicle Models
The Virtual Vehicle Composer (VVC) app lets you build a vehicle model tailored to your powertrain architecture. You can select from options like Battery Electric Vehicle (BEV), Internal Combustion Engine (ICE), or Hybrid Electric Vehicle (HEV) variations. Further customization is possible with components from electrical, mechanical, fluid, thermal, and multibody libraries. For automated driving, you can incorporate sensor models like cameras and lidar to the model generated by the VVC app. VVC connects to custom libraries and integrates with Simulink, supporting Functional Mock-Up Interface (FMI) for enhanced interoperability.
Integrate Embedded Software
You can either use pre-built controllers to assess the closed-loop performance of your vehicle or customize it with your proprietary algorithms. To test controllers modeled in Simulink and Stateflow, start with model-in-the-loop (MIL) simulation. As more customized controllers get integrated, the model size can grow. Following best practices for large-scale models is critical to manage this complexity.
At a later development phase, you can bring production C/C++ code for software-in-the-loop (SIL) simulation. You can call or compile C code through the C/C++ interfaces built into Simulink and analyze code coverage within the imported code.
Learn More
- Best Practices for Building Large Models from Components to Complex Systems (26:13)
- Webinar Series on Best Practices for Large Scale Modeling in Simulink
- C/C++ Code Integration with Block and Blockset Authoring
- Managing Projects in MATLAB and Simulink
- C Code Integration in MATLAB and Simulink to Control an External Interface
Parameterize and Validate the Model
After integrating the embedded controls, the next step is parameterizing the model to reflect the vehicle’s weight, aero drag, tire rolling resistance, component efficiencies, and component inertias. You can use Powertrain Blockset and Vehicle Dynamics Blockset to access critical parameters and Model-Based Calibration Toolbox to automate model fitting and calibration for motor efficiency and battery parametrization. Once the model is parameterized, comparing the simulated results against data from a real vehicle can provide further insights into the model capabilities and results accuracy.
To determine this, MathWorks, in collaboration with FEV North America, validated the model using real-world data from FEV’s benchmarking catalog. FEV parameterized the model and simulated it against the same drive cycles as the benchmarking vehicle, achieving results within a few percent of test data.
Define Test Scenarios, Simulate and Analyze Results
A suite of predefined driving maneuvers or standard drive cycle data is available for electric, hybrid, or conventional powertrain development. For automated driving, you can interactively create complex 3D road networks and markings. You can also generate an area of road networks by importing high-definition map data and then adding actors and trajectories. For simulating camera, radar, and lidar sensors, you can use sensor models that run in the Unreal® environment co-simulating with Simulink.
When your complete vehicle model simulates as expected, improve performance and run massive simulation studies to explore the design space or validate the whole system behavior. You can scale up your simulation by distributing jobs to local multicore, GPU, clusters, or the cloud for parallel execution. Once the simulation results are available, you can review them with built-in visualization tools and flexible MATLAB data visualization capabilities. Also, you can automate report generation for your simulations based on your organization’s standards.
Deploy and Democratize Simulations
You can extend the benefits of simulation to broader teams who are not modeling experts. With App Designer, you can create customized apps and package them for distribution as a MATLAB app, standalone desktop app, or web app.
To integrate your virtual vehicle simulation with real-world vehicle fleet test data, you can deploy it to the cloud. Also, you can deploy full vehicle models for hardware-in-the-loop (HIL) testing using MATLAB code-generating products to validate hardware/software integration.