Effacer les filtres
Effacer les filtres

Simulink: Model referencing of MATLAB System. Parameters not set in setupImpl

1 vue (au cours des 30 derniers jours)
Hi everyone,
I have some issues in initialization of a MATLAB System block with interpreted execution. My model hierachy looks like this:
ParentModel
|-ModelRefA
|-ModelRefB
|-MyLibWithMATLABSystem
All models are parameterized with model arguments and assigned as arguments to each system propagated from the ParentModel. That works fine and also in my library (MyLibWithMATLABSystem) I get the proper parameters.
My MATLAB System looks like:
% ...
properties
MyProp = getDefaultPropValue();
end
% ....
function setupImpl(obj)
test = obj.MyProp; % <-- always shows default parameter but not model argument parameter
% Some other code for initialization, relying on MyProp
end
I assign different values for MyProp as model arguments/mask parameters.
When I test MyLibWithMATLABSystem in a test model everything is working, also when running ModelRefB with loaded parameters in the model workspace. When I use it as a referenced model, I only get the defaults for MyProp.
My guess is, that the initializiation takes place before the model parameters are passed to each submodel.
How to solve that problem or where do I have my logical error?
Thanks for your help!

Réponses (1)

Ludo Houben
Ludo Houben le 3 Jan 2024
Hi
I have the same 'challenge'. I would like to use a loaded struct for the parameterization of a function, but it is vital that the info is already present when the block is created. I'm still finding the real solution but maybe my workaround also works for you:
Regards
Ludo

Catégories

En savoir plus sur Create Large-Scale Model Components dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by