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.

Fixpoint Controller Simulation

0 votes

We already have a working and well tested plecs standalone simulation model. As a next step we would like to transform the control logic from plecs model into VHDL code for hardware implementation. There is no floating point unit on the FPGA available - the final controller must be of fixedpoint form. Is there any way to simulate a fixed point control logic?

Our first idea:

  • Write some script that implements the controller. For example a python script relying on for fixed point operations.
  • Run this python script using the "DLL" block that can be found under Library browser -> Control -> Functions & Tables.
    Unfortunately we did not get this DLL block to execute any python code at all. The manual only explains the inclusion of C/C++. We could not find a MWE in python so far.
  • Last step would be to transfer from python script to VHDL. This is fairly easy once all fixedpoint number format are known.
Any suggestions are warmly welcome!


asked Aug 11 by egglia (12 points)

1 Answer

+1 vote

Unfortunately only DLLs using C and C++ are officially supported in PLECS. Googling gives a few option that you could try, but again this is fully experimental and not officially supported/tested by the Plexim developers.

1. Implement the fixed-point control algorithm in C using the FixMath library (
2. Embed python into C, see e.g. or
3. It might be possible to create a dll from Python using Cython (see or

Best regards,
answered 5 days ago by Niklaus Felderer (56 points)