08-15-2018 08:18 AM
Hi,
is there any option to stop a while loop (or force it to start the next iteration) if the the execution time of the VIs in the loop exceeds a certain value?
The methods I know to stop a loop after a certain time only work if the loop continuously starts new iterations (since the condtions are only checked at the start of an iteration) but don't work if the program gets stuck in one iteration.
08-15-2018 08:45 AM
First of all you need a tool to interrupt the work of the subVI.
After this, you can do a runtime check.
What kind of function are you calling?
08-15-2018 08:59 AM
The program is doing some doing some test and calibrations of a device, so it is mostly sending and receiving date to and from the device. It is quite complex and was written by someone else who is not available anymore. So I have only a very rough idea where the problem is.
Therefore I'm looking for a quick and dirty solution, since everything else would be to time consuming.
08-15-2018 09:10 AM
I'm afraid brute force will not help here. Interrupting the operation with the equipment can lead to malfunctions, so the next iteration of the loop will end with an error and will have to restart the system.
You need to add timeouts into the function of working with the equipment
08-15-2018 09:15 AM
Thats not really a problem, since if this problem occurs the device has anyway failed the test.
08-15-2018 09:39 AM - edited 08-15-2018 09:42 AM
Since there is no code to look at I am guessing that if your UUT fails then it will stop communicating (or no comms is a fail)?
Are you setting a timeout for your VISA Reads? You can adjust this timeout with the VISA Serial Setup or a VISA property node.
Connect the error cluster to the loop's stop terminal (OR it if necessary) and the loop should now stop if there is a serial communication timeout.
Does that help?
08-15-2018 09:49 AM - edited 08-15-2018 09:51 AM
BTW: There is no way to stop and abort a While Loop in the middle of its execution. All of the code in the loop must execute before the loop can complete an iteration. So if one VISA Read deep in your loop hangs up because the UUT is not responding. Your program is going to just sit there until the VISA timeout expires.
LabVIEW is based on the dataflow paradigm, turn on the trace (the light bulb) on your block diagram and watch your program run, you will see what I mean.
08-16-2018 12:29 AM
There seems to be a timeout set for the Visa communication.
Connecting an error cluster doesn't really work, since the error would only stop the loop in the next iteration.
The general Problem for me is that for the test our technicians usually use a version of the vi that is compiled to be used as a stand alone executable, which make it hard find out what really happens when the problem occurs.
08-16-2018 12:33 AM
Not thinking much, the very first idea strikes is "How about replacing For Loop with While loop (Decide your loop stop based on your requirement)"
08-16-2018 09:19 AM - edited 08-16-2018 09:20 AM
@GMAch wrote:
There seems to be a timeout set for the Visa communication.
Connecting an error cluster doesn't really work, since the error would only stop the loop in the next iteration.
The general Problem for me is that for the test our technicians usually use a version of the vi that is compiled to be used as a stand alone executable, which make it hard find out what really happens when the problem occurs.
Without seeing your code I can only make uneducated guesses from here on out....
But It sounds like you need to completely rewrite that section of code, maybe a simple state machine inside the while loop would work better as that allows you to jump around between states as needed.