# Magic T-Handles in Space: Simulating 3D Rotational Dynamics in Modelica

Everyday objects rarely move in ways that surprise us.
One does not need an understanding of physics to catch a ball—
human intuition is enough to predict its path. Knowledge of gravity and momentum is useful for quantifying and explaining the arc the ball follows, but it is not needed to know a ball in the air will fall back to earth. Similarly, multibody models in Modelica are usually used to predict with precision, rather than explain the bizarre, because objects at everyday speeds rarely do anything astonishing.

So here’s a surprise:

This is a simple T-handle aboard the International Space Station. It doesn’t have any internal moving parts, hidden magnets, or invisible wires. This is a solid object floating freely. Aside from a very small amount of air resistance, no external forces or torques are acting on the object. So what on earth (err…in space) is going on here?

### Explanation

There are no external torques, so the object’s momentum must be constant. This is a rigid body, so its inertial properties are also constant. So why does the rotational velocity vary wildly?

The answer is that the momentum is constant from the astronaut’s reference frame, and the rotational inertias are constant in reference to the object, but the object is rotating and these two frames change alignment. Initially, the momentum is about an axis with a comparatively large moment of inertia. As the object wobbles, some of that same momentum ends up being about an axis with a much lower inertial moment, and a large rotational velocity results. This is why the object appears to “snap”—there is a high rotational velocity about the “lighter” axis until the object once again aligns the “heavier” axis with its momentum. This effect is known as torque-free precession. Now, how do we simulate it?

### Modeling Torque-Free Precession

For a complex behavior, the motion of the T-handle is very easy to simulate in Dymola using the Modelica Standard Library’s Multibody package.

One approach to modeling the T-Handle would be to add a Modelica.Mechanics.MultiBody.Parts.Body and typing in inertial properties. While this approach would certainly work, it comes with the hurdle of estimating an inertia tensor for the T-handle. Instead, I opted to use two rigidly linked instances of BodyCylinder. The cylinders are defined with constant density, and the Dymola solver calculates the inertia tensor based shape. This approach has the added benefit of showing the cylinders in Dymola’s animation window by default. I used a bit of trial and error to create a shape similar to the T-Handle in the video. The block diagram of the final model is below.

This model is merely 3 components—the two cylinders defining the T-Handle and the Modelica.Mechanics.MultiBody.World block, which is needed to define certain global parameters. Gravity is the most interesting of these parameters for our case, because it must be changed from it’s default value to zero.

All that is left is to set some initial conditions. Position and velocity are fixed to initialize at zero. I also zeroed the starting angles, giving the object an initial orientation aligned with world coordinates. I used an initial rotational velocity of 10 rad/s about the x-axis, along with a .1 rad/s rotation about z to give the handle a very slight wobble.

With only 3 components and a few changes to the default parameters, here we are:

Excluding annotations, the model is only 20 lines of code. Modelica makes simulating torque-free precession easier than explaining it.

Written by: Joseph Henning – Software Engineer

Please get in touch if you have any questions or have got a topic in mind that you would like us to write about. You can submit your questions / topics via: Tech Blog Questions / Topic Suggestion