LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with sub-vi cycles

Hi,

  I am trying to create a sub-vi from a top-level vi, but I get the following error message: "The SubVI resulting from the selection creates cycles when dropped on the caller vi's diagram.".

 

  The Help explains that a sub-vi should not have its output affecting signals coming back to its input. I can understand that this could create a closed-loop system IF the affected subvi input influences the SAME output. In my case, the subvi output goes to the caller diagram, comes back to another input of the subvi, then influences a DIFFERENT output of the subvi, which eventually leaves the caller diagram. There are no closed loops. Actually, the diagrams runs correctly when it is flat (no sub-vi). So why is LabView complaining?  Is there a way to disable this check?

 

  I tried to sever the subvi in two sections with a sequence, to further seperate the "supposed" loops, but it is still complaining.

 

  Thanks,

  Benoit

0 Kudos
Message 1 of 6
(3,766 Views)

Hi Benoit,

 

Have you gone through the following article:

SubVI Creates Cycles Error Message

 

If so, be sure to post your code; it's always easy to help out when we can visualize the code.

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 2 of 6
(3,763 Views)

Hello Benoit,

 

that's dataflow 🙂

 

What should happen first: let the subvi wait for any inputs or start the subvi to produce some output? That's why LabView is complaining about cycles...

 

Can you show the code? Does the code run before inclusion/creation of the subvi?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 6
(3,761 Views)

Thanks for the replies.

 

Yes, the code runs correctly when the top-level VI is flat (i.e., when the content of what I want to put in a sub-vi is still at the top-level). As soon as I try to make it a sub-vi, I get the error message. This is what I find stange: why does pushing it to a sub-vi make a difference?

 

Here are the two VIs in attachement. "test2.vi" is the top level. "error intercepter2.vi" is the sub-vi.

 

Thanks,

Benoit

Download All
0 Kudos
Message 4 of 6
(3,744 Views)
The problem is in test 2 VI.  You have 2 subVI's, the intercepter and the AG initialize.  The error from one goes to the second.  The error from the second goes to the first.  A subVI can't run until it has all its inputs satisfied.  So you have a catch22, which subVI should run first?  Eliminate one of the error wires.
0 Kudos
Message 5 of 6
(3,733 Views)

I did not know the rule about having all the inputs ready before a sub-vi can run. So data cannot flow back and forth from the sub-vi to the top-level...  The sub-vi has to run once.

 

Ok. Now I understand why it fails. My current solution is to move parts of the sub-vi to the top-level. It is not as clean as having everything in the sub-vi, but it works...

 

Thanks!

Benoit

0 Kudos
Message 6 of 6
(3,727 Views)