## Background

Systems in Simumatik emulate multiple aspects of how components interact, such as electronic ports, pneumatics and programmable behavior. Here, we take a look at how two physical attributes work, friction and bounciness.

## Starting with the Component Editor

The Component Editor is where you create new components in Simimatik. A component is visually defined by a 3D-model, and an optional material attribute where color or texture can be applied.

In addition, several other physical attributes may be defined to specify how components interact with each other, such as collision modelling, inertia and surface. The surface attribute contains the property of friction, which we will explore in more detail now.

Simumatik relies on a sophisticated physics engine that emulates the physical behavior of components. The simulation is an approximation of how objects interact. Physics simulations rely on advanced mathematics that can be computationally heavy. To be usable, the physics engine needs to strike a balance between the level of detail and the complexity, both in terms of computational resources, as well as the amount of data needed as input.

## Friction

Frictional force is calculated by the formula: *F = *µF_{n} , where *F*_{n} is the normal force and µ is the friction coefficient. The friction coefficient has to be experimentally measured and differs if for example the surfaces are dry, dirty or lubricated. The coefficient is calculated for each pair of surfaces, such as steel on steel or steel on wood, and differs if the objects are in motion or non-moving. Having to specify all these different friction coefficients for every kind of surface interaction is unfeasible. It has to be abstracted.

The friction parameter in Simumatik is specified under **base_link**, so one component is limited to one friction value, independent of the complexity of the 3D-model. When two surfaces interact, the friction is calculated as a combination of the two individual friction coefficients, instead of being based on different coefficients for every case. This is an approximation that is detailed enough for the settings where Simumatik is intended to be used, but may warrant some exploration to understand. For example, what happens when one of the surfaces has a friction value of zero? Let’s find out by testing it out in Simumatik.

Here we have a scene with four slopes. Each of the slopes have a cube placed on top. We are going to look at how different friction parameters affect the resistance between the cubes and the surfaces. Friction is a constant between 0 and 1, and is set in the component editor.

The first two cubes both have high friction values of 0.8. High friction is indicated by the color red here, and value of zero is indicated with green. The blue cube has a low friction value, set to 0.1. The first slope has a high friction, and the rest are frictionless. The floor in the simulation has a green surface with zero friction placed in front of the slopes. The floor outside the green surface has the default friction value of 0.5.

Let’s run the simulation and see what kind of conclusions we can make. Starting from the left we can see that the first cube doesn’t move. Both the cube and the slope under it have high friction values. The friction between the cube and the slope is too large for the cube to move at all.

The other cubes slide over the slippery surfaces, but behave differently when they reach the area with higher friction. The second and third cube slow down and stop when they reach the sticky part of the floor, clearly affected by friction. The red cube stops earlier than the blue as expected. The fourth, green cube, keeps sliding seemingly indefinitely. Compared to the blue cube, the green is remarkably unaffected by the friction against the floor. This suggests that a friction value of zero nullifies the friction of the other object.

## Bounciness

Just as with friction, bounciness is a constant in the range zero to one, where zero means no bounciness, the collision is inelastic, and one means maximum bounciness, the body is perfectly elastic. A more descriptive term for bounciness is “coefficient of restitution”, COR, from Newton’s law of restitution, commonly denoted with the letter e . COR is calculated as the ratio between the change in velocity for two bodies, before and and after collision. Two bodies with velocity *u _{1}* och

*v*collide. After the collision the bodies have velocity

_{1}*u*och

_{2}*v*. This gives the coefficient of restitution

_{2}*e=(u*.

_{2}-u_{1})/(v_{2}-v_{1})Just as with friction, bounciness is a property attributed to pairs of objects. A collision between a tennis ball and a hard tennis court will have one value, while the same ball bouncing on a grass court will have another. In Simumatik this is abstracted in the same way as friction. The ball will have one constant and the two different courts will have one each. Each impact is calculated as a function between the ball and the coefficients for each court.

Let’s see what that means in practice. In this system we have four balls, each with a bounciness value of one. The floor is covered by four surfaces colored in different shades of green. The floor surfaces have decreasing amount of bounciness starting from the right. The bounciness values are 1, 0.5, 0.25 and 0.

When we run the simulation we see that the rightmost ball sticks to the floor as it hits it, and never bounces up, even though the ball has a bounciness value of 1. This is similar to how a friction value of zero works by negating the friction of the other object.

The two middle balls bounce a few times as you would expect from most objects. The leftmost ball on the dark green surface with a bounciness value of one keeps bouncing without losing any height, seemingly endlessly. Both the floor and the ball are super elastic.

## Conclusion

Components in Simumatik can be designed to deal with physical properties such as bounciness and friction. The implementation in the physics engine is an abstraction of the physical properties as they work in the real world. Simumatik uses coefficients for each individual object and calculates the resulting friction or bounciness as a function of both coefficients for the interacting objects.

Extreme values are possible in Simumatik and these may have surprising effects. An object with a bounciness value of zero never creates any bounce when colliding with other objects, and an object without friction slides on any surface.