aceav8or Posted June 12, 2012 Share Posted June 12, 2012 Hey Guru, I'm trying to get a couple of displays to link up to the same period in time. The problem, or should I say annoyance, is that the channels I'm trying to do this with all have different timings. So if I want a display of what the reading was one minute ago and I have a 1 second reading I do channel[60], for .1 sec channel2[600] et cetera right, but is there a way to do this en masse without worrying about the channel timing? Preferably based upon system time. Link to comment Share on other sites More sharing options...
AzeoTech Posted June 13, 2012 Share Posted June 13, 2012 Depends. If you want to align two arrays, use the align() function. If you only want a single point within a time range, just subset on time, something like: (myChannel[systime()-60, systime()-59])[0] Link to comment Share on other sites More sharing options...
aceav8or Posted June 22, 2012 Author Share Posted June 22, 2012 Got it working! Thanks! Link to comment Share on other sites More sharing options...
aceav8or Posted June 27, 2012 Author Share Posted June 27, 2012 The subset worked great on streaming data, now I'm trying to do the same thing with a channel that's updated on an event. I've got a channel that increments a count and insert's time when this occurs making it easy to read the data in the channel table to see when it last occurred, but I'm building a display that links everything up and it's become problematic as the displays only show the value at the ime it was logged, instead of the last value at that time. That is to say that if I had an event occur 30 seconds ago that changed the channel value from 1 to 2, and I have a display of that channel with a 30 second subset the display only functions for 1 second before returning to an "X". How can I make a variable value display what the channel value was 30 seconds ago no matter when the channel value changed?? Link to comment Share on other sites More sharing options...
AzeoTech Posted June 27, 2012 Share Posted June 27, 2012 I'm not sure how you are subsetting, but basically you want to do this: (myChannel[systime()-30, systime() - 10000000])[0] the 10,000,000 is just an arbitrarily big number. The first subset returns all the data between 30 seconds ago and 10 million seconds ago. Then we do [0] on it to get the most recent value from that array. Link to comment Share on other sites More sharing options...
aceav8or Posted June 27, 2012 Author Share Posted June 27, 2012 Sweet, thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.