MATLAB Answers

Tunable Parameter/Gain and rapid acceleration

9 views (last 30 days)
I am having difficulty using Tunable parameters. Here is how it looks inside simulink mdl = 'Mymodel.mdl':
* Constant Block (value 1)---> GainA -> mpt.paramter constant block
I will be running this simulation on a single set of input dataset in a for loop, changing the gain for each itiration (with same input vector).
Sample Code:
for i=1:10000
if i==1
rtp = Simulink.BlockDiagram.buildRapidAcceleratorTarget(mdl);
SimOutput = sim(mdl,'SimulationMode','rapid','RapidAcceleratorUpToDateCheck','off');
This code need to build new rapid target for each itiration else it runs same model again and again without changing GainA. Is there any way around?


Sign in to comment.

Accepted Answer

Kaustubha Govind
Kaustubha Govind on 19 Apr 2012
But you never pass the modified parameter into SIM right? Simulink.BlockDiagram.modifyTunableParameters creates a new RTP structure. It doesn't apply it to the model.
rtp = Simulink.BlockDiagram.buildRapidAcceleratorTarget(mdl);
for i=1:10000
new_rtp = Simulink.BlockDiagram.modifyTunableParameters(rtp, ...
SimOutput = sim(mdl,'SimulationMode','rapid', ...
'RapidAcceleratorUpToDateCheck','off', ...
'RapidAcceleratorParameterSets', new_rtp);


Sign in to comment.

More Answers (1)

Jayesh Kavathe
Jayesh Kavathe on 19 Apr 2012
Cant thank you enough for a quick solution on this! This works perfectly for me :)


Paul on 21 Apr 2012
I looked through the Simulink R2012A documentation on TMW website for the functions Simulink.BlockDiagram.modifyTunableParameters and
Simulink.BlockDiagram.buildRapidAcceleratorTarget and couldn't find them. Can someone point me to the doc page where I can learn about them?
Kaustubha Govind
Kaustubha Govind on 24 Apr 2012
Paul: Unfortunately, it doesn't look like there is a doc page, but you can find some information using "help Simulink.BlockDiagram.modifyTunableParameters" and "help Simulink.BlockDiagram.buildRapidAcceleratorTarget". I found information about the usage from this demo:

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by