In Merge block, For execution of more than one subsystem(Nested If loops) I have an error saying Ensure that the Merge block output is updated by only one of its input signals

22 ビュー (過去 30 日間)
For this project all I am using nested if loops, I need the value at the end to display the most recently computed output of its driving block.
I am facing a small issue with merge block.
I have 4 nested if loops and I am trying to merge the answers, but I am having the trouble with understanding the error
Caused by: Output of Merge block 'bug/Merge1' is being updated concurrently at t = 0 by both block 'bug/Step1//1' 'Output Port 1' and block 'bug/If Action Subsystem' output port 1. Ensure that the Merge block output is updated by only one of its input signals at every time step
So I can neither use concatenate block nor bus creator block.I have attached the Simulink file just in case if it could help you understand my problem better.
Kindly please help me to resolve this issue or if you have any better solution for such kind of problem. Thankyou!
  5 件のコメント
Rasya KIRANI AMARNATH
Rasya KIRANI AMARNATH 2022 年 8 月 25 日
編集済み: Rasya KIRANI AMARNATH 2022 年 8 月 25 日
Yes Its the continuous nested if loop, I cant change the sample time or add delay. So I am looking for way to resolve this situation @Walter Roberson
Walter Roberson
Walter Roberson 2022 年 8 月 25 日
It is not obvious to me why this is happening.

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

採用された回答

Fangjun Jiang
Fangjun Jiang 2022 年 8 月 26 日
編集済み: Fangjun Jiang 2022 年 8 月 29 日
You need to re-construct your model.
At any time, there should be at most one of the inputs at the Merge block being updated. At time 0, you have two inputs at the Merge block being updated. That is the error.
You thought that since you had the nested if-else condition, it is guaranteed that only one of the inputs getting updated. It is true in logic and it is true if it is implemented in coding. But it is not true based on the way it is implemented in your Simulink model.
For example, the If block "Step2" is always executed (surprise!). One of its two outputs will always drive downstream blocks to be executed.
It could be implemented using Simulink blocks, but if you use if-else conditions, you need to wrap all the "else" contents in ONE action subsystem, not like the way you implemented it, where it is flat, it is not "nested". Block "Step3" is also always executed.
For this logic, I recommend using a MATLAB Function block, where you write MATLAB code to implement the logic.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by