查看信号是否来自Simulink中的总线 [英] See if a signal originates from a bus in Simulink
问题描述
我们有一个S功能,在Simulink中不支持总线信号,因此我正在以编程方式试图找到一种方法来确定输入/输出的信号类型是否源自总线或正向总线传输,所以我可以进行多路分配并根据需要自动复用信号。不幸的是,我可以找到的唯一可靠地告诉端口是来自总线还是来自总线的块属性是它是否从总线继承了属性,这在所有情况下可能都不正确。对如何解决这个问题有任何想法吗?
好吧,我得到了Matlab支持的答复,我已经尝试过了,经过测试,它确实有效,唯一的是Mathworks建议使用总线选择器而不是DEMUX块。简而言之,您可以执行以下操作:
- 查找模型中所有信号线的句柄。
- 如果需要,可以获取名称,但是,我使用句柄进行了操作,效果很好。
- 编译模型以创建 CompiledBusType属性。
- 获取模型中每条信号线的'CompiledBusType'属性。然后终止模型的编译模式。
'CompiledBusType'返回'NOT_BUS','VIRTUAL_BUS'和'NON_VIRTUAL_BUS'。 / p>
希望这个问题可以帮助其他人,必须等一个星期才能让Matlab找我。
We have an S-Function that does not support bus signals in Simulink, so programmatically I am trying to find a way to determine if the signal type of an inport/outport originates from/is going to a bus so I can demux and mux the signal automatically as needed. Unfortunately, the only block property I can find that reliably tells if the port comes from or goes to a bus is if it inherits properties from the bus, which might not be true in all cases. Any idea on how to figure this out?
Well, I got an answer back from Matlab support, I have tried this and tested this and it works, the only thing is that Mathworks recommends using a Bus Selector instead of a DEMUX block. In a nutshell, here is what you do:
- Find the handles of all signal lines in the model.
- Get the names if you need to, however, I did this using handles and it worked fine.
- Compile the model to create the 'CompiledBusType' property.
- Obtain the 'CompiledBusType' property of each signal line in the model. Then terminate the compilation mode of the model.
'CompiledBusType' returns 'NOT_BUS', 'VIRTUAL_BUS', and 'NON_VIRTUAL_BUS'.
Hope this question helps someone else out, had to wait a week for Matlab to get back to me.
这篇关于查看信号是否来自Simulink中的总线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!