07-04-2012 10:41 AM
I want to compare the value of a variable with the value of the same variable 10 seconds before.
What is the best way to obtain the value of that variable 10 seconds before without any waiting time?
Solved! Go to Solution.
07-04-2012 12:34 PM
Previous values are not stored in LabVIEW automatically. You have to tell it to store the value and recover it yourself when you need it.
Rob
07-04-2012 06:15 PM
How often does the value change?
You need to keep track of 10s worth of data. This could be a single point if you record at 0.1Hz or millions of points if you record very fast. Can you tell us a little more about your application?
Typically you would maintain the history in a shift register.
I don't understand what you mean by waiting time? Please explain.
07-05-2012 03:22 AM
The easy way to do this is get the value from the variable then put a Wait and then get the value from the variable again but in this case the comparation have a waiting time (from the Wait funtion) so is not done imediatly...
Note that the 10s. is also a variable and can be any value...
07-05-2012 06:32 AM
Hi,
can you post the vi? This would make it way easier to see what you are talking about.
Regards
Florian
07-05-2012 06:38 AM - edited 07-05-2012 06:38 AM
Hi IDILIO,
"so is not done imediatly"
When you get the variable's value the second time you can compare immediatly - as you compare with a already stored older value...
It seems you're using local variables to reach your goal. You should know LabVIEW uses wires to store values!
07-05-2012 07:23 AM
Hi,
Attached VI is an imagination of what is understood by me on comparison of delay value.
Hope it helps.
Regards.
07-05-2012 07:26 AM
See attached Example.vi
What I want is compare the value actually in the screen (on indicator "Value") with the value that was on that indicator 10s. (delay control) before.
With this vi I cannot show the result for every values in the Value (the comparation is done only for one value every 10s.) and the result is showed 10s. after I want.
07-05-2012 07:29 AM
07-05-2012 08:49 AM
Hi IDILIO,
when you want to compare the current value with a value in the past and with a variable delay you have to create a history of your values.
As shown in your example I would create an array of values (like a ringbuffer). Now you would be able to compare the current value with each value in that buffer...