WOLFRAM SYSTEM MODELER

Car

Model of a car with replaceable wheels and powertrain

Diagram

Wolfram Language

In[1]:=
SystemModel["EducationExamples.MechanicalEngineering.SlidingCar.Car"]
Out[1]:=

Information

Library Dependency

This model requires the PlanarMechanics library.

  • The free PlanarMechanics library was created especially for modeling multibody systems with two-dimensional mechanical components. Compared to the MultiBody library, currently available in the Modelica Standard Library, it is simpler to use and it is more optimized to planar modeling. Planar models of mechanical systems are useful in many different applications, for example, in contact problems that are more easily modeled in 2D than in 3D.

Model

This model shows the concept of configurable modeling. The wheels are defined as replaceable models and can easily be changed in the car model.

This model is based on the TwoTrackWithDifferentialGear example from the Planar Mechanics Library. The library can be downloaded here. Four wheels interact with the ground through a friction model. Depending on the type of wheel and ground, different friction coefficients are used. To switch between different setups, use the drop-down menu in the General tab.

Simulation

To simulate the model, click the Simulate button:simulate

Plot the Results

The simulation is set to run for 15 seconds. A constant torque is applied to the back wheels during the simulation. After 7 seconds, the front wheel will turn to the right over 3 seconds and then keep that front wheel angle for the rest of the simulation. See the position of the wheels of the car (as plotted below) or the forces on the wheels in the Model plots. The top plot shows the motion on asphalt and the bottom plot shows the motion on ice.

Automatic 3D Animation

PlanarMechanics and Multibody systems have visualizers to show what a real-world system would look like.

To show a 3D animation of the model, click the Animate button:

It is also possible to add traces to the wheels to see the path they have taken over time in the animation. To do this, right-click the background in the animation and choose Trace Path, and then choose the components to trace. One option is to trace the different cylinders 2–5 (powerTrain.fixedTranslation2.cylinder) as shown in the following image:

AnimScrShotTraces

Changing the Wheels

By using the replaceable concept, we can redeclare the Wheel model and effectively change all four wheels of the car model with a drop-down menu.

Components (12)

planarWorld

Type: PlanarWorld

Description: Planar world coordinate system + gravity field + default animation definition

WheelJoint1

Type: Wheel

Description: Model of the wheels used in the car

WheelJoint2

Type: Wheel

Description: Model of the wheels used in the car

WheelJoint3

Type: Wheel

Description: Model of the wheels used in the car

WheelJoint4

Type: Wheel

Description: Model of the wheels used in the car

constantTorque

Type: ConstantTorque

Description: Constant torque, not dependent on speed

differentialGear

Type: DifferentialGear

Description: Simple Model of a differential gear

powerTrain

Type: PowerTrain

Description: Model of the powertrain used in the car

inertia4

Type: Inertia

Description: 1D-rotational component with inertia

inertia3

Type: Inertia

Description: 1D-rotational component with inertia

inertia2

Type: Inertia

Description: 1D-rotational component with inertia

inertia1

Type: Inertia

Description: 1D-rotational component with inertia