For Simscape Multibody, Is it possible to generate C code which can be customized?

1 view (last 30 days)
I have succeded to generate C Code using Embedded Coder for some Simulink model, not for simscape block
With the C Code, I was able to customize input/output parameter of XXXXX_step function.
But with simscape block, is it possible to generate C code which can be customized?
When I tried to do it with Embedded corder (target mode is ert.tlc), I faced some problem that generated code and some reference gave me some error message. (ex. "creal_t" is undefined type)
So I'm trying to generate C code using Simulink Coder.
However, it seems that Simulink corder only create C code which can not be customized. ( It seems to be similar to an realeased application )
What I want is generated C Code which works like some code made with Embedded Coder.
Is it possible?

Accepted Answer

Steve Miller
Steve Miller on 1 Dec 2022
Hi JL,
While you can certainly read and edit the code that is produced from Simulink Coder or Embedded Coder, we generally do not recommend manual changes to the code. If the model changes and you regenerate the code, your manual changes will be lost (or you will have to do them again).
From your post, it sounds like you want to "customize input/output parameters". I believe you should make the changes to the model such that these inputs, outputs, or parameters are easily accessible in workflows that use the generated code with no (or minimal) modifications.
  1. For modifying parameters, please read about Run-Time Parameters. This will help you see how to modify your model so that parameters can be tuned in the generated code.
  2. For inputs and outputs, they should appear at the top level of your model or Model Reference so that they are inputs/output to the generated code.
If you can tell us specifically what you want to do, we can guide you to more targeted resources. Ideally, you would not need to modify the generated code.
--Steve

More Answers (0)

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!