User Defined Tire Model Tutorial
This tutorial shows how a user can define a tire model in Vortex. Sample code is provided in <Vortex Studio Installation Folder>\tutorials\ExUserDefinedTireModel
. It contains an example implementation of the magic formula tire model.
This tutorial goes hand in hand with the https://vortexstudio.atlassian.net/wiki/spaces/VSD2410/pages/3817442697 page which gives additional details about the ITireModel
interface and the various data structures used in implementing it.
To create a tire model in Vortex, you must create an extension which implements the ITireModel
interface.
If you are not familiar with creating new extensions and exposing them through plugins in Vortex, please look at https://vortexstudio.atlassian.net/wiki/spaces/VSD2410/pages/3817443818#C++Tutorial1:Plugins-MyExtension.h.
class ExTireModelMagicFormula
: public TireModel::ITireModel
, public TireModel::RollingResistanceModel
, public VxSim::IExtension
, public VxSim::IDynamics
, public VxDynamics::IAssemblyAddOn
, public VxDynamics::IMechanismAddOn
The class ExTireModelMagicFormula
, inherits from ITireModel
which is the interface that must be implemented to define a tire model. It also inherits from IRollingResistanceModel
which enables adding an additional rolling resistance model on top of the magic formula. For more information about rolling resistance and the magic formula, please read https://cm-labs.atlassian.net/wiki/spaces/VSD2410/pages/948552911/Tire+Models+Technical+Notes#Magic-Formula-(1997-and-2002-Pacejka-models) https://cm-labs.atlassian.net/wiki/spaces/VSD2410/pages/948552911/Tire+Models+Technical+Notes#Rolling-Resistance-Speed-Model .
To implement ITireModel
, the function getTireForces
must be overridden. In this function, all the forces are calculated for the tire model and returned to the vehicle system.
TireModel::TireForces getTireForces(const TireModel::WheelInfo& wheel, const TireModel::GroundInfo& ground, const double normalForce) override;
All of the parameterization of the magic formula tire model is done through fields of the extension.
VxData::FieldArray<VxData::Field<double>> inputA; // size 14
VxData::Field<double> inputA111;
VxData::Field<double> inputA112;
VxData::FieldArray<VxData::Field<double>> inputB; // size 11
VxData::FieldArray<VxData::Field<double>> inputC; // size 18
VxData::Field<double> inputDamping;
See ExTireModelMagicFormula.cpp
for the details of how the getTireForces function is implemented for the magic Formula.
Using the tutorial
Compile the project
Start the Vortex Editor
Open vehicle mechanism or assembly for which you want to add this tire model.
Add the Example Tire Model Magic Formula extension from the toolbox.
Drag the Example Tire Model Magic Formula extension under the Tire Type.
Set the ground materials for this model.
Start the simulation.
Look at the outputs of the wheel adapters to see the various outputs of the tire model.