simulating the confort of a car

If G is the center of mass of the transversal section of the car, we consider x the elevation and theta the swing of the car with respect to the center of mass, L1 and L2 are the distances from the front and back wheels, and k1 and k2 are the stiffness of the front and back suspension with shock absoption coefficient b, then the equations of the confort of a car are:

# Car confort when passing a bump (simplified version)

# parameters

param k1=0.9  k2=0.5  L1=1  L2=1.8  b=0.1

# functions

delta(t)=heav(t-30)-heav(t-31)

g1(t)= delta(t)

g2(t)= delta(t)

# equations

x1' = x2 + g1(t)

y1' = y2 + g2(t)

x2' = -(k1+k2)*x1 + (k1*L1-k2*L2)*y1 - b*x2

y2' = (k1*L1-k2*L2)*x1 - (k1*L1^2+k2*L2^2)*y1 - b*y2

where f1 and f2 are the forces due to the variations of the soil. We rewrite the system, and we consider also other forces on the velocities g1 and g2:

Now we replace f1 and f2 for some oscilation that resonante with the elevation and swing.

Now the situation when the cas pass a “bump”, in order to model this we take f1=f2=0 and g1=g2=delta, a dirac mass, with small shock absoption b=0.5.

Now the situation after a braking of the car, in order to model this we take f1=f2=0 and g1=g2=-delta, and we stop the advancing of the car in the animation, without shock absoption b=0.0

We first consider in the following animation the car driving on an oscilating soil (g1=g2=0 and f1=f2=oscilating function showed in red in the animation), without shock absoption (b=0).