Can't run a import FMU, modelDescription.xml is not found

조회 수: 23 (최근 30일)
songyue zheng
songyue zheng 2021년 6월 3일
답변: Wenhan Huang 2021년 8월 2일
i was trying to import a FMU from the other tool into Simulink.
i can see that my cm_FMU folder has been generated under slprj\_fmu folder, and there is modelDescription.xml under cm_fmu folder.[D:\Program Files\Polyspace\R2020b\slprj\_fmu\8ae35f333694fdbb35d722538d0fc9e8\cm_FMU]
but when i start the simulation. following error message popup.
______________________________________________
Error in supplied FMU: An error occurred in function 'fmi2Instantiate' for block 'fmudemo_cm/Subsystem/FMU' during simulation. To view debug logs, open FMU log file. For more information, see the FMU troubleshooting documentation.
Debug Logging enabled for block 'fmudemo_cm/Subsystem/FMU' Log from FMU: [category:error, status:fmi2Error] Can't find D:/Program%20Files/Polyspace/R2020b/slprj/_fmu/8ae35f333694fdbb35d722538d0fc9e8/cm_FMU/modelDescription.xml
so what is going on there, any other steps need to be done?
thanks.

답변 (2개)

Seungbum Koo
Seungbum Koo 2021년 6월 25일
It looks like MATLAB cannot find the file you mentioned. Although the file exists, MATLAB cannot find it if the file is not in the known path.
Can you load the file from the MATLAB command line?
DOMnode = xmlread('D:\Program Files\Polyspace\R2020b\slprj\_fmu\8ae35f333694fdbb35d722538d0fc9e8\cm_FMU\modelDescription.xml')
If it works, then it means the file exist but MATLAB does not know where it is. So you should tell MATLAB that when asked to find files, look into that folder as well.
To add the path to that xml file to let MATLAB to be able to locate it, you can do the followings:
% To add the path to the file
oldpath = addpath('D:\Program Files\Polyspace\R2020b\slprj\_fmu\8ae35f333694fdbb35d722538d0fc9e8\cm_FMU');
% do whatever work you need to do
% To remove the added path
path(oldpath)
If there are other files in other subfolders in the same project (I assume slprj stands for sl project), you can do the following to add all of the subfolders under D:\Program Files\Polyspace\R2020b\slprj by doing the followings:
oldpath = addpath(genpath('D:\Program Files\Polyspace\R2020b\slprj'));
% do whatever work you need to do
path(oldpath)
Place addpath before the loading occurs. It will fix the problem.
Note: addpath is effective only in that session. If you turn off MATLAB and launch it again, you have to add it again.

Wenhan Huang
Wenhan Huang 2021년 8월 2일
Hi Songyue,
I suspected that the FMU doesn't handle uri nicely, likely due to %20 there. Do you want to run the FMU under any path without space?
Wenhan

카테고리

Help CenterFile Exchange에서 Create Standalone FMU에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by