问题描述
我想在Simulink中为系统建模,然后从python程序访问该模拟以为其提供新的条件或输入.
I want to model a system in Simulink, and then access that simulation from a python program to feed it new conditions or inputs.
我知道那里有一个模块,允许您从Python访问Matlab引擎,但这有些不同.
I know there is a module out there that allows you to access the Matlab engine from Python, but this is a little different.
我想要一个在Simulink中建模的系统,并使用Python监视某些硬件.然后,每四分之一秒左右,调用Simulink,使用硬件的当前条件运行仿真,获得一些输出并重复该过程.基本上,我正在尝试使用硬件的实时模拟器.
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.
我正在运行Ubuntu 11.04
I am running Ubuntu 11.04
我知道Python并不是最合适的选择,但这不是重点.知道这是否可行吗?还是我可以从哪里开始?
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?
推荐答案
对于Matlab Simulink,有一个名为SimServer的开源HTTP和XML-RPC服务器:
There's an open-source HTTP and XML-RPC server for Matlab Simulink called SimServer:
http://simulinksimserv.sourceforge.net/
(在包装中)提供了一个示例Python脚本,该脚本显示了如何在运行的Simulink模型中使用XML-RPC接口获取和设置数据.
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.
这篇关于从Python访问/调用Simulink的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!