Code Generation


Translating Circuits into C Code for Real-time Simulation

The PLECS Coder generates ANSI-C source code from a circuit schematic. The user typically simulates a system in PLECS first, then generates C code from the model. This code can be compiled to execute on the simulation host or a separate target, such as an embedded control platform or real-time simulator. A typical code generation application is to execute a PLECS model in real-time as a virtual plant for the verification and validation of control hardware and software. Generated code can also be compiled and executed on the host to reduce simulation time for complex models.

In addition to generic C code, the PLECS Coder can generate C code ready for deployment on a specific hardware target. Target support packages permit customizing the code generated for virtually any CPU/MCU-based platform. A simple association between signals in a PLECS model and the physical input and output pins on a target is made directly in the PLECS schematic via I/O blocks. In PLECS Standalone the Coder directly targets the PLECS RT Box for both controller hardware-in-the-loop simulations and rapid control prototyping.