LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to plot real-time cylinder pressure

Hi everyone,

I'm a fresh user of LabView, and i'm having some trouble in my laboratory experience.

I have a pressure signal, acquired with a NI acquisition device 6110 type, and an encoder signal acquired with a 6533 type. The frequency at which the analog signal is acquired is higher than the digital one.

My goal is to plot pressure value real-time, showing it's trend cycle by cycle (which means, each 720 degrees), with an "oscilloscope"-kind graph. The issue is that velocity is not constant during the cycle, and the pressure values have to be synchronized with the encoder. In other words, in the graph the pressure must be in function of the degree, which means that every time the encoder signal varies (from 0 to 1, or vice versa), the corresponding pressure value must be read and plotted. 
In my first attempt i modified a previous program which reads the digital signal as analogic, with the same frequence of the pressure signal, which guarantees the synchronism between them, but i'm having trouble with the read functions (error 200279), i think because they're too slow compared to the acquisition (?). Anyway using a chart to plot the pressure array something good seemed to come out, even if the image was not fixed and some flashing behaviours showed (I set the number of data plotted in the chart to 3600, which must be the number of extracted p values in a cycle, considering that the angular distance of the encoder is 0.2). I attach my program below. Another idea is to directly use the digital signal to command the reading of pressure signal, but i have no idea of how to do this.
Please note that I'm using LabView 2010.

Thank you.

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

Hi,

as far as I understand, you want to acquire the pressure value each time you receive a rising (or falling) digital edge from the encoder... correct? ...And you want to refresh the complete plot graph as soon as the counting edges rise 720... correct as well?

Anyway, I had a look on your code, but I don't think it's the correct way to carry out a well-done data acquisition.

First of all, I suggest you to have a look on the NI examples available in the

 

Help -> Find Examples... -> Hardware Input and Output -> DAQmx

 

to achieve your skills in the field of data acquisition with NI product... and maybe you will find a good solution for your application. Then please, answer my two questions... we can help you!

 

bye, bye!

 

Stefano Fois

National Instruments - Application Engineer

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

Thank you for your advice! I'm looking at the examples, and I see the difference between them and my code.
What you're saying is quite correct! The graph must be refreshed once the shaft completes 2 rotations (720 degrees;1 cycle). Anyway the number of digital edges corresponding to one rotation depends on the encoder resolution. Now the angular distance of the encoder is set at 0.2 degrees, so the number of edges in two rotation is 720/0.2 = 3600. 
I hope now it's clearer.

0 Kudos
Message 3 of 8
(3,413 Views)

Hi sectumsempra,

 

use the encoder signal as external clock source for your AI task.

This way the AI samples are accurately measured with each pulse of your encoder pulse train…

 

Then just read the needed number of samples (like 3600 in your last post) and display the result in a graph!

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(3,411 Views)

Hi GerdW,

I'm trying to follow your solution, and the DAQmx Timing function with Change Detection seems a great option to use the digital signal as the external clock source, but my device doesn't support Change Detection. 

Is there another way to achieve the same result? 
Thank you.

0 Kudos
Message 5 of 8
(3,397 Views)

Hi,

 

you don't need this "change detection" feature. All you need is the external sample clock using a usual PFI pin…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 8
(3,379 Views)

Thank you!

I know this seems easy to you, but it's my first experience with data acquisition.. Is there any guide or tutorial that explains how to do this? With my extreme lack of experience and knowledge, i simply linked a PFI of the digital acquisitiom schede to the sample clock.. but it's not working. Error 89139 occurs at the reading function. 

0 Kudos
Message 7 of 8
(3,368 Views)

Hi sectumsempra,

 

did you read the error explanation of this error number?

Did you try to solve the error according to its description?

 

Did you try to create a DAQmx task in MAX with all the settings you need? Did you look at the wiring schematics shown in MAX?


Is there any guide or tutorial that explains how to do this?

Well, there's the LabVIEW help. And there are example VIs with lots of explanations in their block diagrams.

And there are app notes at NI.com!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 8
(3,360 Views)