Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

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

1 visualizzazione (ultimi 30 giorni)
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.

Risposte (0)

Questa domanda è chiusa.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by