Mathematical model of pendulum motion
The schematic diagram of the motion of a simple pendulum is shown in the figure below:
According to Euler’s second law, the sum of all moments about a fixed point is zero. In the figure above, there are two moments exerted at point x
One is the gravitational moment and the other is the inertia moment.
The gravitational moment is expressed as:
?
M
g
=
m
g
L
s
i
n
(
θ
)
M~g~=mgLsin(θ)
M g =mgLsin(θ)
The moment of inertia is expressed as:
?
M
i
=
m
L
2
d
(
d
(
θ
)
)
M~i~=mL^2d(d(θ))
M i =mL2d(d(θ))
where d(d(θ)) represents the second derivative of θ, here represents the angular acceleration
According to Euler’s second law, the sum of the moments at x is zero, that is:
?
M
g
+
M
i
=
m
g
L
s
i
n
(
θ
)
+
m
L
2
d
(
d
(
θ
)
)
=
0
M~g + M~i=mgLsin(θ) + mL^2d(d(θ))=0
M g + M i=mgLsin(θ) + mL2d(d(θ))=0
The above formula is further simplified to:
?
d
(
d
(
θ
)
)
=
?
g
s
i
n
(
θ
)
/
L
d(d(θ))=-gsin(θ)/L
d(d(θ))=?gsin(θ)/L
In order to further simplify the problem, assuming that as time goes by, the swing angle θ will become small enough, then sin(θ) is approximately equal to θ
The above formula can be simplified to:
?
d
(
d
(
θ
)
)
=
?
g
θ
/
/
L
d(d(θ))=-gθ//L
d(d(θ))=?gθ//L
The angular velocity ω can be expressed as:
?
ω
=
d
θ
/
d
t
ω=dθ/dt
ω=dθ/dt
Therefore, the above formula can be further expressed as:
?
d
ω
/
d
t
=
?
g
θ
/
L
dω/dt=-gθ/L
dω/dt=?gθ/L
Modelica model of the motion process of the pendulum
The code of the Modelica model of the pendulum motion process is as follows:
model SimplePendulm1 //Set the unit type Length = Real(final quantity = "Length", final unit = "m"); type Acceleration = Real(final quantity = "Acceleration", final unit = "m/s2"); type Angle = Real(final quantity = "Angle", final unit = "rad"); type AngularVelocity = Real(final quantity = "AngularVelocity", final unit = "rad/s"); //Set constants and parameters parameter length L = 2; constant Acceleration g = Modelica.Constants.g_n; //Set variables Angle theta; AngularVelocity omega; //initial equation initial equation theta = 0.1; omega = 0; //equation equation der(theta) = omega; der(omega) = -(g / L) * theta; end SimplePendulm1;
View simulation results:
The Modelica model code without simplification is as follows:
model SimplePendulm13 //Set the unit type Length = Real(final quantity = "Length", final unit = "m"); type Acceleration = Real(final quantity = "Acceleration", final unit = "m/s2"); type Angle = Real(final quantity = "Angle", final unit = "rad"); type AngularVelocity = Real(final quantity = "AngularVelocity", final unit = "rad/s"); //Set constants and parameters parameter length L = 2; constant Acceleration g = Modelica.Constants.g_n; //Set variables Angle theta; AngularVelocity omega; //initial equation initial equation theta = 1.57; omega = 0; //equation equation der(theta) = omega; der(omega) = -(g / L) * sin(theta); end SimplePendulm13;
The equation der(omega) = -(g / L) * sin(theta) is different. Theta is changed to sin(theta), and the initial swing angle is set to 90 degrees, which corresponds to radians, which is 1.57
View the simulation results, as shown in the figure below:
Now set the initial radians to 0.1 and compare the differences between the two models. The results are as shown in the figure below:
It is found that the curves almost overlap, but in fact there is still a little difference, but it is reasonable to make such a simplification
Now set the initial radians to 1.57 and compare the differences between the two models. The results are as shown in the figure below:
It was found that the difference in the results is relatively large. Therefore, when the swing angle is relatively large, the assumption that sin(θ) is approximately equal to θ cannot be made.
Use angles instead of radians
We usually care about changes in angles rather than changes in radians, so it is necessary to make such a substitution
The definition of angle units in the Modelica standard library is as follows:
type Angle = Real(final quantity = "Angle", final unit = "rad", displayUnit = "deg");
In this way, you can set the unit of the angle. The simulation results are as follows:
The changing trend of angular velocity with angle is shown in the figure below:
Reference books:
“Introduction and Improvement of Modelica Multi-domain Physical System Modeling”