PDA

View Full Version : controlling 1 load 2 PE Cells


Mike Jones
22 Nov 10, 05:24 PM
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}

NickD
22 Nov 10, 06:02 PM
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

Mike Jones
23 Nov 10, 02:45 PM
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

Nik
23 Nov 10, 03:44 PM
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

Newman
23 Nov 10, 03:46 PM
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 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.