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))

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

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개)

change the storage class to "auto".

댓글 수: 2

It's work , but do you know reason?
"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.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기

제품

릴리스

R2017a

태그

질문:

2019년 6월 25일

댓글:

2023년 10월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by