12-19-2012 07:16 AM
Hello,
I needed to develop a method where I would monitor a value with respect to time and if the value did not increase more then a specified value an event would occur.
Here is a better description of my desired algorithm. I need to monitor the temperature of a component and determine whether or not it has stabilized. The definition on whether or not this component has stabilized is the temperature has not increased more the 5°C over a time span of 15 minutes.
So my inputs would be the temperature delta, between now and 15 minutes ago. If the delta is less then 5 °C then the part has stabilized.
I guess I would need to store the temperature data over the last 15 minutes at see if the temp value of the first and last value has changed more then 5°C if it has not then the first saved temperature value would be deleted and the current temperature value would be added to the list.
What would be the best way to hold this temperature data some short of linked list?
12-19-2012 07:40 AM
You can use a State machine desgin pattern to perform this job. In that you can use the shift register to save the value and compare it after the given time.
12-19-2012 08:22 AM
Hello thanks for the response.
I understand that I could save a temp value via a shift register but I am a little unclear how a state machine would help me do this.
Furthermore how would I store multiple data from different time intervals. Could I use an array?
12-19-2012 08:25 AM
You can wire any type to the shift register, including arrays.
To learn more about LabVIEW and state machines, I suggest you try looking at some of these tutorials.
You can also do a search within this forum for "state machine" and you should find many threads, some with examples of how to implement your solution.
12-19-2012 08:31 AM - edited 12-19-2012 08:38 AM
smoothdurban wrote:
Furthermore how would I store multiple data from different time intervals. Could I use an array?
Well... there are multiple ways of doing this... Using an array is one of them.
It depends what you want to do with the data, and what you mean by store.
Do you mean getting data that you want to store for later, as in writing to file?
Do you mean getting data that you need x-number of samples to analyze?
Do you mean getting data that you need to find a key element (ie:search)?
From your OP, this is what you are looking for:
I guess I would need to store the temperature data over the last 15 minutes at see if the temp value of the first and last value has changed more then 5°C if it has not then the first saved temperature value would be deleted and the current temperature value would be added to the list.
What would be the best way to hold this temperature data some short of linked list?
There are examples of such code in the forum. You should also mention your sampling rate. For temperature, it is reasonable to take a sample every minute, so 15 measurements is not much. An array could do the trick with a shift register.
12-19-2012 08:54 AM
I would be looking to store the data in a buffer which one it was full it would delete the oldest piece of data.
I would not be looking to write this data to file
12-19-2012 09:19 AM
I guess I would need to store the temperature data over the last 15 minutes at see if the temp value of the first and last value has changed more then 5°C if it has not then the first saved temperature value would be deleted and the current temperature value would be added to the list.
What about the values in between? You didn't mention the interval, or is the interval 15 min?
If you want to compare only 2 values over a time period, then you don't need an array. Just a shift register.
12-19-2012 09:39 AM
The values between would need to be stored because if the condition is not met the oldest value would be deleted and replaced by the second oldest value.
Perhaps I am not explaining the problem correctly. Stabilization occurs when the temperature of the test sample is less then 5°C over the previous 15 minutes.
Theoretically the program would have to run at least 15 minutes before it would compare its first pair of data. T0 would be the first piece of data and followed by t1, t2 . . . . until t900 (assuming we are recording at 1HZ) once the first 900 sample of data have been collected we would want to compare the vale at t0 and t900 if difference is less then 5°C then the sample has stabilized. If the difference is greater then 5 °C the part has not stabilized so replace the value at t0 with the value at t1, the value at t1 with the value at t2 . . .(and so on) . . value at t899 with t900 and add then new value to t900 and compare the new value at t900 with t0. This process is to be repeated until the value between t900 and t0 is less then 5°C.
I hope this clears up what IU am trying to achieve.
12-19-2012 09:59 AM - edited 12-19-2012 10:00 AM
Sorry... I just run in & out of the forum...
I created a quick example of a state machine. It will give you an idea how to start your solution.
It is not the best example, because the stop button needs to wait until the time waiting has elapsed before taking effect.
The purpose of the code is to give you an idea how to implement your solution.
You can copy the code snippet into your LV code. It's in 2012.
Gatta go..