Clear Filters
Clear Filters

Trying to use setparam for a parameter inside a referenced model

10 views (last 30 days)
I am deploying a model hierarchy onto a SpeedGoat for real time deployment. The intention is to control the SpeedGoat outputs in real time using a GUI. I have allowed tuneable parameters in all of the models being deployed onto the SpeedGoat. When I load the model onto the SpeedGoat only the top model tuneable parameter blocks are visible. The GUI interface model is a referenced model and so I need to access those blocks via "setparam" but the function cannot find the parameters as none of the referenced models appear to have tuneable parameters on the Simulink Real Time Explorer.
Is there a setting somewhere that is preventing referenced models from having tuneable parameters?
I want to avoid having to create variables for each block parameneter in order to tune it so I was hoping there was another way.
Any help on this is appreciated.

Accepted Answer

Pablo Romero
Pablo Romero on 19 Apr 2022
There are some limitations on tuning parameters in referenced models. For more information about using instance-specific block parameters and using model arguments to configure these, see:
Marcel Schoch
Marcel Schoch on 19 Apr 2022
So no, it is not possible to tune parameters in referenced models without creating a variable.
This is highly inconvenient. Please consider re-enabling this possibility.
Calvin Watson
Calvin Watson on 21 Apr 2022
I have resorted to creating variables for each tuneable parameter. It is a little frustrating as it is one method for real time and one method for simulation running for varying parameters.

Sign in to comment.

More Answers (2)

Marcel Schoch
Marcel Schoch on 12 Apr 2022
I'm having the exact same problem since the upgrade to the 64bit Speedgoat real-time OS.
I have a very large model with dozens of referenced models. With Matlab 2018b and the old real-time OS, I could easily access any (available) block parameter. Now I'm trying to upgrade the model to 2021a, which includes the upgrade to the 64bit real-time OS, but unfortunately, only the top level block parameters can be accessed.
I have attached a small example that illustrates the problem. It consists of "Mainmodel" and a referenced model "Submodel", and each system contains a delay-block. The delay-block output signal can be accessed in both the mainmodel and the submodel. But the parameter "InitialCondition" can only be accessed in the mainmodel.
tg.getsignal('Mainmodel/Delay', 1) % works
tg.getsignal({'Mainmodel/Model', 'Submodel/Delay'}, 1) % works
tg.getparam('Mainmodel/Delay', 'InitialCondition') % works
tg.getparam({'Mainmodel/Model', 'Submodel/Delay'}, 'InitialCondition') % error: Unrecognized field name "typeInfo".
Any suggestions? This is a major problem for my system upgrade.

Stefanie Schwarz
Stefanie Schwarz on 7 Feb 2024
Edited: Stefanie Schwarz on 7 Feb 2024




Community Treasure Hunt

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

Start Hunting!