How to replicate counter in PICED in SHAC

Discussion in 'C-Bus Automation Controllers' started by Marine Boy, Oct 5, 2018.

  1. Marine Boy

    Marine Boy

    Joined:
    May 17, 2018
    Messages:
    13
    Likes Received:
    0
    Have an old C-Bus install that is being upgraded and adding a SHAC. There is only piece of logic in PICED and it is a counter to turn on a two different GA's from a single button that has custom function.

    GA66 is addressed to the switch. The switch has the following block functions:

    Short Press - On Key
    Short Release - Off Key
    Long Press - On Key
    Long Release - Off Key

    There are 4 counter functions that trigger other GA's. For exmaple,

    Counter 1 - set GA81 to On
    Counter 2 - set GA82 to On

    Counter 3 - Set GA81 to Off
    Counter 4 - Set GA82 to Off

    Have tried to find script that resembles this in the helpers but no luck. Is this possible with scripting?

    TIA for any assistance.
     
    Last edited: Oct 5, 2018
    Marine Boy, Oct 5, 2018
    #1
    1. Advertisements

  2. Marine Boy

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,321
    Likes Received:
    18
    Location:
    Adelaide
    Can you explain in more detail? It's not clear what the counters are counting or under what conditions the other groups are being switched (for example... when is GA82 ever switched on?)

    Perhaps you could post the original code.

    Nick
     
    NickD, Oct 5, 2018
    #2
    1. Advertisements

  3. Marine Boy

    Marine Boy

    Joined:
    May 17, 2018
    Messages:
    13
    Likes Received:
    0
    Sorry Nick, my mistake when typing the info. Counter 2 sets GA82 to On (have updated the post). See code below:

    once (GetLightingState("*Ensuite Heat*") = ON) then
    begin Counter := Counter + 1;
    end;

    once Counter = 1 then
    begin
    SetLightingState("Ensuite IXL Heat 1", ON);
    end;

    once Counter = 2 then
    begin
    SetLightingState("Ensuite IXL Heat 2", ON);
    end;

    once Counter = 3 then
    begin
    SetLightingState(".Ensuite IXL Heat 2", OFF);
    end;

    once Counter = 4 then
    begin
    SetLightingState("Ensuite IXL Heat 1", OFF);
    Counter := 0;
    end;

    Thanks.
     
    Marine Boy, Oct 5, 2018
    #3
  4. Marine Boy

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,321
    Likes Received:
    18
    Location:
    Adelaide
    Ah ok.. so it's one counter to track 4 states.

    I would have thought that an event triggered script would be the way to go.

    These script get run each time there is an event for the given object (in this case, your Ensuite Heat GA).

    The script would otherwise be much the same, except rather than using "once" you would use "if" since the event driver script only gets run when there is a new event on the GA (rather then every loop like the old logic engine).

    Another option to do this would be to use an eDLT with the multi-level widget (this was exactly the use case it was created for). This widget uses one key to cycle through 3 or 4 preset levels.. you then put both heat lamps on the same GA, and use the turn on thresholds in the relay/dimmer to switch the different lamps at different levels.

    Nick
     
    NickD, Oct 5, 2018
    #4
    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.