Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

how to write measurement data from cRIO to drive on host-PC

Hi,

 

I want to log the data that I get from my cRIO on my computer.

 

I set up a simple system using a cRIO-9073 that has a modul with a AI.

 

I managed to show the signal on a scope. So I used the the write measurement date to file - box (functions --> programming --> file I/O -->  writing measurement data to file) and connected it to the same signal that feeds the scope.

 

The problem I have now is that the file has not been created after I run and stop the application.

 

Does anyone know what I do wrong?

 

 

0 Kudos
Message 1 of 12
(5,813 Views)
Is it possible for you to post your code?
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 2 of 12
(5,811 Views)
Here is my code.
Download All
0 Kudos
Message 3 of 12
(5,808 Views)

Is a file not created when you implement this? What exactly goes on? Try to test this in a blank VI with a random number generator as input to the Write to Measurement File.

 

Also, this is not the right way to implement your code. You need to use the producer/consumer architecture. You can find a template by navigating to File -> New.. in the LabVIEW environment and looking in Design Patterns. Also, you should always collect data and then write them together in a file at regular intervals. Accessing the hard disk at every iteration is not the best implementation. 

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 4 of 12
(5,805 Views)

There is no file created when i implement this.

 

With the test in a blank VI it works and data is written to the file.

 

Is the producer/consumer architecture really needed? I don't exactly understand what it does.

 

 

0 Kudos
Message 5 of 12
(5,802 Views)

Just a thought, what's the path you provide for the file?

 

You should use the producer/consumer architecture since writing to the file at every iteration will take up more cycles and slow the loop down. Have a look at the following:

Application Design Patterns: Producer/Consumer

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
Message 6 of 12
(5,788 Views)

The path is the normal windows user directory (i.e. "C:\Users\Username\Documents\LabVIEW Data")

 

The producer/consumer loop seems to be a good thing to do once I got the basic functions running.

 

Isn't there a simple example somewhere that explains how to log the data that is measured? One would expect that this kind of task is performed every day witht he cRIO.

I found the "cRIO Embedded Data Logger" example which seems to save the data on the cRIO modul itself. This could be helpful if on saves small portions of data there and then transfers it to the host but I can't get it running to save data neither on the host nor on the target.

 

0 Kudos
Message 7 of 12
(5,785 Views)

Correction: I set the path to "C:\Users\Username\Documents\LabVIEW Data" but it seems that the files are stored on the cRIO itself. I looked for them with a ftp-programm and the files exist on the cRIO in a LabVIEW Data subfolder.

It seems that I understood the whole concept wrong. I thought the host code is executed on the host and so the file dialog is pointing to the host (just like the scope is shown on the host) but it seems that LabVIEW puts the data to the targer (i.e. the cRIO) ... although this still does not allow me to write directly on the host computer 😞 

Message 8 of 12
(5,782 Views)
Exactly. Shouldn't the path reflect the directory structure of the cRIO? You might want to change that and you should see your file.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
Message 9 of 12
(5,781 Views)
Oh well it WAS supposed to be written to the cRIO. You will need to use FTP programs to transfer the files over to the host.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 10 of 12
(5,779 Views)