Connect Simulink PMIO Port to a referenced subsystem with a .m script

조회 수: 5 (최근 30일)
Alex
Alex 2024년 1월 25일
댓글: Alex 2024년 1월 29일
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
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.
Alex
Alex 2024년 1월 29일
Hi @Angelo Yeo, I built a dummy to show the problem. However, even if the code and model seem exactly the same to me, there is another error, which I am not able to solve. Instead of the error with the physical modeling domain, now there is an Invalid Simulink object name of my cell, every time I try to add lines between the components. The errors are in the lines 42, 85 and 104. I assume that if this error is resolved, the former error about the physical modeling domain should arise again.
I hope this code helps understanding my problem.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by