4

I want to model a system in Simulink, and then access that simulation from a python program to feed it new conditions or inputs.

I know there is a module out there that allows you to access the Matlab engine from Python, but this is a little different.

I'd like to have a system modeled in Simulink, and monitor some hardware using Python. Then, every say quarter second or so, call Simulink, run the simulation using current conditions of the hardware, get some output and repeat the process. Basically I'm trying to play around with a real time simulator for hardware.

I am running Ubuntu 11.04

I know Python isnt ideally suited for this, but that's not the point. Any idea if this is possible? Or where I may start?

1
  • 1
    You may compile your Simulink program to executable using the Matlab compiler. The communication could be done using files. Commented Nov 20, 2011 at 1:08

1 Answer 1

4

There's an open-source HTTP and XML-RPC server for Matlab Simulink called SimServer:

http://simulinksimserv.sourceforge.net/

An example Python script has been provided(in the package) which shows how the XML-RPC interface can be used to Get and Set data in a running Simulink model.

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks for the link. Will check it out.
This seems to be Windows specific. I should have said I am running Ubuntu Linux.
I have looked at it github site: github.com/jonmills/simserver and the original developer said "SimServer builds and works fine on Windows XP. I haven't tried it, but it ought to be possible to get it working under Linux too, with a few changes to the mex_simserver.m file. All of the dependencies are cross-platform. "
Maybe if you ask it this way: "how do i change this mex file to make it run on linux", add the mex file and tag it matlab+mex you'll get better response here ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.