Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

What's the correct scheduling of calling C functions of a Simulink model after Simulink Coder conversion?

1 Ansicht (letzte 30 Tage)
I've used Simulink to build a subsystem and converted it into C using Simulink Coder. Then I will write my main function where the subsystem's C functions (mdlOutput(), mdlUpdate(), etc) will be called, as follows:
/* scheduling 1*/
main()
{
...
for (i=0;i<100;i++)
{
mdlOutput();
mdl_U = 1-mdl_Y; /* updating input using output */
mdlUpdate();
}
...
}
You can see that a feedback is formed in the main function. However, I've seen many examples where mdl_U is put ahead of mdlOuput(), like:
/* scheduling 2*/
main()
{
...
for (i=0;i<100;i++)
{
mdl_U = 1-mdl_Y; /* updating input using output */
mdlOutput();
mdlUpdate();
}
...
}
Above two schedulings give different results. I'm wondering which one is correct? Many thanks for any help.

Antworten (0)

Diese Frage ist geschlossen.

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by