controlling 1 load 2 PE Cells

Discussion in 'Pascal Logic Code Examples' started by Mike Jones, Nov 22, 2010.

  1. Mike Jones

    Mike Jones

    Joined:
    Jul 12, 2010
    Messages:
    3
    Likes Received:
    0
    Location:
    sydney
    Hi i am having some difficulty with this code it seems to work on the test page but has some trouble with the load chasing at non consistant times on site i have also attached .CTA and .CBZ file could some one give a a set of fresh eyes PLEASE!!

    Once (GetLightingState("E&D PE Disable/Enable")= ON) Then {PE Disable/Enable}
    begin
    If (GetLightingState("E & D Perimeter NW 1")= ON) Or {Control Group in PE Cell 1}
    (GetLightingState("E & D Perimeter NW 2")= ON) Then {Control Group in PE Cell 2}
    SetLightingState("E&D Work Stations NW Perimeter", ON) {Actual Lighting Group}
    end;

    Once (GetLightingState("E&D PE Disable/Enable")= OFF)Then {PE Disable/Enable}
    begin
    SetLightingState("E&D Work Stations NW Perimeter", OFF) {Actual Lighting Group}
    end;

    {PE ON Control Switch}

    Once (GetLightingState("E & D Perimeter NW 1")= ON) Then {Control Group in PE Cell 1}
    begin
    If (GetLightingState("E&D PE Disable/Enable")= ON) And {PE Disable/Enable}
    ((GetLightingState("E & D Perimeter NW 1")= ON) Or {Control Group in PE Cell 1}
    (GetLightingState("E & D Perimeter NW 2")= ON)) Then {Control Group in PE Cell 2}
    TimerSet(1,-1); {Timer Set to Stop}
    SetLightingState("E&D Work Stations NW Perimeter", ON) {Actual Lighting Group}
    end;

    Once (GetLightingState("E & D Perimeter NW 2")= ON) Then {Control Group in PE Cell 2}
    begin
    If (GetLightingState("E&D PE Disable/Enable")= ON) And {PE Disable/Enable}
    ((GetLightingState("E & D Perimeter NW 1")= ON) Or {Control Group in PE Cell 1}
    (GetLightingState("E & D Perimeter NW 2")= ON)) Then {Control Group in PE Cell 2}
    TimerSet(1,-1); {Timer Set to Stop}
    SetLightingState("E&D Work Stations NW Perimeter", ON) {Actual Lighting Group}
    end;

    Once (GetLightingState("E & D Perimeter NW 1")= ON) Then {Control Group in PE Cell 1}
    begin
    If (GetLightingState("E&D PE Disable/Enable")= OFF) And {PE Disable/Enable}
    ((GetLightingState("E & D Perimeter NW 1")= ON) Or {Control Group in PE Cell 1}
    (GetLightingState("E & D Perimeter NW 2")= ON)) Then {Control Group in PE Cell 2}
    SetLightingState("E&D Work Stations NW Perimeter", OFF) {Actual Lighting Group}
    end;

    Once (GetLightingState("E & D Perimeter NW 2")= ON) Then {Control Group in PE Cell 2}
    begin
    If (GetLightingState("E&D PE Disable/Enable")= OFF) And {PE Disable/Enable}
    ((GetLightingState("E & D Perimeter NW 1")= ON) Or {Control Group in PE Cell 1}
    (GetLightingState("E & D Perimeter NW 2")= ON)) Then {Control Group in PE Cell 2}
    SetLightingState("E&D Work Stations NW Perimeter", OFF) {Actual Lighting Group}
    end;

    {PE OFF Control Switch}

    Once (GetLightingState("E & D Perimeter NW 1")= OFF) Then {Control Group in PE Cell 1}
    begin
    If (GetLightingState("E & D Perimeter NW 2")= OFF) Then {Control Group in PE Cell 2}
    TimerStart(1) ; {Start Timer}
    end;

    Once (GetLightingState("E & D Perimeter NW 2")= OFF) Then {Control Group in PE Cell 2}
    begin
    If (GetLightingState("E & D Perimeter NW 1")= OFF) Then {Control Group in PE Cell 1}
    TimerStart(1) ; {Start Timer}
    end;

    {PE Dealy OFF Timer}

    If ( TimerTime(1)=(10) ) Then {15 Minute OFF Timer} {Set to 10 seconds for testing purposes}
    SetLightingState("E&D Work Stations NW Perimeter", OFF); {Actual Lighting Group}
     

    Attached Files:

    Last edited by a moderator: Nov 22, 2010
    Mike Jones, Nov 22, 2010
    #1
  2. Mike Jones

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,420
    Likes Received:
    62
    Location:
    Adelaide
    Hi,

    Before getting too involved in deciphering your code... we can't really help you without knowing what's going wrong.

    It would be helpful if you can tell us :

    1) What you're doing (ie the inputs to the system)
    2) What you're expecting to happen as a result (ie what your code is meant to do)
    3) What you're observing happening

    Cheers,

    Nick
     
    NickD, Nov 22, 2010
    #2
  3. Mike Jones

    Mike Jones

    Joined:
    Jul 12, 2010
    Messages:
    3
    Likes Received:
    0
    Location:
    sydney
    1) What you're doing (ie the inputs to the system)

    Lights turn on when ><E & D Control group is pressed, PE cell is disabled

    2) What you're expecting to happen as a result (ie what your code is meant to do)

    the code is meant to turn perimeter lights off once both the PE cells are off for more than 10 seconds (at the moment for testing) if either one is ON then the perimeter lights stay ON

    3) What you're observing happening

    at random times during the day the lighting load chases it self ie switches ON then OFF then ON then OFF for about 5 minutes then goes back to normal either ON or OFF depending on the outside light level
     
    Mike Jones, Nov 23, 2010
    #3
  4. Mike Jones

    Nik

    Joined:
    Sep 9, 2008
    Messages:
    30
    Likes Received:
    0
    Hey,

    Code seems overly complicated for what you are trying to achieve..

    I will try to get myself 10 mins to muck around tonight..

    Cheers,
    Nik
     
    Nik, Nov 23, 2010
    #4
  5. Mike Jones

    Newman

    Joined:
    Aug 3, 2004
    Messages:
    2,203
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    This sounds like you have the light level sensors installed in a location where they are receiving light coming from the loads. To cure this you will have to either increase the margin parameter in the light level sensors, or move them to a location where they are not influenced by the light coming from the load.

    From the sounds of things, the sequence of events probably looks some thing like this:
    - Initially light is high, so the output from the sensors is off
    - It gets dark enough to cause the sensor to turn on a C-bus Group
    - Your logic turns on the loads
    - The light level measured by the sensor increases to a point above the set threshold, causing the sensor to turn off the C-Bus Group
    - Your logic turns the loads off
    - Cycle repeats itself

    If the above is true, you may be able to fix this by increasing the value of the Margin parameter.

    Did you know that you could control the relays directly from the PE Cells without the need for writing logic engine code? You can use the in-built logic functions in the output units such that either PE Cell can turn on/off the loads. It would be much simpler to maintain than all the code you have there.
     
    Newman, Nov 23, 2010
    #5
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.