A Pattern to Serialize a Simulink Bus.

조회 수: 15 (최근 30일)
Petri
Petri 2012년 10월 10일
답변: Fabiano Silva 2016년 8월 1일
Hi there,
I have the mother of Simulink busses. It contains other nested busses and just to make stuff interessting some arrays of busses. Ultimately I would like to send the buss over a UDP link.
My question is, "Is the a generic pattern to convert busses to a character stream?" Would I would not like is to change some blocks every time I change the bus definition or use S-functions or a MATLAB-function block.
For extra browny points the edianess of the data being streamed should be considered.
Thanx Petri

답변 (2개)

Kaustubha Govind
Kaustubha Govind 2012년 10월 10일
This may not work for you since you seem to have a non-virtual bus, but I just wanted to throw it out there. If you could convert your nonvirtual bus to a virtual bus, you might be able to utilize the Bus To Vector block. (Note: You mentioned using arrays of buses - these cannot be virtual AFAIK)
  댓글 수: 2
Petri
Petri 2012년 10월 10일
Hi Kaustubha,
Your right, my bus is non-virtual. I have tried something in that direction.
I use a Signal Conversion block to convert non-virtual to virtual, then that is connected to a Bus To Vector. Here all matrices have to converted to vectors otherwise signal sizes can not be propigated. However I can't seems to get around the issues that IBus to Vector block input port cannot accept mixed data types. I've we can resolve that then I have a solution.
Thanx Petri
Kaustubha Govind
Kaustubha Govind 2012년 10월 10일
Petri: Perhaps you should use Data Type Conversion blocks to convert your bus elements to be all of the same type? There is no concept of a Simulink vector/matrix having mixed types (like cell-arrays in MATLAB).

댓글을 달려면 로그인하십시오.


Fabiano Silva
Fabiano Silva 2016년 8월 1일
Hi Petri, I had a similar problem and couldn't find a way to serialize a Simulink non-virtual bus. My solution was extract the signals from the bus with a Bus Selector and then use a Byte Pack block to serialize them. I think it's not the better way to serialize the information in the bus, but it's working well.

카테고리

Help CenterFile Exchange에서 Interactive Model Editing에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by