Delay beween exports


Recommended Posts


I have some code that while true will perform the following action, every cycle the parameters for the "ActivationLogging" export condition change so a new line of data is logged.

//Log data

Export.ActivationLogging.strFileName = LoggingPath + formatdatetime("ActivationLog %Y.txt",SysTime())


The problem is that not every line of data is logged and it appears to be random which ones are missed. Should I have a delay between cycles and if so what would be the minimum delay time?


Link to comment
Share on other sites

  • 2 weeks later...


I'm not sure if you got the file in the end. Perhaps you can answer the question in principal?

If I had an infinite loop running at maximum speed, should I have a delay between calling a beginexport function with say 8 datapoints. If so what would be the minimum delay time.


Link to comment
Share on other sites

Sorry for the delay. Had a little trouble receiving the file. I think the biggest problem with spam nowadays isn't the spam, but the over-compensating IT people that make doing normal things like sending large attachments difficult. The worse is that you often don't know there is a problem until its been a week and you haven't gotten a response. That's why we ask anyone contacting us to follow up if they don't get a reply within a few days.

Anyhow, your last post explains better what you want:

No, you can't run an infinite loop at max speed with an export set. The export set runs in a separate thread and you can't predict when that thread will actually start. Doing beginexport() simply marks the export set to start. It may start immediately before the command after beginexport(), or your calling script may run for another 20 milliseconds or more before it kicks in. Its all up to windows (and the priority level of your sequence.

If you want to write data to disk more predictably at high speed you should use the File. functions to do it right from your sequence script. This keeps everything in the same thread and thus allows you to determine when things occur relative to one another. You can then run as fast as DAQFactory and your PC will allow. This actually applies to just about anything in DAQFactory. Many things run in different threads, such as channel Timing loops, logging sets, export sets, PID loops, and sequences. If you need control over order you need to do it all from script. That is one of the reasons we offer the low level control from script. You can do everything a logging or export set does from script and have more control.

To do this, use the file.writedelim() function along with the and file.close() function. I just responded to this post: with some info on it, or check out the help and post if you have questions.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.