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

2 次查看(过去 30 天)
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?

采纳的回答

Steve Miller
Steve Miller 2022-12-1
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Deployment, Integration, and Supported Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by