ledbelly2142 Posted October 24, 2012 Share Posted October 24, 2012 I am monitoring equipment through relays with an on=1 or off=0 value, I would like to use the channel array to determine how long (in seconds) the equipment (or relay) has been on. I am not sure where to start. Maybe a combination of GetTime and SeqAdd? There is an example of counting the uptime of a digital channel using Var. on page 95. Thanks Link to comment Share on other sites More sharing options...
AzeoTech Posted October 25, 2012 Share Posted October 25, 2012 The best way to do this is with a test channel and addvalue. Create a test channel to hold the on time (remember to set the Timing to 0!). Then, in the relay channel's event, put: testChannel.addValue(relayChannel[0] * (relayChannel.time[0] - relayChannel.time[1]) + testChannel[0]) You might have to add insertTime() in there too. Note that this will create a new line even if the relay is off, the total just won't change. Also note that you'll need to initialize testChannel to 0 whenever you clear its history (and at the very beginning). Just do testChannel.addValue(0). If you make testChannel have persist, then you shouldn't have to do it again. To reset the time, just do the same thing. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.