MATLAB: How to make parameters to referenced models non-tunable to avoid the following error: “Model arguments can not be used in non-tunable expressions”

referenced modelsimulink

Hi,
My model of a whole power station includes a number of generators. I'd like each generator to use the same model, but have different parameters, such as power rating. To do this I'm using referenced models within the main model; one per generator. I've masked the reference model and include the parameters I need to change.
All works fine, except for the parameters that are used in non-tunable expressions. As an example, the response time of one part of the generator uses a continuous time transfer function block. But when I use a parameter as one of the coefficients I get the following message:
Model arguments can not be used in non-tunable expressions. The expression '[param1 1]' in parameter field 'Denominator' of 'generator_model/Response' can not be tuned but it refers to variables (param1 (model argument))
How can I set the parameters as non-tunable so I can use the masked parameters within the referenced model?
Regards
Andrew

Best Answer

Did you mean to ask "How can I set the parameters as tunable so I can use the masked parameters within the referenced model?" It is not possible for you to change the tunability of a library block, since the block decides whether a parameter is tunable or non-tunable. depending on its implementation. Please see my answer here to see how you can query the block to see whether each of its parameter is non-tunable or not. You may need to find another equivalent block (or create one yourself) which defines that parameter as tunable.