演習1:システム定義の作成と使用
本演習では、元のシステムMDLファイルからシステム定義を生成する方法について学習します。
- *DefineSystem()
- *System()
- *SetSystem()
- *Attachment()
本演習では、これらのアクションを実施します:

図 1. 二重振子の詳細図
- チュートリアルMV-1060:MDLステートメントを用いた振子モデルの構築からの振子モデルを修正し、sys_pendu_mdlというシステム定義を作成します。
- このシステム定義を使って、別の振子をモデルに追加し、図 1に示すような二重振子のモデルを作成します。
- ベースモデルをdoublependulum.mdlとして保存します。
- 過渡応答の動力学シミュレーションを実行し、アニメーションを表示させます。

図 1. 二重振子の詳細図

図 2. 二重振子のプロパティ一覧
システム定義の作成
このステップでは、チュートリアルMV-1060:MDLステートメントを用いた振子モデルの構築からのMDLモデルファイルを使ってシステム定義を作成します。
-
mbd_modeling\mdlフォルダーにあるpendulum.mdlファイルを、自身の<作業ディレクトリ>にコピーします。
以下が、以前のチュートリアルの振子モデルについてのMDLサンプルファイルです:
このMDLファイルは、多少の変更を加えることによって、システム定義に変換することができます。//Pendulum Model //05/31/XX *BeginMDL(pendulum, "Pendulum Model") //Topology information //declaration of entities //Points *Point(p_pendu_pivot, "Pivot Point") *Point( p_pendu_cm, "Pendulum CM") //Bodies *Body(b_link, "Ball", p_pendu_cm) //Graphics *Graphic(gr_sphere, "pendulum sphere graphic", SPHERE, b_link, p_pendu_cm, 1) *Graphic(gr_link, "pendulum link graphic", CYLINDER, b_link, p_pendu_pivot, POINT, p_pendu_cm, 0.5, CAPBOTH) //Revolute Joint *RevJoint(j_joint, "New Joint", B_Ground, b_link, p_pendu_pivot, VECTOR, V_Global_X) //Output *Output(o_pendu, "Disp Output", DISP, BODY, b_link) //End Topology // Property Information *SetPoint(p_pendu_pivot, 0, 5, 5) *SetPoint(p_pendu_cm, 0, 10, 10) *SetBody( b_link, 1, 1000, 1000, 1000, 0, 0, 0) *EndMDL()
重要: この変換は、すべてのケースで適用できるわけではありません。いくつかの条件(本チュートリアル内で後ほど説明)に気を付ける必要があります。 - *BeginMDL()および*EndMDL()ステートメントをそれぞれ*DefineSystem()および*EndDefine()ステートメントで置き換えます。システム定義について、適切な変数名を指定します。
-
ステートメント
att_point
およびatt_body
を使って、システムがどこで結合するか(アタッチメントポイントまたはピボットポイント)、およびどのボディに結合するか(アタッチメントボディ)を指定します。 -
これらの変数を*DefineSystem ()ステートメントで使用します。
*DefineSystem (sys_def_pendulum, att_point, att_body)
注: 先に述べたとおり、アタッチメントエンティティは、任意のMDLエンティティでかまいません。したがって、変数が表わすエンティティタイプを指定する必要があります。例えば、att_point
はPOINTエンティティを表わします。 -
*Attachment()ステートメントを使って、各変数が表わすエンティティタイプを指定します。
*Attachment (att_point, "Pivot Point", POINT, "Attachment point where the pendulum definition gets attached") *Attachment (att_body, "Attachment body" , BODY, " Any body to which the pendulum definition gets attached")
注: オリジナルモデルの変数p_pendu_pivot
は、ピボットポイントを表わしていました。振子モデルを振子システム定義に変換する際、ピボットポイントはアタッチメントポイントとして与えられます。ポイントp_pendu_pivot
はアタッチメントとして渡されます。したがって、ピボットポイントを定義する必要はありません。 - ステートメント*Point (p_pendu_pivot, "Pivot Point")を削除します。
- 振子の重心ポイント、および*Body()ステートメントを保持します。
-
*RevJoint()ステートメントで、
B_ground
をatt_body
に、p_pendu_pivot
をatt_point
に置き換えます。 - 球の*Graphic()ステートメントを保持します。
-
円筒の*Graphic()ステートメント内で、
p_pendu_pivot
をatt_point
に置き換えます。注: スクリプト全体で、適用可能な箇所では、アタッチメント変数で元の変数を置き換える必要があります。 -
*Output()ステートメントを保持します。
これにより、モデル内の各振子ボディの変位出力が取得できます。
- *setpoint(p_pendu_pivot, 0, 5, 5)を削除します。
-
*Setpoint()ステートメント内で、ステートメント(
att_point.y+5, att_point.z+5
)を用いてシステム内のポイントをパラメータ化します。これにより、重心点がアタッチメントポイントから5ユニット離れた所に設定されます。注: 以下はサンプルシステム定義(system.mdl)です:// system.mdl // created on: *DefineSystem(sys_def_pendulum, att_point, att_body) //Topology Data // Declaration of Entities //Attachments *Attachment (att_point, "Pivot Point", Point, "Attachment point where the pendulum definition gets attached") *Attachment (att_body, "Attachment body" , Body, " Any body to which the pendulum definition gets attached") //Points *Point( p_pendu_cm, "Pendulum CM") //Bodies *Body(b_link, "Ball", p_pendu_cm) //Joints *RevJoint(j_joint, "New Joint", att_body, b_link, att_point, VECTOR, V_Global_X) //Output *Output(o_pendu, "Disp Output", DISP, BODY, b_link) //Graphics *Graphic(gr_sphere, "pendulum sphere graphic", SPHERE, b_link, p_pendu_cm, 1 ) *Graphic(gr_link, "pendulum link graphic", CYLINDER, b_link, att_point, POINT, p_pendu_cm, 0.5, CAPBOTH ) // Property Data *SetPoint(p_pendu_cm, 0, att_point.y+5, att_point.z+5) *SetBody(b_link, 1, 1000, 1000, 1000, 0, 0, 0) *EndDefine()
- ファイルをsys_pendu.mdlとして保存します。
MDLファイルの手動によるオーサリングでシステム定義を追加
このステップでは、システム定義を含むMDLファイルを書き、それを数度にわたってインスタンス化します。
- テキストエディタで新しい空のファイルを作成します。
- モデルファイルを*BeginMDL()ステートメントで開始します。
-
sys_pendu.mdlファイルから、テキストを
*DefineSystem()
から*EndDefine()
までを、*BeginMDL()ステートメントの下の新規ファイルにコピーします。 -
*System()ステートメントを使って、1つ目の振子システムをインスタンス化します:
*System(system1, "First Pendulum System", sys_def_pendulum, P_Global_Origin, B_Ground)
注: シンタックスについては、MDL Language Referenceオンラインヘルプをご参照ください。要確認: システムをインスタンス化する際は、次の点に注意が必要です。- *System()ステートメント内で、システム定義を、3番目の引数として変数名を指定することにより参照します。システム定義の変数名は、対応する *DefineSystem()ステートメントで指定したものと同じものを使用します。上の例では、system1はシステム定義
sys_def_pendulum
を使用します。 - 適用可能な場合、システム定義内のアタッチメントを指定します。例えば、
sys_def_pendulum
は、*RevJoint()ステートメント内のbody_2
を参照するアタッチメントatt_body
を含みます。system1
で、振子ボディb_link
はグラウンドボディB_Ground
に結合されています。したがって、B_Ground
は*System()ステートメント内でアタッチメントボディとして指定されます。 - 必須ではありませんが、*DefineSystem()の後ろに*System()ステートメントを追加することが推奨されます。
- *System()ステートメント内で、システム定義を、3番目の引数として変数名を指定することにより参照します。システム定義の変数名は、対応する *DefineSystem()ステートメントで指定したものと同じものを使用します。上の例では、system1はシステム定義
-
適切な変更を加えて手順4を繰り返し、2つ目の振子システムを作成します。
- システムインスタンスには異なる変数名system2を与えます。
-
アタッチメントとして1つ目のシステムからPendulum CM (
p_pendu_cm
)とPendulum Body (b_link
)を使用します。以下と全く同じステートメントを使用してください:*System(system2, "Second Pendulum System", sys_def_pendulum, system1.p_pendu_cm, system1.b_link )
-
*EndMDL()ステートメントでファイルを閉じます。
モデルファイルの例を以下に示します:
*BeginMDL(model, "MODEL") *System(system1, "First Pendulum System", sys_def_pendulum, P_Global_Origin, B_Ground) *System(system2, "Second Pendulum System", sys_def_pendulum, system1.p_pendu_cm, system1.b_link ) *DefineSystem(sys_def_pendulum, att_point, att_body) //Topology Data // Declaration of Entities //Attachments *Attachment (att_point, "Pivot Point", Point, "Attachment point where the pendulum definition gets attached") *Attachment (att_body, "Attachment body" , Body, " Any body to which the pendulum definition gets attached") //Points *Point( p_pendu_cm, "Pendulum CM") //Bodies *Body(b_link, "Pendulum Body", p_pendu_cm) //Joints *RevJoint(j_pivot, " Revolute Joint at Pivot Point ", b_link, att_body, att_point, VECTOR, V_Global_X) //Output *Output(o_pendu, "Disp Output", DISP, BODY, b_link) //Graphics *Graphic(gr_sphere, "pendulum sphere graphic", SPHERE, b_link, p_pendu_cm, 1 ) *Graphic(gr_link, "pendulum link graphic", CYLINDER, b_link, att_point, POINT, p_pendu_cm, 0.5, CAPBOTH ) // Property Data *SetPoint(p_pendu_cm, 0, att_point.y+5, att_point.z+5) *SetBody(b_link, 1, 1000, 1000, 1000, 0, 0, 0) *EndDefine() *EndMDL()
- モデルをdoublependulum.mdlとして保存します。
-
MotionViewでMDLファイルを開きます。特に、Projectブラウザ内にリストされているFirst Pendulum SystemファイルとSecond Pendulum Systemファイルに着目してモデルを確認します。
(System)アイコンの下に、小さな'手'のマークが付いています。これは、両方のシステムが単一の定義を有しているShared Definition(共有定義)と呼ばれる特徴です。
図 3. -
すべてのインスタンスに変更を加えます。
- メニューバーで、Tools > Optionsをクリックします。
-
OptionsダイアログでBuild Model(ツリーの下部)をクリックします。
図 4. -
Legacy Supportの下のCreate separate
definitions when modifying a shared instanceオプションのチェックマークを外します。
これで、インスタンスに変更を加えた際、別の定義を作成しなくても、その変更がすべてのインスタンスで反映されるようになります。
- OKをクリックします。
-
MotionSolveの実行と結果のポスト処理を行います。
-
(Run)パネルボタンをクリックします。
- パネル内で、End timeを1.0に、Print intervalを0.01と指定します。
- Run ボタンをクリックします。
-