05-16-2012 11:10 AM
Hello to everyone,
I am not sure if i put the right name for this subject but i will try to explain my proble below:
We have a sensor and we are reading the voltage of the sensor and is 4.5v and we have another sensor which measuring the distance is going to be made from the other sensor.
When the first sensor starting to move the voltage starts from 4.5v and when it detects a metal plate the voltage starting to decrease and when is right above the metal plate is almost zero and when starting to pass above the metal plate the voltage increase again and reaches to 4.5v. With the other sensor we are measuring the distance made by the first sensor from the starting point (voltage of the sensor is 4.5v) to the end point (the voltage of the sensor is again 4.5v) and we want to create a XY Graph to correspondence the voltage to distance. The total length of the movement of the sensor is 0 mm Starting point to 240 mm End point. In the first pass of the sensor above the metal plate I am taking this image (see image XY Graph first iteration) which is what i expected, but when the sensor returning back to the starting point and passing again above the metal plate I am taking something I don’t like (see image XY GRAPH).The reason I am taking this is because the sensor which measure the distance starts from 240 to 0 which is correct but what I want to see in my XY GRAPH is:
First passing above the plate x-axis distance 0-240 , second passing above the plate return to starting point x-axis distance 240-480,third passing above the plate x-axis distance 480-720 ,fourth passing above the plate return to starting point x-axis distance 720-960 and so on.
So the question is how can I do that? Can please someone provide a code solution for that?I am also posting the vi I am using which will help more i think.
05-16-2012 01:51 PM
Just add 240 to your second iteration's X-values, then 480 to the third iteration, and 640 to the 4th iteration X-values.
05-16-2012 02:03 PM
Ok that's a thought,but how you can do that?I want to this done automatically not manual.
05-16-2012 02:25 PM
Add 240*i to your X values. i is your iteration index and multiplying it by 240 will iterate your starting X values in 240 steps.
05-16-2012 02:36 PM
Ok now i understand your meaning.I also have to change by a property node the x scale multiplier or not?
05-16-2012 02:45 PM
i also notice by doing what you propose that my graph did not start from zero but from 1858? i don't understand why that?any suggestions?
05-21-2012 01:49 AM
Hello and Good Morning,
I just try your suggestion crossrulz but it's not working as expected.The data in the XY GRAPH are not presented in the right way i think,do a small example like the vi i give and you will see what is the proble.Any other possible solutions,suggestions please?
05-21-2012 04:57 AM
XY GRAPH PICTURE
05-21-2012 11:03 AM
Hello to All,
The friend crossrulz propose a solution but after doing what you propose i multiply i*240 and add this to my X values it seams this is not working propelry.Am i doing something wrong?I am sending a photo of what i am seeing in my graph rigth now (name of photo XY GRAPH 1).What i would like to see is shown in the photo (IDEAL WAVEFORM).Can anyone suggest a code solution for my problem?I have try many things but still i can solve my problem. In the begging of this subject i post the code i am using right now.
05-21-2012 11:05 AM
Hello to All,
The friend crossrulz propose a solution but after doing what you propose i multiply i*240 and add this to my X values it seams this is not working propelry.Am i doing something wrong?I am sending a photo of what i am seeing in my graph rigth now (name of photo XY GRAPH 1).What i would like to see is shown in the photo (IDEAL WAVEFORM).Can anyone suggest a code solution for my problem?I have try many things but still i can solve my problem. In the begging of this subject i post the code i am using right now.