Package mbdyn :: Module references :: Class ReferenceFrame
[hide private]

Class ReferenceFrame

source code

record.RecordBase --+            
                    |            
        record.Record --+        
                        |        
       common.BasicObject --+    
                            |    
               BasicReference --+
                                |
                               ReferenceFrame
Known Subclasses:
interface.references.ReferenceFrame

The reference frame interface. When describing a simulation, the first instance is usually a ReferenceFrame because this is a construction object.

In MBDyn, the reference frames are used to describe the initial conditions of the problem. They are not going to be used for the resolution. So this object exists only at the beginning of the simulation and its values are saved when Simulation calls the method store_mbdyn_data.

The reference frames are usually linked. A new reference frame is described relative to another one by the set_relative_from method. The properties of one reference frame is inherited to all the reference frames that are linked to. This feature is for example very useful to give an initial rotational speed to many other reference frames, and thus to the nodes attached to them. The drawback is that a mistake done on a base reference frame is propagated to all the other ones. A common mistake is a wrong orientation matrix.

By default a reference is frame is relative to the absolute referential, with a null position, a identity rotation matrix, a null velocity and a null angular velocity. However, it a relative reference frame is used, it is important to call set_relative_from just after the instance creation (otherwise the default values will be applied relative to the global reference frame - a default to fix).

Example of use:
   import numpy as N

   angle = N.pi/3.
   ref1 = ReferenceFrame()
   ref1.set_orientation_matrix(one=(N.cos(angle),
                                    N.sin(angle),
                                    0.),
                               three=(0., 0., 1.))

   ref2 = ReferenceFrame()
   ref2.set_relative_from(ref1)
   ref2.set_position(10., 0., 0.)

   ref3 = ReferenceFrame()
   ref3.set_relative_from(ref2)
   ref3.set_angular_velocity(0., 0., 2.2)

The reference frame ref1 is turn of a π/3 angle along the z axis. The reference frame ref2 follows this orientation and is placed at 10 m from the origin. However, but this feature is provided by MBDyn, its value in the absolute reference frame is: (10. cos(π/3), 10. sin(π/3), 0.). ref3 gets a angular velocity of 2.2 rad/s along the z axis and is at the position of ref2. This kinematic property is going to be transfered to any node attached to this reference frame. The reference frame can also be used to enter element property, but the kinematic properties are in that case not relevant as only the nodes introduced kinematic degrees of freedom.

At the end, the MBDyn results are always output in the absolute reference frame, from which the integration is performed. However, transformations in a particular reference frame can be easily done by using node rotation matrix that are updated at each iteration.

Instance Methods [hide private]
 
__init__(self, name='reference') source code
 
set_default(self)
Set the reference frame default.
source code
 
set_relative_from(self, ref)
Set the relative reference frame.
source code
 
set_to_none(self)
No referential and no prefix for the MBDyn input file
source code
 
set_position(self, *args, **kargs)
Set the position relative to its reference frame.
source code
 
set_orientation_matrix(self, *args, **kargs)
Set the orientation matrix relative to its reference frame
source code
 
set_velocity(self, *args, **kargs)
Set the velocity relative to its reference frame
source code
 
set_angular_velocity(self, *args, **kargs)
Set the initial angular velocity relative to its reference frame
source code
 
get_mbdyn_instance(self)
Get the MBDyn instance created by WraptMBDyn.
source code
 
_init_results(self)
Initialize the results and set the callbacks for getting MBDyn values.
source code
 
store_mbdyn_data(self)
Saved the initial values converted in the absolute reference frame by MBDyn.
source code

Inherited from BasicReference: to_mbdyn

Inherited from common.BasicObject: get_lines, set_comment, set_label, set_name, set_simulation_ref

Inherited from record.Record: common_init_results, init_results, save, set_own_parameters, will_save, will_save_nothing, will_save_only

Inherited from record.RecordBase: collect_own_parameters, collect_parameters, set_own_para, set_parameters

Inherited from record.RecordBase (private): _collect_own_para

Method Details [hide private]

__init__(self, name='reference')
(Constructor)

source code 
Overrides: BasicReference.__init__

set_default(self)

source code 
Set the reference frame default. It means a null position, a identity rotation matrix, a null velocity and and null angular velocity relative to its reference frame

set_relative_from(self, ref)

source code 
Set the relative reference frame. All the values entered will be relative to the given reference frame.

get_mbdyn_instance(self)

source code 
Get the MBDyn instance created by WraptMBDyn.
Overrides: common.BasicObject.get_mbdyn_instance

store_mbdyn_data(self)

source code 
Saved the initial values converted in the absolute reference frame by MBDyn. By default, only the absolute position and absolute orientation matrix are saved. The absolute velocity and absolute angular velocity can be added by:
   will_save("velocity",
             "angular_velocity")