LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Log data from Daqassistant to csv file and show it on graph.

Hello

 

I'm working on a project where I want to log the data from the Daqassistant into a .csv file (I'm using a NI9208 to measure current). I want a time stamp and the measurment to show in two columns. I use a case structure to do some easy calculations. Instead of showing 0,004 mA, I want it to show numbers between 0-100 (it works great, so that's not really a problem). My measurement range is 0-20mA.

 

I tried following this example from youtube: 

https://www.youtube.com/watch?v=GBhJk5Tnshc

 

In the video you can see that he opens the .csv file in excel and he gets two columns. One for the time and one for the voltage. But when I follow this example I get some strange numbers (check out FT_wrong file to see what I get). I don't understand what I'm doing wrong. I have also attached the VI.

 

 

Another question:

Is there a easy way to do so I only log every 2 hour? So that after 2 hour the log resets and start over agian. And how to read from the .csv file and plot into a graph? I also want to open the .csv file when user press a button.

 

I am very new to labview, and I'm trying my best. So please be kind to me 🙂

 

 

Download All
0 Kudos
Message 1 of 4
(3,091 Views)

Hi ojb,

 

what exactly is your goal with this VI?

 

- Your DAQAssistent is set to read 16 channels and puts the samples into a single DDT wire

- Then you compare that DDT wire (with readings from 16 channels!) to 4.2 - what exactly is the result of that operation?

- Then you either scale your data - or output a zero…

- Then you add the scaled readings of 16 channels into a single waveform - how are the samples mixed in the waveform?

- Then you save that waveform…

 

Is there a easy way to do so I only log every 2 hour?

Yes: write to your log file only once in 2 hours…

 

So that after 2 hour the log resets and start over agian.

Do you want to log every 2 hour - or do you want to start a new log file every two hours?

Please explain with more details…

 

And how to read from the .csv file and plot into a graph?

Why do you want to read the csv file to show a plot? You already have the data in the waveform wire - you only need to connect it to a graph…

 

I also want to open the .csv file when user press a button.

Where and how do you want to "open" the csv file?

Best regards,
GerdW


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

Hello

 

- Your DAQAssistent is set to read 16 channels and puts the samples into a single DDT wire

A: I just copied the DAQAssistant from my main program. in my main program I got a split signals for the 16 channels. Tried to run with just one channel, still got some strange results. Not getting 0-100 like it shows on the indicator or the graph that is directly wired to case structure.

 

- Then you compare that DDT wire (with readings from 16 channels!) to 4.2 - what exactly is the result of that operation?

A: I got some transmitters that sends out 4mA when there is no flow. So when there is no flow I want the indicator to show 0. Thats why the case structure is set up like it is. I use 4,2 becouse some of the transmitters sends out a signal that is between 4,0 - 4,2mA at 0 flow.

 

-Yes: write to your log file only once in 2 hours…

A:Not sure how to do that sorry. 

 

Do you want to log every 2 hour - or do you want to start a new log file every two hours?

Please explain with more details…

A: I want the log to read the measurements for 2 hours. When 2 hours are gone it deletes or overwrite the old file with a new blank file with the same name . And than starts over again.

 

-Why do you want to read the csv file to show a plot? You already have the data in the waveform wire - you only need to connect it to a graph…

A:On my main VI (what I uploaded is just a test to see how I can get it to work.) I want the user to see real-time numbers on the indicators for each transmitter. But when the user press the icon for one transmitter, it opens a sub VI containing a graph for the last 2 hours, option to open .csv file in excel with a click on a button for a closer look and to open the data sheet for the transmitter with a button. I just tought it would be easier to save each log to csv file and than open/plot it with graph it when the user opens the sub VI.

 

-Where and how do you want to "open" the csv file?

I want to open it with excel. I want to open it when the user press a bool button on the sub VI.

 

 

 

0 Kudos
Message 3 of 4
(3,058 Views)

Hi ojb,

 

Not getting 0-100 like it shows on the indicator or the graph that is directly wired to case structure.

Then you need to debug your VI!

What is attached to your waveform? What is stored in the waveform?

I asked similar questions in my first post…

 

I want the log to read the measurements for 2 hours. When 2 hours are gone it deletes or overwrite the old file with a new blank file with the same name . And than starts over again.

There is the ElapsedTime expressVI - it will tell you when 2 hours are gone.

With its output you can drive a case structure:

 

IF 2hours elapsed THEN
  delete old log file
  create new log file
ELSE
  keep old log file
ENDIF

 

But when the user press the icon for one transmitter, it opens a sub VI containing a graph for the last 2 hours

It would be much easier to buffer data of last 2 hours in memory instead of saving files and loading them again…

 

I want to open it with excel. I want to open it when the user press a bool button on the sub VI.

It's not a good idea to open a file in Excel while you still try to access it from LabVIEW…

Best regards,
GerdW


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