12-30-2014 04:37 PM
Hi everyone,
i am seeking for something that i haven't found here as an already soluted question (maybe because i did not use proper keywords).
I am trying to make a programme-measuring of a voltage. The voltage is caused by a change of concentration of gas in liquid, i use some probes for it. One part of a programme is measuring of the voltage and waiting for a stabilized state in order to have proper results.
Let's say, that I measure 540 points (3 minutes, 3 Hz). The condition, that has to occur, is following: A1<A2>A3 or A1>A2<A3, A1 is average of the 180 values of the first minute, A2 is average of the 180 values of the second minute and so on. If one of those conditions occurs, then i can continue with another part of programme. But if not, I need to add another minute of measurement and try, if the conditions have already occured. The next conditions should look following: A2<A3>A4 or A2>A3<A4. This means that I need to delete or replace A1 and generally make this: A(n+1) new=A(n) old.
I am looking for a function called "Add another frame if condition occurs" or something like that. Could someone please help me or give some advices?
Regards
Jan
Solved! Go to Solution.
12-30-2014 05:16 PM
Those conditions actually look a bit like peak detections. There's some canned VIs you can use if you search for peak that may or may not be usefull.
Regarding what I think is your general concern, you can use shift registers to change the conditions.
You will need to replace my logic test placeholder and maybe some code (another shift register?) to collect samples before the logic test.
12-31-2014 09:36 AM
Thank you very much for your help, I will try it. If I have any trouble, i will write it here. Happy New Year 🙂
01-01-2015 03:54 PM
Well, I found another problem, as I expected :D..
First of all, I need to generate Ai-2, then Ai-1 and then we are coming to the last frame of of sequence. For the first time everything is alright (Ai is different from Ai-1 and Ai-2), but after the shift register starts working, Ai and Ai-1 are the same values and that is not what I need. I need Ai to be different value from Ai-1 (Ai-1 and Ai-2 shifts properly). I need all the numbers to change and shift. This time I am only trying to make the simplified programme without any case structures. Wouldn't you know, how to solve this? Maybe there is a very simple solution, but as I am a beginner, I don't have much experience.
01-02-2015 08:33 PM
It sounds like you need the current value (X), the previous value (X-1), and the one before that (X-2). You can do that with a shift register by adding another stage on the left edge, like the example. Note that you have X, X-1, and X-2 available inside the While loop, so only need to add the "stopping logic" (which I left out) to wire to the Stop terminal.
Bob Schor
01-03-2015 10:09 AM
Well, that's it. Thank you very much for your help.
Pinca