[MBDyn-users] Problem with relative orientations and FreeCAD.

MBDyn users list mbdyn-users at mbdyn.org
Sun Nov 14 17:07:33 CET 2021


Dear MBDyn users

I have been programming a FreeCAD (https://www.freecadweb.org/) "workbench"
aiming at integrating FreeCAD and MBDyn. The main idea is to automatically
"translate" a CAD assembly into an input file for MBDyn, so that FreeCAD
can be used as a kind of pre and post processor for MBDyn. I have so far
made good progress (https://www.youtube.com/user/josegegas/videos) but I am
stuck due to some problems with relative orientations, so I thought someone
in this mailing list may help me. Please let me explain what my problem is.

The next input file was generated using my FreeCAD workbench, and
represents a simple pendulum:

#-----------------------------------------------------------------------------

# [Data Block]


begin: data;

problem: initial value;

end: data;


#-----------------------------------------------------------------------------

# [Problem Block]


begin: initial value;

initial time: 0.0;

final time: 6.0;

time step: 0.01;

max iterations: 100;

tolerance: 1e-06;

derivatives tolerance: 0.0001;

derivatives max iterations: 100;

derivatives coefficient: auto;

end: initial value;


#-----------------------------------------------------------------------------

# [Control Data Block]


begin: control data;

default orientation: euler321;

initial stiffness: 1.0, 1.0;

structural nodes: 1;

rigid bodies: 1;

joints: 1;

gravity;

end: control data;


#-----------------------------------------------------------------------------

# [Design Variables]


#body: 1

set: real mass_1 = 0.4365667728833106; #mass [kg]

set: real volume_1 = 5.526161682067222e-05; #volume [m^3]


#-----------------------------------------------------------------------------

# [Intermediate Variables]


#Moment of inertia


#body 1:

set: real Ixx_1 = 8.550899247423066e-05; #moment of inertia [kg*m^2]

set: real Ixy_1 = -1.360420992105478e-20; #moment of inertia [kg*m^2]

set: real Ixz_1 = 1.471489667892456e-20; #moment of inertia [kg*m^2]


set: real Iyx_1 = -1.360420992105478e-20; #moment of inertia [kg*m^2]

set: real Iyy_1 = 0.000565723290354828; #moment of inertia [kg*m^2]

set: real Iyz_1 = 6.818251834179195e-22; #moment of inertia [kg*m^2]


set: real Izx_1 = 1.471489667892456e-20; #moment of inertia [kg*m^2]

set: real Izy_1 = 6.818251834179195e-22; #moment of inertia [kg*m^2]

set: real Izz_1 = 0.0006439561699476704; #moment of inertia [kg*m^2]


#-----------------------------------------------------------------------------

# [Drive callers]


drive caller: 1, name,"drive:1", const, 10.0;


#-----------------------------------------------------------------------------

# [Constitutive laws]


#-----------------------------------------------------------------------------

# [Nodes Block]


begin: nodes;


structural: 1,

dynamic,

0.04883070341485204, -1.6811028652876376e-18, 0.005, #<absolute_position>
[m]

3, 0, 0, 1.00000000000000, 2, 0, 1.00000000000000, 0,
#<absolute_orientation_matrix>

0.0, 0.0, 0.0, #<absolute_velocity> [m/s]

0.0, 0.0, 0.0; #<absolute_angular_velocity> [rad/s]


end: nodes;


#-----------------------------------------------------------------------------

# [Elements Block]


begin: elements;


#-----------------------------------------------------------------------------

# [Bodies]


body: 1,

1, #<node_label>

mass_1, #<mass> [kg]

0.0, 0.0, 0.0, #<relative_center_of_mass> [m]

Ixx_1, Ixy_1, Ixz_1, #<inertia_matrix> [kg*m^2]

Iyx_1, Iyy_1, Iyz_1,

Izx_1, Izy_1, Izz_1;


#-----------------------------------------------------------------------------

# [Joints]


joint: 1,

revolute pin,

1, #<node_label>

-0.04883070341485204, 1.740996700923339e-18, 0.0, #<relative_offset> [m]

hinge, 3, -2.09466019007024e-24, -1.19787671271403e-17, -1.00000000000000,
2, guess, #<relative_orientation_matrix>

1.0473300950351195e-26, 5.989383563570156e-20, 0.005,
#<absolute_pin_position> [m]

hinge, 3, -2.09466019007024e-24, -1.19787671271403e-17, -1.00000000000000,
2, guess; #<absolute_pin_orientation_matrix>


#-----------------------------------------------------------------------------

# [Gravity elements]


gravity: uniform, 0, -1.00000000000000, 0, string, "model::drive(1, Time)";
#<gravity_acceleration> [m/s^2]


end: elements;


As you can see, the only one node is initially oriented parallel to the
global reference frame:


3, 0, 0, 1.00000000000000, 2, 0, 1.00000000000000, 0,
#<absolute_orientation_matrix>

The orientation matrix for the node is obtained from the orientation of the
CAD part that represents the pendulum.


Since the node is parallel to the global frame, the revolute pin´s relative
orientation equals its absolute orientation:


joint: 1,

revolute pin,

1, #<node_label>

-0.04883070341485204, 1.740996700923339e-18, 0.0, #<relative_offset> [m]

hinge, 3, -2.09466019007024e-24, -1.19787671271403e-17, -1.00000000000000,
2, guess, #<relative_orientation_matrix>

1.0473300950351195e-26, 5.989383563570156e-20, 0.005,
#<absolute_pin_position> [m]

hinge, 3, -2.09466019007024e-24, -1.19787671271403e-17, -1.00000000000000,
2, guess; #<absolute_pin_orientation_matrix>


Now, if I change the node´s initial orientation as follows:


3, 0, -6.57126875612185e-16, 1.00000000000000, 2, -1.00000000000000,
-6.57126875612185e-16, 0, #<absolute_orientation_matrix>


While keeping the joint´s relative orientation, the initial assembly
obviously fails. My question is, how can I obtain the joint´s relative
orientation in the same format, given the node´s and joint´s absolute
orientations?


I have tried as follows:


hinge, 3, -2.09466019007024e-24, -1.19787671271403e-17, -1.00000000000000,
2, 1.00000000000000, -6.57126875612185e-16, 0,
#<relative_orientation_matrix>


But the initial assembly still fails, so I believe I am misinterpreting the
relative orientation as the joint´s orientation relative to its node's
orientation?


I have closely looked at the tutorials (
https://www.sky-engin.jp/en/MBDynTutorial/) as well as the input file
manual, but it seems to me that neither provide a precise definition for
the relative orientations of the joints.


Any comments will be useful.


Kind regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mbdyn.org/pipermail/mbdyn-users/attachments/20211114/94705e37/attachment.html>


More information about the MBDyn-users mailing list