"Unable to read some Variables" error when converting to FMU

조회 수: 11 (최근 30일)
Ashwin
Ashwin 2024년 3월 18일
댓글: Himanshu 2024년 3월 21일
I am able to compile my model successfully and it is giving the expected results. However on trying to convert it to an FMU, I am getting an error "=== Export to Standalone Co-Simulation FMU (Elapsed: 0.76 sec) ===
Error:Unable to read some variables. Variable name lengths must be less than or equal to MATLAB maximum name length of 63 characters.
".
However on checking the variable names in my model, I found out that the variable with the longest name is only 40 characters which is well below the 63 character limit that Matlab enforces. I was able to successfully convert my model into an FMU several times in the past and the only change made in the model now, is an additional input port (whose name length is 11) and an additional output port (whose name length is 6). I tried undoing these changes and generating an FMU but it is throwing up the same error again.
Is there any other model setting which influences this? Has anyone faced a similar issue?
All help and suggestions are appreciated.

답변 (1개)

Himanshu
Himanshu 2024년 3월 21일
Hello Ashwin,
I understand that you have successfully compiled your model but you are encountering an error stating, "Unable to read some variables. Variable name lengths must be less than or equal to MATLAB's maximum name length of 63 characters," when attempting to convert it to an FMU.
I faced a similar issue and found a solution that worked for me in MATLAB R2022a. Typically, this problem arises when variable names exceed the maximum length of 63 characters, as discussed in a MATLAB Answers post here:
The real challenge was pinpointing and locating where the error was occurring. Reinstalling MATLAB R2022a fixed this error.
I hope this helps.
  댓글 수: 2
Ashwin
Ashwin 2024년 3월 21일
Hello Himanshu,
Thank you for your answer. I actually found the issue. None of the variable names were more than 63 characters long. The longest variable name was 40 characters only.
The actual reason was target hardware setting in model settings tab. I had set it to Linux64 previously. When I set it back to Win64, the saved cache .slxc file was unable to find the Win64 library in temp folder.
So, I deleted the .slxc and other cache, set target hardware to Win64, saved the model and then restarted Matlab. After this the error was fixed.
(In your case, maybe reinstalling Matlab had the same effect of deleting the cache)
Himanshu
Himanshu 2024년 3월 21일
Hello Ashwin,
Glad to know that your issue was resolved. Thank you for sharing the details of the issue.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

태그

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by