Car suspension simulation
This example demonstrates the simulation of a car's suspension when hitting an obstacle.
The obstacle is set as a rectangular signal using the Signal Generator block. Using a speed source, the derivative of the signal (speed) is fed to port C of the Translational Spring block, which describes the elastic properties of the wheel.
Translational Spring, in turn, is attached to the mass, which characterizes the inertial properties of the wheel.
The wheel is mounted on suspension elements, a shock absorber and a shock spring, which are represented by blocks Damper and Spring.
The "quarter" of the car itself is attached to other ports of the Damper and Spring blocks.
The wheel has a mass of 50 kg, and the "quarter" of the car is 350 kg.
The obstacle is 5 cm high.
Model diagram:
Defining the function to load and run the model:
function start_model_engee()
try
engee.close("suspension_physmod", force=true) # closing the model
catch err # if there is no model to close and engee.close() is not executed, it will be loaded after catch.
m = engee.load("$(@__DIR__)/suspension_physmod.engee") # loading the model
end;
try
engee.run(m) # launching the model
catch err # if the model is not loaded and engee.run() is not executed, the bottom two lines after catch will be executed.
m = engee.load("$(@__DIR__)/suspension_physmod.engee") # loading the model
engee.run(m) # launching the model
end
end
Running the simulation
try
start_model_engee() # running the simulation using the special function implemented above
catch err
end;
Extracting data from a simout into a variable:
sleep(5)
result = simout;
res = collect(result)
Writing data about wheel and car movement, as well as overload, to variables:
wheel_pos = collect(res[1])
car_pos = collect(res[4])
overload = collect(res[2]);
Visualization of simulation results
using Plots
plot(wheel_pos[:,1], wheel_pos[:,2], linewidth=3, label="Wheel position, m")
plot!(car_pos[:,1], car_pos[:,2], linewidth=3, label="Vehicle position, m")
plot(overload[:,1], overload[:,2], linewidth=3, label="Overload, m/(s^2)")
Analyzing the graphs, you can see that the overload (the ratio of body acceleration to free fall acceleration) that occurs when hitting an obstacle is slightly more than 2 , affects a quarter of the car in less than 50 ms.
Such an overload is not large and will not have a dangerous effect on a person, nor will it affect the comfort of passengers.
Conclusion:
This example demonstrates the simulation of the car's suspension during a sudden collision with an obstacle. The parameters of the movement of a quarter of the car, as well as the value of overload, which can affect the safety and comfort of passengers, are analyzed.