Home > リソース > MBDynモデル集 > 17. Nリンク剛体振り子
MBDynモデル集

17. Nリンク剛体振り子

アニメーション



入力ファイル

nlink_pendulum.mbd
# nlink_pendulum.mbd

#-----------------------------------------------------------------------------
# [Data Block]

begin: data;
   problem: initial value;
end: data;

#-----------------------------------------------------------------------------
# [<Problem> Block]

begin: initial value;
   initial time:   0.;
   final time:     5.;
   time step:      1.e-3;
   max iterations: 10;
   tolerance:      1.e-7;
end: initial value;

#-----------------------------------------------------------------------------
# [Control Data Block]

begin: control data;
   output frequency: 10;
   structural nodes: 10;
   rigid bodies:     10;
   joints:           10;
   gravity;
end: control data;

#-----------------------------------------------------------------------------
# Design Variables
set: real M = 0.2; # Mass of Link
set: real L = 0.2; # Length of Link

#-----------------------------------------------------------------------------
# Intermediate Variables
set: real I = M*L^2./12.; # Moment of Inertia of Link

#-----------------------------------------------------------------------------
# Node Labels
set: integer Node_Link1 = 1;
set: integer Node_Link_curr;

# Body Labels
set: integer Body_Link_curr;

# Joint Labels
set: integer JoRevp_Link1 = 1;
set: integer JoRevh_Link_curr;

# Index
set: integer Index;

#-----------------------------------------------------------------------------
# [Nodes Block]

begin: nodes;

   #-----------------------------------------------------------------------------
   # Nodes
   set: Index = 1;
   include: "node_link.sub";
   
   set: Index = 2;
   include: "node_link.sub";
   
   set: Index = 3;
   include: "node_link.sub";
   
   set: Index = 4;
   include: "node_link.sub";
   
   set: Index = 5;
   include: "node_link.sub";
   
   set: Index = 6;
   include: "node_link.sub";
   
   set: Index = 7;
   include: "node_link.sub";
   
   set: Index = 8;
   include: "node_link.sub";
   
   set: Index = 9;
   include: "node_link.sub";
   
   set: Index = 10;
   include: "node_link.sub";
   
end: nodes;

#-----------------------------------------------------------------------------
# [Elements Block]

begin: elements;

   #-----------------------------------------------------------------------------
   # Bodies
   set: Index = 1;
   include: "body_link.sub";
   
   set: Index = 2;
   include: "body_link.sub";
   
   set: Index = 3;
   include: "body_link.sub";
   
   set: Index = 4;
   include: "body_link.sub";
   
   set: Index = 5;
   include: "body_link.sub";
   
   set: Index = 6;
   include: "body_link.sub";
   
   set: Index = 7;
   include: "body_link.sub";
   
   set: Index = 8;
   include: "body_link.sub";
   
   set: Index = 9;
   include: "body_link.sub";
   
   set: Index = 10;
   include: "body_link.sub";
   
   #-----------------------------------------------------------------------------
   # Joints
   
   joint: JoRevp_Link1, 
      revolute pin, 
         Node_Link1, 
            -1./2.*L, 0., 0.,                    # relative offset
            hinge, 1, 1., 0., 0., 3, 0., 1., 0., # relative axis orientation
            null,                                # absolute pin position
            hinge, 1, 1., 0., 0., 3, 0., 1., 0.; # absolute pin orientation
       
   set: Index = 2;
   include: "joint_link.sub";
   
   set: Index = 3;
   include: "joint_link.sub";
   
   set: Index = 4;
   include: "joint_link.sub";
   
   set: Index = 5;
   include: "joint_link.sub";
   
   set: Index = 6;
   include: "joint_link.sub";
   
   set: Index = 7;
   include: "joint_link.sub";
   
   set: Index = 8;
   include: "joint_link.sub";
   
   set: Index = 9;
   include: "joint_link.sub";
   
   set: Index = 10;
   include: "joint_link.sub";

   #-----------------------------------------------------------------------------
   # Gravity  
   gravity: 0., 0., -1., const, 9.81;
   
end: elements;

node_link.sub
# node_link.sub

#-----------------------------------------------------------------------------
set: Node_Link_curr = Index;

structural: Node_Link_curr, dynamic,
   (Index-1)*L+1./2.*L, 0., 0., # absolute position
   eye,                         # absolute orientation
   null,                        # absolute velocity
   null;                        # absolute angular velocity

body_link.sub
# body_link.sub

#-----------------------------------------------------------------------------
set: Node_Link_curr = Index;
set: Body_Link_curr = Index;

body: Body_Link_curr, Node_Link_curr,
   M,                                # mass
   null,                             # relative center of mass
   diag, 0., M*L^2./12., M*L^2./12.; # inertia matrix

joint_link.sub
# joint_link.sub

#-----------------------------------------------------------------------------
set: Node_Link_curr = Index;
set: JoRevh_Link_curr = Index;

joint: JoRevh_Link_curr, 
   revolute hinge, 
      Node_Link_curr-1,
         1./2.*L, 0., 0.,                     # relative offset
         hinge, 1, 1., 0., 0., 3, 0., 1., 0., # relative axis orientation
      Node_Link_curr,
         -1./2.*L, 0., 0.,                    # relative offset
         hinge, 1, 1., 0., 0., 3, 0., 1., 0.; # relative axis orientation
スポンサーリンク