11-02-2012 04:04 AM
All, can you please help me out with the following;
I have data to log when one signal is for at least one hour between two values. If this is the case, all the data can be kept. If this is not the case, let's say after 30min that one signal is out of spec, previous measured data in those 30min may not be displayed in the log file. Does somebody have a solution for this?
Thanks in advance
Solved! Go to Solution.
11-02-2012 04:12 AM
How do you say the signal is stable?. Do you have a min and max limit for the signal. please explain more specifically
11-02-2012 04:14 AM
Yes, I have a min and max value. It is a pressure that needs to be between 8 and 12 bar. Out of this range, logged values are of no interest.
11-02-2012 04:24 AM - edited 11-02-2012 04:26 AM
So, it means, you want to log data if pressure is between 8 and 12 bar. Else, discard data and continue monitoring of data. Monitor only value
Right?
you can compare the pressure value using an In Range function and put a case structure to log data only when the value is in range. use timestamps to know when the data was in range. so the file only contains data when the pressure is in range
Or, if you want to log data ONLY IF the presusre was between 8 and 12 bar AND for an hour or more, then, put a timer to check time elapsed since the last value change and then log if timer has counted an hour. Then instead of inrange, use a shift register to see the last value which changed and then turn on a timer. When the value changed next, update the shift register. when the timer is up, reset the timer and log data.
I will take time to put these two logics on code and post. instead, you can make a code of either of the two options and post back. we can review your progress.
Almost forgot two questions: How are you reading the data? hardware used and data type? which file format do you plan to use?
11-02-2012 05:05 AM
I want to log data ONLY IF the presusre IS between 8 and 12 bar AND for an hour or more. Can you follow my logic? Logging does not have to start after this requirements are fullfiled. If requirements are fullfiled for an hour or more, the data can be used.
I will try to work further on code and post it for review.
Regards
Filip
11-02-2012 05:09 AM
I'm reading the data with an USB-6009. Except the pressure, I also have to log two other channels when requirements are fulfilled. Those 3 channels are all 0-10V. I wanted to use a .txt file to log.
11-02-2012 06:01 AM
This may be of help. Sorry, the code is a bit untidy!!
11-06-2012 02:07 AM
Thank you .aCe, this is very usefull.
One more question; now the logfile is limited to 1.25x the measurement time. What can I do to make the data after an hour also logged (as long as pressure still is in specification). Now I solved it by putting in a large number at the array size, but in my opinion this is not a good and clean solution.
Greetings