
Delay - bus as initial condition and bus propagation
24 views (last 30 days)
Show older comments
Hi
I want to use the delay block with initial condition through input port. I read the documentation (source: Delay) and it seems both u and x0 can be set to a bus, but if I try to do this, then I can't get the bus names on the output.
If I set the initial condition option to Dialog, then everything works. But the issue is that I need to set the initial condition through the bus, with values that I need. Is it even possible?
Here's an example:

0 Comments
Answers (1)
Fangjun Jiang
on 19 Feb 2025 at 15:53
Edited: Fangjun Jiang
on 19 Feb 2025 at 15:58
I am intested in this question so I made an example.
According to the document, 'The initial condition x0 port accepts nonvirtual bus signals.'
So I made it a nonvirtual bus but there is still a model error at the Bus Selector block.
The error disappeared only after I made the data input u also a nonvirtual bus.
Thus it seems that if you want to utilize "input port" to do initilization of a bus, then the bus input also needs to be a nonvirtual bus. I think this makes sense. Please contact tech support to confirm this.
To make a nonvirtual bus, basically you need to create a Simulink.Bus object and then specify the data type as this bus object. The bus signal line displayed below is nonvirtual bus.

2 Comments
Fangjun Jiang
on 20 Feb 2025 at 15:07
It is not depend on a matlab workspace variable. The Simulink.Bus object is just used to "define" the nonvirtual bus. The initial condition could come from top model inputs. Specify the data type of that Inport block as this bus type.
When you say "two buses with the exact same structure", it implies nonvirtual bus. Virtual bus does not map to a fixed structure.
See Also
Categories
Find more on Composite Interfaces in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!