How can I generate a C function from a subsystem?
Show older comments
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?
Answers (0)
Categories
Find more on Schedule Model Components 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!