Connect Simulink PMIO Port to a referenced subsystem with a .m script
조회 수: 5 (최근 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!