PLC alarm detection

Borte

Member
Join Date
Feb 2004
Location
Norway
Posts
238
Hello everybody!

It's been a while since my last post... (to long!)
But here is a problem I'm sure the members of PLCtalk can help out with (and even gain som info from):

I've been trying to come up with a good solution on how to monitor a movement (like a cylinder moving back and forth) for errors.

Let's say you have a movement like this:
With one output (Y1) making it move out (hitting sensor S1) and spring return making it move backwards (hitting sensor S2).
Code:
                    S2        S1
   |---------|   |          |
   |        |------------
   |---------|
The normal approach to detect an error on this would be to use a timer that runs when you have output Y1 and not input S1 and vice versa. If this timer reached it's timervalue then you would have an error.

The problem with this solution is that it eats up a lot of the cpu power in the plc (scantime) since it has to run one timer pr. movement. And on a bigger machine this would be a LOT of timers...

My approach to this problem is the following:
The situation giving the error is static; meaning if the outputs and sensors stays on for a given time then that would indicate an error.

So based on this I came up with the idea that all I had to do was to check for the error every X second and for only one plc scan.

Principal:
Scan number - Action
1 - Save status of inputs and outputs

2 - Compare current inputs and outputs to saved status.
If same, perform alarm logic and trigg error if logic is true.
If different, no error (since were looking at an static situation)

Checkin the error logic every second scan would give us minimum x seconds of static situation before the error would be detected. If X was 5 seconds then it would be a minimum time before error is detected of 5 seconds and maximum 10 seconds.

And it would not affect the plc scantime since it's only being trigged one scan.

The problem however is that sometimes (when used on a machine, not when simulated) is that it triggers the alarm when there is no error. I suspect this to be due to the monitored movement happing at the "wrong" time. I thought I would not have this problem when I was doing it in the manner being described above but it's still happening. I can't see any error in the plc program either so I'm posting it here to have some new inputs from you guys...

I hope the above description makes sence if not I'll try to explain further...

My code is attached here:
Code:
FUNCTION "ALM_V2_SSY" : VOID
TITLE =
AUTHOR : Borte
FAMILY : ALM_V2
NAME : SSY
VERSION : 2.0


VAR_INPUT
  S1 : BOOL ;	
  S2 : BOOL ;	
  Y1 : BOOL ;	
END_VAR
VAR_IN_OUT
  AlmState : BOOL ;	
  AlmState_S1 : BOOL ;	
  AlmState_S2 : BOOL ;	
  AlmState_Y1 : BOOL ;	
  ErrorDetected : BOOL ;	
END_VAR
BEGIN
NETWORK
TITLE =

      SET   ; 
      A     #AlmState; 
      JC    M001; 

// Save signal state
      A     #S1; 
      =     #AlmState_S1; 
      A     #S2; 
      =     #AlmState_S2; 
      A     #Y1; 
      =     #AlmState_Y1; 

      SET   ; 
      S     #AlmState; 
      JU    Chng; 

M001: NOP   0; 
      SET   ; 
      R     #AlmState; 

// Check for changes in state
      A     #S1; 
      X     #AlmState_S1; 
      JC    Chng; 
      SET   ; 
      A     #S2; 
      X     #AlmState_S2; 
      JC    Chng; 
      SET   ; 
      A     #Y1; 
      X     #AlmState_Y1; 
      JC    Chng; 

// Alarm logic
      SET   ; 
      R     #ErrorDetected; 
      AN    #AlmState_Y1; 
      AN    #AlmState_S2; 
      S     #ErrorDetected; 
      SET   ; 
      A     #AlmState_Y1; 
      AN    #AlmState_S1; 
      S     #ErrorDetected; 
      SET   ; 
      A     #AlmState_S1; 
      A     #AlmState_S2; 
      S     #ErrorDetected; 
      JU    End; 

Chng: NOP   0; 
// Change detected, No error
      R     #ErrorDetected; 

End:  SET   ; 
      A     #ErrorDetected; 
      SAVE  ; 
      BEU   ; 




END_FUNCTION

Cheers
Borte
 
Not the answer to your question, but...

Instead of using one timer per movement, I use one timer per device. Something like this:

If (Y1 and NOT S1) OR (NOT Y1 and NOT S2) OR (NOT S1 and NOT S2 ) OR
(S1 AND S2) for TIME X, THEN Fault.

This usually covers the most common cylinder faults,
Should be extended, but it isn't
Should be home, but it isn't
Not home or extended (stuck in middle)
home and extended at same time (bad sensor?)
 
Last edited:
Hello Ken!

I generally work with productionlines so it would still require a lot of timers...

So If I could work out an approach that would give me the flexibility to add as many alarms as needed then this would be best.

cheers
Borte
 
Hi Borte,

Here's a S7 function that works in a similar fashion to Ken's suggestion. It doesn't use any 'timers' at all. We store the 'actual values' in data words and depending on the application, use either another data word or a constant for the preset. All you need to create is a one second one-shot for the clock input. It has very little overhead so shouldn't cause any scantime issues.

Code:
FUNCTION FC 216 : VOID
TITLE =Cylinder Alarm Block. Type Q1EE
//: Alarm detect block for cylinder. 1 x output. Energise to extend. 
AUTHOR : KH
FAMILY : ALARM
NAME : CA_Q1EE
VERSION : 1.0

VAR_INPUT
  Air_OK : BOOL ; //Mains air supply healthy
  Y_Energised : BOOL ; //Cylinder control solenoid valve energised
  Retracted : BOOL ; //Cylinder retracted sensor
  Extended : BOOL ; //Cylinder extended sensor
  Reset : BOOL ; //Alarm reset.
  Delay_Clk : BOOL ; //Clock pulse for fail delay. Use a one-shot
  Alarm_Preset : INT ; //Cylinder alarm delay preset value
END_VAR
VAR_IN_OUT
  Alarm_Actual : INT ; //Cylinder alarm delay actual value
  Alarm : BOOL ; //Cylinder alarm
END_VAR
BEGIN
NETWORK
TITLE =
//Descriptions are for a mechanical configuration of energise s.v to extend 
//cylinder.
//
//Fail conditions detected are:
//- Output energised and extended sensor is not =1
//- Output energised and retracted sensor remains at =1
//- Output de-energised and retracted sensor is not =1
//- Output de-energised and extended sensor remains at =1
	  A	 #Air_OK; 
	  A(	; 
	  A	 #Y_Energised; 
	  A(	; 
	  O	 #Retracted; 
	  ON	#Extended; 
	  )	 ; 
	  O	 ; 
	  AN	#Y_Energised; 
	  A(	; 
	  ON	#Retracted; 
	  O	 #Extended; 
	  )	 ; 
	  )	 ; 
	  JC	ALM; //Fail conditions true: goto timer
	  L	 0; 
	  T	 #Alarm_Actual; //Else reset timer
	  A	 #Reset; 
	  R	 #Alarm; //Reset if requested
	  JU	END; //And jump to end
ALM:  L	 #Alarm_Actual; 
	  L	 #Alarm_Preset; 
	  >=I   ; //If alarm delay complete
	  S	 #Alarm; //then set the alarm
	  AN	#Delay_Clk; //If no clock pulse this scan
	  O	 #Alarm; //or alarm already active
	  JC	END; //then jump to end
	  L	 1; //else increment alarm timer
	  L	 #Alarm_Actual; 
	  +I	; 
	  T	 #Alarm_Actual; 
//Set ENO output
END:  SET   ; 
	  SAVE  ; 
 
 
 

END_FUNCTION


Kevin H
 
Thanks for the replys!

I'll have a look at the block Kevin!

But does anyone have any feedback on the idea I had at top? I would like to keep the integer math out of the block since this is what affects the scantime most (on a regular 315 plc).

I know it should affect it much when you use a one shot timer but I still would like to keep it as low as possible. Because if I can find a good system for this then I'd use it for a lot of alarm situations (not just movements).

cheers
Borte
 
You should check out PDIAG. It has this functionality built in. There's also an addon for the HMI that lets you show ladder logic on any graphics panel.
 
This is on the "hardware" level of the plc I think.

I really would like to do this in the program (makes it plc generic).

Cheers
Borte
 

Similar Topics

Hi folks, in the alarm manager of Rslogix 5000, the tag-based alarm has been created. But when I tried to change the condition, it was found the...
Replies
2
Views
207
Hello friends, I've (SYSMAC CJ1M CPU21 )Omron PLC workind with a filling machine. The PLC is not functioning and an alarm via its ERR/ALM led...
Replies
3
Views
660
Hello, someone have experience about how to delete an alarm message(alarm already solved) from alarm viewer with something coming from PLC? THANKS
Replies
0
Views
399
Hi guys, This my first time posting hope I get help in my issue.. I have Allen bradley control logix safety PLC (1756-L61S) connected with...
Replies
11
Views
2,343
I’m trying to perfect the HMI interface for alarm control. I’ve provided the user alarm options for all analog inputs, as follows. HH Boolean...
Replies
4
Views
1,557
Back
Top Bottom