[Ipopt] Question: Using IPOPT as an S-function in Simulink (Martijn Disse)

John Hedengren john.hedengren at gmail.com
Wed May 30 12:29:54 EDT 2012


Martijn,

There is an example on the Mathworks File Exchange of nonlinear MPC in an
S-function using IPOPT for a 4 tank process. I think the author, Trevor
Slade, was using another solver but you can change it to IPOPT with an
option change to NLC.solver = 3.

http://www.mathworks.com/matlabcentral/fileexchange/35999-nonlinear-control-of-4-tank-process

This isn't exactly how you are trying to implement it but it may give some
ideas for your project.

-John Hedengren


> ---------- Forwarded message ----------
> From: Martijn Disse <M.W.Disse at student.tudelft.nl>
> To: "ipopt at list.coin-or.org" <ipopt at list.coin-or.org>
> Cc:
> Date: Tue, 29 May 2012 19:52:54 +0000
> Subject: [Ipopt] Question: Using IPOPT as an S-function in Simulink
>
> 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!****
>
> Best,****
>
> Martijn ****
>
> **
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/ipopt/attachments/20120530/ff8d9f2b/attachment.html>


More information about the Ipopt mailing list