When export simlink model to FMU by matlab2023b, cannot export the paraments set in InitFcn,how to deal it

조회 수: 7 (최근 30일)
The following parameters are not exported due to Code Generation limitations: 'Branch_L,Cap_Value,Initial_Voltage_Cap,Load_R,Ts,end_time,start_time'. Update the storage class of the parameter to get the expected results.
组件:Simulink | 类别:Model 警告

답변 (1개)

Nithin
Nithin 2025년 4월 24일
This error occurs because parameters defined in the "InitFcn" (Initialization Function) are not automatically recognized as "tunable" or "exportable" during FMU code generation. By default, these parameters are treated as constants or local variables, so they are not included as FMU parameters.
To address this, you can make these parameters tunable in the FMU by creating them as "Simulink.Parameter" objects in the MATLAB base workspace and setting their "StorageClass" to "ExportedGlobal" or "Model default".
If this approach does not suit your needs, you can try one of the following alternatives:
  • Define the parameters as "Simulink.Parameter" objects directly in the model workspace and set their "StorageClass" to "ExportedGlobal".
  • Convert the model to use a data dictionary, store all the parameters in the dictionary and set the storage class as needed.
Kindly refer to the following MathWorks documentations for better understanding about:

카테고리

Help CenterFile Exchange에서 Code Interface Definitions에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by