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

7 views (last 30 days)
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 警告

Answers (1)

Nithin
Nithin on 24 Apr 2025
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:

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!