How to make the gain of the Discrete Derivative block tunable?
2 views (last 30 days)
Show older comments
Are the "Gain Values" of the "Discrete Derivative" and "Discrete Time Integrator" blocks tunable?
In my model these gains are in a structure MDLparam.ki and MDLparam.kd. where MDLparam is a Simulink.Parameter object. When I generate code or run the simulation I get the following warnings and as a result these two gain values do not appear tunable in the generated code:
Warning: Reducing expression 'MDLaram.kd' in parameter field 'gainval' of 'MDL/Discrete Derivative' to its numerical equivalent because this field is marked not tunable. This expression resolves to tunable variables (MDLparam (base workspace)). You will be unable to tune this expression during model execution
Warning: Parameter field 'gainval' of 'MDL/Discrete-Time Integrator' is non-tunable but refers to tunable variables (MDLparam (base workspace))
0 Comments
Accepted Answer
Kaustubha Govind
on 9 Aug 2012
It appears that the parameter is not tunable. You can verify this with the commands:
>> dp = get_param('MDL/Discrete Derivative', 'DialogParameters');
>> dp.gainval
ans =
Prompt: 'Gain value:'
Type: 'string'
Enum: {}
Attributes: {'read-write' 'read-only-if-compiled' 'link-instance'}
The attribute 'read-only-if-compiled' indicates that the parameter cannot change once the model has been compiled (ie. during execution).
It is not possible to change how the block itself defines its parameters, so I would recommend following your block with a Gain block. Enter the Gain as 1 in the Discrete blocks, and use the Gain block instead to tune your parameter.
More Answers (0)
See Also
Categories
Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!