Simulink导出FMU模型文件方法

一、安装FMIKIT

首先下载FMIKit-Simulink-master.zip文件,然后解压缩,在matlab中把添加该文件到路径

addpath("C:\FMIKit-Simulink-master")

二、加载FMIKIT

初始化FMIKIT在matlab命令行输入:

FMIKit.initialize()

三、安装Cmake

安装“cmake-3.21.0-windows-x86_64.msi”,用以编译用的

四、导出FMU模型文件

  1. Add external inputs and outputs (optional)
  2. Open **Simulation > Model Configuration Parameters** (CTRL+E)
  3. Under **Solver > Type** select **Fixed-step** for a Co-Simulation FMU or **Variable-step** for a Model Exchange FMU
  4. 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
  5. Under **Code Generation > CMake** select the **CMake generator** for your toolchain
  6. Apply the **Model Configuration Parameters** dialog
  7. Select **Code > C/C++ Code > Build Model** (CTRL+B) to export the FMU to the current working directory。
     

在simulink测试导出的模型,

或者用FMIpy测试

 

猜你喜欢

转载自blog.csdn.net/qingfengxd1/article/details/125489017