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

## 17. Ｎリンク剛体振り子

### 入力ファイル

```# 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

# Body Labels

# Joint Labels

# Index
set: integer Index;

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

begin: nodes;

#-----------------------------------------------------------------------------
# Nodes
set: Index = 1;

set: Index = 2;

set: Index = 3;

set: Index = 4;

set: Index = 5;

set: Index = 6;

set: Index = 7;

set: Index = 8;

set: Index = 9;

set: Index = 10;

end: nodes;

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

begin: elements;

#-----------------------------------------------------------------------------
# Bodies
set: Index = 1;

set: Index = 2;

set: Index = 3;

set: Index = 4;

set: Index = 5;

set: Index = 6;

set: Index = 7;

set: Index = 8;

set: Index = 9;

set: Index = 10;

#-----------------------------------------------------------------------------
# Joints

revolute pin,
-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;

set: Index = 3;

set: Index = 4;

set: Index = 5;

set: Index = 6;

set: Index = 7;

set: Index = 8;

set: Index = 9;

set: Index = 10;

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

end: elements;
```

```# node_link.sub

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

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

```# body_link.sub

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

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

```# joint_link.sub

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