Multiple Istances of Referenced Model and its Effect on S-Function Builder Block
조회 수: 22 (최근 30일)
이전 댓글 표시
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
채택된 답변
Titus Edelhofer
2013년 12월 9일
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!