2017-04-08

Upside down

It is intuitive to expect that after releasing a raised pendulum it will tend to swing around and eventually stop at rest at the bottom. It is perfectly reasonable: after all the gravity acts downwards, and the loss of energy due to friction will slowly bring the movement to stop. Of course, you can also balance the pendulum upside down, but it is not a stable configuration - any slightest disturbance will topple the system.
Situation changes when you introduce vibrations while holding the pendulum. The oscillation fools the pendulum, as if confusing it to where the top and where the bottom is. The shape of the potential function changes and new stable minima appear. You can now easily balance the pendulum upside down! In fact, it is possible to balance the pendulum at any angle to the vertical. (You can’t do it by hand. The required amplitude and the frequency of oscillations are too big to be generated this way).
It’s a very curious phenomenon, and I’m very grateful to my friend Maciej Ciężkowski who drew my attention towards it. The inverted pendulum is one of his areas of research, and he’s done some great work pursuing that interest. I encourage you to check out his papers ([1, 2]) which explain in detail the things you’ll read about below.
I wanted to observe what exactly is happening when you subject the pendulum to oscillations - and what better (and cheaper!) way to do it if not to make a simulation?
(One more note: this is open-loop control, so no feedback is used.)

Pendulum simulator

The interactive demonstration of the phenomenon is available HERE.
The source code is hosted at GitHub: .https://github.com/dagothar/inverted-pendulum
Fig. 1. Pendulum simulator.
Features:
  • pendulum dynamics simulator,
  • completely parametrizable,
  • introduce pendulum base oscillations,
  • measure pendulum angle and angular velocity,
  • measure pendulum angle with vibrations filtered out,
  • observe the shape of gravitational potential Ug and the effective potential Uef,
  • slow-mo,
  • click to drag pendulum around,
  • bugs (?).
The pendulum is shown in the middle (it’s the black rod with a black circle on its end). The base of the pendulum is shaken by a linear actuator (black rectangle). The angle of the actuator (the plane of oscillations) is shown as the dashed black line denoted β. Thin dashed black line shows the current angle of the pendulum θ. The blue line shows the angle of the pendulum ψ after filtering out the quick vibrations (which are due to the shaking).
The pendulum is surrounded with a plot shown in polar coordinates. The green line shows the potential due to gravity Ug, while the red line shows the potential modified due to oscillations Uef. It is somehow tricky to spot the minima and the maxima of a function plotted in polar coordinates. The grey concentric circles represent the different levels of the potential and the dashed red circle shows the value of the potential at the current position of the pendulum.
The panel on the left allows for the modification of the parameters. You can restore the default values by clicking the Reset parameters button at the bottom. The panel on the top right contains a set of controls. Here you can Reset the system, Start and Pause the simulation and tweak the inputs. I suggest to begin with changing the plane of the oscillations β (don’t do it too quickly!). You can slow down the time by using the Time scale slider.
You can also interact with the pendulum directly. Simply click on the image in the center. In the paused mode, the pendulum will be placed wherever you have clicked. In the running mode, a force will be added to the pendulum that will attract it to the cursor’s location.
There was a lot of trickery and fiddling required to make this work (wrap-around issues and frequency scaling were particularly nasty). Do not hesitate to ask about the technical details.
The model and the parameters will be described in more detail below.

The model of the pendulum

The model of the pendulum is presented in fig. 2.

Fig. 2. The model of the pendulum.
The pendulum consists of a rod of length l and mass m, mounted on a linear actuator of length 2A. The rod has uniform density. The angle of the pendulum from the vertical is denoted θ. The angle of the oscillation plane is
β. The linear actuator induces oscillations of frequency ω. The position of the center of mass of the pendulum is (cx, cy), while the position of oscillating hinge is (rx, ry). The gravitational acceleration g acts downwards.
The parameters are described in the following table.
# parameter units description
1 θ0 [rad] the initial angle of the pendulum
2 dθ0 [rad/s] the initial angular velocity of the pendulum
3 m [kg] the mass of the pendulum
4 l [m] the length of the pendulum
5 g [m/s^2] the gravitational acceleration
6 Amax [m] maximum amplitude of the oscillations (scales the amplitude slider)
7 ωmax [rad/s] maximum frequency of the oscillations (scales the frequency slider)
8 dmax [Ns] maximum damping for the pendulum (scales the damping slider)
9 kpull [Nm] spring coefficient for pulling the pendulum with the mouse
10 dpull [Ns] damping coefficient for pulling the pendulum with the mouse
11 [1] low-pass filter coefficient k for the filtered pendulum angle ψ
12 [1] low-pass filter coefficient T for the filtered pendulum angle ψ

The equations of motion

The dynamics of the pendulum are described by the following equation:
\ddot\theta \; = \; \frac{3}{2 \: l} (-A\:\omega^2 \: \sin \omega t \: \cdot \: \sin (\beta \: - \: \theta) \: + \: g \: \sin \theta)
One might also add a damping term to curb the oscillations, like so:
\ddot\theta \; = \; \frac{3}{2 \: l} (-A\:\omega^2 \: \sin \omega t \:  \cdot \: \sin (\beta \: - \: \theta) \: + \: g \: \sin \theta) - \frac{3\: d}{m \: l^2} \: \dot\theta
It is also necessary to calculate the position of the base point of the pendulum (the one driven by the oscillations):
r_x \; = \; A \: \sin \beta \: \sin \omega t
r_y \; = \; A \: \cos \beta \: \sin \omega t
It’s quite easy to derive these equations through Lagrangian formalism. Start with the equations of motion for the oscillating base, then add the rotational swing of the pendulum for the velocity and the position of the center of mass of the pendulum. These expressions can then be plugged into potential and kinetic energy calculations, which make up the Lagrangian: L = T - U.
The equations of motion pop out from:
\frac{d}{dt}\:\frac{\partial\mathcal{L}}{\partial\dot\theta} \; = \; \frac{\partial\mathcal{L}}{\partial\theta}
The filtered angle of the pendulum is computed with the use of a low-pass filter to cut out the high frequency oscillations. The filter equation is:
\dot\psi \; = \; \frac{k_\psi \: (\theta \: - \: \psi)}{T_\psi}
(This filter could use some tuning perhaps.)

The effective potential

What makes the pendulum think it should go to a certain position is the force due to the gradient of the effective potential. This is the potential felt by the slowest mode of the pendulum oscillations. The effective potential Uef is calculated as follows [1]:
U_{ef} \; = \; \frac{1}{2}\: g \: l \: m \: \cos \varphi \: - \: \frac{3}{32} \: A^2 \: m \: \omega^2 \: \cos \: 2\:(\beta \: - \: \varphi)

Examples

With no oscillations introduced, the pendulum behaves as expected: it falls down from its top unstable position and slows down at the bottom (see fig. 3).
Fig. 3. The pendulum falls down when no oscillations are present.
The effective potential changes its shape when the oscillations are introduced. The fig. 4 shows the pendulum oscillating around a new stable point at 45 degrees from the vertical. Notice how the minimum is visible in the shape of the Uef function: the red line rises on both sides around the pendulum position and the tangent red dashed circle.
You might notice that you have to place the plane of oscillations somewhat “higher” than the desired angle of the pendulum. You can find the formula for this angle in [1].
Fig. 4. Pendulum balanced around 45 degrees to the vertical (default parameters; β=0.591).
But how to achieve that stable configuration? The fig. 5 shows the pendulum moved into its top position by first introducing the oscillations and then rotating the plane of the vibration. Notice how the shape of the effective potential deviates from the base as the frequency of the oscillations is increased.
Fig. 5. Stabilizing the pendulum in its top position.
There are still some open questions here to answer. How to achieve the time optimal transit between the positions? Is it possible to arbitrarily shape the potential function? What on Earth can this be used for?

Literature

[1] M. Ciężkowski, Stabilization of Pendulum in Various Inclinations Using Open-Loop Control, Acta Mechanica et Automatica. 5(4), 22–28 (2011), full text available: http://www.actawm.pb.edu.pl/volume/vol5no4/CIEZKOWSKI_EN_2011_105.pdf
[2] M. Ciężkowski, Dynamic stabilization of the pendulum in a moving potential well, 2016 21st International Conference on Methods and Models in Automation and Robotics (MMAR), Miedzyzdroje, 2016, pp. 54-58. doi: 10.1109/MMAR.2016.7575087

No comments:

Post a Comment