## Model Wheel Contact in a Car

This example shows how to create a system that models a wheel rolling down an inclined plane by using the Spatial Contact Force block.

### Model a Rolling Wheel

To create a new Simscape™ Multibody™ model, at the MATLAB® command prompt, enter:

`smnew % create new Simscape Multibody model`

Delete Scope, PS-Simulink Converter, and Simulink-PS Converter blocks. Rename and connect the blocks as showing in following figure.

Assign these properties to Wheel Location:

PropertyValue
Rotation > Method`Aligned Axes`
Rotation > Pair 1 > Follower`+Z`
Rotation > Pair 1 > Base`-Y`
Rotation > Pair 2 > Follower`+X`
Rotation > Pair 2 > Base`+X`
Translation > Method`None`

Assign these properties to Ramp Incline:

PropertyValue
Rotation > Method`Standard Axis`
Rotation > Axis`+Y`
Rotation > Angle`5 deg`
Translation > Method`Cartesian`
Translation > Offset`[30 0 -15] cm`

Assign these properties to Cylindrical Wheel:

PropertyValue
Geometry > Radius`5 cm`
Geometry > Length`4 cm`
Geometry > Export > Entire Geometry`selected`
Inertia > Type```Calculate from Geometry```
Inertia > Based on`Density`
Inertia > Density`650 kg/m^3`
Graphic > Type`From Geometry`
Graphic > Visual Properties`Simple`
Graphic > Visual Properties > Color`[0.6 0.0 0.0]`
Graphic > Visual Properties > Opacity`1.0`
Frames > Show Port R`selected`

Assign these properties Inclined Plane:

PropertyValue
Geometry > Dimensions`[90 20 5] cm`
Geometry > Export > Entire Geometry`selected`
Inertia > Type```Calculate from Geometry```
Inertia > Based on`Density`
Inertia > Density`1000 kg/m^3`
Graphic > Type`From Geometry`
Graphic > Visual Properties`Simple`
Graphic > Visual Properties > Color```[0.4196 0.5569 0.1373]```
Graphic > Visual Properties > Opacity`1.0`
Frames > Show Port R`selected`

Assign these properties to Contact Force:

PropertyValue
Normal Force > Stiffness`1e6 N/m`
Normal Force > Damping`1e3 N/(m/s)`
Normal Force > Normal Force: Transition Region Width`1e-4 m`
Frictional Force > Method`Smooth Stick-Slip`
Frictional Force > Coefficient of Static Friction`0.3`
Frictional Force > Coefficient of Dynamic Friction`0.3`
Frictional Force > Critical Velocity`0.01 m/s`
Sensing > Separation Distance`unselected`
Sensing > Normal Force`unselected`
Sensing > Frictional Force Magnitude`unselected`

On the Modeling tab, select Model Settings > Model Settings to open the Configuration Parameters. In the Solver pane, under Solver details, update the following:

 Max step size: `1e-3` Absolute tolerance: `1e-3`

At this point, both the Cylindrical Wheel block and Inclined Plane block should have a geometry port. As shown in the figure, connect the geometry ports of the Inclined Plane and Cylindrical Wheel blocks to the base and follower ports of the Spatial Contact Force block, respectively.

On the Simulation tab, click Run. In the MATLAB window, the Mechanics Explorer pane opens, and you see the cylindrical wheel roll down the surface.

### Model a Bumper Car

The modeling process described above can be used to develop more complicated models that include contact forces. To see a more complicated model, at the MATLAB command prompt, enter:

`sm_bumper_car % open Simscape Multibody bumper car model`

Open `Bumper Car Playset`.

The model is made of two structures: the Car and the Ramp Structure. The Spatial Contact Force blocks that are used to model the contact forces between each wheel of the car and the ramps are housed in the `Car to Ramp` subsystems.

To simulate the model, in the Simulation tab, click . In the Mechanics Explorer, you can see the bumper car rolling down multiple ramps.