07-24-2019 08:26 PM - edited 07-24-2019 08:39 PM
Hello Application Engineers,
I am trying to do a baseline offset for a multiple XY graph so as to get a normalized XY graph starting from point zero. A random generator is used to produce raw data at a fast speed, say 50 ms per set (of three data, (X, Y1, Y2 and Y3)), then one set data is extracted for XY graph at every 15 sets of raw data, or say it 15 sets per graph.
I want to use an average (Y10, Y20, Y30) of the first 10-graph's data as a base line, then all frame's data is off-setted by the baseline value (average), meaning the normalized xy graph all start from a zero point. The normalized i-th data should be
(Xi, Y1i - Y10, Y2i - Y20, Y3i - Y30)
First, I used an array to simulate such a process, see the XY-graph_offset.vi, it worked as I wanted, however, after migrating it to the application program, XY-graph-offset_app.vi, it did not come with expected result. I played around and was not able to fix it.
Enqueue and dequeue are used in the app, but you can ignore them and just focus on the data offset part.
My offset program includes 4 parts:
1. calculate average of the first 10 graph's data,
2. replace the first 10 graph's data using the value after offset,
3. replace the new data using the value after offset,
4. graph the normalized data.
Could someone help me with the troubleshooting?
Gu
07-25-2019 12:03 AM
Hi, it's very simple to solve this problem.
You have to check which value is the highest and than the value "+1"(highest value +1 = calculated value).
The calculated value goes in Y-Max and so you have a konstant Offset.
Y-Min is zero
Look at de picture.
07-25-2019 09:22 AM - edited 07-25-2019 09:50 AM
Hi KarlBStrich,
Thank you for your response. But I did not get your point. My real application is similar to the one posted previously, the random data generation represents my live data acquisition.
For troubleshooting, I added a few indicators to the program, which is attached here below. one indicator is the baseline offset loop count, it supposed to just run once to calculate the average of the first 10 graph data when the graph iteration reaches 10. The interesting thing is that the extracted-subarray for averaging and result of the average are both correct, however, the loop counter can go up to 15, meaning repeating the average calculation 15 times. I do not understand why it can happen. The graph iteration equal to 10 condition can only be met 1 time. How can the baseline offset loop count go over 1 and up to 15?
Gu
07-29-2019 04:16 AM
My idea is correct