Delay - bus as initial condition and bus propagation

8 次查看(过去 30 天)
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:

回答(1 个)

Fangjun Jiang
Fangjun Jiang 2025-2-19
编辑:Fangjun Jiang 2025-2-19
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 个评论
Augusto Dufloth
Augusto Dufloth 2025-2-20
Hmm, it seems to do the trick.
But it would be more "intuitive" to not depend on a matlab workspace variable. Actually, in my specific case, I control the delay initial conditions through top model inputs.
I would expect that if you provide two buses with the exact same structure, then the output should be propagated.
I'm making a suggestion through the official channel.
Fangjun Jiang
Fangjun Jiang 2025-2-20
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Composite Interfaces 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by