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

11 次查看(过去 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
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

请先登录,再进行评论。

采纳的回答

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 CenterFile Exchange 中查找有关 General Applications 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by