[Ipopt] Question: Using IPOPT as an S-function in Simulink

Martijn Disse M.W.Disse at student.tudelft.nl
Tue May 29 15:52:54 EDT 2012

Dear all,
For my thesis work I am using IPOPT as a solver for a Model Predictive Controller. IPOPT is open source and exist of a large collection of files written in C++. I installed the solver to be used with Matlab via the OPTI-Toolbox (http://www.i2c2.aut.ac.nz/Resources/Software/OptiToolbox.html) which come with a precompiled mex-file that acts as a function to call the solver. This works perfectly. However, since I need to use XPC-target or Windows Real Time Target, I need to implement the solver somehow in a Simulink block.
This is what I've tried so far:
*         Since I already have a mex-file I thought it would be convienent to use that inside a simple 'Matlab Function'-block. This works in Simulink, but the code generator cannot compile the Simulink diagram to a real-time executable code.
*         Creating an S-function in which I call the .mex function. This code cannot be compiled since the .tlc file is missing.
After some search on fora<http://www.mathworks.se/matlabcentral/answers/38962-call-a-mex-function-from-simulink> and Matlab central<http://www.mathworks.com/matlabcentral/answers/36879-calling-mex-function-from-within-simulink>, I found out that I should create a C MEX S-function and compile it. To make life easier, Simulink comes with an S-function builder in which libraries etc. can be added. I failed in constructing one and it is driving me crazy. My question to you therefor  is:
Who has experience in compiling IPOPT (or any other set of C++ files) to act as an S-function in Simulink and is willing to point me in the right direction?
Your help will be greatly appreciated!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/ipopt/attachments/20120529/fc9a5ce1/attachment.html>

More information about the Ipopt mailing list