Plotting data against "run time", not systime()


Recommended Posts

So I have a V-channel in my DAQFactory Lite that begins a "run_time counter" when the user presses a screen button, which also begins the data logging command.

Expression for V-Channel: FormatDateTime("%H:%M:%S", SysTime() - start_log_timer)

FYI, start_log_timer is set when the button is depressed, using code:

if (logging.SE_Mk4_continuous.running)




logging.SE_Mk4_continuous.strFileName = "c:\DAQFactory...." + formatdatetime("%y%m%d_%H%M%S",systime()) + ".csv"

logging.SE_Mk4_intermittant.strFileName = "c:\DAQFactory...." + formatdatetime("%y%m%d_%H%M%S",systime()) + ".csv"

start_log_timer = systime()




I want to be able to:

(1) display all my data in graphs against this "run_time", not the systime().

I have tried this (putting "V.run_time" in the X Expression), and although the graph does change it's x-axis, none of the data shows up.

I assume it's something to do with the "date" associated with the "run_time" being screwed... when I look at the lower-left corner of the graph, it states the date as "31 Wed Dec 69", so its possibly something to do with my V-Channel expression.

(2) I would love to be able to log data with the first column being the "run_time" and not the standard systime().

Thanks in advance,


Link to comment
Share on other sites

1) that is part of it. There are two problems:

a) you are using formatdatetime() so the data being stored in V.run_time is a string not a number and strings can't be plotted. You probably should create another V channel to hold the run time. Its just systime() - start_log_timer

<_< you don't have a history if you just do systime() - start_log_timer because both of these are scalers. Instead, you need to add:

V.run_time = inserttime(systime() - start_log_timer, myChan.time[0], 0)

in the event for myChan, where myChan is whatever your real input channel is. This will create a history in V.run_time

2) the only way to get rid of the "thetime" column in a logging/export set is to not use a logging/export set and log manually using the File. functions. I strongly recommend against not logging using a number for time in at least one column. String times are harder to parse and are not universal. For example in the US, dates are month/day/year while in many other places it is day/month/year.

Link to comment
Share on other sites


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