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

5 views (last 30 days)
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 Comments

Sign in to comment.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 26 Aug 2022
Edited: Fangjun Jiang on 29 Aug 2022
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.

More Answers (0)

Categories

Find more on Simulink Functions 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!