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.

How to specify the Base name parameter for Codegen?

0 votes
626 views
Is it possible to set the Base name property with xmlrpc connection from python script?
related to an answer for: Build plecs file in python
asked Sep 15, 2021 by abugabma (16 points)

2 Answers

0 votes
I need a better description of what exactly you are trying to change. Can you clarify what the "Base Name" property is? Can you show where this setting exists in the context of a PLECS menu or in the generated code?
answered Sep 16, 2021 by Bryan Lieblick (1,853 points)
it is located in the Coder options window, under the General Tab, Ouput options section. See attached file for reference.
Thank you for clarifying.  Out of curiosity, why would you like to change this parameter?

You cannot change that parameter directly through XML-RPC.  When left empty the base name field is derived from the model or subsystem same. You can use the plecs.set() command to change the subsystem name by changing the "Name" parameter of the subsystem to the desired value.

plecs.set('componentPath', 'parameter', 'value')

If you want a name independent of the subsystem name, then the only workaround that comes to mind is to use string replacemet to edit the value saved in the *.plecs file using python.
Thank you for your reply, I have a model that I compile into 6 different variants, right now they would all show with the base model name on the RTBox HTML dashboard, I was hoping I can change the name programmatically during the build process for easier identification, of which model is currently flashed to the RTBox.

I have included an image for clarification.
If you are generating code for the top-level model, then you should change the name of the model file just prior to code generation.  If you are generating code for just a subsystem, then you can change the name of the subsystem.  Either method should have the desired result.
+1 vote

This is not officially supported, but the Base name property is stored in a parameter named 'CodeGenBaseName'. 

plecs.set('<ModelName>','CodeGenBaseName','Value')

should do the trick (or '<ModelName/Subsystem>' when code is generated for a subsystem).

Kind regards,

Oliver Schwartz

answered Sep 26, 2021 by Oliver Schwartz (618 points)
...