LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TDMS file reference invalid error 2501

I know this has been covered before, but none of other solution seem to fit my problem.

 

Here's an example of what I'm trying to do. Please ignore the missing error pathways, and note that the Read nodes data in my actual code goes out to a CSV which works.

 

 

I'm constantly getting an Invalid TDMS Reference error on the TDMS Write node. I've probed the path, and the number stays the same along the path, and I'm not closing it until the while loops are stopped. Can I not branch the TDMS Open path? Am I doing an illegal process here that is messing up the reference?

 

example.PNG

0 Kudos
Message 1 of 9
(3,975 Views)

You don't post the actual code and based on the picture, you have two errors (no stop condition).  So the code is obviously not executable.  How certain are you that both loops have stopped before you close the TDMS reference? 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 9
(3,953 Views)

<delete please>

0 Kudos
Message 3 of 9
(3,897 Views)

aputman,

I would have posted the code, but 1) proprietary 2) the portion I've shown is the essential piece. Yes, I understand there is no stop condition, hence why it's an example and not working code. As to how sure am I the loops haven't stopped, I'm absolutely positive since the stop condition stops the entire VI and that doesn't happen without the user clicking a button. 

 

My question is more about the routing of the TDMS, what I can and cannot do with it, and if I'm doing the TDMS portion properly or if the error is caused upstream somewhere. As shown, I need to be able to write to it when the boolean is True, and then once the boolean goes from True to False (via the user input), the TDMS file needs to be read and the outputted to a CSV.

0 Kudos
Message 4 of 9
(3,890 Views)

I know you say to ignore the missing error lines and ignore the missing stop conditions but in the whole scheme of things, what you think is working code may in fact be the cause of your problem.  

 

What is in the other case structure frames?

Why do you need two loops if you are writing to the TDMS while the boolean is true and reading from TDMS while boolean is false?  Am I missing something here?  Can you not combine the case structures so there is no way to read and write from the TDMS as the same time?

If this is example code, can you post it rather than your proprietary code?

 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 5 of 9
(3,879 Views)

why do you need two loops?  a single loop would handle your situation, or put your tdms access in a subVI / functional global that can be called in multiple places.

 

if you need branch your tdms reference, use the advanced vis instead, they have better handling of parallel tdms file access (read n write).

 

-Joe

0 Kudos
Message 6 of 9
(3,868 Views)

I agree that parallel access should be eliminated with a VIG or some other mechanism.  But that being said TDMS is quite robust, and I've seen tests where many parallel loops read and write to the same reference all the time and didn't see an issue.  I'd refactor it and see if the issue goes away but with (the little) I can see I wouldn't expect an issue.

0 Kudos
Message 7 of 9
(3,859 Views)

what about the size of the array that to be written?  TDMS write will generate error when the array is empty.

 

-Joe

0 Kudos
Message 8 of 9
(3,841 Views)

I know this is example code, but it also doesn't look like the shift register for Record Data in the top loop is being initialized, so there might be some unexpected behavior there. If that runs through to the false case in the top loop, you might be closing the reference early in your real code, but it's hard to tell without the stop conditions. 

 

I'll echo that screenshots of the other cases would definitely be helpful here, and that combining this process into one loop could help clarify what's happening.

Claire M.
Technical Support
National Instruments
Certified LabVIEW Developer
0 Kudos
Message 9 of 9
(3,822 Views)