03-19-2020 07:21 AM
@GerdW wrote:
Hi Hulk,
You are constantly opening the TDMS file, but you are never closing the file!
Open the file once on "start logging" and close it once at "Stop logging", but use the file reference in between!
Yes, this should be spot on.
With the afforementioned 100 samples/sec and 3 hours you get to 1 million refs, which should stop the system.
/Y
03-19-2020 08:21 AM
@Hulk1978 wrote:
Hi guys,
i tested the version with permanent open and close the tdms file. That´s not possible. System performance is going down.
The second solution is not possible because i need to open the file inside of while loop. I´m sending the path from the event struct.
Any other solutions?
I was going to demonstrate passing the path to the appropriate case, but I see you already do that in your code.
I'd like to suggest that you might find some value in using an enum (as you already are) and a variant as the datatype in order to allow passing more arbitrary "data", but that's up to you and may not be necessary.
As to the path and opening/closing, you should do as Artem.SPb shows and only use TDMS Open in the "Start" case, TDMS Close in the "Stop" case, and then write during the write case.
To handle sometimes logging and sometimes not, you can check if the refnum is a valid refnum using Not a Number/Path/Refnum or you can just always try to write, but ignore the error from an invalid reference (be careful if you choose to do this).
03-19-2020 10:00 AM
hm,
it seems that i need a state machine....
I need more time to reconstruct 😞