开发者

See if a signal originates from a bus in Simulink

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:

  1. Find the handles of all signal lines in the model.
  2. Get the names if you need to, however, I did this using handles and it worked fine.
  3. Compile the model to create the 'CompiledBusType' property.
  4. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜