How to make a Simulink Parameter non-tunable to avoid the following error: Parameter 'InputPortWidth' of '' is non-tunable but refers to tunable variables (NUM_OF_FAULT_EVENTS (base workspace))
76 ビュー (過去 30 日間)
古いコメントを表示
I have the following defined in my base workspace by a .m file at startup:
NUM_OF_FAULT_EVENTS = Simulink.Parameter;
NUM_OF_FAULT_EVENTS.Value = 35;
NUM_OF_FAULT_EVENTS.CoderInfo.StorageClass = 'Custom';
NUM_OF_FAULT_EVENTS.CoderInfo.Alias = '';
NUM_OF_FAULT_EVENTS.CoderInfo.Alignment = -1;
NUM_OF_FAULT_EVENTS.CoderInfo.CustomStorageClass = 'Define';
NUM_OF_FAULT_EVENTS.CoderInfo.CustomAttributes.HeaderFile = '';
NUM_OF_FAULT_EVENTS.CoderInfo.CustomAttributes.ConcurrentAccess = false;
NUM_OF_FAULT_EVENTS.CoderInfo.Alias = '';
NUM_OF_FAULT_EVENTS.CoderInfo.Alignment = -1;
NUM_OF_FAULT_EVENTS.Description = 'The number of fault events';
NUM_OF_FAULT_EVENTS.DataType = 'uint8';
NUM_OF_FAULT_EVENTS.Min = [];
NUM_OF_FAULT_EVENTS.Max = [];
NUM_OF_FAULT_EVENTS.DocUnits = '';
This Parameter is used to define the "Input port size:" of a Selector block with the following options selected:
Number of input dimensions: set to 1
Index Mode: set to "Zero-based"
Index Option: set to "Index vector(port)"
Input port size: set to NUM_OF_FAULT_EVENTS
I get the following error when I build the model for code generation:
Invalid setting in '<model path>/Selector' for parameter 'InputPortWidth'.
Caused by:
Parameter 'InputPortWidth' of '<model path>/Selector' is non-tunable but refers to tunable variables (NUM_OF_FAULT_EVENTS (base workspace))
My question is:
How do I force the the NUM_OF_FAULT_EVENTS parameter to be non-tunable in my base workspace using the .m file when the model project is loaded?
1 件のコメント
omar Elkawokgy
2020 年 7 月 27 日
As far as I know you should only define it as variable not a Simulink parameter
NUM_OF_FAULT_EVENTS = uint8(35);
Also do not forget to set Configuration Parameters => Optimization => Signals and Parameters => Default parameter behavior: "Inline"
回答 (1 件)
Fangjun Jiang
2020 年 7 月 27 日
change the storage class to "auto".
2 件のコメント
Fangjun Jiang
2023 年 10 月 25 日
"InputPortWidth" should be non-tunable. It is possible to use CustomStorageClass "Define" to define it but the setting seems to be incomplete. For example, the usually needed header file is empty. Use 'auto' storage class is the easiest solution.
参考
カテゴリ
Help Center および File Exchange で Data Types についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!