Create PLECS circuits automatically with MATLAB code

Hello everyone,

my Name is Heiko and I have a Question. Topic: Create PLECS circuits automatically with MATLAB code

I would like to use MATLAB code to automatically generate PLECS Circuits in Simulink.
I usually use the following command in MATLAB:
add_block

Example code:
new_system(‘Example’);
open_system(‘Example’);
add_block([‘fl_lib/Electrical/Electrical Elements/Resistor’], [Example/R_1’]);

works perfectly.

For the PLECS Blockset, I first create:
add_block(‘plecslib/Circuit’, [‘Example/PLECS Circuit’]);

Then I want to insert a resistor into the PLECS Circuit:
add_block([‘plecslib/Components/Electrical/Passive Components/Resistor’], [Example/PLECS Circuit/R_1’]);

The PLECS Circuit is inserted correctly into SImulink, but then the following error message appears:
There is no block named ‘plecslib/Components/Electrical/Passive Components/Resistor’

Thanks for your support

Heiko

Hello Heiko,

There currently is not a way to build PLECS models and place components via a scripting interface. The plecslib/Components Mask does not itself contain any Simulink components, but rather launches the PLECS Blockset model library. Once inside the PLECS Circuit component, then everything is modeled using the PLECS framework where one cannot directly use Simulink commands, but can use the commands described in the PLECS Manual under Simulation Scripts + Command Line Interface in PLECS Blockset

Thanks,

Bryan

1 Like

Hello Bryan,

my name is Heiko. Thank you for answering my question.

Heiko