LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing X Axis of a Waveform Chart to Seconds

Hello NI community,

 

I am relatively new to labVIEW, and I am attempting to make a closed-loop control program to control the velocity of a linear actuator. One issue that I am having is that the X Axis of my waveform charts are not in seconds. I would like to have the charts in terms of elapsed seconds so that I can compare the estimated velocity of the actuator (mm/s) to taking the difference in a potentiometer position reading over the elapsed time (mm/dt) as a sanity check. Right now the X axis seems to relate to time, however it is not the true elapsed time. Any pointers as to how to get the X axis in true relative time?

 

Thanks! (program attached below)

0 Kudos
Message 1 of 7
(2,618 Views)

A waveform *chart* doesn't have a notion of "time history" as it's just a collection of points. Think of it as an array. A waveform *graph* can display X/Y data. I almost always use graphs as I find it easier to manually handle my time data, and the waveform data type is very easy to use. Use "Build waveform" and set the Y array to your accumulated data and the dt to your time period. Note you'll need to manually keep track of your accumulated data instead of feeding it one point at a time.

 

If you don't want to do that, here are a couple more options you could modify to suit your needs:

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YHcoCAG&l=en-US

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YGxCCAW&l=en-US

 

Last, you could always right click and go to "Properties" then "Scales" then "Time (X-Axis)" then modify the Scaling Factor Multiplier to something that makes sense. For example, if your sample rate is 10 Hz, then set your scale factor to 1/10 or 0.1.

0 Kudos
Message 2 of 7
(2,612 Views)

I'm going to go with the obvious first.  Since you said Waveform Chart you should have a known dt.  Did you format the x axis scale as relative time?


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 7
(2,608 Views)

I've tried relative time and floating point, but it still isn't the true time.

0 Kudos
Message 4 of 7
(2,601 Views)

Thanks for your response. I've thought about trying to use a property node and scaling the X axis, but i want a definite conversion, not something that I try and do guess and check on. I may look in to using a graph instead. What block should I use to create the X axis as time? And one thing that is convenient is to monitor the chart in real time, but I think I may try and do both.

0 Kudos
Message 5 of 7
(2,598 Views)

You can monitor a graph in real time, just accumulate the data and plot it to the chart once every so often. Keep the old data in a shift register.

 

And scaling the X axis isn't guess and check. You set the scale factor to 1/dt and it's exactly right (assuming, of course, that your sample rate is known and constant). If it's not constant, you probably shouldn't use a chart anyway, but you can kind of "cheat it" a little with this trick:

 

 

BertMcMahan_1-1611687735688.png

 

0 Kudos
Message 6 of 7
(2,563 Views)

Thanks for the reply, kind of a stupid question here, but how can i check the sampling rate? I saw in one of the links about using a DAQmx "Sample clock" and a property node, but is there a more basic way to check or obtain that info?

0 Kudos
Message 7 of 7
(2,558 Views)