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 generate C code with coder for just a subsystem in PLECS ?

0 votes
I designing an inverter simulation, so I would like to generate code for my controller which is inside the sub-system. Is it even possible? Ever time I tried to generate it only generated for the entire model. I even tried putting the controller into an atomic subsystem still, it generated for the entire Plecs file.
asked Dec 17, 2020 by Shaz (16 points)

1 Answer

+1 vote

Hi Shaz,

Yes, absolutely. This is given in the PLECS User Manual here, under "Generating Code" within the chapter titled "Code Generation".

"To enable a subsystem for code generation, select the subsystem, then choose Execution settings... from the Subsystem submenu of the Edit menu or the context menu. In the Subsystem Settings dialog check the option Enable code generation. Note that it is not possible to enable code generation for a subsystem that is contained by or that itself contains other subsystems that enable code generation."


answered Dec 17, 2020 by Manu Parimi (297 points)