Multiple Istances of Referenced Model and its Effect on S-Function Builder Block
20 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mohammed Manna
am 9 Dez. 2013
Kommentiert: Mohammed Manna
am 9 Dez. 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 Kommentare
Akzeptierte Antwort
Titus Edelhofer
am 9 Dez. 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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Simulink Coder finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!