Rapid Accelerator tunable parameters mapping structure remains empty after build

4 views (last 30 days)
I am trying to to learn how to tune parameters of a rapid accelerator model that I want to build. For starters I followed Getting the most out of Rapid Accelerator mode. Using R2015a, I opened up the "sldemo_bounce"-model, enabled the Inline parameters option under Configuration parameters --> Optimization --> Signals and Parameters and saved it under a new name ("bounce_demo"). The code I am trying to run looks like this:
clearvars; clc;
k = Simulink.Parameter;
k.CoderInfo.StorageClass = 'SimulinkGlobal';
k.Value = -0.9;
mdl = 'bounce_demo'; % Renamed version of "sldemo_bounce" with Inline Paremeters enabled, nothing else changed
open_system(mdl)
rtp = Simulink.BlockDiagram.buildRapidAcceleratorTarget(mdl,'AddTunableParamInfo','on');
The model compiles without warnings/errors, but rtp.parameters.map is empty (= []). rtp.parameters.value has all the values of the bouncing ball model, but somehow the corresponding mapping field does not hold the variable names. So when I try to change the variable "k" according to the above mentioned example by
k_values = [-0.9:0.1:-0.1];
for i = 1:length(k_values)
paramSet(i) = Simulink.BlockDiagram.modifyTunableParameters(rtp, 'k', k_values(i));
end
it does not work as "k" is not defined within the rtp-structure (Error using modifyRTP The rtp structure passed in did not have a parameter k).
So is there any setting I am unaware of or the author has forgotten to mention in the above article to make it work?
Also I am unsure at what point the actual executable (.exe) is created as so far none has been created. Only the "slprj"-folder is created.
Any feedback is highly appreciated.
  1 Comment
Tong Zhao
Tong Zhao on 16 Feb 2022
I experienced similar error:
Error using modifyRTP
The rtp structure passed in did not have a parameter ACC_ADJ
Have you figured out the solution? Thanks.

Sign in to comment.

Answers (1)

Tong Zhao
Tong Zhao on 16 Feb 2022
I had a similar problem, and here's how I resolved it:
In my Simulink model, the tunable parameters I provided did not contribute to the output of the model, and that was why the error popped out:
Error using modifyRTP
The rtp structure passed in did not have a parameter ACC_ADJ
Then I corrected the mistake, and made sure that the tunable parameter I have will affect the output of the model. Then everything worked fine.
Hope this helps.

Community Treasure Hunt

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

Start Hunting!