バックナンバーはこちら。
https://www.simulationroom999.com/blog/model-based-of-minimum-2-backnumber/
はじめに
FMILibraryサンプルプロジェクトfmi2_import_cs_testの起動時の引数を確認。
ついでに使用するサンプル用のFMUも特定。
今回は実際に動かしてみる。
いろいろごちゃごちゃっと出てくるが・・・。
まぁ重要なところは一部の・・・はず。
登場人物
博識フクロウのフクさん

イラスト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
fmi2_import_cs_testの起動時パラメータ

fmi2_import_cs_testの使い方もわかったことだし、
実際に動かしてみよう。

引数とかは大丈夫?

FMUとテンポラリディレクトリのPathを渡すだけだらからたぶん大丈夫。

とりあえず、
FMU:..\Testing\BouncingBall2_cs.fmu
テンポラリ:.\
って感じでやってみる。
fmi2_import_cs_test実行

よし!
実行だ!
C:\FMILibrary-2.0.3\build-fmi\MinSizeRel>fmi2_import_cs_test.exe ..\Testing\BouncingBall2_cs.fmu .\
argv[0] = fmi2_import_cs_test.exe
argv[1] = ..\Testing\BouncingBall2_cs.fmu
argv[2] = .\
module = FMILIB, log level = VERBOSE: Allocating FMIL context
module = FMILIB, log level = VERBOSE: Detecting FMI standard version
module = FMIZIP, log level = VERBOSE: Unpacking FMU into .\
module = FMIXML, log level = VERBOSE: Parsing XML to detect FMI standard version
module = FMIXML, log level = VERBOSE: XML specifies FMI 2.0
module = FMILIB, log level = INFO: XML specifies FMI standard version 2.0
module = FMILIB, log level = VERBOSE: Parsing model description XML
module = FMI2XML, log level = VERBOSE: Parsing XML element fmiModelDescription
module = FMI2XML, log level = VERBOSE: Parsing XML element CoSimulation
module = FMI2XML, log level = VERBOSE: Parsing XML element ModelVariables
module = FMI2XML, log level = VERBOSE: Building alias index
module = FMI2XML, log level = VERBOSE: Variables HIGHT_SPEED and HIGHT_SPEED alias reference the same vr 1. Marking 'HIGHT_SPEED alias' as alias.
module = FMI2XML, log level = VERBOSE: Parsing XML element ModelStructure
module = FMILIB, log level = VERBOSE: Parsing finished successfully
module = FMILIB, log level = INFO: Loading 'win64' binary with 'default' platform types
module = FMICAPI, log level = VERBOSE: Loaded FMU binary from .\\binaries\win64\BouncingBall2.dll
module = FMICAPI, log level = VERBOSE: Loading functions for the co-simulation interface
module = FMILIB, log level = VERBOSE: Successfully loaded all the interface functions
Version returned from FMU: 2.0
module = FMICAPI, log level = VERBOSE: Calling fmi2GetModelTypesPlatform
Platform type returned: default
GUID: 123
module = FMICAPI, log level = VERBOSE: Calling fmi2SetupExperiment
module = FMICAPI, log level = VERBOSE: Calling fmi2EnterInitializationMode
module = Test CS model instance, log level = INFO: [INFO][FMU status:OK] ### Initializing component ###
module = Test CS model instance, log level = INFO: [INFO][FMU status:OK] Init HIGHT=1
module = Test CS model instance, log level = INFO: [INFO][FMU status:OK] Init HIGHT_SPEED=4
module = Test CS model instance, log level = INFO: [INFO][FMU status:OK] Init GRAVITY=-9.81
module = Test CS model instance, log level = INFO: [INFO][FMU status:OK] Init BOUNCE_COF=0.5
module = FMICAPI, log level = VERBOSE: Calling fmi2ExitInitializationMode
Ball height Ball speed
1.35586 3.019
1.61361 2.038
1.77326 1.057
1.83482 0.076
1.79827 -0.905
1.66363 -1.886
1.43089 -2.867
1.10004 -3.848
0.671095 -4.829
0.14405 -5.81
0.193049 2.36545
0.385449 1.38445
0.479749 0.40345
0.475949 -0.57755
0.374049 -1.55855
0.174049 -2.53955
0.0454508 1.31883
0.133188 0.337825
0.122826 -0.643175
0.0143633 -1.62417
Simulation finished. Checking results
module = FMILIB, log level = VERBOSE: Releasing FMU CAPI interface
module = FMICAPI, log level = VERBOSE: Successfully unloaded FMU binary
module = FMILIB, log level = VERBOSE: Releasing allocated library resources
Everything seems to be OK since you got this far=)!
Press 'Enter' to exit
fmi2_import_cs_test実行結果確認

なんか、一気になんか表示された・・・。

うん。
どうやらうまく動いてるみたいだね。

ここからなぜうまく動いたとかわかるのか・・・。

まぁシミュレーション上で重要なのは
Ball height、Ball speed
と
その下に続いてる数値の方だな。
それ以外の「log level = VERBOSE」ってのはFMILibraryの内部のデバッグログだね。

で、
この数値は・・・。何?

次回、ここら辺をもう少し見やすくしてみよう。
まとめ

まとめだよ。
- fmi2_import_cs_testの起動時パラメータ確認。
- FMUとテンポラリディレクトリのPathを設定。
- 実行と結果を取得。
- 「log level = VERBOSE」ってのはFMILibraryの内部のデバッグログ。
- Ball height、Ball speedとその次に続いている数値がシミュレーション上重要。
バックナンバーはこちら。
コメント