バックナンバーはこちら。
https://www.simulationroom999.com/blog/model-based-of-minimum-2-backnumber/
はじめに
ついにFMILibraryによるmodelDescription.xml内の変数情報を列挙が成功。
ソートルールは「XMLファイルに記載されているオリジナルの順序」にしているので、
その通りになっているかも確認した。
と、思ったところで、
ソートルールって複数あったような・・・。
登場人物
博識フクロウのフクさん

イラストACにて公開の「kino_k」さんのイラストを使用しています。
https://www.ac-illust.com/main/profile.php?id=iKciwKA9&area=1
エンジニア歴8年の太郎くん

イラストACにて公開の「しのみ」さんのイラストを使用しています。
https://www.ac-illust.com/main/profile.php?id=uCKphAW2&area=1
ソートルール

これで列挙はOKだね。

と思ったんだけど、
前回の最後でソートルールの話してたじゃん?

してたね。

ソートルールはここでやったから一応把握はしているんだけど・・・。

確かソートルールって複数あったよね?
0:XMLファイルに記載されているオリジナルの順序。
1:変数名でアルファベット順。
2:型/valueReferenceでソート。

あー。なるほど。
他のソートルールも試したいってことだね。

そうそう。

じゃー、サクっと確認だけしちゃおう。
「変数名でアルファベット順」でソート
==============================
Variable name: A variable
Description: Speed of the ball
VR: 100
Variability: continuous : 4
Causality: local : 4
Initial: exact : 0
base_type: Real : 0
==============================
Variable name: BOUNCE_COF
Description: Bouncing coefficient
VR: 3
Variability: continuous : 4
Causality: local : 4
Initial: exact : 0
base_type: Real : 0
==============================
Variable name: GRAVITY
Description: Gravity constant
VR: 2
Variability: continuous : 4
Causality: local : 4
Initial: exact : 0
base_type: Real : 0
==============================
Variable name: HIGHT
Description: Hight of the ball
VR: 0
Variability: continuous : 4
Causality: output : 3
Initial: exact : 0
base_type: Real : 0
==============================
Variable name: HIGHT_ACC
Description: Speed of the ball
VR: 4
Variability: continuous : 4
Causality: local : 4
Initial: calculated : 2
base_type: Real : 0
==============================
Variable name: HIGHT_SPEED
Description: Speed of the ball
VR: 1
Variability: continuous : 4
Causality: local : 4
Initial: exact : 0
base_type: Real : 0
==============================
Variable name: HIGHT_SPEED alias
Description: Speed of the ball
VR: 1
Variability: continuous : 4
Causality: local : 4
Initial: calculated : 2
base_type: Real : 0
==============================
Variable name: LOGGER_TEST
Description: The logger will print the value of this variable when it is set.
VR: 0
Variability: continuous : 4
Causality: local : 4
Initial: calculated : 2
base_type: String : 3
==============================
Variable name: LOGGER_TEST_BOOLEAN
Description: This is only used to test logger replace function #b0#
VR: 0
Variability: continuous : 4
Causality: local : 4
Initial: calculated : 2
base_type: Boolean : 2
==============================
Variable name: LOGGER_TEST_DERIVATIVE
Description: This is to test that the derivative attribute may appear on any Real variables.
VR: 10
Variability: continuous : 4
Causality: local : 4
Initial: calculated : 2
base_type: Real : 0
==============================
Variable name: LOGGER_TEST_DERIVATIVE_DER
Description: This is to test that the derivative attribute may appear on any Real variables.
VR: 11
Variability: fixed : 1
Causality: local : 4
Initial: calculated : 2
base_type: Real : 0
==============================
Variable name: LOGGER_TEST_INTEGER
Description: This is only used to test logger replace function #i0#
VR: 0
Variability: continuous : 4
Causality: local : 4
Initial: calculated : 2
base_type: Integer : 1
「型/valueReferenceでソート」の結果
==============================
Variable name: HIGHT
Description: Hight of the ball
VR: 0
Variability: continuous : 4
Causality: output : 3
Initial: exact : 0
base_type: Real : 0
==============================
Variable name: HIGHT_SPEED
Description: Speed of the ball
VR: 1
Variability: continuous : 4
Causality: local : 4
Initial: exact : 0
base_type: Real : 0
==============================
Variable name: HIGHT_SPEED alias
Description: Speed of the ball
VR: 1
Variability: continuous : 4
Causality: local : 4
Initial: calculated : 2
base_type: Real : 0
==============================
Variable name: GRAVITY
Description: Gravity constant
VR: 2
Variability: continuous : 4
Causality: local : 4
Initial: exact : 0
base_type: Real : 0
==============================
Variable name: BOUNCE_COF
Description: Bouncing coefficient
VR: 3
Variability: continuous : 4
Causality: local : 4
Initial: exact : 0
base_type: Real : 0
==============================
Variable name: HIGHT_ACC
Description: Speed of the ball
VR: 4
Variability: continuous : 4
Causality: local : 4
Initial: calculated : 2
base_type: Real : 0
==============================
Variable name: LOGGER_TEST_DERIVATIVE
Description: This is to test that the derivative attribute may appear on any Real variables.
VR: 10
Variability: continuous : 4
Causality: local : 4
Initial: calculated : 2
base_type: Real : 0
==============================
Variable name: LOGGER_TEST_DERIVATIVE_DER
Description: This is to test that the derivative attribute may appear on any Real variables.
VR: 11
Variability: fixed : 1
Causality: local : 4
Initial: calculated : 2
base_type: Real : 0
==============================
Variable name: A variable
Description: Speed of the ball
VR: 100
Variability: continuous : 4
Causality: local : 4
Initial: exact : 0
base_type: Real : 0
==============================
Variable name: LOGGER_TEST_INTEGER
Description: This is only used to test logger replace function #i0#
VR: 0
Variability: continuous : 4
Causality: local : 4
Initial: calculated : 2
base_type: Integer : 1
==============================
Variable name: LOGGER_TEST_BOOLEAN
Description: This is only used to test logger replace function #b0#
VR: 0
Variability: continuous : 4
Causality: local : 4
Initial: calculated : 2
base_type: Boolean : 2
==============================
Variable name: LOGGER_TEST
Description: The logger will print the value of this variable when it is set.
VR: 0
Variability: continuous : 4
Causality: local : 4
Initial: calculated : 2
base_type: String : 3
==============================
結果確認

両方とも狙った通りのソートが出来てる感じだねー。

まぁ実際はここでソートするより、
内部でデータ構造作って管理しそうだから、あんまり切り替えて使うってのはないかもねー。

そんな身も蓋も無いことを・・・。

あとは、可能性の話になるが、
PCではなく、組み込み環境でFMUを読み出す際は有効な機能かも。

PC以外でFMUを使うってあるの?

HILSやRAPIDコントローラの環境とか。
といっても、Linuxなり、それなりのOSが載ってることが多いから、
やっぱりあんまり出番はないかなー。

結局無いんかい!

まぁ使うかどうかより一通り機能が確認できたってところを重視しよう。

確かに、使わないにしても試してない機能があると不安にはなるもんねぇ。
まとめ

まとめだよ。
- 変数リストのソートルールが複数あることを思い出した。
- よって、他のソートルールも試した。
- それぞれ想定通りの動作になっていることを確認。
- ソートの変更は現実的にはあまり出番は無さそう。
- HILS、RAPIDコントローラで使うかもしれないが、それらもそこそこの性能があるのでやはり使わない?
コメント