Skip to content

generated .fmu file is not runnable in Matlab/Simulink #222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hongbiaozhu opened this issue Oct 23, 2024 · 11 comments
Open

generated .fmu file is not runnable in Matlab/Simulink #222

hongbiaozhu opened this issue Oct 23, 2024 · 11 comments

Comments

@hongbiaozhu
Copy link

Hi, I generated a .fmu file according to the tutorial then imported to the Matlab/simulink, but matlab will crash after running it.

@Nils12345678901234567
Copy link

We experienced the same. The FMU ran once, then MATLAB would crash on the second run.

Have a look at this setting: https://se.mathworks.com/help/simulink/gui/fmuimportblocks.html;jsessionid=8d5c9ea364961b4142a101596f3b

I MATLAB use the command:
set_param(gcs, 'DebugExecutionForFMUViaOutOfProcess','on')

This fixed the problem for us.

@hongbiaozhu
Copy link
Author

hongbiaozhu commented Oct 24, 2024

Thanks for replying. Yeah, it did fix the crash issue. Unfortunately, there is still an error after running it:

image

(and i actually selected the "Enable FMU Debug Logging" box, but i didn't see any useful FMU log, thus didn't know how to debug this .fmu further)

@MinsGoing
Copy link

Hi, I generated a .fmu file according to the tutorial then imported to the Matlab/simulink, but matlab will crash after running it.

Which version?

@hongbiaozhu
Copy link
Author

Hi, I generated a .fmu file according to the tutorial then imported to the Matlab/simulink, but matlab will crash after running it.

Which version?

Matlab R2023b

@MinsGoing
Copy link

Hi, I generated a .fmu file according to the tutorial then imported to the Matlab/simulink, but matlab will crash after running it.

Which version?

Matlab R2023b

pythonfmu version,The latest version of pythonfmu has fixed this issue.

@hongbiaozhu
Copy link
Author

Hi, I generated a .fmu file according to the tutorial then imported to the Matlab/simulink, but matlab will crash after running it.

Which version?

Matlab R2023b

pythonfmu version,The latest version of pythonfmu has fixed this issue.

20241126-103142
I tested it wiz Pythonfmu 0.6.5, and the same issue persisted.

@markaren
Copy link
Member

Set a communication step size (not -1). If that does not work, try adding some log statements to check the internals of the model.

@RajKumar1242
Copy link

We found a work around this problem.

  1. Unzip the FMU.
  2. In binaries folder add the python3.dll, python313.dll, vcruntime140.dll, vcruntime140_1.dll (you find them in Python installation )
  3. Zip the files back together.

And check if the FMU is running in Matlab/SIMULINK

@markaren
Copy link
Member

@RajKumar1242 What you outline sounds like a general PATH issue. PythonFMU needs to be able to load Python. These .dlls should be added to PATH (or similar temporal shell solution). No need to add them inside the FMU.

@RajKumar1242
Copy link

The python3.dll and python313.dll and DLLs are added to the PATH and we still have this issue. So, we tried adding direct dlls to the binaries folder.

Should also try adding vcruntime140.dll and vcruntime140_1.dll to the PATH?

@markaren
Copy link
Member

vcruntime140 should be located in system32 folder, which should be pre-populated on PATH. Now, by having these .dlls with the FMU they do get loaded before any other (not already loaded dlls), so it may solve an ordering issue in case you have conflicting dlls on PATH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants