5500PACA TIME function

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by jka, Apr 10, 2006.

  1. jka

    jka

    Joined:
    Apr 9, 2006
    Messages:
    19
    Likes Received:
    0
    Location:
    Wollongong
    Hi there. I am trying to control some exhaust fans - I want the fans to start after a preset time when the light is on. I am using the time function to set the start delay but it does not seem to relate to seconds as I am reading it. (See code example following). HallFanDelay is set to 60, but 60 equals approx 110 seconds. I thought the time would give me the start seconds, then I could add the delay constant that I have defined.



    {Turns fan on after preset time if only light is on}
    once
    (GetLightingState("HTL1 - hall toilet downlight") = ON) and
    (GetLightingState("HTL2 - hall toilet exhaust fan") = OFF)
    then
    HallFanTime := (Time + HallFanDelay);
    while
    (GetLightingState("HTL1 - hall toilet downlight") = ON) and
    (GetLightingState("HTL2 - hall toilet exhaust fan") = OFF)
    do
    begin
    if (GetLightingState("HTL1 - hall toilet downlight") = ON) and
    (GetLightingState("HTL2 - hall toilet exhaust fan") = OFF) and
    (Time >= HallFanTime)
    then
    PulseCBusLevel("Local Network", "Lighting", "HTL2 - hall toilet exhaust fan", 100%, 0, "0:00:02", 100%);
    end;
     
    jka, Apr 10, 2006
    #1
  2. jka

    Nobes

    Joined:
    Oct 7, 2004
    Messages:
    167
    Likes Received:
    1
    Location:
    Hobart
    There is an example code in PICED that does the toilet fan delay function. Not sure why 60 seconds isn't sixty seconds though.
     
    Nobes, Apr 11, 2006
    #2
  3. jka

    martymonster

    Joined:
    Aug 5, 2004
    Messages:
    162
    Likes Received:
    1
    Your code seems to be in a tight CPU intensive loop (while do ) for 60 seconds then turning on the Fan.

    What about doing something like

    ONCE GetLightingState("HTL1 - hall toilet downlight") = ON
    IF GetLightingState("HTL2 - hall toilet exhaust fan") = OFF
    Start a TIMER
    ENDIF
    END

    ONCE TIMER reaches 60 seconds
    IF GetLightingState("HTL1 - hall toilet downlight") = ON and GetLightingState("HTL2 - hall toilet exhaust fan") = OFF
    TURN FAN ON
    ENDIF
    STOP TIMER
    END


    How does the FAN turn off?

    What about setting the wall switch as a TIMER to turn it and and automatically turn if off?
    This would then not use the PAC at all.
    SHORT press turns it on and also does RETRIG for set time
    LONG press turns it OFF if you want to turn it off earlier.

    Martin
     
    martymonster, Apr 11, 2006
    #3
  4. jka

    jka

    Joined:
    Apr 9, 2006
    Messages:
    19
    Likes Received:
    0
    Location:
    Wollongong
    Thanks

    Thanks for the reply Chris
    I will check the examples now
    The constants I used (and seconds) below
    10 (30S), 20 (71s), 30 (110s), 60 (210s)
    Maybe I should change the loop as Marty suggests
    regards Jim
     
    jka, Apr 11, 2006
    #4
  5. jka

    jka

    Joined:
    Apr 9, 2006
    Messages:
    19
    Likes Received:
    0
    Location:
    Wollongong
    Thanks

    Thanks for the reply and tip
    Was not worrying about turning it off yet
    (will probably use another timer)
    regards Jim
     
    jka, Apr 11, 2006
    #5
  6. jka

    martymonster

    Joined:
    Aug 5, 2004
    Messages:
    162
    Likes Received:
    1
    To turn it off, just start another timer when you turn the fan on.
    Then do the same type of check

    ONCE TIMER reaches 60 seconds
    IF GetLightingState("HTL1 - hall toilet downlight") = ON and GetLightingState("HTL2 - hall toilet exhaust fan") = OFF
    TURN FAN ON
    St 2nd TIMER
    ENDIF
    STOP TIMER
    END

    ONCE 2nd_Timer reaches (00:10:00) { 10 minutes for example )
    Turn OFF Fan
    Turn Light OFF
    Stop the 2nd Timer
    END

    This is the type of code I use for my Hall and Stair lights.

    Martin
     
    martymonster, Apr 11, 2006
    #6
  7. jka

    jka

    Joined:
    Apr 9, 2006
    Messages:
    19
    Likes Received:
    0
    Location:
    Wollongong
    Good Tip

    Martin
    I have used the following code and it is now working as it should
    180 for HallFanDelay is 3 minutes!

    {Turns fan on after preset time if light is on}
    once
    (GetLightingState("HTL1 - hall toilet downlight") = ON)
    then
    begin
    HallFanTime := (Time + HallFanDelay)
    end;
    once
    (Time >= HallFanTime)
    then
    if
    (GetLightingState("HTL1 - hall toilet downlight") = ON) and
    (GetLightingState("HTL2 - hall toilet exhaust fan") = OFF)
    then
    begin
    PulseCBusLevel("Local Network", "Lighting", "HTL2 - hall toilet exhaust fan", 100%, 0, "0:00:02", 100%);
    end;


    Thanks for the tips, it has been a while since I have used Pascal
    Will look at the rest later on
    regards Jim
     
    jka, Apr 11, 2006
    #7
  8. jka

    coppo

    Joined:
    Sep 7, 2004
    Messages:
    221
    Likes Received:
    10
    Location:
    Adelaide
    loopy DA loop

    As the others say it is a looping problem.

    this may be a slight repeat of others but it is very literal and reads very easily, uses up the timers but what the hey.


    1ST option starts fan after the light has been on for a period, then
    turns the fan off with the light.

    Code:
    once (GetLightingState("halltoiletdownlight") = ON) then
    begin
      TimerStart(1);
    end;
    
    once TimerTime(1) = 10 then
    begin
      SetLightingState("halltoiletexhaustfan",ON);
    end;
    
    {RESET}
    once (GetLightingState("halltoiletdownlight") = OFF) then
    begin
      TimerStop(1);
      SetLightingState("halltoiletexhaustfan",OFF);
    end;
    

    2ND option starts fan after the light has been on for a period, then
    uses a 2nd timer to make fan "run on" for specified time... FAN turns off
    based upon the 2nd timer

    Code:
    once (GetLightingState("halltoiletdownlight") = ON) then
    begin
      TimerStart(1);
      TimerStop(2);
    end;
    
    once TimerTime(1) = 10 then
    begin
      SetLightingState("halltoiletexhaustfan",ON);
    end;
    
    once (GetLightingState("halltoiletdownlight") = OFF) and
         (GetLightingState("halltoiletexhaustfan") = ON) then
    begin
      TimerStart(2);
    end;
    
    once TimerTime(2) = 10 then
    begin
      TimerStop(2);
      SetLightingState("halltoiletexhaustfan",OFF);
    end;
    
    See how you go!

    ===========================================
     
    coppo, Apr 12, 2006
    #8
  9. jka

    jka

    Joined:
    Apr 9, 2006
    Messages:
    19
    Likes Received:
    0
    Location:
    Wollongong
    Thanks for your help Coppo
    regards Jim
     
    jka, Apr 12, 2006
    #9
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.