Connect Simulink PMIO Port to a referenced subsystem with a .m script
7 次查看(过去 30 天)
显示 更早的评论
I want to connect a PMIO Port called "el_P_1" to the corresponding port inside a referenced subsystem. The referenced subsystem is called "cell_1" and includes the PMIO Port "el_P" (Port number 1). Per drag and drop with the cursor the connection can be made. However, if the same operation is tried with the "add_line()" command, there is the following error:
Error using TopDownPrinciple01
The points input cannot lie on objects that do not share the same Physical Modeling domain
With the set_param() command I already set the 'ConnectionType' property to 'Connection: foundation.electrical.electrical' (instead of the standard 'Inherit: auto'). After reading it back with the get_param() command, the connection types of both ports is set to the set connection type. When double clicking the blocks in Simulink, the connection type matches as well. If trying to run the program, the same error arises than before.
Does anyone know how this error can be solved?
That's the relevant code:
get_param('mymodel/Cell_Block_1/el_P_1', 'ConnectionType')
get_param('mymodel/Cell_Block_1/cell_1/el_P', 'ConnectionType')
add_line('mymodel/Cell_Block_1', 'el_P_1/RConn 1', 'cell_1/1', 'autorouting', 'smart')
2 个评论
Angelo Yeo
2024-1-25
Hi @Alex, it's preferred to have the model to better understand Simulink issues (I also understand how hard it is to describe what you see in text formats). If you do not want to share the model due to security reasons, you can consider creating a reproducible toy model with reproduction steps.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Programmatic Model Editing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!