Why do I receive error when using ADD_BLOCK in SimScape 3.8 (R2012b)?
15 次查看(过去 30 天)
显示 更早的评论
I'm wondering if it is possible to build up a physical model in Matlab command line instead of using the interactive way in simscape.
I found similar idea is achievable for simulink by proporly utilizing the Matlab command "add_block" and "add_line". So, it looks quite straightforward to try the following codes in command window.
simscape;
open_system('ssc_dc_motor_thermal_circuit');
add_block('simscape/Foundation Library/Thermal/Thermal Elements/Thermal Reference', ssc_dc_motor_thermal_circuit/Thermal Reference');
where "ssc_dc_motor_thermal_circuit" is just a demo simulation randomly picked up for trial.
Yet, the code gave the following error.
There is no block named 'simscape/Foundation Library/Thermal/Thermal Elements/Thermal Reference'
Do you have any idea why the error pops up and how to fix it? Is it because "add_block" is applicable only to simulik, but not simscape?Or, do you have better idea to build physical model in command line?
采纳的回答
MathWorks Support Team
2013-5-9
The basic syntax of ADD_BLOCK is add_block('src', 'dest'), which copies the block with the full path name that you specify with 'src' to a new block with a full path name that you specify with 'dest'.
The reason of the error is due to the different full path of the blocks in SimScape Library compared to those in Simulink library. Take Thermal Mass as an example, you could get the full path of the block by the following steps:
a) Open Simulink Library Browser and right click on Foundation library
b) Click 'Open Foundation Llibrary Library'
c) Find the Thermal Mass and left click it
d) Execute 'gcb' in MATLAB command window, you'll have 'fl_lib/Thermal/Thermal Elements/Thermal Mass', which is the correct 'src' value for adding Thermal Mass in your model with ADD_BLOCK.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating Custom Components and Libraries 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!