Delay - bus as initial condition and bus propagation

22 ビュー (過去 30 日間)
Augusto Dufloth
Augusto Dufloth 2025 年 2 月 19 日 10:09
コメント済み: Fangjun Jiang 2025 年 2 月 20 日 15:07
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 日 15:53
編集済み: Fangjun Jiang 2025 年 2 月 19 日 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 件のコメント
Augusto Dufloth
Augusto Dufloth 2025 年 2 月 20 日 5:52
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 日 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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeComposite Interfaces についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by