Logging from time zero or logging dT or change in time


jaresing

Recommended Posts

I want to log time starting from time zero at the beginning of a run. Right now I get some clunky system time that is tough to handle with my processing software.

On a separate matter, how do I save my file with an extension automatically added to the end of a file

Her is my code for logging to a file:

if (component.startstop.strCaption == "Start")
   Private string strName = File.FileSaveDialog(Logging.COLLECT.FileName)
   if (!IsEmpty(strName))
	  Logging.collect.FileName = strName
	  component.filename.strCaption = strname
   endif
endif

Link to comment
Share on other sites

To log from a zero time, create a test channel to hold the delta T value so you can log it. Make it an A/D channel with Timing = zero. Call it say "deltaTime". Create a global variable to store the start time of your run, let's say "startTime". Set it equal to systime() at the start of your run. In the event of one of the channels you are logging put:

deltaTime.addValue(insertTime(systime() - startTime, systime(), -1))

Then log deltaTime with your data set.

As for your second question, just put + ".csv" or whatever you want after strName in the two assignment lines inside the internal if().

Link to comment
Share on other sites

  • 6 months later...

Thanks so much. Finally back in the lab.

Ok two questions.

My logged time has at least 5 sig figs beyond the decimal. How do I reduce that to one or two?

After I added the + ".txt" to my sequence, then the next time I wanted to save to the same file it now became filename.txt.txt and then file name.txt.txt.txt.

How can I just get it to save as a file type?

Link to comment
Share on other sites

By logged time, do you mean the absolute time, or your deltaTime channel? Absolute time sig figs is setting on the Details page of the logging set. deltaTime's sig figs (and for that matter any other logged channel) is set in the logging set itself on the Main page in the table. It defaults to 6 sig figs.

As for the ".txt", your script must have changed. Please post your current script so I can tell what you are doing.

Link to comment
Share on other sites

Archived

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