Engee 文档
Notebook

刚性机械系统

您已经看到求解器的设置如何影响建模过程--其速度和结果。 本例展示了一个使用变螺距求解器的刚性机械系统模型。 这个刚性系统包括两个摆动质量块,每个质量块都有不同的螺距求解器。下图显示了系统本身。

image_2.png

下面显示了求解器的设置。

image.png

现在我们来运行模型并分析结果。为此,我们需要声明一个辅助函数。

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

让我们构建结果图。

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

结论

从图中我们可以看到,第二个物体处于静止状态,而第一个物体正在做摆动运动。