LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SUB VI STALLING PROBLEM

Solved!
Go to solution

Hi All!

 

I am doing an exam project in Labview 8.6. I have created a server VI to simulate a blow moulding machine. It contains two parts. The first is a simple bunch of random number generators and some arithmetic to simulate temperatures.

 

The second is a sub VI that consists of a case structure, inside this is 4 part flat sequence structure, iside each sequence is a while loop with a timer express VI that simulates the different stages of the machine, I haveset these at the moment at 3 seconds each. This sub VI is set by a boolean from the temperature simulating VI. On its own the sub VI runs perfectly!

 

Now the problem, when I run the first part of the VI its fine, the tempertatures simulate and fluctuate, but when I hit the start button for the sub VI the simulation hangs, the temperatures only cahnge randomly and the sub VI values dont work.

 

I have a feeling it may be something to do with the timing but I really cannot see what it can be!

 

Any input is greatly appreciated!!

 

Thanks in advance!

 

Mark

0 Kudos
Message 1 of 14
(3,580 Views)
It would be a good idea to post some simple VIs that replicate the issue. LabVIEW developers over here are more likely to help if they can visualize what you have done.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 2 of 14
(3,579 Views)

Seeing the code would help. I'm guessing your problem is this: once the subVI is running, the calling VI must wait until the subVI is finished before continuing. That means no updates to anything on the front panel. Is this what you are seeing? If you need to have the calling VI continue to update its front panel, but this is based on data that's being generated by the subVI then you must use a data transfer mechanism between the calling VI and the subVI. A queue would be a good choice. There are shipping examples that show you how to use queues. Additionally, you must use the VI Server to dynamically launch the subVI so that control can be returned back to the calling VI.

 

Of course, seeing the code would help to confirm/negate that suspicion. 

Message Edited by smercurio_fc on 04-24-2009 05:35 PM
Message 3 of 14
(3,558 Views)

Hi Again,

 

Thanks for your help so far, its appreciated! I am an online student so dont have much else to back me up!

 

SMERCURIO: With regards the the data of the calling VI, the temps are not affected by the SUB vi, I have a boolean switching the SUB VI from the callling VI. The main issue is that the SUB VI just doesnt work correctly, it stays timing on one of the sequences, then might randomly jump to another after a few seconds.....really annoying!

 

I have attached two screen shots, the first is of half of the sub VI, its the one with 4 express timers that run in sequence one after the other...the second is of the main VI with the sub VI in it. The main VI is surrouinded by a while loop, I have a time delay in that of 200ms. There is no time delay in any of the loops in the sub VI.

 

Thanks again for any advise!

Download All
0 Kudos
Message 4 of 14
(3,534 Views)

Smercurio was right. The main program cannot continue until the subVI completes (which seemingly takes a long time once it starts).


Marko1982 wrote:

There is no time delay in any of the loops in the sub VI.


Tha's a big mistake. How often do you really need to check for the elapsed time? Loops like this need a small wait.


Marko1982 wrote:

The main issue is that the SUB VI just doesnt work correctly, it stays timing on one of the sequences, then might randomly jump to another after a few seconds.....really annoying!


 

That description does not make any sense. Can you describe it in more details? What are the timer inputs? Remember, once the subVI runs, changing a timer control in the main program does not do anything until next time the subVI runs.  Think dataflow!

 

Why don't you attach the actual VI? Images are difficult to debug. 😉

 

Instead of that worm of a sequence in the subVI, try a simple state machine in the toplevel VI.

Message 5 of 14
(3,529 Views)

Hi Alten bach!

 

I did try to put the sequence on the fron t panel but I had the same problem. I dont have much experience with Labview so my knowledge is very limited and anything I have learnt has been from Labview help!

 

I have attached the VI that I have made, if you sould have a look that would be great!

 

 

0 Kudos
Message 6 of 14
(3,522 Views)

Marko1982 wrote:

 

I did try to put the sequence on the fron t panel but I had the same problem.


I don't quite understand what you mean by this, since sequences are used on the block diagram, and not on a front panel, and your VI doesn't contain any sequence structures.

 

You did not include your subVI. As has been noted, if the subVI needs to run in parallel with the calling VI then you cannot place the subVI in the loop, since the loop must wait until the subVI finishes running and returns data to the calling VI. That's what dataflow is. Is the subVI supposed to stop after some time? Is the calling VI supposed to be updating the front panel while the subVI is running? If so, then a simple fix would be to have a parallel loop that simply runs the subVI. Based on what I see, it appears that only a Boolean would need to be passed into the subVI. 

 

Please post the subVI so we can further troubleshoot this.

Message 7 of 14
(3,506 Views)

Hi!

 

Im sorry, I meant to attach that too. It is attached here.

 


Marko1982 wrote:

 

I did try to put the sequence on the fron t panel but I had the same problem.


 

 

What I meant with that quote was the calling VI not front panel....sorry!

 

You say that the SUBvi cannot be inside the loop, I do have it in the loop so perhaps this is the problem. The sub VI is meant to keep running until stopped, The machine cycles through five timers, one after the other, the length of these is set from the front panel. There is also a basic counter to count up one after each cycle.

 

Also yes the calling VI is supposed to update temperatures as the SUB vi is running, is this possible to do?

0 Kudos
Message 8 of 14
(3,503 Views)

Hi All,

 

So I have tried romoving the Sub VI and replacing it with a nother parallel loop on the calling VI. The replacment parallled VI just wont work at all!

 

Marko1982

0 Kudos
Message 9 of 14
(3,432 Views)

Marko1982 wrote:

Hi All,

 

So I have tried romoving the Sub VI and replacing it with a nother parallel loop on the calling VI. The replacment parallled VI just wont work at all!


You must not be doing it right since the technique is used all the time. Smiley Wink

 

I think the key problem you have is to decide where you want the indicators to be. You currently have indicators on the main VI, and duplicate indicators on the subVI. But, the subVI is not set up to display its front panel when called (at least the one you posted isn't). This means that when called it will simply run in the background. It will not update the main VI's front panel. Do you want the subVI to display its own front panel? If so, then those timer indicators on the main panel are superfluous. Also, the subVI has to be written to act more like a "regular" VI. I.e., it needs its own loop and event handling. If, on the other hand, you just want the subVI to be used as a timer then you don't need any of the front panel indicators on the subVI. In this case in order for the subVI to update the main VI while the subVI is running, you have to pass control references to the subVI so that it can write to the main VI's indicators while the subVI is running. 

Message 10 of 14
(3,422 Views)