Raymond Posted June 28, 2011 Report Share Posted June 28, 2011 I have two loops. One for data taking and logging, one for loading a parameter file. I notice that when I click the "browse" button on the "load file" field, the data taking and logging loop freezes. Attached is an example which demonstrates the problem. Thank you in advance! Raymond suspend.vi Quote Link to comment
Mark Smith Posted June 28, 2011 Report Share Posted June 28, 2011 I have two loops. One for data taking and logging, one for loading a parameter file. I notice that when I click the "browse" button on the "load file" field, the data taking and logging loop freezes. Attached is an example which demonstrates the problem. Thank you in advance! Raymond So I found a couple of interesting things. First, I downloaded your VI and opened it up with LV2010 and could not reproduce the problem. Then I noticed your signature says LV8.5 - I don't have 8.5 loaded, so I opened it up in 8.6 and then the problem was just as you described. So, one fix would be to update to LV2010 But the crux of the problem seems to be the fact that the Write To Spreadsheet File VI opens and closes the target file on every write. When the File Dialog is open, the Open/Create/Replace file function seems to be blocking and can't open the data file on the read loop until the dialog closes. Take a look at the attached VI where I open the file outside the data loop and then append to it on every iteration and close the file when the loop exits. This is better practice. Best practice would be to separate the data read loop and the data write loop (see the producer/consumer template that ships w/LV). This creates a buffer so that the data taken gets stacked in a queue until the loop that writes to file can service it. Mark suspend-3.vi Quote Link to comment
Raymond Posted June 29, 2011 Author Report Share Posted June 29, 2011 So I found a couple of interesting things. First, I downloaded your VI and opened it up with LV2010 and could not reproduce the problem. Then I noticed your signature says LV8.5 - I don't have 8.5 loaded, so I opened it up in 8.6 and then the problem was just as you described. So, one fix would be to update to LV2010 But the crux of the problem seems to be the fact that the Write To Spreadsheet File VI opens and closes the target file on every write. When the File Dialog is open, the Open/Create/Replace file function seems to be blocking and can't open the data file on the read loop until the dialog closes. Take a look at the attached VI where I open the file outside the data loop and then append to it on every iteration and close the file when the loop exits. This is better practice. Best practice would be to separate the data read loop and the data write loop (see the producer/consumer template that ships w/LV). This creates a buffer so that the data taken gets stacked in a queue until the loop that writes to file can service it. Mark Thanks Mark, it works. I'll definitely try to apply this to my project. Another slight complication is that I need to create a new file for data logging at midnight every day. I suppose if I do not open the file dialog at midnight, I'll be fine? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.