- The configuration set can be changed entirely but doing this will change the configuration parameters for all the models using the reference set, so make sure you actually desire this before taking this approach.
- For parameter update to a particular block, the configuration set can be cloned, and the cloned copy can be used to make necessary changes to the model parameters. This cloned copy can then be added to the model. A sample demonstration to achieve the same is shown using the ‘LinearActuator’ and ‘nonLinearActuator’ example Simulink models.
How can I programmatically override referenced configuration parameters?
8 ビュー (過去 30 日間)
古いコメントを表示
I have a reference configuration set applied to a large collection of custom blocks. I am trying to programmatically override certain parameters depending on which block I am working with. From the documentation there is a way to do this within the Configuration Parameters GUI, but is there a way to access the override functionality from within a script when using reference configuration sets?
0 件のコメント
回答 (1 件)
Rajanya
2024 年 10 月 3 日
I understand that you are trying to control the configuration parameters of a reference model programmatically. A configuration reference is especially designed to ensure consistency across multiple models by referencing a shared configuration set. Thus, parameter update is not directly supported for a configuration reference via scripts; but a workaround can be made to achieve similar results.
Both the ‘LinearActuator’ and the ‘nonLinearActuator’ are made to reference a common configuration set called ‘sharedConfig’, and then the ‘nonLinearActuator’ model’s ‘System Target File’ is made to change to ‘grt.tlc’ as opposed to the reference set’s ‘System Target File’ of ‘ert.tlc’ which is also inherited by ‘LinearActuator’.
After creating the copy in ‘clonedConfigSet’ and setting the parameters accordingly, the new configuration set is added to model explorer using ‘attachConfigSet’ and is activated using ‘setActiveConfigSet’.
modelName = 'NonLinearActuator';
configRef = getConfigSet(modelName, 'Configuration');
clonedConfigSet = configRef.copy;
set_param(clonedConfigSet, 'SystemTargetFile', 'grt.tlc');
attachConfigSet(modelName, clonedConfigSet, true);
setActiveConfigSet(modelName, clonedConfigSet.Name);
save_system(modelName);
This creates a new copy configuration ‘Configuration2’ which the desired model uses.
You can use the following commands to view the documentations of the used functions for more information.
doc attachConfigSet;
doc setActiveConfigSet;
doc Store Data in Dictionary Programmatically
Hope this helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Multicore Processor Targets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!