Invalid Simulink object name: R/2

Hello. I have drawn a simple circuit (RLC) using electrical simulink.
I can add new components in code without any problem, but when I try to add line between components using the code below:
add_line(project_name, 'R/2', 'C/2')
the error below appears:
Invalid Simulink object name: R/2
How can I resolve this problem? Many thanks for your time.

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 4 月 29 日

0 投票

Instead of /1 and /2, the simscape blocks use /LConn1 and /RConn1 to indicate the ports connected on the left and right side of the blocks. So the correct syntax is
add_line(project_name, 'R/LConn1', 'C/RConn1')
See the attached file (Saved in R2020a) for a demo. Open the simulink file and run this code
add_line(gcs, 'R/RConn1', 'VS/LConn1')
add_line(gcs, 'C/LConn1', 'VS/RConn2')
add_line(gcs, 'VS/RConn1', 'PS/LConn1')
add_line(gcs, 'PS/1', 'S/1')

2 件のコメント

Mr Noone
Mr Noone 2020 年 4 月 30 日
Many thanks for your helpful answer @Ameer Hamza .
Ameer Hamza
Ameer Hamza 2020 年 4 月 30 日
I am glad to be of help.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeSimscape Electrical についてさらに検索

質問済み:

2020 年 4 月 29 日

コメント済み:

2020 年 4 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by