CATIA-Systems / FMIKit-Simulink

Import and export Functional Mock-up Units with Simulink
Other
157 stars 51 forks source link

FMIKit 3.1 build error in Simulink with grt #455

Closed sloghavi68 closed 12 months ago

sloghavi68 commented 1 year ago

Hello,

In my use case, I import a soruce code FMU from Dymola 2020x and use the Simulink grt target build an executable. For the purpose of this test, so far I have tried this process in Matlab 2020b.

During the build with grt and FMIKit 3.1, I get a series of errors related to the compilation of sfun_fmurun.c. I am attaching the Simulink diagnostics output from the build. FMIKit_3.1_build errors-Simulink diag.txt

In comparison I have in the past worked with FMIKit (for example commit id 5eae886) and never had an issue with the same process with grt.

I would appreciate your feedback.

I have created a test case and attaching it below (zipped file).

The content of the zipped file: 1) oscillar_2020x.fmu : FMU used to import a simple forced mass spring dmaper model (generated with Dymola 2020x) FMU settings: FMI 2.0, soruce code included, license free, using an inline integrator (explicit euler) with step size 1ms. 2) oscillar_2020x.mo : Original model used to create the above mentioned FMU. 3) oscillar_2020x_MatlabR2020b_FMIKit5eae886.exe : generated executable using grt and FMIKit (commit ID : 5eae886). If you place the exe at "C:\GIT\Dymola2022x_investigation\2020x", you can run it from the command line without having to regenrate the exe (I think the exe is path dependent). Otherwise, I have provided the .slx file used to build the .exe and you can build the model with Simulink (Matlab R2020b) and run it from your desired path. 4) oscillar_2020x_MatlabR2020b_FMIKit5eae886.slx : Simulink model used to create the above mentioend .exe using FMIKit from commit id: 5eae88. I have included required precalls for you to simply open the .slx and model should be able to run and you can build the model as well. 5) oscillar_2020x_MatlabR2020b_FMIKit31.slx : Simulink model used to import the same FMU using FMIKit 3.1. The error file attached is from the build diagnostics of this simulink model. This model also has the required precalls to load the model properly. 6) oscillar_pos.mat : Oscillator position (results). From the model with FMIKit 3.1. 7) oscillar_pos_2.mat : Oscillator position (results). From the model with FMIKit (commit id: 5eae886). This file gets updated either by running the slx in Simulink or running the exe.

Zipped file below: 2020x.zip

sloghavi68 commented 1 year ago

I opened both Simulink models with Matlab 2021b and got the same exact results. You should be able to test the package in any version of Matlab from 2020b or later

t-sommer commented 1 year ago

Can you give 8c0fe8734f90fa7e8778378218fd3e1eea29b0b8 a try?

sloghavi68 commented 1 year ago

Hi @t-sommer Yes. 8c0fe87 works as expected. Grt was able to build and .exe runs without issues. Thanks.

sloghavi68 commented 1 year ago

Hi @t-sommer . I am attaching the files I mentioned to you in the email about the Dymola 2022x FMU here. The File transfer isn't working for me. Thank you, 2022x.zip

Saeid