In Simulink, how to substitute the default configuration set, not adding a new one??

8 vues (au cours des 30 derniers jours)
Dyson Freeman
Dyson Freeman le 24 Jan 2014
Modifié(e) : Jakub Krizan le 5 Déc 2016
Here I just list corresponding code sections:
hCs = getActiveConfigSet(gcs);
hCs_1 = hCs.copy;
attachConfigSet(gcs,hCs_1,true);
setActiveConfigSet(gcs,hCs_1.Name);
After running, There are two ConfigSets in the Model Explorer. Every time I run this code, the number of ConfigSet plus one. Although it will work correctly, but it potentially increase the model size. So I need to substitute not add a new ConfigSet, or a method that I can eliminate redundant Configs using command line.

Réponses (2)

ES
ES le 24 Jan 2014
% Simulink parameters which has to be checked
Configuration.Set = {
'SolverType'; ...
'Solver'; ...
'SolverMode'; ...
'AlgebraicLoopMsg'; ...
'BlockPriorityViolationMsg'; ...
'SingleTaskRateTransMsg'; ...
'CheckMatrixSingularityMsg'; ...
'UnderSpecifiedDataTypeMsg'; ...
'UnnecessaryDatatypeConvMsg'; ...
'VectorMatrixConversionMsg'; ...
'SignalLabelMismatchMsg'; ...
'UnconnectedInputMsg'; ...
'UnconnectedOutputMsg'; ...
'UnconnectedLineMsg'; ...
'ConsistencyChecking'; ...
'ArrayBoundsChecking'; ...
'InlineParams'; ...
'BlockReduction'; ...
'BooleanDataType'; ...
'ConditionallyExecuteInputs'; ...
'OptimizeBlockIOStorage'; ...
'ZeroCrossControl'; ...
'BrowserLookUnderMasks'; ...
'BrowserShowLibraryLinks'; ...
'ModelBrowserVisibility'; ...
'WideVectorLines'; ...
'ShowPortDataTypes'; ...
'ShowLineDimensions'; ...
'LibraryLinkDisplay'; ...
'SimBuildMode'; ...
'UpdateModelReferenceTargets'; ...
'UpdateHistory'; ...
'SFUnusedDataAndEventsDiag'; ...
'SFUnexpectedBacktrackingDiag'; ...
'SFInvalidInputDataAccessInChartInitDiag'; ...
'SFNoUnconditionalDefaultTransitionDiag'; ...
'SFTransitionOutsideNaturalParentDiag' ...
};
% Solver options
slConfig.SolverType = 'Fixed-step';
slConfig.SolverMode = 'SingleTasking';
% Diagnostics options
slConfig.Solver = 'FixedStepDiscrete';
slConfig.AlgebraicLoopMsg = 'error';
slConfig.BlockPriorityViolationMsg = 'error';
slConfig.SingleTaskRateTransMsg = 'warning';
slConfig.CheckMatrixSingularityMsg = 'warning';
slConfig.UnderSpecifiedDataTypeMsg = 'warning';
slConfig.UnnecessaryDatatypeConvMsg = 'warning';
slConfig.VectorMatrixConversionMsg = 'warning';
slConfig.SignalLabelMismatchMsg = 'warning';
slConfig.UnconnectedInputMsg = 'error';
slConfig.UnconnectedOutputMsg = 'error';
slConfig.UnconnectedLineMsg = 'error';
slConfig.ConsistencyChecking = 'none';
slConfig.ArrayBoundsChecking = 'none';
% Advanced settings
slConfig.InlineParams = 'off';
slConfig.BlockReduction = 'off';
slConfig.BooleanDataType = 'on';
slConfig.ConditionallyExecuteInputs = 'on';
slConfig.OptimizeBlockIOStorage = 'off';
slConfig.ZeroCrossControl = 'EnableAll';
% View settings %
slConfig.BrowserLookUnderMasks = 'on';
slConfig.BrowserShowLibraryLinks = 'on';
slConfig.ModelBrowserVisibility = 'on';
slConfig.WideVectorLines = 'on';
slConfig.ShowPortDataTypes = 'off';
slConfig.ShowLineDimensions = 'off';
slConfig.LibraryLinkDisplay = 'all';
% Additional settings %
slConfig.SimBuildMode = 'sf_nonincremental_build';
slConfig.UpdateModelReferenceTargets = 'Force';
slConfig.UpdateHistory = 'UpdateHistoryWhenSave';
% Stateflow settings %
slConfig.SFUnusedDataAndEventsDiag = 'error';
slConfig.SFUnexpectedBacktrackingDiag = 'error';
slConfig.SFInvalidInputDataAccessInChartInitDiag = 'error';
slConfig.SFNoUnconditionalDefaultTransitionDiag = 'error';
slConfig.SFTransitionOutsideNaturalParentDiag = 'warning';
% Write settings %
for i=1:length(Configuration.Set)
%converting cell string to string
strOptionName = char(Configuration.Set(i));
strSetting = slConfig.(strOptionName);
set_param(ModelName,strOptionName, strSetting);
end

Jakub Krizan
Jakub Krizan le 5 Déc 2016
Modifié(e) : Jakub Krizan le 5 Déc 2016
To replace config set: 1. attach new one 2. set it active 3. detach old one
hCs = getActiveConfigSet(gcs);
hCs_1 = hCs.copy;
attachConfigSet(gcs,hCs_1,true);
setActiveConfigSet(gcs,hCs_1.Name);
detachConfigSet(gcs,hCs.Name);

Catégories

En savoir plus sur Modeling dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by