Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

Add component to Library Plecs Blockset

+1 vote
4,608 views
I'm trying to add a reusable component like in this tutorial: https://www.plexim.com/de/support/videos/custom-component-part-2

I accomplished that in Plecs Standalone but I cannot get it to work in the Blockset version. Can somebody explain how that works with the Simulink integration?

 

Regards

Julian
asked Jan 24, 2019 by juledev (16 points)

2 Answers

+1 vote
 
Best answer
Hello Julian,

Have you reviewed the process in our User Manual? Here is the description below:

Creating a New Library in PLECS Blockset
To create a new component library, open the PLECS Extras library (in the Simulink library navigator) and copy the PLECS Library block into a Simulink model or library. The Simulink model must be named (i.e. saved) before you can copy components from the component library.
To add the new library to the library browser it has to be added to the list of user libraries in the PLECS Preferences window, which is accessed from the File menu when inside the PLECS Circuit block.

You will also need to create a MATLAB path link to the folder containing this library model file.

Please let us know if you are successful or have specific questions.

Thank you,

Kris
answered Jan 29, 2019 by Kris Eberle (1,575 points)
selected Feb 4, 2019 by Kris Eberle
Hello,

i have create a new library name "custom" in plecs library,  now the problem is:

how can i add my model to that library, so that when i need it i can just drag one from library?

like i show in the picture.

thanks!
Hello,

You have placed your custom components in a standard PLECS Circuit block. But you need to use the PLECS Library Block in the PLECS Extras category, as shown in the attached image. Place this block into a Simulink model, add your custom components, and save it. Then link to this model in the PLECS Preferences and it should appear in your library browser so that you can then drag it into any other model. Let me know if you get this to work, thanks!

Kris
Hello Kris,

i do it exactly in the way you said. and it's work.

but the only problem is, when i closed the model, the library disappear from the plecs library window. and it says: "one or more libraries were unloaded, click here to refresh browser".

why is that, do you know?

fig_01:  when i open the model, the library appear.

fig_02:  when i close the model, the library disappear.

fig_03: when i close the model, the message on the plecs library.
 

Shaofei
I believe the problem is that you don't have a reference to the path directory containing your library model saved in MATLAB. You can either place the library model in the same folder as your current model and navigate to this as your present working directory in MATLAB, or save this path in the MATLAB list so there is a permanent link. The message is normal if you haven't done this step and you just need to click on the library when that happens. But it won't happen if you save the path permanently to the folder with your library model.
Hello Kris,

i've done exatly what you said and the problem has been solved !

Thank you a lot !
0 votes
Hi,

I know this question has been resolved, but just for future reference, there is now a video explaining how to create a new user library component in PLECS Blockset -- https://youtu.be/jRE0j-7x-08

Regards,
Manu
answered Nov 14, 2019 by Manu Parimi (363 points)
add custom library
...