3

First of all, a happy new year to the readers!

I have a bus object A that needs to be translated into another bus object B. Both bus objects are identical except the names and labels. Ideally, I should be able to get the same result because it is a just an extra interface layer, nothing primary that would affect the results.

I tried to use bus creator and selector blocks in pair to fix this, but apparently SIMULINK doesn't like this. The other solution would be to use individual signals for this. Does anyone know any better solution?

Kind Regards,

Robert Seifert
  • 25,078
  • 11
  • 68
  • 113
ha9u63a7
  • 6,233
  • 16
  • 73
  • 108
  • You should be able to do this using a MATLAB Function block. Input your BUS (which is accessed like a structure within the m-code), and create a new bus, with new names, for the output. – Phil Goddard Jan 02 '14 at 20:35
  • @PhilGoddard My problem is not that. Bus A has elements a1, a2, a3 - Bus B has elements b1, b2, b3. The labels are different, but the type and size of the elements are the same (e.g. logical/real32). I was trying to translate it without having the mismatch. I did it by replacing the bus definitions. – ha9u63a7 Jan 06 '14 at 08:55
  • 2
    I had the same problem. Solution was to make a generic bus (with same amount of elements) that would replace both A and B (I mean generic names that would make sense to use in both or multiple places). However, it would be nice to have bus type casting blocks in Simulink. – remus Jan 09 '14 at 08:01
  • I am interested in the solution to this as well. I checked to see if this was possible in C and the behaviour purportedly is undefined: https://stackoverflow.com/questions/3995940/casting-one-c-structure-into-another This thread of discussion suggests using a union to do this work; although I'm not sure unions work well with Simulink. – Jordan McBain Sep 16 '20 at 19:47

0 Answers0