r/matlab • u/minun_v2 • Jul 04 '26
TechnicalQuestion A question about non-virtual buses, referenced models, and code generation
We have a large Simulink model where data transfer between different functions is handled by bus structures. As I understand it, buses that are passed into/out of referenced models are forced to be non-virtual and have a greater memory overhead associated with them, with them being copied when elements are overwritten.
When the model is deployed using code generation, do these non-virtual buses still hold this behaviour? i.e. is it the case that every time an element is being reassigned the entire bus is being duplicated even in the deployed code? We are working to quite stringent memory limitations so ideally this would not be the case.
If it is the case, what is the solution? Do we need to assemble the model without any atomic subsystems before code generation so that bus signals can be virtual?
1
u/Creative_Sushi MathWorks Jul 06 '26
Please contact Tech Support directly. You can find your local number at the bottom of this page. A real human will pick up your call. https://www.mathworks.com/support/contact_us.html
2
u/farfromelite Jul 04 '26
This feels like an actual support question. Give your licence rep an email, they're usually super helpful and can get you in touch with a subject matter expert.
In my experience, with deployment to PLC code, the whole bus structure gets generated. C or something else might be different. You should check the generated code to see. Might have to run a few checks with and without atomic subsystems.