Clear Filters
Clear Filters

Export Model as FMU with Linux Binary on Windows

39 views (last 30 days)
wen li
wen li on 29 Jun 2024 at 6:40
Commented: wen li on 4 Jul 2024 at 13:36
Hello Mathwork team:
I would like to export FMU according this documnent(Export Model as FMU with Linux Binary on Windows - MATLAB & Simulink - MathWorks China) .
but after I try generate FMU model, a error happened. it tell me “Failed to setup the environment. WSL must be at least version '2.0.9.0'. ”. Then I have check my WSL verison. it shows my WSL version is 2.2.4.0. and I have run WSL --update and try to update the version of WSL, but it tell me my WSL version is the latest one.
so I think my WSL is the latest one, but why simulink still reminde me that my WSL version is not ok? can you help me to solve it.
matlab verstion: 2024a update 4
FMU builder version: 24.1.1
thank you
  2 Comments
Umar
Umar on 30 Jun 2024 at 3:44
Hi Wen li,
To address the issue with the WSL version error in MATLAB when exporting an FMU model, ensure that the WSL version is correctly recognized by MATLAB. Sometimes, even though the WSL version is up to date, MATLAB may not detect it accurately.
One workaround is to manually set the WSL version in MATLAB by modifying the system environment variables. You can try setting the WSL version to '2.0.9.0' explicitly in the system settings to see if MATLAB recognizes it correctly.
Hope that answers your question.
wen li
wen li on 1 Jul 2024 at 13:13
Hello, Umar:
thank you for your answer. but I don't know how to change the system setting. Can you tell me how to do it.
thank you.

Sign in to comment.

Accepted Answer

Umar
Umar on 1 Jul 2024 at 18:31
Hi Wen li,
This one is a little tough to tackle, sounds like IT Engineer job. However, if I jog my memory, you have to manually set the WSL version in MATLAB by following these steps: first, try Open the System Properties window by pressing Windows key + Pause/Break. Then, click on "Advanced system settings" on the left.Afterwards, in the System Properties window, go to the "Advanced" tab and click on "Environment Variables". Under System Variables, click on "New" and add a new variable: Variable name: WSLENV Variable value: MATLAB_VER=2.0.9.0
Then, click "OK" to save the changes and restart MATLAB to apply the new WSL version setting.
By explicitly setting the WSL version to '2.0.9.0' in the system settings, you can help MATLAB recognize the correct WSL version and resolve the export issue with FMU models.
Let me know if you need my further assistance. Good luck!
  1 Comment
wen li
wen li on 3 Jul 2024 at 12:58
Hello, Umar:
I have follow your advise, it is still not work. but then I have change my system language to English.(Default is Chinese). then matlab can recognize WSL.
but when I try to generate FMU, another issue is happened.
Setting System Target to FMU 'Co-Simulation' for model 'TestDemo'. Setting Hardware Implementation > Device Type to 'MATLAB Host' for model 'TestDemo'. ### 'GenerateComments' is disabled for 'Co-Simulation' FMU Export. Build Summary Top model targets built: Model Action Rebuild Reason ========================================================================================== TestDemo Code generated and compiled. Code generation information file does not exist. 1 of 1 models built (0 models already up to date) Build duration: 0h 0m 15.925s
Assertion failed.
do you know the root cause?
thank you

Sign in to comment.

More Answers (1)

Umar
Umar on 3 Jul 2024 at 18:45
Hi Wen,
Analyzing your error message, the assertion failure typically occurs when a condition that should be true at a particular point in the code is false. In this case, the assertion failure might be due to a discrepancy or inconsistency in the code or the settings related to FMU generation.
  1 Comment
wen li
wen li on 4 Jul 2024 at 13:36
Hello, Umar:
thank you for your quick answer.
I am shortening the file path, then it passed.
all issue is solved, now I can generate FMU with Linux binary.
thank you

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!