File Exchange

image thumbnail

Simscape Vehicle Templates

version 21.1.2.1 (63.4 MB) by Steve Miller
Set of templates for creating custom vehicle models using Simscape for use within Simulink.

158 Downloads

Updated 31 Mar 2021

From GitHub

View Version History

View license on GitHub

This library contains library blocks and a configurable vehicle model that you can use for a wide range vehicle design tasks. This video shows you some of the capabilities: https://youtu.be/kWfv_zZrO-4

For more details, see this page:
https://www.mathworks.com/solutions/physical-modeling/simscape-vehicle-templates.html

Here are some of the tasks you can perform:

1. Configure the powertrain architecture to model conventional, hybrid, battery electric, and even fuel cell vehicles.
2. Modify the suspension design by moving hardpoints obtained from a CAD.
3. Connect custom multi-link suspensions to passive and active hydraulic and pneumatic systems.
4. Design active chassis controls by integrating controls for anti-lock brakes, stability, and active roll control systems
5. Develop regenerative braking algorithms by incorporating electrical networks into your vehicle model.
6. Test your embedded software against a virtual vehicle by converting your Simscape model to C Code and running it on a real time computer, such as Speedgoat.

The templates are designed to be extendable. Create your own variant for any portion of the vehicle model (such as the brakes, suspension, or drivetrain) and you can adjust the libraries so that variant can be selected. It includes the tire modeling software MFeval, another submission on the File Exchange, which inspired this submission.

Please read the README.md file to get started.

The download button will let you access files compatible with the latest release (R2020b).
Use these hyperlinks to access versions from earlier releases.

For R2021a: Click on "Download from GitHub" button above.
For R2020b: https://github.com/mathworks/Simscape-Vehicle-Templates/archive/20.2.2.1.zip
For R2020a: https://github.com/mathworks/Simscape-Vehicle-Templates/archive/20.1.2.1.zip
For R2019b: https://github.com/mathworks/Simscape-Vehicle-Templates/archive/19.2.2.1.zip
For R2019a: https://github.com/mathworks/Simscape-Vehicle-Templates/archive/19.1.2.1.zip
For R2018b: https://github.com/mathworks/Simscape-Vehicle-Templates/archive/18.2.2.1.zip

Cite As

Steve Miller (2021). Simscape Vehicle Templates (https://github.com/mathworks/Simscape-Vehicle-Templates/releases/tag/21.1.2.1), GitHub. Retrieved .

Comments and Ratings (38)

Steve Miller

Hi Krishna - thanks for providing the example model and simulation results. I will examine them and get back to you. --Steve

krishna teja

hi steve miller
I have replaced MFEval simulink block with Combined Slip Wheel 2DOF from vehicle dynamics blockset and rewired connections appropriately. The difference in responses is too huge to be acceptable from vdbs block, especially the transient characteristics. R2021a has some minor changes to vdbs tire internal blocks (relaxation blocks), however results are pretty much same as that from R2020b. Unfotunately, majority of implementation of vdbs block is .p file, to check equations. The result screenshot and vdbs simscape tire (works with R2020b only) are available at https://drive.google.com/drive/folders/1ZYX9xx1G0UbpxDd01tprEzE6GHfxnB2p?usp=sharing. can you kindly provide solution to this

Steve Miller

Version 2.1 of Simscape Vehicle templates released for MATLAB R2018b through MATLAB R2021a. Adjusted regenerative braking algorithm, added lap-time optimization example that factors in battery SOC, fixed an interface issue with MFeval tire model.

Steve Miller

The newer the release, the better. The files are maintained from R2018b forward, so you can use it any release R2018b to the current one.

sungho park

should i use new matlab version like 2020b?

Steve Miller

Thanks Krishna - that is very helpful input!!

krishna teja

Hi @steve miller
sorry for late reply
the difference in results in brake test are due to small issue in smcar tire/MFEvalTransform to Spin Frame CPI. The radius is fixed to 0.4225, instead it should be loaded radius.

Sara Luciani

Hi @steve miller
Im working on Simscape Vehicle Templates and Im trying to run my model with different manoeuvres on Speedgoat Baseline hardware but whenever I select the solver in fixed step, it seems there's an error saying there's a kinematic singularity.

An error occurred while running the simulation and the simulation was terminated
Caused by:
['sm_car/Vehicle/Vehicle/Chassis/SuspA2/Linkage/Linkage R/DoubleWishboneA/Spherical LA Shock', 'sm_car/World/Solver Configuration']: 'sm_car/Vehicle/Vehicle/Chassis/SuspA2/Linkage/Linkage R/DoubleWishboneA/Spherical LA Shock' kinematic constraints cannot be maintained. Check solver type and consistency tolerance in the Simscape Solver Configuration block. Check Simulink solver type and tolerances in Model Configuration Parameters. A kinematic singularity might be the source of this problem.

Could you kindly suggest me a solution to this problem?
Thanks in advance!

EUGENIO TRAMACERE

Hi @steve miller
Im trying to validate my model with different maneuvers but whenever I select the solver in fixed step, it seems there's an error saying there's a kinematic singularity.

An error occurred while running the simulation and the simulation was terminated
Caused by:
['sm_car/Vehicle/Vehicle/Chassis/SuspA2/Linkage/Linkage R/DoubleWishboneA/Spherical LA Shock', 'sm_car/World/Solver Configuration']: 'sm_car/Vehicle/Vehicle/Chassis/SuspA2/Linkage/Linkage R/DoubleWishboneA/Spherical LA Shock' kinematic constraints cannot be maintained. Check solver type and consistency tolerance in the Simscape Solver Configuration block. Check Simulink solver type and tolerances in Model Configuration Parameters. A kinematic singularity might be the source of this problem.

Could you kindly suggest me a solution to this problem?
Thanks in advance!

guang xu

Steve Miller

Hi Krishna - if you can send me the model you used to make these curves, I can look into it. I don't think I have enough information in those plots to determine the best solution.

krishna teja

Hi @steve miller
There seems to be significant difference in tire behavior between MFEval from this library and MFSwift (2020.2)
I have used standard 'Siemens_car205_60R15.tir' for this brake test.
please find the Fx and slip ratio curves here (https://drive.google.com/drive/folders/1ZYX9xx1G0UbpxDd01tprEzE6GHfxnB2p?usp=sharing). [blue-MFEval, red-MFSwift]
can you kindly provide a solution

thanks in advance

krishna teja

edit: blue - MFEval
red - MFSwift

Steve Miller

Hi @krishna teja - There are a couple maneuvers with cones. See Scene.Skidpad (cone locations are parameterized by circle radius), Scene.Double_Lane_Change (cone locations parameterized by lane location). The components used in the simulation models are in sm_car_lib.slx, there is a shortcut to open that library under "Project Shortcuts". I'll work on having it show up in the Simulink Library Browser.

krishna teja

hi,
I have x,y,z values of road and pylons. How do i use that to generate road and pylons. Will visualisation also get updated?

thanks in advance

krishna teja

hi, thanks for great templates
It would be helpful if its published as toolbox with each subsystems as library blocks (similar to vehicle dynamics toolbox).

Steve Miller

Hi Thulasi, i621148, and other visitors! Please note that version 2.0 which was added just before Christmas, includes 3-axle trucks (semi-trucks) and two axle trailers. The tanker has a slosh model as well.

Siddhi Pandey

can u please provide me this model for MATLAB R2015 b ?

Matthew Loew

Steve Miller

Hi Thulasi - I am working on creating a template for a 3-axle vehicle. For now, you could modify the existing template by copy-and-pasting one axle. An easier option would be to just enable the trailer and replace the spherical joint connection with a weld joint so all three axles are connected to the same chassis.

Thulasi Ram

kindly suggest me that how i can use this tool for design of 6 wheel vehicle including each motor at the wheel to drive vehicle

ismail Macit

Juho

Greeting Mr.Steve Miller,
I am appreciated that you have been creating this powerful tool.

Steve Miller

Hi Guilherme - does this track include height data or is it flat? Flat is easier, but both are possible. If you are defining a flat track, take a look at the files in "\Libraries\Event\Scene\Track_Mallory_Park". The easiest thing to do would be to modify those files and just use it directly. If you need to specify height as well, modify the files in folder "\Libraries\Event\Scene\CRG_Plateau\Data". Save a copy of the original files as a reference before you start changing them.

Hello!! Great job!! I have a question, what if I want to create my own layout? For example, I am from a Formula Student Team and I want to create the track that will be used in the competition. How do I add the track to the code? What parameters do I need to fill in excel?
Thanks for the attention!

Ronnie Debbe

Steve Miller

Hi i621148 - these models include a couple features that were first introduced in R2018b (the Simscape Bus for grouping physical connections). I cannot port this entire example back to R2017b. You may be able to work directly with the components sm_car_lib to build up your own model. We have plans to add a semi truck and trailer, so click on the "Follow" button up near the "Download from GitHub" button to be informed when we make an update.

i621148

How about a semi truck & trailer?

i621148

Please include working 2017b version?

Veer Alakshendra

Marco Furlan

Jan Van Rensburg

Please also comment on additional features you would like to see included in the Simscape Vehicle Templates

Oliver Jaehrig

Jan Van Rensburg

Toshinobu Shintai

Great! Thank you for uploading.

MATLAB Release Compatibility
Created with R2020b
Compatible with R2018b to R2020b
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!