How to compile a simscape model (to dll) with tunable parameters?

8 ビュー (過去 30 日間)
Bruno Paduano
Bruno Paduano 2021 年 7 月 22 日
回答済み: Yifeng Tang 2021 年 7 月 23 日
Hello everyone,
I have a problem in simscape compiling. I need to "tune" some parameters from an external source (I already do this with a compiled simulink model) hence, with simscape I have to set them as "run-time parameters".
In this way setting the target to ert ( create visual studio solution) I am able to compile an exe file which gives me the same output of the simscape model.
Anyway my final goal is to create a DLL file that can be imported into an external software (OrcaFlex). But when I compile the project (adding a wrapper), OrcaFlex gives me the error "floating point division by zero".
If I compile the model without run-time parameters it works.
Anyone can help me?
Thanks in advance,
Bruno

回答 (1 件)

Yifeng Tang
Yifeng Tang 2021 年 7 月 23 日
Hi Bruno,
Try this: make the parameter you want to tune in the generated code a "Simulink variable", i.e. a variable in the Simulink model's workspace, not the MATLAB workspace. Then keep it run-time parameter. I believe this way it will appear as an input in the generated code/functions.
Here are some Doc page talking about workspace and tunability in the generated code:
https://www.mathworks.com/help/simulink/ug/using-model-workspaces.html
https://www.mathworks.com/help/simulink/ug/using-tunable-parameters.html#bu1rgli

カテゴリ

Help Center および File ExchangeRun-Time Parameters についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by