Mathematical models of bodies
In this example we will consider two models of bodies. In the first case it will be a pendulum and in the second case it will be a body on a spring. We will analyse the behaviour of these bodies.
Mathematical pendulum
Let's analyse the process of describing oscillating systems using integral calculations in the Engee development environment. The figure shows a model of an oscillating system:

The model includes several basic concepts:
- A material point of mass m.
- A weightless inextensible thread of length l.
- A homogeneous field of gravitational forces g.
In this case, the formula for calculating the momentum of gravity is equal to the negative of the mass , multiplied by and and by the sine of the angle of deflection of the pendulum.
Let's move on to implementation. The first step is to declare the system parameters.
Pkg.add(["CSV"])
m = 1;
g = 9.8;
l = 1;
theta_init = 40*(pi/180); # перевод начального значения градуса отклонения в радианы
mgl=(-m*g*l);
invI = 1/(m * l^2);
Now let us run the system of integral equations constructed in Engee models. The figure below shows this model:

Note: the AB3 solver was used in the modelling.
AB3 is a three-step method of the third order, initialisation of Ralston methods of the second order.
# Запуск модели
model = engee.load("/user/start/examples/base_simulation/mathematical_models_of_bodies/Math_pendulum.engee"; force = true);
engee.run(model, verbose=true);
engee.close(model, force=true);
For processing and visualisation of simulation results we need to connect several libraries.
using CSV
using DataFrames
using Plots
plotlyjs()
Now we can read the data recorded during the modelling process. The data in the CSV file contains two columns:
- the timestamps of the simulation;
- output data, in this case the values of the degree of pendulum deflection.
# Чтение CSV
Data = Matrix(CSV.read("/user/start/examples/base_simulation/mathematical_models_of_bodies/out.csv",DataFrame));
Data_time = Data[:,1];
Data = Data[:,2];
Now let us analyse the results of the oscillation, presenting them graphically.
# Построение графиков
plot(Data_time , Data, legend = false)
plot!(title = "Результаты моделирования в Engee", ylabel = "Данные", xlabel="Время, c")
As we can see, the model displays non-damped oscillations of the mathematical pendulum with constancy of the oscillation process.
Mathematical model of mass-spring-damper model
In this example we will demonstrate the possibilities of calculating the behaviour of a body on a spring in order to demonstrate the capabilities of Engee in solving integral equations. The figure below shows a general view of the body for which the calculations will be performed.

The mass-spring damper shown in the figure is modelled by a second order differential equation.
where is the force applied to the mass and is the horizontal position of the mass.
Let's move on to implementation. First, let's declare the system parameters.
m = 2;
c = 50;
k = 0.2;
invM = 1/m;
Now let's run the system of integral equations constructed in Engee models. The figure below shows this model:

Note: the AB3 solver was used in the modelling.
AB3 is a three-step method of the third order, initialisation of Ralston methods of the second order.
# Запуск модели
model = engee.load("/user/start/examples/base_simulation/mathematical_models_of_bodies/Body_on_spring.engee", force=true);
engee.run(model, verbose=true);
engee.close(model, force=true);
For processing and visualisation of simulation results we need to connect several libraries.
using CSV
using DataFrames
using Plots
plotlyjs()
Now we can read the data recorded during the modelling process. The data in the CSV file contains two columns:
- modelling timestamps;
- output data.
# Чтение CSV
Data1 = Matrix(CSV.read("/user/start/examples/base_simulation/mathematical_models_of_bodies/out1.csv",DataFrame));
Data2 = Matrix(CSV.read("/user/start/examples/base_simulation/mathematical_models_of_bodies/out2.csv",DataFrame));
Data_time = Data1[:,1];
Data1 = Data1[:,2];
Data2 = Data2[:,2];
Now let us analyse the results of the oscillation and present them graphically.
# Построение графиков
plot(Data_time , Data1, legend = false)
plot!(Data_time , Data2, legend = false)
plot!(title = "Результаты моделирования в Engee", ylabel = "Данные", xlabel="Время, c")
As we can see, the model displays oscillations with gradual damping of the oscillation process, which is identical to the behaviour of a physical body on a spring.
Conclusion
As a result of this example we have shown you the capabilities of Engee in modelling the behaviour of physical objects by building a mathematical model of the object.
This example allows you to demonstrate the behaviour of an object based on its parameters, which can be applied to more complex algorithms and systems.