How can I generate a C function from a subsystem?

Hi everyone!
I want to create a C function from a subsystem. The goal is to create a nice GUI application in C/C++ for control applications, while using Simulink to create the PID regulators.
But let's just say that the subsystem contains a discrete integrator, and its sample time is set to 0.1s. How can I generate, or rather call the function that Simulink Coder generates?
Let the blocks name be MyIntegrator.
I checked Treated as atomic and packaging as Reusable function.
I want to generate a function, something like:
double MyIntegrator(double input)
and when called, it would return the current output of the integrator block.
Of course I would be responsible for calling it with the period.
How can I achieve this functionality using Simulink Coder?
Do I need to call the ..._step() fuction periodically, while updating the ..._U - input block? And then read the ..._Y block for the output?

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSchedule Model Components についてさらに検索

質問済み:

2019 年 1 月 14 日

編集済み:

2019 年 1 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by