简体   繁体   中英

How to use FMIKit in 64-bit Matlab / Simulink to generate 32-bit binary FMU?

I have successfully used FMIKit2.7(from [ https://github.com/CATIA-Systems/FMIKit-Simulink] )in 64-bit Matlab / Simulink (Matlab2017a) to generate a 64-bit binary FMU, which is indeed useful. However, now other simulation tools need to use 32-bit binary FMU for co-simulation, I follow the following way: [ https://ww2.mathworks.cn/help/coder/ug/build-32-bit-dll-on-64-bit-windows(r)-platform-using-msvc-toolchain.html?s_tid=srchtitle] Added a 32-bit compiler toolchain to 64-bit Matlab. In addition, Intel-> x86-32 (Windows32) is selected for Hardware Implementation, and rtwsfcnfmi.tlc is selected for System Target File. The FMI Option sets the output to a Co-Simulation type FMU.

Hardware Implementation

System Target File

FMI Option

However, in fact, the FMU generated by FMIKit is still a 64-bit binary FMU.

My guess is that FMIKit automatically chose a 64-bit compiler during the compilation and linking process. What do I need to do to modify the FMIKit configuration file (such as a .tlc file or others) or Matlab / Simulink to generate a 32-bit binary FMU?

You should use the grtfmi.tlc target insted of the rtwsfcn.tlc target. Then you either manage to configure the cmake-build to directly generate a 32-bit FMU. (I am not familiar with this. But there are offered different cmake generators for different VisualStudio versions, some of them having a 64 in the name. So are the others 32bit?) 在此处输入图片说明

As an alternative: check "Include Sources in FMU"

在此处输入图片说明

Then you can afterwards compile the FMU eg using fmpy (command line or gui --> help --> add platform binary) from a 32-bit python version. You cannot use the Anaconda installation for the latest fmpy version in 32bit, see https://github.com/CATIA-Systems/FMPy/issues/64 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM