Slow PIR-PAC Response

Discussion in 'Pascal Logic Code Examples' started by stereo247, Jun 11, 2020.

  1. stereo247

    stereo247

    Joined:
    Jun 5, 2019
    Messages:
    7
    Likes Received:
    0
    Hi All
    I have a 3rd party PIR wired into 5504AUX and a PAC with the logic code below. Originally I had the PIR trip the Scullery light immediately but this would run during daylight hours which became irritating. So I put some code into the PAC and it does switch on only between sunset and sunrise. Problem is it does so only after significant movement or about 4 sec's. Compared to the original setup which switched the light on in about 1 sec. I can't think of why and maybe somewhere here could point me in the right direction.

    Code:
    if (Time < SunRise) or (Time > SunSet) then
    once GetLightingState("Trigger Scullery PIR")= ON then
    begin
      PulseCBusLevel("Local Network", "Lighting", "Scullery", 100%, "0s", "0:01:00", 0%);
     end;
    The AUX unit setting are in the screenshot below:

    [​IMG]

    [​IMG]

    Cheers
    Brent
     
    stereo247, Jun 11, 2020
    #1
    1. Advertisements

  2. stereo247

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,140
    Likes Received:
    116
    Location:
    Adelaide, Australia
    I assume it's a typo when you have "Trigger Scullery PIR" in the logic and "PIR trigger scullery" in the block?

    Anyway, using ON key and Toggle isn't very reliable with logic. The logic only scans every 200mS, so if the PIR triggers and clears within this time the logic will miss it.

    What you should be doing is setting the group ON in the PIR only (i.e. make the release functions unused), then setting it OFF in the logic when the ONCE is triggered. That way you can never miss a trigger.

    Also, put the IF inside the ONCE, not the other way around
     
    Ashley, Jun 13, 2020
    #2
    1. Advertisements

  3. stereo247

    stereo247

    Joined:
    Jun 5, 2019
    Messages:
    7
    Likes Received:
    0
    Thanks Ashley
    Appreciate the advice a heck of a lot. I've gone from knowing nothing about c-bus 3 months ago to now based mostly on reading this forum which is credit to everyone who contributes here. I've updated the code to the below - I understand why you advised the change.

    I set the Group to "ON" (On Key, Idle, Idle, Idle) but for some reason it wont run at all now?

    Code:
    once (GetLightingState("PIR trigger scullery") = ON) then
    if (Time < SunRise) or (Time > SunSet) then
    begin
        PulseCBusLevel("Local Network", "Lighting", "Scullery", 100%, 0, "0:01:00", 0%);
      end;
    Good catch on the "PIR trigger" wording.
     
    stereo247, Jun 14, 2020
    #3
  4. stereo247

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,140
    Likes Received:
    116
    Location:
    Adelaide, Australia
    You need to set the group back to zero in the logic
    Code:
    once (GetLightingState("PIR trigger scullery") = ON) then
    begin
       if (Time < SunRise) or (Time > SunSet) then
        PulseCBusLevel("Local Network", "Lighting", "Scullery", 100%, 0, "0:01:00", 0%);
       setLightingState("PIR trigger scullery", OFF);
    end;
     
    Ashley, Jun 14, 2020
    #4
  5. stereo247

    stereo247

    Joined:
    Jun 5, 2019
    Messages:
    7
    Likes Received:
    0
    Thanks for the advice - I’ve updated and everything is working. The slow response is still there - perhaps I need to increase the sensitivity of PIR or maybe it’s the processing speed of the PAC. But good to know that the logic code is right.
     
    stereo247, Jun 14, 2020
    #5
  6. stereo247

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,140
    Likes Received:
    116
    Location:
    Adelaide, Australia
    The PAC runs the logic modules every 200mS so it's unlikely to cause a delay unless it is doing lots of other stuff. Even then you wouldn't get a 4 second delay.

    Try putting a switch directly across the 5504AUX input, or if you have a spare switch nearby program it to set the trigger ga. That way you can isolate where the delay is.
     
    Ashley, Jun 15, 2020
    #6
    1. Advertisements

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.