LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sync real time sensor data from multiple sensors

Solved!
Go to solution

Hello NI community, 

I am working on a vi that acquires sensor data and plots them in real time. My setup consists of a pump that is responsible for circulating a coolant in a loop, and 4 sensors - a type K thermostat, a flowmeter and 2 pressure transducers (one on each side of the pump). 

I have been able to successfully read data from all sensors. However, I had to add a filter to reduce noise from the pressure sensor data. I used a lowpass Butterworth filter with sampling frequency fs = 3.0, and while it has made the curves smoother, it has caused a time delay.

Here is a snippet demonstrating the problem:

 

The first figure shows the pressure reading before adding the filter, and the second shows after.

 

pressure noisy.PNG

pressure smooth but delayed.PNG

 

I want to avoid doing this since I am looking to get all the sensor data in real time, and plotted on the same time axis. As you will see in the figure below, there is a lag in the pressure readings.

data acquistion charts.PNG

 

I should also mention that I used DAQ assistant for flowmeter readings, whereas I used DAQmx vi's for the thermostat and pressure sensor readings. While I have made the plots look like similar, the one for the flowrate is actually a waveform while the other 2 are xy graphs. I was wondering if there is a way I could make an xy graph for flowrate too, with time in seconds plotted on the x-axis. Again, I would like for all 3 plots to be on the same time series.

Also, as you will see, the plot for flowrate is noisy too. I tried to make it smoother by adding a lowpass filter to it as well, but it does not seem to work.

I am attaching the vi with this post. If you could please look into it and suggest any ideas to fix these issues, it would be of great help. To summarize, the 3 issues are:

1) fix the phase difference in pressure readings

2) plot flowrate on an xy graph that shares the x (time) axis with the other 2 plots

3) reduce noise from flowrate


Thank you in advance for any input you may have for me.


0 Kudos
Message 1 of 3
(1,759 Views)
Solution
Accepted by topic author viamotors

Hi viamotors,

 


@viamotors wrote:

I should also mention that I used DAQ assistant for flowmeter readings, whereas I used DAQmx vi's for the thermostat and pressure sensor readings. While I have made the plots look like similar, the one for the flowrate is actually a waveform while the other 2 are xy graphs. I was wondering if there is a way I could make an xy graph for flowrate too, with time in seconds plotted on the x-axis. Again, I would like for all 3 plots to be on the same time series.

I am attaching the vi with this post. If you could please look into it and suggest any ideas to fix these issues, it would be of great help. To summarize, the 3 issues are:

1) fix the phase difference in pressure readings

2) plot flowrate on an xy graph that shares the x (time) axis with the other 2 plots

3) reduce noise from flowrate


 

  1. A low-pass filter like yours will always add a lag (or: phase shift). A simple solution would be to use no filter - or the same filter for all signals…
  2. Why do you still use the DAQAssistent for that 3rd measurement? Convert it to DAQmx functions, too! (Simple fix: convert the DDT-output of that ExpressVI to a "useful" datatype using FromDDT…) Now you can use the same XYGraph approach:
  3. Is there "noise" - or does the flowrate really fluctuate over time!?

There are some more issues in your VI:

  • NEVER delete the label of frontpanel elements! You can hide the label in the frontpanel, but should haveit visible in the block diagram…
  • When you create a reference (like those DAQmx tasks) then you should close them, too! Did you learn from the example VIs coming with LabVIEW+DAQmx?
  • Building potentially large arrays could slow down your loop. They may get lost (due to program errors) before you have a chance to save them to a file…

 

Best regards,
GerdW


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

Thank you so much! That was very helpful. 

0 Kudos
Message 3 of 3
(1,645 Views)