Simulink model argument (for model referencing) with unknown array size
Mostra commenti meno recenti
Suppose I have a model ('mdlRef') which is intended to be referenced by a top level parent model ('mdlTop'). 'mdlTop' is responsible for setting the value of a variable ('tableData') in 'mdlRef'.
However, when 'mdlRef' was designed, the size of 'tableData' is unknown and therefore set to some arbitrary size in its model workspace. If 'mdlTop' were to set 'tableData' to a different size, an error occurs:
Invalid dimensions for parameter argument 'tableData' of Model block 'mdlTop/mdlRef'. The parameter provided is a [1x3] array but a [1x1] array is expected
Is there a way to workaround this problem? The same problem also prevents 2 instances of the same model reference to be assigned different sized data (which is quite common for look up tables) by the parent model.
4 Commenti
Still true in 2015b. Here (<http://www.mathworks.com/help/simulink/ug/parameterizing-model-references.html>) it says that "The value of the model argument does not default to the value of the corresponding MATLAB variable. That value is available only to a standalone or top model." so it even should display an error..
Maybe in a very hidden place it says that these parameters are limited to some options, but not size and type of data.
yuanyi wu
il 10 Mag 2020
Still true in R2019b.
When specifying an argument with 'Simulink.Parameter' or 'Variable', the default value will be respected at the beginning of simulation.
This causes errors when using Selector block, where it prompts the widths of vector changes during simulation.
db1024
il 19 Mag 2021
Still true in R2020b.
I could also not find a corresponding note in the documentation. Is there any update on this issue?
Number seven
il 5 Ott 2022
Still true in R2021b, looking forward to an update to this issue!
Risposte (1)
Kaustubha Govind
il 27 Ago 2013
0 voti
I don't think there is a workaround for this situation. The sizes and types of parameters cannot change after compilation. However, I'd recommend that you verify this with MathWorks Tech Support and submit an enhancement request with a use-case if they confirm the limitation.
1 Commento
Still true in 2015b. May you point to some article of the Documentation that refers to this limitation? There is nothing over here.
EDIT: maybe here is a key, as it says "Model block is context-independent, so it cannot inherit signal properties. Explicitly set input and output signal properties."... Anyway, is a parameter "inheritance"?
Categorie
Scopri di più su Model References in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!