Menu

Matlab

Help
2008-04-16
2013-04-25
  • Tom Wambecq

    Tom Wambecq - 2008-04-16

    Hi,

    is anybody using matlab/simulink in combination with openMI? Can anybody help me with that?

    Tom Wambecq

     
    • Bert Jagers

      Bert Jagers - 2008-04-20

      Hi Tom,

      Although the combination of MATLAB and OpenMI has come up during the early stages of development it never got to the top of the priority list. I have used both MATLAB and OpenMI but not yet in combination. I can think of two approaches that would make sense to me:

      1) Turning some MATLAB functions or object into an OpenMI compliant component. This would require the implementation of a generic MATLAB wrapper that would communicate with MATLAB in some way effectively making the OpenMI interface available inside the MATLAB environment (I don't consider converting MATLAB itself into an OpenMI compliant DLL an option). An object interface seems to be as most attractive. I am not sure how the two way interaction would work out. It would be great if such components could still be compiled into stand alone programs/DLL's compatible with OpenMI.

      2) Using MATLAB as the environment to set up and trigger a configuration. This would possibly allow you to treat any OpenMI compliant component as a MATLAB function or object.

      As said above I have not experience yet in combining MATLAB and OpenMI, but the combination could offer great flexibility. I'm definitely willing to investigate these options further.

      Best regards,

      Bert

       
    • Peter Sinding

      Peter Sinding - 2008-04-22

      Hi Tom,

      I the situation is that you have a MATLAB component and wants to use that as an OpenMI component I suggest you take a two step approach.

      First you wrap your MATLAB compont into a win32 dll. See http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/apiref/bqoqnz0.html&http://www.mathworks.com/access/helpdesk/help/techdoc/helptoc.html#bqoqoj6-1
      for details on how top turn your MATLAB components into a Win32 dll.

      After that the simplest way would be to wrap your win32 component interface using the pattern described on the OpenMI Organisation wiki: http://public.deltares.nl/display/OPENMI/Migrating+existing+Fortran+based+models+codes

      As an alternative to the first step you may consider wrapping your MATLAB component directly into C# and skip the win32 layer. Take a look at: http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=12987&objectType=file. I haven't tried this myself.

      Lets here if you are succesfull. I can imagine one could do all kind of cool things using the graphic capabilities of MATLAB while running a linked OpenMI composition.

      Best regards
      Peter Sinding, DHI

       
  • Tselekounis  Yiannis

    Hello to all,

    I' m trying to turn a Matlab component into an OpenMI compliant component by taking the approach discribed here(for the wrapping):
    http://www.mathworks.com/matlabcentral/fileexchange/12987

    I tried the third method(C shared library) but i didn't get good results. As you can see in the above link, the third method for
    integrating Matlab with C#, which is the most fragile and it's not recommended. Using the second method (.net dll)  i am able to call matlab functions from C# code  but i m comfused about the steps i need to follow(if  any exist) in order to turn the matlab function to an openmi compliant component.   I was wondering if anyone has ever succedded in combining Matlab with OpenMI. Any help would be appreciated.

    Best regards
    Yiannis Tselekounis

     

Log in to post a comment.

MongoDB Logo MongoDB