Problem Description:
How do I connect the SimPowerSystems blocks using the command line?
I tried to connect the SimPowerSystems blocks using the following commands: new_system('new')
open_system('new')
add_block('powerlib/Electrical Sources/AC Current Source','new/source1')
add_block('powerlib/Elements/Series RLC Branch', 'new/branch1')
add_line('new','source1/1','branch1/1')
However, I received the following errors:
??? Error using ==> add_line
Invalid Simulink object specifier.
Solution:
This bug has been fixed in Release 14 Service Pack 2 (R14SP2). For previous releases, please read below for any possible workarounds:The lines connecting the SimPowerSystems blocks are electrical lines. They can be connected using the following commands:
new_system('new')
open_system('new')
powerlib
add_block('powerlib/Electrical Sources/AC Current Source','new/source1')
add_block('powerlib/Elements/Series RLC Branch', 'new/branch1')
Block1PortHandles = get_param('new/source1','PortHandles');
Block2PortHandles = get_param('new/branch1','PortHandles');
add_line('new',Block1PortHandles.RConn(1), Block2PortHandles.LConn(1));