LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

graph/chart x-scale time

Hello,

 

i am trying to aquire signal from DAQ 6009.

I have signal on my graph/chart but i cannot set x scale to show time.

I need to have on X-scale from 0 to some defined number of seconds.

I tryed something with property node, but i am unable to set this properly.

Can someone help?

 

VI is in attachemnt.

 

Thank you.

Milan

0 Kudos
Message 1 of 8
(2,509 Views)

This is probably an interaction between the properties of the data you are plotting and the properties of the Chart or Graph you are using to plot it.  

 

You are plotting a Waveform produced by DAQmx.  Congratulations in avoiding the Dreaded DAQ Assistant and using the Waveform representation of your data.  This contains two "time" pieces of information -- the starting date and time that you acquired the data (t0) and the time interval (dt) between the points -- both can be used to set the properties of the X (Time) Axis.

 

Notice that the Chart shows the X Axis formatted as Date and Time, suggesting it is using the t0 information.  You probably do not want this -- you probably want Time to start at 0 and end some seconds later.  So let's change the Time Property of the Chart.

 

Right-click the Chart and select "Properties" from the Drop-down.  I recommend you spend some time exploring the Chart's Property Sheet, including the Help button.  But start with Display Format.  Make sure that "Time (X Axis)" is showing on the List-Box at the top left.  Notice that Absolute time (meaning "at what date/time did you acquire the data") is selected -- change it to Relative Time.

Display format, X AxisDisplay format, X Axis

Now examine Scales.  Again, be sure you select "Time (X Axis)".  You should probably start with "AutoScale" and set the Offset and Multiplier to their default values, 0 and 1.  See if this helps.

 

Bob Schor

 

 

0 Kudos
Message 2 of 8
(2,484 Views)

Hello Bob,

 

Thank you for reply.

I manage something, please check attachment.

I assume that x-scale is now 5 second long (because i multiple sampling rate in one second and number of devides (five of them) on chart ). Is this correct??

 

A you can see, my VI run one stepper motor and aquire magnetic inducion from sensot.

 

But also I have a problem.

If I set sampling rate 2000 or higher, i get error:

The application is not able to keep up with the hardware acquisition.

error.JPG

 

My VI wait to complete running and then plot hole signal. I assume that buffer is fulling, and then plot all samples at the end.

How i can get higher sampling rate?

How to get continues ploting? 

 

Thank you very much.

Milan

0 Kudos
Message 3 of 8
(2,479 Views)

and VI front panel

0 Kudos
Message 4 of 8
(2,477 Views)

First, some advice:  write your code in smaller "pieces".  First write the Data Acquisition part.  Get it working.  Be sure you can control the While Loop (you currently cannot -- it will run exactly once, or "forever").  Once you have it working, write (and test separately) the Stepper Motor part.  Once both work independently, think about combining them.

 

Now to your problem with the Data Acquisition loop.  Remember the Principle of Data Flow

  • Functions don't run until all of their inputs have data, and don't produce output until they finish;
  • Loops don't repeat until everything inside them has executed.

Your DAQmx Read will "wait" until it has read all of your samples.  If you sample at a higher rate, it will wait a shorter time.  Then any data it produces gets processed, and when it is all processed, the Loop can repeat.  Your DAQ Read is configured for Continuous Samples (good!), so as soon as it outputs the current Waveform, it starts to acquire the next one.  If the Loop is still busy processing the previous data, the DAQ Read's buffer will fill up and you will get an error.

 

So the solution is to speed up the processing of the data.  One way is to not use Express VIs, many of which use Dynamic Data Wires (which I dislike and refuse to use, myself).  I would recommend using a simpler Filter from the Waveform Palette that produces a Waveform output.  You might also consider plotting less, or creating a plot showing both Voltage and Induction on the same plot.

 

You might also look up the Producer/Consumer Design Pattern, but I don't think you should really need it.

 

Bob Schor

0 Kudos
Message 5 of 8
(2,473 Views)

Hello Bob,

 

thank you for your help and sugestions.

I tried to change filter (butterworth filter), but even without any filter, i cannot do sampling at higher rate.

Also i remove voltage graph, but still sampling over 2000 is too much.

 

I tryed producer-consumer design, but problem is the same...Please check attachemnt.

How i can change producer-consumer design to get higher sampling rate?

 

Thank you.

 

Best regards

 

0 Kudos
Message 6 of 8
(2,459 Views)

I'm not sure what aspect of your code is causing you trouble, but there are a number of things that need to be fixed.  I'm also taking the liberty of separating the Analog Input from the Digital Output.  I'm attaching my revision of your AI code, and would like you to run it and see if it appears to perform correctly.

 

There were a number of (what I thought were) mistakes in your code, some involving DAQmx, some involving Producer/Consumer, some involving how to stop multiple asynchronous loops (yesterday I gave a talk at NIWeek, the LabVIEW Conference in Austin, Texas, dealing with using Channel Wires to help manage dozens of such asynchronous loops).  Because I'm at this Conference, I don't have time right now to write a long explanation, but I'll try to do this in the next day or two.  Meanwhile, feel free to study the code, run it, and see if it works better.

 

Bob Schor

 

0 Kudos
Message 7 of 8
(2,450 Views)

Hi Bob,

 

i accidentally pressed t, accept as solution 🙂

 

I tried to run VI, and study a litle bit.

There is some error, input parametars are invalid. Where is the problem?

How i see, format of elements in enqueue elements block is ok.

Error 3.JPGerror4.JPG

Thank you a lot for your support

0 Kudos
Message 8 of 8
(2,432 Views)