从Simulink模型获取模型拓扑 [英] Obtaining the model topology from a Simulink model

查看:121
本文介绍了从Simulink模型获取模型拓扑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Python中创建一个表示Simulink模型的结构.我知道至少有两种方法可以执行此操作-通过解析".mdl"文件,或使用Matlab的api与模型进行通信.

I would like to create a structure in Python which represents a Simulink model. I am aware of at least two ways of doing this - by parsing an ".mdl" file, or by using Matlab's api for communicating with the model.

您能推荐好的库或API来做到这一点吗?

Can you recommend good libraries or APIs for doing this?

尤其是,我需要在Simulink模型上执行一些处理,并且我想在Python中进行处理.同样,我也不想一直与Matlab进行通信(以便我可以发布浮动许可证).

In particular, I need to perform some processing on a Simulink model and I would like to do it in Python. Also I don't want to be constantly communicating with Matlab for doing this (so that I can release the floating license).

我在网上看到了一些解析器,但是它们似乎有一些局限性,通常不支持诸如Bus Creators和Bus Selectors,Muxes,Demuxes以及读取UserData信息之类的组件.

I have seen some parsers online, but they seem to be a little limited, usually not supporting components such as Bus Creators and Bus Selectors, Muxes, Demuxes, and reading UserData information.

任何帮助将不胜感激.

推荐答案

不是我所在的地区,但是注意到了这个

Not my area, but noticed this Python parser which may be helpful.

或者您可以购买 Simulink报告生成器以保存/操作.该模型作为XML文件.

Or you can purchase the Simulink Report Generator in order to save/manipulate the model as a XML file.

或者* .mdl文件是可读的ascii文件.您可以使用fread语句将其读取为字符串,更改字符串,然后将其保存为您选择的格式,或者将其写回到* .mdl文件中.我的同事想到了这个,不是我!但是,这需要使用您自己编写的例程进行编辑/解析.

Or the *.mdl file is a readable ascii file. You could read it into a string with a fread statement, alter the string, then either save it to your format of choice or write it back out to a *.mdl file. My coworker thought of this, not me! But would require doing the editing/parsing with a routine you write yourself.

这篇关于从Simulink模型获取模型拓扑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆