Log a Subset of Signals using fast restart

3 ビュー (過去 30 日間)
Riccardo Spica
Riccardo Spica 2022 年 1 月 12 日
I am trying to log a subset of signals in a model by specifying a DataLoggingOverride in a Simulink.SimulationInput object.
Everything works as expected as long as I don't use fast restart, in which case the DataLoggingOverride seems to be ignored.
Fast restart significantly improves execution time when I simulate a large number Simulink.SimulationInput objects so I would really like to use it. However, I typically have different batches of simulations (sets of Simulink.SimulationInput arrays) and I don't need to log everything every time so I would like to be able to set different sets (or subsets if necessary) of signals to log for each batch within my scripts.
From the documentation of fastrestart it seems to be possible to change signals to log without reinitializing the model.
Here is a working example in r2021b
load_system(docpath(fullfile(docroot, 'toolbox', 'simulink', ...
'examples', 'ex_bus_logging')));
load_system(docpath(fullfile(docroot, 'toolbox', 'simulink', ...
'examples', 'ex_mdlref_counter_bus')));
mdl = 'ex_bus_logging';
blk = 'ex_bus_logging/IncrementBusCreator';
blkPort = 1;
ov = Simulink.SimulationData.ModelLoggingInfo(mdl);
so = Simulink.SimulationData.SignalLoggingInfo(blk,blkPort);
ov.Signals(1) = so;
% create the simulation input
in = Simulink.SimulationInput(mdl);
in = in.setModelParameter('DataLoggingOverride',ov);
in = in.setModelParameter('SimulationMode', 'accelerator');
% Simulate without fastrestart
out = sim(in);
% observe that only the signal 'ex_bus_logging/IncrementBusCreator' is
% being logged as specified in ov
% Simulate again with fastrestart
out = sim(in, 'UseFastRestart', 'on');
% observe that signals are logged as specified in the model (ov is ignored)

回答 (0 件)


Help Center および File ExchangeVerification, Validation, and Test についてさらに検索




Community Treasure Hunt

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

Start Hunting!

Translated by