matlabdymolafmi

How to load and run a Dymola FMU in a Matlab script?


I am trying to load a FMU (FMI2), generated from Dymola, in a Matlab script. I have tried using the loadlibrary function to load the dll, but I am not sure I have supplied the appropriate headers. I tried with fmi2Functions, fmi2FunctionTypes and fmi2TypesPlatform.

What would be the basic steps to load such a dll, initialize the simulation and then run a step?

Here's my current code:

libname = 'toto';
ext = '.dll';

libfile = [libname ext];

if ~libisloaded(libname)
    loadlibrary(libfile,'dymosim.h','addheader','fmi2Functions','addheader','fmi2TypesPlatform','addheader','fmi2FunctionTypes')
end

Solution

  • There is no direct FMI support in MATLAB.

    You have the following possibilities: