MATLAB: How to include tunable parameters when exporting a Simulink model as a Tool-Coupling FMU in R2018b or later

carmakeremptyexportfmuimportparameterparameterssimulinktool-couplingtunable

I am trying to export a Simulink model as a Tool-Coupling FMU using MATLAB R2018b (or later).
I have exported it as a Tool-Coupling FMU, by going through the following MathWorks doc page:
The issue is that the resulting FMU seems to contain only the inputs and outputs coming from the inports and outports, respectively, of the Simulink model from which it has been generated, while it does not include the parameters defined in the MATLAB Workspace or in a Simulink Data Dictionary object in the model.
I would like to be able to use these parameters as tunable parameters in the exported FMU model.

Best Answer

Please follow these steps to make some of the model parameters visible in the FMU Block Parameters window:
  • Open the Model Explorer.
  • Make sure that the parameters used in the model are stored in the Model Workspace.
  • Check the box 'Argument' for those parameter you wish to be visible in the Parameters tab of the FMU block.
Now you can save the model and then retry the FMU Export.
Finally, the commands to run in order to start the automation server from a Windows Command Prompt are:
cd C:\ProgramData\MATLAB\SupportPackages\R2018b\toolbox\shared\ fmu_share\script
fmu-matlab-setup.cmd
start 1