LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plot Analog Output Signal in Real Time

Hello,

 

First of all, I am using the following equipment/software:

 

1.  LabVIEW 8.0

2.  Traditional DAQ

3.  PCI 6110 DAQ Card

 

I am trying to create a program that will simultaneously input a signal into a piezoelectric actuator and read signals from both the internal sensor of the piezoelectric actuator and a load cell.  The signal that will be inputted into the actuator is a ramp up pattern followed by a constant followed by a ramp down pattern.  I've attached the program as actuator_and_loadcell_2.vi. 

 

NOTE:  I did not write the program that generates the ramp signal (attached as ramp_subvi_5.vi); I used the one I found in this thread:  http://forums.ni.com/ni/board/message?board.id=170&message.id=137810&query.id=843435#M137810.

 

The problem is that I cannot get the Actuator Output signal to plot in real time.  When I run the program, the Actuator Output signal plots instantaneously.  Is there a way to get the Actuator Output signal to plot in real time so that I can calculate the difference between the input and output signals in real time?

 

Thank you,

Joel 

 

 

Download All
0 Kudos
Message 1 of 5
(5,010 Views)

What you will need to do is put the waveform chart in a loop and feed it one value at a time with a loop rate equivalent to your sample rate.

 

See attached.

 

There are some places where the code can be simplified.

Message 2 of 5
(5,002 Views)

Hi Ravens Fan,

 

Thanks for the help.  I implemented all the changes you described in your attachment but I'm still having some trouble.  The Actuator Output chart displays data at about half the rate that the Sensor chart displays data.  I tried decreasing the value of the constant connected to the multiply block in the For Loop but that doesn't seem to be fixing the problem.  When I decrease it to values between 501 and 999, nothing changes; when I decrease it to values less than 501, the chart stops plotting data altogether.    

 

I am also having trouble trying to plot the difference between the Actuator Output data and Sensor data in real time.  I tried plotting it in a separate For Loop (as shown in the attachment) but that only shows the difference after I stop the program.  What can I do to show the Actuator Output, Sensor, and Error all in real time?

 

Thanks,

Joel 

0 Kudos
Message 3 of 5
(4,979 Views)

I don't have the traditional DAQ installed, so all those VI's show up as ? marks to me.

 

Both seem to be set for the same rate of 1000 Hz.  However in your lower loop, you are trying to read all (-1) samples.  Since there is no other timing mechanism in that loop, I wonder if it is actually running faster then 1000 Hz and sometimes you are getting 0 data, between samples coming in.  Perhaps you should set it to read 1 sample at a time.

 

To have all 3 show at the same time, you will need to combine all the loops into one loop.  The other possibility is to pass the data from the analog input into a queue.   Feed that into a loop that indexes the analog output waveform, does the math, and displays all 3 on their respective charts.

 

Since you are running at a 1000 Hz.  You really can't update charts quick enough for a human to see each individual update.  I would recommend reading 100 samples at a time, doing the math on those 100 samples and updating the charts.  The charts would then update 10 times a second which would look like a near continuous update.  The program should run fast enough to keep up with the incoming data.

Message 4 of 5
(4,969 Views)

Hi Ravens Fan,

 

I tried setting it to read 1 sample at a time but it doesn't seem to make a difference.  I'll try combining all the loops into one loop and see how that works. 

 

Thanks for all the help,

Joel

0 Kudos
Message 5 of 5
(4,940 Views)