Home > リソース > MBDynモデル集 > 12. ラック&ピニオン
MBDynモデル集

12. ラック&ピニオン

アニメーション



入力ファイル

rack_pinion.mbd
# rack_pinion.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-4;
   max iterations: 10;
   tolerance:      1.e-7;
end: initial value;

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

begin: control data;
   output frequency: 100;
   structural nodes: 3;
   rigid bodies:     2;
   joints:           5;
   forces:           2;
end: control data;

#-----------------------------------------------------------------------------
# Design Variables
set: real M_Pinion = 0.1; #[kg] Mass of Pinion
set: real M_Rack   = 0.1; #[kg] Mass of Rack
set: real R_Pinion = 0.1; #[m] Radius of Pinion

set: real K_Pinion_Rack = 100000.; #[N/m] Stiffness Coefficient of Contact
set: real C_Pinion_Rack = 100.;    #[Ns/m] Damping Coefficient of Contact

#-----------------------------------------------------------------------------
# Intermediate Variables
set: real I_Pinion = M_Pinion*R_Pinion^2./2.; #[kgm^2] Moment of Inertia of Pinion

#-----------------------------------------------------------------------------
# Node Labels
set: integer Node_Ground = 1;
set: integer Node_Pinion = 2;
set: integer Node_Rack   = 3;

# Body Labels
set: integer Body_Pinion = 1;
set: integer Body_Rack   = 2;

# Joint Labels
set: integer JoClamp_Ground      = 1;
set: integer JoRevp_Pinion       = 2;
set: integer JoInlin_Ground_Rack = 3;
set: integer JoPrism_Ground_Rack = 4;
set: integer JoTotp_Pinion_Input = 5;

# Force Labels
set: integer CoStr_Pinion = 1;
set: integer FoStr_Rack   = 2;

#-----------------------------------------------------------------------------
# Scalar Functions 
scalar function: "cubstep",
   cubicspline, do not extrapolate,
      -0.03, 0.00,
      -0.02, 0.00,
      -0.01, 0.00,
       0.00, 0.00,
       1.00, 1.00,
       1.01, 1.00,
       1.02, 1.00,
       1.03, 1.00;

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

begin: nodes;

   #-----------------------------------------------------------------------------
   # Nodes
   structural: Node_Ground, static,
      null, # absolute position
      eye,  # absolute orientation
      null, # absolute velocity
      null; # absolute angular velocity
      
   structural: Node_Pinion, dynamic,
      null,                 # absolute position
      euler, pi/2., 0., 0., # absolute orientation
      null,                 # absolute velocity
      null;                 # absolute angular velocity
      
   structural: Node_Rack, dynamic,
      0., 0., -R_Pinion, # absolute position
      eye,               # absolute orientation
      null,              # absolute velocity
      null;              # absolute angular velocity
      
end: nodes;

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

begin: elements;

   #-----------------------------------------------------------------------------
   # Bodies
   body: Body_Pinion, Node_Pinion,
      M_Pinion,               # mass
      null,                   # relative center of mass
      diag, 1., 1., I_Pinion; # inertia matrix
      
   body: Body_Rack, Node_Rack,
      M_Rack,           # mass
      null,             # relative center of mass
      diag, 1., 1., 1.; # inertia matrix  
   
   #-----------------------------------------------------------------------------
   # Joints   
   joint: JoClamp_Ground,
      clamp,
         Node_Ground,
            null, # absolute position
            eye;  # absolute orientation
              
   joint: JoRevp_Pinion, 
      revolute pin, 
         Node_Pinion,
            null,                        # relative offset
            hinge, eye,                  # relative orientation
            null,                        # absolute pin position
            hinge, euler, pi/2., 0., 0.; # absolute pin orientation
            
   joint: JoInlin_Ground_Rack, 
      in line,
         Node_Ground,
            0., 0., -R_Pinion,             # relative line position
            1, 0., 0., -1., 3, 1., 0., 0., # relative orientation
         Node_Rack;
      
   joint: JoPrism_Ground_Rack,
      prismatic,
         Node_Ground,
         Node_Rack;
         
   joint: JoTotp_Pinion_Input,
      total pin joint,
         Node_Pinion,
            position, null,                             # relative offset
            position, null,                             # absolute position
            rotation orientation, euler, pi/2., 0., 0., # absolute rotation orientation
         position constraint,
            inactive, inactive, inactive,
            null,
         orientation constraint,
            inactive, inactive, active,
         single, 0., 0., 1., string, "2.*pi*sin(2.*pi*Time/4.)*model::sf::cubstep(Time)";
            
   #-----------------------------------------------------------------------------          
   # Plugin Variables
   set: [element, AZ_Pinion, JoRevp_Pinion, joint, string="rz"];
   set: [element, WZ_Pinion, JoRevp_Pinion, joint, string="wz"];
   set: [node, X_Rack, Node_Rack, structural, string="X[1]"];
   set: [node, VX_Rack, Node_Rack, structural, string="XP[1]"];
   
   #-----------------------------------------------------------------------------
   # Forces       
   couple: CoStr_Pinion,
      follower,
         Node_Pinion,
         single, 0., 0., 1., 
            string, "-K_Pinion_Rack*(AZ_Pinion*R_Pinion-X_Rack)*R_Pinion\
                     -C_Pinion_Rack*(WZ_Pinion*R_Pinion-VX_Rack)*R_Pinion";
         
   force: FoStr_Rack,
      follower,
         Node_Rack,
            position, null, # relative arm
         single, 1., 0., 0.,
            string, "K_Pinion_Rack*(AZ_Pinion*R_Pinion-X_Rack)\
                     C_Pinion_Rack*(WZ_Pinion*R_Pinion-VX_Rack)";
                 
end: elements;