How to Generate C code of Continuous time blocks?

6 vues (au cours des 30 derniers jours)
Muhammad Shoaib Ullah
Muhammad Shoaib Ullah le 23 Août 2015
Réponse apportée : SRance le 17 Nov 2020
Hey Everyone, I want to know how should i generate C code from models that are utilizing continuous time blocks such as transformers?

Réponses (1)

SRance
SRance le 17 Nov 2020
Each Simulink block or MATLAB functions defines whether or not it can be generated to C/C++ code, which can be checked against the general list of MATLAB supported functions for code generation or with each block, listed at the bottom of the help page for that function of block. I.e. even if you wrote a MATLAB function for Simulink, it doens't neccessarily mean the function can be converted to C code.
For C code it is good to avoid continuous states as much as possible so that you can control the discrete time steps of your model when it is deployed to hardware, else you are likely to run into overflow quite quickly.
Use the Debug tab in Simulink to check the discrete and continous parts of your model, noting that for most continuous blocks there is a discrete alternative.
Once your are happy with you model, simply set-up your model to generate code for your specific hardware, noting you will need the Embedded or Simulink coder, or relevant support package for Arduino or Raspberry Pi.

Catégories

En savoir plus sur Deployment, Integration, and Supported Hardware dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by