Calculated Value Channel (Test Device) - Time Goes Backwards?


Recommended Posts

Hi,

 

i have a "test" device of type "D to A" - into which i put values using variable.AddValue(x).

 

I do that in a loop in a sequence.

 

However, the historical plot of this variable appears totally screwed - upon closer inspection, it appears to me that the autogenerated time is wrong, and sometimes even goes backwards. Sometimes as far as 20 minutes . . . .

 

 

 

What do I do wrong?

 

it nearly appears as if the binary format of the time was different than expected (bits flipped in the memory), or that the time resolution in the auto-generated time in x.AddValue(y) is too low . . .?

 

post-9424-0-16807300-1400077569_thumb.pn

Link to comment
Share on other sites

DAQFactory only autogenerates the time in addValue() if the value inside the () doesn't have time already.  So:

 

mychan.addValue(3)

 

will autogenerate time, but:

 

mychan.addValue(myOtherChan[0])

 

will not.  It will instead use the time of myOtherChan[0].

 

I'm guessing that you are doing some calculations using values with time associated and that's getting carried through.  Use insertTime() to fix this:

 

myChan.addValue(insertTime(myOtherChan[0], systime(), 0))

Link to comment
Share on other sites

Yes, that helped.

 

I was taking a dynamic maximum value over last 10 minutes of the other channel. I have read the documentation but what thrown me off is that in my calculation process, i was using private variables, not channels. Apparently channel time is preserved when copying to private value.

Link to comment
Share on other sites

Archived

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