LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Display calculated values for x and y

Solved!
Go to solution

Hi all,

 

I have set up a VI to test a rig for flexibility and resillience which needs to display a continuously updating display of the twist moment vs. the angle between two string pots attached to the setup. I'm testing it currently with a virtual NI device simulating inputs from 2 string pots, but nothing is displaying on my XY graph. To be more clear: I need to be able to display the y-values of one DAQ input on the y axis and the y-values of the other DAQ input on the x-axis after they have gone through some basic calculations. I have attached my VI to take a look at. 

 

Thanks for any help you might be able to offer, I'm a bit stuck. 

 

Also, here's a screenshot of the MAX task I've set up. I put two dummy virtual string pots at the beginning of the task, since it wouldn't let me simulate loads and string pots at the same time and I know my load chart is working fine. 

 

maxtask.PNG

0 Kudos
Message 1 of 18
(4,071 Views)

What do you want to do?  I'm guessing that you want to sample possibly 1000 points at 1KHz (so 1000 points "appear" every second) and plot these data as a continuous multi-second stream.  I'll note that the sampling rate is a Front Panel control, but I don't see where the number of samples is defined or set.

 

You are plotting with a Graph, which plots a defined set of points, without scrolling.  For scrolling, you need a Chart.  I'm assuming you know that, but something isn't working right for you, and I'm uncertain what you want, and how it is failing.

 

Bob Schor

 

P.S. -- thank you for posting the code.

0 Kudos
Message 2 of 18
(4,056 Views)

I'll try to answer your questions as best as I can...

 

I do want to sample the data at 1KHz, but the rate is less important to me at this time than the actual displaying of the data. I have displayed a scrolling waveform many times before, but the issue is that I want to see the data as Moment vs. Angle on the front panel. No scrolling is necessary, since the resulting graph should look something like this:

 

graphsample.PNG

 

I'm having a problem separating the angle/moment data from their respective waveforms, which I attempted in that nonsense for loop on the top right corner of the Start Button value change event. 

 

I'm not sure if that was what you are looking for...

0 Kudos
Message 3 of 18
(4,041 Views)

To further clarify:

 

I have four inputs in my MAX task which is being loaded into my VI. The top right corner of my VI shows splitting that full waveform input into 4 separate waveforms, then splitting the second two into x and y and bundling the y's of both to be displayed on the XY graph. Nothing displays on the top graph when I run the VI, but the bottom graph displays the loads perfectly. Am I making an error with the arithmetic I went through on the second two waveforms? Could it be an issue with the two y arrays being labeled as such, and therefore not plotting anything for the X-axis? I don't know the inner workings of LabVIEW well enough to determine where my problem is, because the logic seems to work out to me. 

 

Thank you again

0 Kudos
Message 4 of 18
(4,015 Views)

Check your for loops first.  You are double indexing on two different arrays on your first level For loop.  This is a problem waiting to happen as the for loop will always use the shortest index.   I'd recommend parsing the data in separate loops and then merging/posting it to the control later after this work is done. Secondarily this will let you track your problems more easily through the process of your code.  This could be done with Functional global, auto indexers, shift registers.  The first place I'd start is splitting those for loops out to parse only one array at a time and then track your dataflow to see what's not jiving.  

 

Capture.PNG

Best wishes,

 

Tim 

0 Kudos
Message 5 of 18
(3,999 Views)

Also consider using the Get Waveform Components to get your Y values, this might reduce your parsing issues:

Capture.PNG

0 Kudos
Message 6 of 18
(3,996 Views)

Thanks so mcuh for your replies. 

 

I took your advice, but the only issue that creates is that the data type the XY graph accepts is a cluster of two 1D arrays (one for the X values and one for the Y). This would output a 2d array of each. I tried to use the auto-concatenating tunnel mode, but still nothing appears on the graph when my program is run. I am extremely confused. 

 

Here is an updated version of what I have: 

0 Kudos
Message 7 of 18
(3,990 Views)

I also tried throwing a for loop around the cluster builder and the XY graph and it does not display anything. I put an array on my front panel to test the 2d array output from the Get Waveform Components portion and the outputs are working, I think now it's just an issue with how I've sent the data to the XY graph. 

 

Thank you!

0 Kudos
Message 8 of 18
(3,986 Views)

You are closer but not quite there,  Probe your wires and watch your data come through, then you'll be able to see where stuff is breaking down.  Cases like this is where highlight execution can really do a lot for you as well.  Use those debugging tools and watch your dataflow.  You'll start to see your problems.

 

One thing I notice is that your Y outputs of the for loop are not auto indexing so you are only getting the last array that you pass into it. 

 

 

Take those two for loops, change to auto indexing outputs and you'll have two 2D arrays.  Assuming that you are wanting to pair each Y from one loop with the Y from the other loop your design could do something like this:

Capture.PNG

For each pair.  There's some work to do figuring out HOW many pairs you've got, but that's how you'd do it.  

 

Regards,

 

Tim

Message 9 of 18
(3,979 Views)

Hi Tim,

 

Could you tell me what VI you have attached to the 2D array? None of the ones I see in the Array menu match that diagram. What you have looks like it will work beautifully. I cuttently have the Build XY graph express VI hooked up to the outputs of the for loops around the get waveform components VI, but I would like to avoid using it, since it seems to create breaks in my recorded data. I am very close, thank you so much for the help you have provided so far!

0 Kudos
Message 10 of 18
(3,940 Views)