Counting Operating Hours

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by 2SC, Jan 26, 2014.

  1. 2SC

    2SC

    Joined:
    Oct 10, 2006
    Messages:
    345
    Likes Received:
    0
    Location:
    Athens, Greece
    After the very nice example of how to use counters http://www.cbusforums.com/forums/showthread.php?t=11730
    I would like to ask for an upgrade :)

    Is there a way to visualize in Homegate the operation hours of a lighting group?
    I use a coupler to get the state of my emergency generator. Using the counter example above mentioned I could learn how many times the generator started.
    But it would be very nice to know how many hours in total worked
     
    2SC, Jan 26, 2014
    #1
  2. 2SC

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,548
    Likes Received:
    178
    Location:
    Adelaide, Australia
    Just create a module that looks at the Generator Operating GA every say minute (or whatever) and increment a counter if it's running. The counter gives you run-time in whatever delay units you specify

    Code:
    if getLightingState("generator running GA") then counter := counter + 1; // Minutes run
    delay ("0:01:00");
    
    Change the delay to 10 seconds or 1 second if you want more precision.

    Alternatively store the current time when the GA turns on, the subtract it from the current time when the GA turns off and add the result into a running total. The disadvantage of this approach is the total run time is only updated when the generator turns off unless you add a bit more logic.
     
    Last edited by a moderator: Jan 27, 2014
    Ashley, Jan 27, 2014
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.