Room joining , 3 x rooms

Discussion in 'Pascal Logic Code Examples' started by razzman35, Oct 15, 2018.

  1. razzman35

    razzman35

    Joined:
    Mar 21, 2013
    Messages:
    5
    Likes Received:
    0
    Location:
    perth
    Hi all i have 3 x rooms with 2 x lighting groups in each (center and perimeter), each room has 1 x 2 Gang switch, reed switch through bus coupler for door switches

    totals
    rooms = 3
    lighting output groups = 6
    switches = 3 x 2 gang
    bus coupler = 2
    touch screen = B&W mark 2

    upload_2018-10-15_12-45-36.png

    logic keeps runing into a timeout error, msgs sent on all scan

    Modules list like this

    upload_2018-10-15_12-50-4.png

    this module works OK - Rooms States


    {Rooms Closed}
    once (GetCBusState("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 4/5 Link") = OFF) and
    (GetCBusState("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 5/6 Link") = OFF) then
    begin
    EnableModule("All Rooms Closed");
    DisableModule("Rooms 4/5 Open");
    DisableModule("Rooms 5/6 Open");
    DisableModule("Rooms 4/5/6 Open");
    end;

    {Rm 4/5 Open}
    once (GetCBusState("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 4/5 Link") = ON) and
    (GetCBusState("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 5/6 Link") = OFF) then
    begin
    EnableModule("Rooms 4/5 Open");
    DisableModule("Rooms 5/6 Open");
    DisableModule("Rooms 4/5/6 Open");
    DisableModule("All Rooms Closed");
    end;

    {Rm 5/6 Open}
    once (GetCBusState("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 4/5 Link") = OFF) and
    (GetCBusState("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 5/6 Link") = ON) then
    begin
    EnableModule("Rooms 5/6 Open");
    DisableModule("Rooms 4/5 Open");
    DisableModule("Rooms 4/5/6 Open");
    DisableModule("All Rooms Closed");
    end;


    {Rm 4/5/6 Open}
    once (GetCBusState("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 4/5 Link") = ON) and
    (GetCBusState("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 5/6 Link") = ON) then
    begin
    EnableModule("Rooms 4/5/6 Open");
    DisableModule("Rooms 5/6 Open");
    DisableModule("Rooms 4/5 Open");
    DisableModule("All Rooms Closed");
    end;

    this next Module works for each room being closed - All Rooms Closed

    {Tracks each switch GA and goes straight to DAli output GA}


    {Rm 27 - Dojo 4}
    TrackGroup("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 4 S1(P)", "DB-L1-N-27.1 DOJO 4");

    TrackGroup("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 4 S2(C)", "DB-L1-N-27.2 DOJO 4");


    {Rm 28 - Dojo 5}
    TrackGroup("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 5 S1(P)", "DB-L1-N-28.1 DOJO 5");

    TrackGroup("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 5 S2(C)", "DB-L1-N-28.2 DOJO 5");


    {Rm 29 - Dojo 6}
    TrackGroup("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 6 S1(P)", "DB-L1-N-29.1 DOJO 6");

    TrackGroup("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 6 S2(C)", "DB-L1-N-29.2 DOJO 6");

    it is when i add this Module into it i get the error message - Rooms 4/5 OPEN

    {Tracks Switch GA to 2 x Dali GA}


    TrackGroup("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 4 S1(P)", "DB-L1-N-27.1 DOJO 4");
    TrackGroup("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 4 S1(P)", "DB-L1-N-28.1 DOJO 5");

    TrackGroup("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 5 S1(P)", "DB-L1-N-27.1 DOJO 4");
    TrackGroup("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 5 S1(P)", "DB-L1-N-28.1 DOJO 5");

    TrackGroup("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 4 S2(C)", "DB-L1-N-27.2 DOJO 4");
    TrackGroup("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 4 S2(C)", "DB-L1-N-28.2 DOJO 5");

    TrackGroup("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 5 S2(C)", "DB-L1-N-27.2 DOJO 4");
    TrackGroup("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 5 S2(C)", "DB-L1-N-28.2 DOJO 5");






    anybody got some hints or tips?

    thanks

    onedrive link to CTA file
    https://1drv.ms/u/s!Alxl1-oDwXCFgbwtXBDFyID_wwbVpA
     
    razzman35, Oct 15, 2018
    #1
    1. Advertisements

  2. razzman35

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    789
    Likes Received:
    31
    Location:
    Adelaide, Australia
    Track group sets the second ga to the value of the first ga.

    So your first line TrackGroup("DB-L1-N", "Level 1", "TRK-DB-L1-N-Dojo 4 S1(P)", "DB-L1-N-27.1 DOJO 4");
    sets "DB-L1-N-27.1 DOJO 4" to match TRK-DB-L1-N-Dojo 4 S1(P)".

    The third line then sets the same ga (DB-L1-N-27.1 DOJO 4) to a different value (TRK-DB-L1-N-Dojo 5 S1(P)).

    Next scan it does it all over again. So you are continually swapping the value of DB-L1-N-27.1 DOJO 4" twice every 200mS. It won't like that.

    You have the same problem with the other ga's.
     
    Ashley, Oct 15, 2018
    #2
    1. Advertisements

  3. razzman35

    razzman35

    Joined:
    Mar 21, 2013
    Messages:
    5
    Likes Received:
    0
    Location:
    perth
    Thanks Ashley, thats what i thought would happen but hoped once they balanced, like the 3rd scan, they would stay stable.
    Any idea how i can change this to work? as its got me stumped.
     
    razzman35, Nov 15, 2018 at 12:39 AM
    #3
  4. razzman35

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    789
    Likes Received:
    31
    Location:
    Adelaide, Australia
    I'm not quite sure what you are trying to accomplish. Can you explain your requirements?
     
    Ashley, Nov 15, 2018 at 11:49 AM
    #4
  5. razzman35

    razzman35

    Joined:
    Mar 21, 2013
    Messages:
    5
    Likes Received:
    0
    Location:
    perth
    Trying to have each room (3) work independently, 2 switch groups in each (centre and perimeter).
    Rm 1 & 2 open, both switches still work but now control both rooms
    Rm 2 & 3 open, both switches still work but now control both rooms
    Rm 1,2,3 open, all switches work and control all rooms as a whole
    does this make sense?
     
    razzman35, Nov 15, 2018 at 10:17 PM
    #5
  6. razzman35

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    789
    Likes Received:
    31
    Location:
    Adelaide, Australia
    This is where you need the trackGroup2 function that tracks both ways, but unfortunately it is only implemented in the Colour Touchscreen.

    What I would do is use the HasChanged statement to detect a switch press. Then if the partition is open, compare the level of the other rooms with the current switch and if different, set them to the value of the switch

    Something like

    local var:
    switch: boolean;


    switch := getLightingState("switch1");
    if HasChanged(switch) then
    begin
    if getLightingState("partition1") and (getLightingState("room2") <> switch) then setLightingState("room2)", switch);
    // repeat for other partition
    end
    ...etc...

    Repeat for each switch.
    This can then run all the time.
     
    Last edited: Nov 17, 2018 at 12:07 AM
    Ashley, Nov 17, 2018 at 12:00 AM
    #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.