Engee documentation
Notebook

Rigid mechanical system

You have seen how the solver settings can affect the simulation process – its speed and result.
This example presents a model of a rigid mechanical system using a variable-pitch solver.
This rigid system includes two oscillating masses, each with a different calculation step. The picture below shows the system itself.

image_2.png

The following shows the solver settings.

image.png

Now let's move on to running the model and analyzing the results. To do this, we will need to declare an auxiliary function.

In [ ]:
# Подключение вспомогательной функции запуска модели.
function run_model( name_model)
    
    Path = (@__DIR__) * "/" * name_model * ".engee"
    
    if name_model in [m.name for m in engee.get_all_models()] # Проверка условия загрузки модели в ядро
        model = engee.open( name_model ) # Открыть модель
        model_output = engee.run( model, verbose=true ); # Запустить модель
    else
        model = engee.load( Path, force=true ) # Загрузить модель
        model_output = engee.run( model, verbose=true ); # Запустить модель
        engee.close( name_model, force=true ); # Закрыть модель
    end
    sleep(5)
    return model_output
end

run_model("stiffMechanicalSystem") # Запуск модели.
Building...
Progress 0%
Progress 5%
Progress 10%
Progress 15%
Progress 20%
Progress 25%
Progress 30%
Progress 35%
Progress 40%
Progress 45%
Progress 50%
Progress 55%
Progress 60%
Progress 65%
Progress 71%
Progress 76%
Progress 81%
Progress 86%
Progress 91%
Progress 96%
Progress 100%
Progress 100%
Out[0]:
Dict{String, DataFrame} with 2 entries:
  "Integrator, Second-Order-1.1" => 1001×2 DataFrame…
  "Integrator, Second-Order.1"   => 1001×2 DataFrame

Let's build the resulting graph.

In [ ]:
Body1 = collect(Body1);
Body2 = collect(Body2);
In [ ]:
gr()
plot(Body1.value, label = "Первое тело")
plot!(Body2.value, label = "Второе тело")
Out[0]:

Conclusion

As we can see on the graph, the second body is at rest, while the first body makes oscillatory movements.