0
votes

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?

1

1 Answers

0
votes

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?) enter image description here

As an alternative: check "Include Sources in FMU"

enter image description here

Then you can afterwards compile the FMU e.g. 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.