Error "An input signal to a Merge block must be connected and must originate from a conditionally executed subsystem that is not an Iterator subsystem"
113 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi there,
I run into this error of "Invalid connection from block 'subsystem_merge_for_iteration/For Iterator Subsystem1/Signal Conversion3' output port 1 to Merge block 'subsystem_merge_for_iteration/For Iterator Subsystem1/Merge' input port 1. An input signal to a Merge block must be connected and must originate from a conditionally executed subsystem that is not an Iterator subsystem". My model is in the snapshot below. I cannot remove the Signal Conversion3 because it will trigger a different error of "Branched signals cannot be fed into a Merge block. The signal from 'subsystem_merge_for_iteration/For Iterator Subsystem1/Subsystem1/x1' output port 1 is connected to both Merge block 'subsystem_merge_for_iteration/For Iterator Subsystem1/Merge' input port 1 and to 'subsystem_merge_for_iteration/For Iterator Subsystem1/Subsystem2/Switch' input port 3. To fix this error, you can insert a Signal Conversion block in Signal Copy mode and feed the output of the Signal Conversion block to only the Merge block...."
Can you please suggest a solution?
0 Commenti
Risposta accettata
Fangjun Jiang
il 6 Feb 2023
For this particular case, use a Switch block to replace the Merge block. "u1" can be used to control the switch.
5 Commenti
Paul
il 7 Feb 2023
Modificato: Paul
il 7 Feb 2023
I tested and much to my surprise was able to use a Switch block to select between outputs from two If Action subsystems. Good to know.
"Always use conditionally executed subsystems to drive Merge blocks, without any intervening blocks."
For some reason, I've always thought that meant that a Merge block must be used to select between (or combine) outputs of conditionally executed subsystems to a single signal. But that appears to be not the case, at least for If Action and Enabled subsystems (I tried both).
This doc page on Conditionally Executed Subsystems doesn't list the If Action block as a type of conditionally executed subsystem even though it uses if-then-else to essentially explain what a conditionally executed subsystem is. And the very first example on that page uses If Action blocks, even though they are (apparently) not conditionally executed subsystems.
Also, all of the examples in the doc, and the example models linked from the doc, that I've seen always show the If Action block outputs driving a Merge block, which probably also reinforced my misunderstanding that that construct is required.
In this question, can the Signal Conversions on the inputs to the Merge block be deleted and replaced with a signal Signal Conversion on the output of the Merge block?
Fangjun Jiang
il 7 Feb 2023
"In this question, can the Signal Conversions on the inputs to the Merge block be deleted and replaced with a signal Signal Conversion on the output of the Merge block? "
Likely Yes, or should be pulled inside the Action Subsystem if they are different.
All the inputs and output of a Merge block share the same memory, so Merge block is more efficient than Switch block.
Più risposte (1)
Glen Tallarek
il 27 Lug 2023
Modificato: Glen Tallarek
il 27 Lug 2023
When I have had this problem and then read the Matlab documentation that said "must originate from a conditionally executed subsystem that is not an Iterator subsystem" I understood it to mean that a "Merge" block will only pass the input value that has changed most recently in the calculation of the subsystems upstream of it. It seems like a "time based" operation which makes sense when you think about it. If you have a subsystem that contains two separate subsystem that are calculating a value that is sent to a "Merge" block then the "Merge" block would not "know" which one to pass since it had two values that were essentially calculated at the same time. In your model above, I assume that you intended to have only one of your subsystems calculate an output value each time this system was entered and executed and it should have worked except for the fact that your Subsystem2 block is using the output of your Subsystem1 block as an input which won't work unless the Subsystem1 block is executed before (in the same "call" of the whole subsystem). I think your model might work if you stored the output of Subsystem1 to a variable that could then be used in Subsystem2 when it was called. I don't know how Matlab analyzes the models to determine if there are errors in the system but I think your "Merge" block error is probably caused by Subsystem2 using the output of Subsystem1 as an input when it isn't possible to run both Subsystems in the same execution. That's just some ideas.
Here is a link to the Merge block info:
0 Commenti
Vedere anche
Categorie
Scopri di più su Schedule Model Components in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!