LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

need to log data every second

Solved!
Go to solution

I changed the .vi to make it as simple as possible.

 

Now the data is double logging at some points...

 

I am just to the point where I'm getting frustrated working with this. Help would be appreciated

 

-T

Download All
0 Kudos
Message 11 of 14
(1,271 Views)
Solution
Accepted by topic author tanyasue327

Hello Tanyasue327,

 

After reading over this post, it looks like you are trying to read your thermocouple every second and log all this data to file. In order to get a better understanding of your system, are you connecting to a network module like the cFP 1808 or a real-time controller like cFP-2110? If it is a real-time controller are you deploying this code to it?

 

As for the code you have here, the reason why this is running slower is that you are saving data in the same loop that acquiring you data and that you are using all express VIs. Everytime the Write to Measurement File is executed it opens a file, save the data to the file, and close the file. Doing this causes the program to become increasing slow and could cause memory leaks. Finally the express VI add a lot of overhead because it tries to automate everything for you. Since you are worried about execution speed, I wouldn't use these at all.

 

In order to avoid using these, I would suggest using the FP-Read. In order to get the right FP-Read, I would suggest to create a project and add the fieldpoint to the project. I have added two help files that explain what the project is and how to add it to the project. From here you can drag and drop FP-Read/ FP-Writes for all your modules in your  Compact Fieldpoint. This read will provide a single read with the timestamp where you can build an array of data to save to a file

 

I would then a Write to Speedsheet File VI (not the express VI) to save the information to a file after the test has been completed. This will take the array of all the data points you have collected and place them into a file. Since it does this after the data has been required, it won't affect the execution of read from your thermocouples.

 

Finally I would use the wait function instead of the Time delay VI. This will provide the same functionality without all the overhead. I have posted what this VI will look like below for you to implement.

 

 

17617iD44489026C47CCA3

 

I hope this information helps you with this and if you need any more assistance feel free to post.

 


Jim St
National Instruments
RF Product Support Engineer
0 Kudos
Message 12 of 14
(1,249 Views)

Hi Jim

 

I implemented this code to see if it works and you are correct it does run much more quickly now. I suppose I'm just used to these express .vi's and before left work I actually tried to run something similar to what you used. The problem I have been having with the write to spreadsheet file is... it's only logging one data point and no time, when I open it up with excel or the text file. When I put this inside the loop with the file path it doesn't ask me to save everytime, but just overwrites the data. This is why I was using the WTMF express .vi because I can add options as to how I want to save. Putting the write to spreadsheet outside of the loop allows my loop to run continuosly until I say stop, but again it's only logging one point in the file I wish to save it in.

 

Eventually with this .vi I'm going to be measuring over 150 channels and need to log every channel's data every second. What would be your suggestion on doing this?

 

Again thank you so much for the informed reply. I am new to the program in some ways and just need a little guidance.

 

Regards

Tanya

0 Kudos
Message 13 of 14
(1,232 Views)

I realized I didn't change my FP channels to Float IO's or index by the loop. Thank you so much for your help Jim! Now I just need to get the timestamp thing under control 😃

 

-T

0 Kudos
Message 14 of 14
(1,215 Views)