How can I switch between thermal and standard block choice in Simscape block programmatically
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I want to be able to switch between different block choices for a given Simscape block from matlab code.
In detail, I want to switch between thermal and non-thermal (standard) variant in a resistor of the Electrical/Passive library.
I could not find a solution by searching the web, so I would very much appreciate any help.
Kind regards,
Martin
0 件のコメント
回答 (1 件)
Joel Van Sickel
2020 年 8 月 5 日
Hello Martin,
unfortunately, there is no API to allow you to do this programmatically. While you can technically access this choices under mask options and change it with the parameter 'ComponentPath', it will not update the block choice in the simulink model. The only way to do this would be to have a custom library with a resistor with and without thermal ports. Then you could progrmatically remove a block and then add a block from this custom library. Just as you can't programmatically change the simscape variant, you can't control with one you add with add_block. The logic would be like this
This is non-trivial:
chose component to toggle betweent
save that components mask parameters
delete component
add other component from custom library
set new components values to the old components values
hook up wires same as old component (not sure if they will automatically connect even if you add the block exactly where the old block was)
Regards,
Joel
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Composite Components についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!