6.3 Inverted Pendulum Problem
255
height = 2 * rad, r = {xp, yp, 0}, r_shape = {-rad,
0, 0}, color = {255, 0, 0});
Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape
ground(shapeType = ”box”, length = 0.01, width = 2 * l,
height = 2 * l, r = {0, -2 * l, 0}, lengthDirection = {0,
1, 0}, color = {0, 255, 0});
Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape
cart(shapeType = ”box”, length = l / 6, width = l / 3,
height = l / 6, r = {x, 0, 0}, lengthDirection = {0, -1, 0},
color = {255, 191, 0});
Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape
rail(shapeType = ”box”, length = 0.01, width = 4 * l,
height = 0.01, r = {0, 0, 0}, lengthDirection = {0, -1,
0}, color = {195, 176, 145});
Modelica.Blocks.Interfaces.RealInput u;
Modelica.Blocks.Interfaces.RealOutput phi(start = pi / 6,
fixed = true);
equation
(M + m) * der(der(x)) - m * l * der(der(phi)) * cos(phi)
+ m * l * der(phi) * der(phi) * sin(phi) + b * der(x) = u;
l * der(der(phi)) - g * sin(phi) - der(der(x))
* cos(phi) = 0;
xp = x - l * sin(phi);
yp = l * cos(phi);
end ReversPendulum;
We present the results of an intermediate numerical experiment. Perform a simulation without adjusting the pendulum. In this case, the pendulum flips over and we
get results similar to an elliptical pendulum. In a medium with friction, we observe
damped oscillations (Fig. 6.65).
The animation with the trace of the movement of the load is as shown in Fig. 6.66.
We also plot the trolley displacement along the x-axis, Fig. 6.67.
Now, let us move on to controlling the pendulum.
Component: Regulator
Create the “Regulator” component, see Fig. 6.68.
Writing a program code for it is not difficult, see Example 6.1 and Fig. 6.69.
Gain can be adjusted either at the bottom of the screen, Fig. 6.70. Or when
performing a numerical experiment.
And finally, combine our model.
Trolley-mounted inverted pendulum
Let us create an icon of the finished model in case we need to use a controlled
pendulum in more complex systems, Fig. 6.71.
Assemble the component model from the created components, Fig. 6.72.
Run a numerical experiment with the settings of the PID controller: K p =
−80, K i = 0, K d = 0. We plot for the angular displacement of the pendulum,
Fig. 6.73a, and for the linear displacement of the trolley, Fig. 6.73b. A more active
damping of oscillations is observed than without a regulator, simultaneously with an
Précédent

- 266/274

Suivant