Engee documentation
Notebook

Car suspension modelling

This example will demonstrate the modelling of a simplified vehicle suspension which consists of independent front and rear vertical suspensions. The model includes the calculation of body tilt.

Suspension diagram of the car model:

car.png

General view of the car suspension model:

suspension_1708522950414.png

The figure shows the modelled characteristics of the semi-truck. The front and rear suspensions are modelled as spring/shock absorber systems. A more detailed model would include a tyre model and damper nonlinearities such as velocity dependent damping (with rebound damping being greater than compression damping). The vehicle body has degrees of freedom for tilting and rebounding. These are represented in the model by four states: vertical displacement, vertical velocity, pitch angular displacement and pitch angular velocity. The full model with six degrees of freedom can be realised using vector algebra blocks to perform axis transformations and force/displacement/velocity calculations. Equation block 1 describes the effect of the front suspension on rebound (i.e., vertical degrees of freedom)...:

$$F_{f} = 2K_f (L_f \theta - (z + h)) + 2C_f(L_f \dot{\theta} -\dot{z})$$

Where:

  • $F_{f}, F_{r} = \mbox{ усилие, направленное вверх на кузов от передней/задней подвески}$

  • $K_f, K_r = \mbox{постоянная пружин передней и задней подвески}$

  • $C_f, C_r = \mbox{ коэффициент демпфирования передней и задней подвески}$

  • $L_f, L_r = \mbox{ расстояние по горизонтали от центра тяжести до передней/задней подвески}$

  • $\theta, \dot{\theta} = \mbox{угол тангажа (поворота) и скорость его изменения}$

  • $z, \dot{z} = \mbox{ расстояние отскока (по вертикали) и скорость его изменения}$

  • $h = \mbox { высота дороги }$

Equation block 2 describes the rocking moments due to the suspension.

$$M_{f} = -L_{f}F_{f}$$

$$F_{r} = -2K_r (L_r\theta + (z + h)) -2C_r ( L_r \dot {\theta} + \dot{z})$$

$$M_{r} = L_r F_{r}$$

Where:

  • $M_{f}, M_{r} = \mbox{ Момент качки из-за передней/задней подвески}$

Equation block 3 solves the forces and moments arising from the motion of the body, according to Newton's Second Law:

$$m_b\ddot{z} = F_{f} + F_{r} - m_b g$$

$$I_{yy} \ddot{\theta} = M_{f} + M_{r} + M_y $$

Where:

  • $m_b = \mbox{ масса тела}$

  • $M_y = \mbox{ момент тангажа, вызванный ускорением транспортного средства}$

  • $I_{yy} = \mbox{момент инерции тела относительно центра тяжести}$

Loading and running the simulation

Connecting the backend - the method of graphics display:

In [ ]:
using Plots
gr();

Loading and running the model:

In [ ]:
try
    engee.close("suspension", force=true) # закрытие модели 
    catch err # в случае, если нет модели, которую нужно закрыть и engee.close() не выполняется, то будет выполнена её загрузка после catch
        m = engee.load("/user/start/examples/controls/suspension/suspension.engee") # загрузка модели
    end;

try
    engee.run(m, verbose=true) # запуск модели
    catch err # в случае, если модель не загружена и engee.run() не выполняется, то будут выполнены две нижние строки после catch
        m = engee.load("/user/start/examples/controls/suspension/suspension.engee") # загрузка модели
        engee.run(m, verbose=true) # запуск модели
    end
Building...
Progress 100%
Out[0]:
Dict{String, DataFrames.DataFrame} with 6 entries:
  "Скорость изменения угла наклона" => 1001×2 DataFrame…
  "Торможение.1"                    => 1001×2 DataFrame…
  "Угол наклона"                    => 1001×2 DataFrame…
  "Усилие на задней оси"            => 1001×2 DataFrame…
  "Препятствие.1"                   => 1001×2 DataFrame…
  "Усилие на передней оси"          => 1001×2 DataFrame

Processing the results

Extraction of data describing braking distance and sliding from the simout variable:

In [ ]:
sleep(5)
data = collect(simout)
Out[0]:
6-element Vector{WorkspaceArray}:
 WorkspaceArray("suspension/Торможение.1")
 WorkspaceArray("suspension/Препятствие.1")
 WorkspaceArray("suspension/Усилие на передней оси")
 WorkspaceArray("suspension/Скорость изменения угла наклона")
 WorkspaceArray("suspension/Усилие на задней оси")
 WorkspaceArray("suspension/Угол наклона")

Defining data from the model into the corresponding variables:

In [ ]:
stop_signal = collect(data[1])
barrier_signal = collect(data[2])
front_force = collect(data[3])
angle_speed = collect(data[4])
rear_force = collect(data[5])
angle = collect(data[6]);

Visualising the results of the modelling:

In [ ]:
p1 = plot(stop_signal[:,1], stop_signal[:,2], title="Сигнал торможения")
p2 = plot(barrier_signal[:,1], barrier_signal[:,2], title="Сигнал препятствия")
p3 = plot(front_force[:,1], front_force[:,2], title="Усилие на передней оси")
p4 = plot(angle_speed[:,1], angle_speed[:,2], title="Скорость изменения \n угла наклона")
p5 = plot(rear_force[:,1], rear_force[:,2], title="Усилие на задней оси")
p6 = plot(angle[:,1], angle[:,2], title="Угол наклона")
plot(p1, p2, p3, p4, p5, p6, layout=(3, 2), legend=false)
Out[0]:

Conclusion:

In this example, modelling of a simplified vehicle suspension has been demonstrated. This model allows the effects of damping and stiffness elements of the suspension to be investigated.

Blocks used in example