Is there a way to get the Simulink real-time parameter set (rtp) from a rapid accelerator build without rebuilding it?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am building and using a rapid accelerator target for myModel using
rtp = Simulink.BlockDiagram.buildRapidAcceleratorTarget(myModel);
newRtp = Simulink.BlockDiagram.modifyTunableParameters(rtp, 'myParam', myValue);
sim(myModel, 'SimulationMode', 'rapid', ...
'RapidAcceleratorUpToDateCheck', 'off', ...
'RapidAcceleratorParameterSets', new_rtp);
If I don't have an rtp object (but I know my model hasn't changed and I want to run in rapid mode without re-building the model) can I get rtp from the model somehow (without re-building)?
Something like:
Simulink.BlockDiagram.buildRapidAcceleratorTarget(myModel); % oops, should have captured the output
rtp = Simulink.BlockDiagram.getExistingRapidAcceleratorTarget(myModel); % does something like this exist?
0 comentarios
Respuestas (1)
Nirja Mehta
el 30 de Ag. de 2017
You can check the checksum of your model and get rtp only if checksums are different.
% To compile the model before calling Simulink.BlockDiagram.getChecksum
myModel([],[],[],'compile')
[cs1,csdet1]=Simulink.BlockDiagram.getChecksum(myModel);
% Get rtp for first time
rtp = Simulink.BlockDiagram.buildRapidAcceleratorTarget(myModel);
[cs2,csdet2]=Simulink.BlockDiagram.getChecksum(myModel);
if (cs1 ~= cs2)
% This means your model changed, time to update rtp
rtp = Simulink.BlockDiagram.buildRapidAcceleratorTarget(myModel);
end
% Your code now
newRtp = Simulink.BlockDiagram.modifyTunableParameters(rtp, 'myParam', myValue);
sim(myModel, 'SimulationMode', 'rapid', ...
'RapidAcceleratorUpToDateCheck', 'off', ...
'RapidAcceleratorParameterSets', new_rtp);
Hope this helps.
3 comentarios
Lee
el 30 de Oct. de 2017
Does saving and reloading the rtp object even work? I've had strange behaviors when reloading saved objects in the past so hadn't even tried it yet... In theory this is a solution, but i agree, no where near as elegant as your proposed function call. Mathworks?
Ver también
Categorías
Más información sobre Simulink Coder en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!