LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

xy plots

Hi,
I am working with Labview 8.2.1. I am trying to plt XY graph as shown in the prototype attached below. I have tried 2 different ways to plot it and SURPRISINGLY none of them work 🙂
I would appreciate, if anyone could help me point out my mistake.

Thanks in advance.

Dhawal
0 Kudos
Message 1 of 14
(4,253 Views)
The second chart is attached below.

Thanks

Dhawal
0 Kudos
Message 2 of 14
(4,248 Views)
Simply saying that "none of them" work doesn't give someone much to work with. You are getting data from a dll that you did not post and even if you did, it probably requires hardware that no one has. Can you better describe exactly what doesn't work the way you expect? Better yet, can you post a version of the VI with sample data? Create another indicator on the other 2D array, run the VI and then select Edit>Make Current Values Default. Save the VI and post it. I suspect that something is wrong with the way you are using the Replace Array Subset or your Index Array. Have you used a probe to look at the data that is being passed to the picture plot?
0 Kudos
Message 3 of 14
(4,233 Views)
One thing I found odd is that the "Physical Channel" control seems to be set up to read 2 channels, but the code implies that you're trying to read 512 samples for 5 channels.

It seems that you're looping through gathering 1 sample from each channel and replacing the appropriate array element. Presumably you're doing this because of the amount of time it will take to scan given the sampling rate. One problem is that you need to initialize the shift register with 0 rather than 1.

Also, the section where you've got the for-loop with the bundling of the elements: You're autoindexing and you're specifying the iteration count. This is redundant. Since you're auto-indexing you don't need to wire the iteration count.
0 Kudos
Message 4 of 14
(4,225 Views)

Dhawal,

Your other post said that you had things working – did something change? Also, a bit more explanation around what is not working and what you are getting / expect to get may help us narrow down what is wrong (along with posting the latest version of your VI). Are you getting errors or just wrong return values?

 

Regarding the VI in the previous post, The DAQ card holds the last value it was given until a new value is output or the task is cleared (outputs default 0v). From the VI posted, it seems that after the arithmetic inside the while loop is true 512 times, than you output a value. Are you looking to output 0v the very next iteration? If so, I would put a DAQmx write in the false case (which adds +1 to the shift register) and output the value 0.

I would also put the same DAQmx write, outputting a value of 0v, after the while loop, before you clear the output task. This will make sure that the last value output is always 0v.

David L.
Systems Engineering
National Instruments
0 Kudos
Message 5 of 14
(4,196 Views)

Hi David,

Sorry for the late reply. I would want the voltage to be zero , not after the first iteration, but after the triggering is over (i.e. the labview would start recording the data once the trigger is initiated, and would again stop recording when the triiger point stops). I was trying to get the zero voltage whenever the trigger is not reached.

I hope I m making myself clear, still i m writing in points what exactly I would want.

1. labview is started

2. machine is started.

3. Labview will not record the data till the trigger is reached.

4. It will start collecting the data points once the trigger has reached and the C++ program would output a value, which would change one or more process parameters of the machine.

5. After a particular period of time (not constant), the trigger stops again, as the triggering condition is not met----- This is where I would want labview to send zero voltage signal to the machine.

Thanks in advance.

Dhawal

0 Kudos
Message 6 of 14
(4,168 Views)
Hi David,
I am facing with a new problem, which I just realized 🙂
I have added a replace array subset, which was there in my previous code as well. I blieve that the function of this block is to substitute the values which is sent to it (through 1D array of waveform) into 2D initialized array in proper rows and columns. I am recording the data which I m sending to Replace array subset, and I m also recording the data which I get from replace array subset. The interesting part is that the data does not match. I am sending the excel sheet with the data that I recorded.
Please also help me with this, cause if I dont get the proper output then the C++ code would not give me the required output.

Thank you.

Dhawal
Download All
0 Kudos
Message 7 of 14
(4,156 Views)
Dhawal,

In order to smooth everything out and have it work correctly, I would suggest only using the 'Y Values' of the waveform when manipulating and saving data so that all datatypes are similar (not waveform vs. double array). You can obtain these by using a 'Get Waveform Components.vi', found in the waveform pallet, and choosing 'Y' from the drop down menu for the output. This will take your input waveform, and give you a 1D array of values representing your Y-Axis data.


David L.
Systems Engineering
National Instruments
0 Kudos
Message 8 of 14
(4,122 Views)
Hi David,
I am trying to do as u told me to, but when I connect "Get Waveform Component", I am getting an error saying that i am trying to connect two terminals of different types, the type of source is 1D array of waveform DBL and the type of sink is waveform DBL.

If possible could you please send me the component that you are talking about in my VI.

Thanks a lot for yr help.

Dhawal
0 Kudos
Message 9 of 14
(4,106 Views)
Dhawal,

The error is correct, in that you are trying to connect an array of waveforms and the 'get waveform components' only takes a single waveform. To fix this error, index the array of waveforms, and then use a 'get waveform components' for each seperate waveform. You can they use array manipulation to put one or all of the waveforms 'y-axis' values into the main array.
David L.
Systems Engineering
National Instruments
0 Kudos
Message 10 of 14
(4,103 Views)