Bootstrap

Simulink导出FMU方法

一、安装FMIKIT

将“FMIKit-Simulink-master.zip”文件解压缩后,拷贝到C盘根目录下面。

二、加载FMIKIT

1、添加FMIKIT路径:

       在matlab命令行输入:addpath("C:\FMIKit-Simulink-master")

2、初始化FMIKIT:

       在matlab命令行输入:FMIKit.initialize()

三、安装Cmake

安装“cmake-3.21.0-windows-x86_64.msi”

四、导出FMU

  1. Open the model to export
  2. Add external inputs and outputs (optional)
  3. Open **Simulation > Model Configuration Parameters** (CTRL+E)
  4. Under **Solver > Type** select **Fixed-step** for a Co-Simulation FMU or **Variable-step** for a Model Exchange FMU
  5. Under **Code Generation > System target file** click **Browse** and select **grtfmi.tlc** for a Generic Real-Time based FMU or **rtwsfcnfmi.tlc** for an S-function based FMU
  6. Under **Code Generation > CMake** select the **CMake generator** for your toolchain
  7. Apply the **Model Configuration Parameters** dialog
  8. Select **Code > C/C++ Code > Build Model** (CTRL+B) to export the FMU to the current working directory。
;