是否可以以编程方式播放Simulink模型并测量其状态? [英] Is is possible to programmatically play a Simulink model and measure its states?

查看:68
本文介绍了是否可以以编程方式播放Simulink模型并测量其状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找为现有Simulink模型建立测试集的方法.理想情况下,我可以完全控制模型,显式地对其进行步进,并测量模型中任何总线上任何信号的状态.

I am looking to set up a test set for an existing Simulink model. Ideally I could take full control of the model, explicitly stepping it and measuring the state of any signal on any bus in the model.

可能已经收集到了,这是该模型的单元测试系统的前身.这样的话,我不能真正证明改变模型以适合测试,测试必须按原样容纳模型.

As might have been gleaned, this is the precursor of a unit testing system for the model. Being so, I can't really justify changing the model to suit the test, the test must accommodate the model as-is.

到目前为止,我最远的是使用load_model()返回模型的句柄.从那里似乎有一个相当模糊集的函数访问模型.我看不到任何与访问状态有关的信息,也看不到与访问已加载模型有关的任何其他命令.

The furthest I've got so far is using load_model() to return a handle to the model. From there there seems to be a quite obscure set of functions for accessing the model. I can't see any that relate to accessing states and can't see any further commands that relate to accessing a loaded model.

推荐答案

最简单的方法是在Simulink Preferences中使用Data Import/Export函数.

The easiest way is to use the Data Import/Export function within the Simulink Preferences.

设置复选框States,它将在工作空间中的每个时间段(包括暂停模拟或逐步执行模拟时)存储系统的每个状态.

Set the checkbox States and it will store every state of your system for every time step in your workspace, also when you pause the simulation or execute it step by step.

请注意不要设置Save simulation output as single object,在这种情况下,访问将更加复杂,您需要遵循

Be aware not to set Save simulation output as single object, in this case the access would be more complicated and you need to follow the instructions here.

这篇关于是否可以以编程方式播放Simulink模型并测量其状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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