# The Use and Understanding of Multibody Orientation

Written by: David Briant – Project Engineer

Development of multibody models and systems can be complex, even when dealing with one orientation; but they can get a lot more complicated to understand and build when there are multiple orientations used within the same system. This post aims to improve understanding of multibody orientations; and build practical knowledge of the use of them to facilitate development of multibody systems.

Firstly, a multibody orientation can be considered as the angles of the X-Y-Z (Coordinate System) a component relative to another; commonly an orientation is considered relative to a “world” orientation, which is the X-Y-Z of the world and is normally stationary. But orientation is not related to position. So if when a door is in closed state it has an orientation being the same as the “world” orientation; when it is opened then the orientation of the door has now changed by being rotated. The position of the door is not important in orientation terms, but the relative angles between the door and the world coordinate system is defined by the orientation.

A coordinate system defines the X-Y-Z axes of a multibody system and which way those axis are pointing. Conventionally a coordinate system uses the “Right Hand Rule”; the index finger representing X, the middle finger representing Y and the thumb representing Z. The 3 axes are orthogonal to each other so if X was forward and Z was up then Y would point to the left.

Consider a partially open door within a door frame, we can fairly easily measure it when its square to the axis; for example a closed door could be 2m x 0.75m x 0.04m and the door frame would be about the same size, but how big is the door if it is open by 32 degrees and measured in the orientation of the door frame? While it can be done with not too much difficulty, wouldn’t it be more convenient to define 2 orientations? 1 for the door and 1 for the frame and defining a relationship between them stating that one orientation is rotated 32 degrees from the other. When considering full vehicle models with many different sub-systems it can make it much easier to manage the model if each component can have its own orientation.

The way of defining a multibody orientation is using a Transformation Matrix, which is a 3×3 matrix, defining the direction of each axis vector relative to another. As shown below, the first line is the vector defining the x vector of a coordinate system, the second defining y and the third defining z.

A transformation matrix describes the relationship between two orientations, therefore it requires that the original orientation is known. Below is an example of a simple transformation, rotating around the z axis.

When considering the transformation from the “World” axis in black to the red coordinate system:

• The red X axis is pointing along the black y axis. Therefore the first line of the transformation matrix is {0,1,0}.
• The red Y axis is pointing in the opposite direction to the black X axis. Therefore the second line of the matrix is {-1,0,0}
• Both red and black Z axes are pointing in the same direction, therefore the last line of the transformation matrix can remain as {0,0,1}.

The resulting transformation matrix is shown below:

The transformation matrix can then be used to correctly orientate forces, torques and positions. But this highlights another potential area of confusion, which is knowing which orientation the position/force/etc. is defined in. If the transformation matrix is from Coordinate System A to B then multiplying it with the force resolved in A would get the force resolved in B; but multiplying it with the force resolved in B would not get the resolved in A. For that the Inverse of the transformation matrix is required.

A multibody connector is referred to as a frame. Within multibody components there are 2 key components to a frame; the position of the frame (r_0) relative to world origin and resolved in world orientation and the orientation record (R). The orientation record is comprised of a transformation matrix (T) and the angular velocity vector (w) of the frame, both resolved in world orientation. w can be a direction differential function of the transformation matrix. Note that the frame connector is always resolved in the world orientation and relative to the world origin. Within Dymola, with all connections at zero angle offset and no orientation changes defined, all frames will be in the same orientation.

There are a few methods that can help in building multi-orientation, multibody systems;

• Reduce use of multiple orientations within the same component by introducing interfacing components that convert the orientation at the interface between components.
• Ensure that the conversion from one coordinate system to another is visible and easily modifiable.

Within the VeSyMA suite of libraries these methods are implemented by using a system of components that handle orientations on a component wide basis, using inner and outer control elements to separate coordinate systems. The component shown below is an engine template, with each multibody connector having a “vehicle to Local” transformation; each transformation is controlled by the “Local orientation block in the lower left of the component. This allows the component to be in a separate, consistent orientation, and the interfacing connections being in vehicle orientation.

• It can be very useful to visualise frames and orientations, using visualiser component to show the orientation; this can aid understanding and highlight potential issues with mismatched orientations. Within the Modelica Standard Library and Claytex Libraries there are frame visualisers that allow users to animate the frames for easier identification.
• Where possible standardise orientation to use normal conventions, unless entirely necessary to reduce complexity of multiple levels of orientations; in vehicles a common orientation is the ISO convention: Forward (X), Left (Y), Upwards (z).

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.