How to export a matlab/simulink model to FMU

Hello everyone,
I have downloaded this "bouncing ball" simulink model from this page https://es.mathworks.com/help/simulink/slref/simulation-of-a-bouncing-ball.html (image below).
Now, I want to export it to FMU.
2 doubts:
-Is there any way of doing it via the simulink itself, clicking on tabs/options? I cannot find the option of exporting to FMU in the tabs of simulink.
-In the other hand, is there also any way of doing it via code with Python? I know that it can be done via Python with OpenModelica models. Is also possible to do it with simulink models?
Thanks a lot in advance,

6 Kommentare

madhan ravi
madhan ravi am 8 Jan. 2024
Verschoben: madhan ravi am 12 Jan. 2024
Jon
Jon am 11 Jan. 2024
Verschoben: madhan ravi am 12 Jan. 2024
Thank you a lot for your quick response,
However, I still have a problem. In that tutorial it is said that, in order to export to FMU, I have to go to Simulation>Save and "standalone FMU" (first image below). However, that option is not in that dialog box (second image below).
Thanks,
madhan ravi
madhan ravi am 11 Jan. 2024
Verschoben: madhan ravi am 12 Jan. 2024
Jon
Jon am 12 Jan. 2024
Verschoben: madhan ravi am 12 Jan. 2024
Much thanks for your reply,
Executing the code you posted, it gives me an error saying that I need the "Simulink Compiler" (https://es.mathworks.com/products/simulink-compiler.html), so for now it seems that I can not export to FMU.
Is it really impossibe to export to FMU only by the Matlab/Simulink panel itself? You, and other internet guides tell clearly that the way of doing that is clicking on Save>Export to> FMU co-simulation, but as you can see above, I do not have that option. Why everyone everywhere say that, then?. Is it really that hard to export to FMU? Also, is it really needed "Simulink Compiler" or is there another way of exporting to FMU without any external add-on/module?
For example, in that guide (https://es.mathworks.com/help/slcompiler/gs/export-simulink-models-to-functional-mock-up-units.html#mw_b6804c90-9242-4064-a65e-8681f9bf84fd) that you posted above, it gives 2 ways of exporting to FMU, the simple way through the panel (which acnnot be done because that option doesn't exist) and the Programatic Interface way (which also cannot be done unless you have 'Simulink Compiler'). Do I have the problem or is simply that this guide is simply outdated?
Thanks a lot in advance,
madhan ravi
madhan ravi am 12 Jan. 2024
Verschoben: madhan ravi am 26 Jan. 2024

In the first link I shared it clearly states the requirements:

Jon
Jon am 22 Jan. 2024
Verschoben: madhan ravi am 26 Jan. 2024
Thank you a lot,
I export to FMU in both ways: via the options of the bar save>export to standalone FMU and via code
In both cases, it gives me a scope to check the simulaion and the following error (images below):
What does that error mean and what is it preventing me from doing exactly?
Also, where is the .fmu file? I cannot find it
Thank you a lot in advance,

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Jon
Jon am 26 Jan. 2024
Bearbeitet: Jon am 26 Jan. 2024

0 Stimmen

SOLVED
I think that this issue of "Error using ScriptParaFMU
Toolchain 'LCC-win64 v2.4.1 | gmake ...... etc"
Is the reason why the .fmu file is not formed.
This exact same issue is asked here, and I solved it installing MATLAB Support for MinGW-w64 C/C++/Fortran Compiler from here and also installing (just in case) Microsoft Visual c++ on my computer. After that, no error occurs and the .fmu file is formed perfectly.
I have a Windows 10 x64 by the way

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2023b

Gefragt:

Jon
am 8 Jan. 2024

Verschoben:

am 26 Jan. 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by