Multiple Istances of Referenced Model and its Effect on S-Function Builder Block
22 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Mohammed Manna
il 9 Dic 2013
Commentato: Mohammed Manna
il 9 Dic 2013
I want to be able to use multiple instances of my model. This model has got a legacy C function (which uses static variables) that is causing issues. I get the following error message when using multiple instances.
The S-Function block 'Elec_Pmp_Ctrl_ChA/Pulse_Desc/S-Function Builder' is not supported in multi-instance Normal mode because it does not declare that it supports multiple execution instances. If the S-Function satisfies the multiple execution instances requirements, you can declare this using the SimStruct function 'ssSupportsMultipleExecInstances' in the 'mdlSetWorkWidths' method.
I tried to add those macros and functions suggested in the error message, but nothing improved.
Does anyone know how to solve this?
0 Commenti
Risposta accettata
Titus Edelhofer
il 9 Dic 2013
Hi Mohammed,
there are two issues here: first, to get rid of the error message. This can be done indeed by doing what the error message suggests. What was wrong with your change, I don't know.
But: this does not solve the problem! If your legacy code contains static variables, you will not be able to use it (correctly) twice within your model, because, the static variables will be shared between the two instances of your S-Function. Only in trivial cases this will not fail.
So: you either can use the S-function only once, or you will need to change the legacy code to remove the static variables. Once this is done, we can take another look why the multiple instance support you tried failed.
Titus
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Simulink Coder in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!