problem with ssc_build to generate custom simscape library
Show older comments
Hi everyone, I am trying to learn how to make custom simscape blocks.I have written ssc file,and created a new directory (named +gear_
pump) that I added to my Matlab path.Then, I run the ssc_build command to generate my custom library. When run the ssc_build command I get the following error message:
Generating Simulink library 'gear_pump_lib' in the MATLAB package parent directory 'D:\matlab\simscape\' ...
Failed to generate 'gear_pump_lib'
原因:
错误使用 feval
函数或变量 'gear_pump.gear_pump' 无法识别。
(translate in English :
reason:
Incorrect use of festival
Function or variable 'gear'_ pump.gear_ The 'pump' is not recognized)

9 Comments
Yifeng Tang
on 28 Apr 2023
Is it possible to share the .ssc file you try to build the library from? It feels like some syntax error in the .ssc file but it would be difficult to identify without the .ssc file itself.
轩 贾
on 4 May 2023
Yifeng Tang
on 4 May 2023
It was able to compile OK on my end, strangely. Just used ssc_build('custom_library') and it generated a custom library. I did need to modify two lines of code later to make the simulation run (has to do with how 'rad' unit is interpreted), but the compiling was OK. The results also seem to make sense.

What version of MATLAB are you using? I can try again in the same version and share the files.
轩 贾
on 5 May 2023
轩 贾
on 5 May 2023
Yifeng Tang
on 5 May 2023
啊,我明白问题出在哪里了 ... 看Answer部分。
轩 贾
on 5 May 2023
Yifeng Tang
on 5 May 2023
在 +dirname 的上一级目录执行 ssc_build('dirname')
轩 贾
on 6 May 2023
Accepted Answer
More Answers (1)
ms z
on 26 Aug 2024
0 votes
你好,我遇到了同样的问题,也是在使用ssc_build的时候报错函数或变量无法识别,请问您是怎么解决的,能否指点一下,谢谢
1 Comment
Yifeng Tang
on 26 Aug 2024
If you used a MATLAB function in your equations session of the .ssc code, the function has to be one on this list: https://www.mathworks.com/help/simscape/lang/equations.html#brtts6o
If you don't think that's the issue, consider ask in a new question and provide more details.
Categories
Find more on Upgrading Hydraulic Models to Use Isothermal Liquid Blocks in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

