A Pattern to Serialize a Simulink Bus.
9 views (last 30 days)
Show older comments
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
0 Comments
Answers (2)
Kaustubha Govind
on 10 Oct 2012
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 Comments
Kaustubha Govind
on 10 Oct 2012
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
on 1 Aug 2016
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.
0 Comments
See Also
Categories
Find more on Interactive Model Editing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!