05-05-2010 09:17 AM
I am doing the following application:
1) Temperature signal is read in every 1 second, define in a while loop;
2) I want to make sure that in a consecutive of 2 minutes, temperature value is always lower than a value, say 10 degree C;
3) If it can meet the criterion, returns true, otherwise continue monitoring until it is true.
A possible way it to define an 1D array with 120 elements, but I would like to know if there is a more elegant way? I cannot put the array in a subVI, as it is destroyed once subVI is left. LabVIEW system provides "RMS" calculation function (everything is in a sub VI) and I do not the function used in that VI.
Solved! Go to Solution.
05-05-2010 09:31 AM
you could store the maximum temperature as a single point in a shift register and then each time you acquire a new temperature use the 'max&min' comparison VI to compare your current value and previous maxium and pass the larger of the two to the shift register.
I am not sure why you can't create a subVI - if you explain further i might be able to help.
05-05-2010 09:36 AM
05-05-2010 09:50 AM
I might have read the original post wrong but I thought the objective was to track the max temp not the mean temp?
Like this: -
05-05-2010 10:05 AM - edited 05-05-2010 10:10 AM
Hi,
Think he also wants to exit if any temp is above a threshold:
Rgs,
Lucither
05-05-2010 03:36 PM
As i understand the opening post he just wants to wait until the temperature is lower than a threshold for at least 2 minutes and then exit?
Something like this should do it if thats the case.
05-05-2010 08:06 PM
I will the solution in the above post, as this is closest to what I want.
If criterion is met, count increases until 120 seconds; otherwise, count is reset to 0.
A further question is that how to put this as a subVI, the while loop is still in the main VI, the the counting part is grouped as subVI (most importantly, no shift register in the while loop).
This is not crititcal in terms of program function, but I am interested to know if it is possible in LabVIEW.
05-06-2010 05:03 AM - edited 05-06-2010 05:04 AM
Ah!! so thats what you meant, ok.
You can easily implement this as a subvi:
This is what the subvi would look like. You would use a while loop that only iterates once with an un-initialised shift register. This will then store the last value in its shift register.
This is how it would look on your main vi:
In this version you do not need to wire the time limit, its default value is 120. If you ever want to change this though you can wire in a new value.
Rgs,
Lucither
05-06-2010 07:44 PM
Hi, all, with the contribution the last post, my problem has been completely resolved.
I learnt a new way of using un-initialized shift register. It is really very useful.
Initially, I worried that values stored in a shift register are destroyed once loop is exited. Actually, it is not true for un-initialized shift register.