Author Topic: Alarm List  (Read 25937 times)

Petty_boy

  • Jr. Member
  • **
  • Posts: 53
  • I'm a llama!
    • View Profile
Re:Alarm List
« Reply #15 on: May 17, 2009, 12:07:37 PM »
Hi,

Can you please join the bits of code required and paste them as one complete working example and post it in a reply.  

Once I have a working example I can edit accordingly.

I still think this is more more complicated than necessary.  As previously stated each DM will only ever have one alarm text message associated to it,  if the DM is a 1 the alarm is active and the one text will be displayed, when the DM = 0 the message is cleared.

Looking for different variables based on different DM values must be a waste of CPU time in this case.

The function I need help with is displaying the different alarms on different lines if active.  This is partly covered above, however at this time it is not clear to me how to join these functions together.

Referencing to different sections in the post and user manual are only adding to the frustration and confusion.

This is the last stumbling block in a so far successful product, which, after the initial trial period is anticipated to be rolled out to multiple sites in the UK.







support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3170
    • View Profile
    • Internet Programmable PLCs
Re:Alarm List
« Reply #16 on: May 17, 2009, 04:40:23 PM »
OK, the original program code still work. The only mistake I made was the clear screen code. It should be SETLCD 0,0,CHR$(1) and was mistakenly written as SETLCD 1,1,CHR$(1) in the original post, which means the screen was not cleared and thus explains why the line 3 and line 4 was not cleared. I reproduce the working code below. It is based on the 3 messages you mentioned in your original thread. You can expand the number of text messages by adding more IF THEN statements.

SETLCD 0,0, CHR$(1)  ' Clear Screen
N = 1    ' starting line
FOR I = 1 to 10
    IF DM <> 0          ' an active event.
          SETLCD N,1, STR$(I,2)+":"
          IF DM = 10
              SETLCD N,4,  "Alarm"
          ELSE
              IF DM = 11
                 SETLCD N,4, "Trip"
              ELSE
                 IF DM = 12
                     SETLCD N,4, "Error"
                 ENDIF
              ENDIF
          ENDIF
          N = N+1
          IF N > 4      ' no more lines for displaying alarm'
                RETURN
          ENDIF
    ENDIF
NEXT
« Last Edit: May 17, 2009, 04:41:34 PM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Petty_boy

  • Jr. Member
  • **
  • Posts: 53
  • I'm a llama!
    • View Profile
Re:Alarm List
« Reply #17 on: May 18, 2009, 01:02:26 AM »
Hi,

This is what I currently have, I have changed the code to suit my use, however I have to fill in dm[1] with 1, dm[2] with 2, dm[3] with 3 etc.

I would like to set each dm with a 1 or 0 only, if I do this all the lines of the lcd have the same text "CB Trip"



SETLCD 0,0, CHR$(1)                      'Clear Screen
SETLCD 1,7, "Alarm list"
N = 2                                  'starting line
FOR I = 1 to 10
  IF DM <> 0                            
         SETLCD N,1, STR$(I,2)+":"      
          IF DM = 1                     'needs to be IF DM[1] = 1
              SETLCD N,4,  "CB Trip"
          ELSE
              IF DM = 2                  'needs to be IF DM[2] = 1
                SETLCD N,4, "Panel Trip"
              ELSE
                IF DM = 3               'needs to be IF DM[3] = 1
                    SETLCD N,4, "Pump Error"
           ELSE
                IF DM = 4               'needs to be IF DM[4] = 1
                    SETLCD N,4, "Pump Trip"
                ENDIF
             ENDIF
              ENDIF
          ENDIF
          N = N+1
          IF N > 4 '4                       ' no more lines for displaying alarm'
            RETURN
         ENDIF
    ENDIF
NEXT

any Ideas?

Cheers

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3170
    • View Profile
    • Internet Programmable PLCs
Re:Alarm List
« Reply #18 on: May 18, 2009, 07:09:29 AM »
The easiest to understand will be to hardcode the text into the IF THEN statement. Try the following:


SETLCD 0,0, CHR$(1)  ' Clear Screen
N = 1    ' starting line

IF DM[1]
   SETLCD N,1, "CB Trip"
   N = N+1
   IF N > 4 RETURN: ENDIF
ENDIF

IF DM[2]
   SETLCD N,1, "Pump Error"
   N = N+1
   IF N > 4 RETURN: ENDIF
ENDIF

IF DM[3]
   SETLCD N,1, "Sensor Error"
   N = N+1
   IF N > 4 RETURN: ENDIF
ENDIF

.......

IF DM[20]
    SETLCD N,1, "Whatever you want"
    N = N+1
    IF N > 4 RETURN: ENDIF
ENDIF
 
« Last Edit: May 18, 2009, 07:10:37 AM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Petty_boy

  • Jr. Member
  • **
  • Posts: 53
  • I'm a llama!
    • View Profile
Re:Alarm List
« Reply #19 on: May 18, 2009, 02:41:33 PM »
Hi,

this is now the working code, it isn't pretty but it works!.  Now i need to change from a SETLCD to a Print #3

How do you convert SETLCD N,4, "230VAC CB TRIP" to a Print # 3?

Print # 3 "?PN,04 230VAC CB TRIP"  is that right?

IF Z=3
SETLCD 0,0, CHR$(1)                      'Clear Screen
SETLCD 1,1, "SCREEN 3-ALARM LIST"
N = 2                                  'starting line
FOR I = 1 to 15
IF DM <> 0                            
SETLCD N,1, STR$(I,2)+":"      
IF DM = 1                     
SETLCD N,4,  "PUMP O/L TRIP"
ELSE
IF DM = 2                  
SETLCD N,4, "230VAC CB TRIP"
ELSE
IF DM = 3               
SETLCD N,4, "SOLENOID CB TRIP"
ELSE
IF DM = 4               
SETLCD N,4, "PUMP O/L TRIP"
ELSE
IF DM = 5               
SETLCD N,4, "PSU CB TRIP"
ELSE
IF DM = 6               
SETLCD N,4, "24VDC CB TRIP"
ELSE
IF DM = 7               
SETLCD N,4, "HEATING CB TRIP"
ELSE
IF DM = 8               
SETLCD N,4, "ESTOP ACTIVE"
ELSE
IF DM = 9            
SETLCD N,4, "PSU DC FAIL"
ELSE
IF DM = 10            
SETLCD N,4, "PUMP DRY RUN"
ELSE
IF DM = 11            
SETLCD N,4, "MOTOR SAVER"
ELSE
IF DM = 12            
SETLCD N,4, "COMM'S FAIL"
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
N = N+1
IF N > 4 '4                       ' no more lines for displaying alarm'
RETURN
ENDIF
ENDIF
NEXT
ENDIF

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3170
    • View Profile
    • Internet Programmable PLCs
Re:Alarm List
« Reply #20 on: May 18, 2009, 03:02:43 PM »
I thought you said DM are to be either 1 or 0 only? Looks like now you are using 15 DMs, and each DM can take on value of 1 to 12?  Anyway, if that is what it is supposed to do then the code should work OK.

Correct string:

PRINT #3 "?P04";STR$(N,2);"230VAC CB TRIP"

STR$(N,2) function converts the integer N into a two digit decimal string which will be appended to "?P04" and forms the row number.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Petty_boy

  • Jr. Member
  • **
  • Posts: 53
  • I'm a llama!
    • View Profile
Re:Alarm List
« Reply #21 on: May 20, 2009, 01:49:53 AM »
Hi,

I do want a 1 or 0 but I needed to get the code in the machine asap.

I will update with your proposed code as it looks a lot tidier.  

I would also like to add the alarm prefix as i think that looks good as well.

When I have updated the code I will convert to print #3 instead of setlcd, if I have any problems I will come back to you.

thanks for the help.

Petty_boy

  • Jr. Member
  • **
  • Posts: 53
  • I'm a llama!
    • View Profile
Re:Alarm List
« Reply #22 on: June 01, 2009, 02:34:21 PM »
Hi,

Modified code.  much easier to work with and has the option of using the LCD port or the MDS display.

Many thanks.

IF Z=3
'SETLCD 0,0, CHR$(1)                      'Clear Screen
'SETLCD 1,1, "ALARM LIST"                  'LCD DISPLAY
PRINT #3 "?C"
PRINT #3 "?P0601";"ALARM LIST"               'MDS 100 DISPLAY
N = 2    
ENDIF   

IF DM[1] AND Z = 3
  'SETLCD N,1, STR$(N-1,2)+" I0.09 PUMP TRIP"                  'LCD DISPLAY
  PRINT #3 "?P01";STR$(N,2); STR$(N-1,2)+" I0.09 PUMP TRIP"         'MDS 100 DISPLAY
  N = N+1
  IF N > 4 RETURN: ENDIF
ENDIF

IF DM[2] AND Z = 3
  'SETLCD N,1, STR$(N-1,2)+" I0.10 CB AC TRIP"
  PRINT #3 "?P01";STR$(N,2); STR$(N-1,2)+" I0.10 CB AC TRIP"
  N = N+1
  IF N > 4 RETURN: ENDIF
ENDIF

IF DM[3] AND Z = 3
  'SETLCD N,1, STR$(N-1,2)+" I0.11 CB SOL TRIP"
  PRINT #3 "?P01";STR$(N,2); STR$(N-1,2)+" I0.11 CB SOL TRIP"
  N = N+1
  IF N > 4 RETURN: ENDIF
ENDIF


IF DM[4] AND Z = 3
    'SETLCD N,1, STR$(N-1,2)+" I0.12 CB PUMP O/L"
    PRINT #3 "?P01";STR$(N,2); STR$(N-1,2)+" I0.12 CB PUMP O/L"
    N = N+1
    IF N > 4 RETURN: ENDIF
ENDIF

IF DM[5] AND Z = 3
    'SETLCD N,1, STR$(N-1,2)+" I0.13 CB PSU TRIP"
    PRINT #3 "?P01";STR$(N,2); STR$(N-1,2)+" I0.13 CB PSU TRIP"
    N = N+1
    IF N > 4 RETURN: ENDIF
ENDIF

IF DM[6] AND Z = 3
    'SETLCD N,1, STR$(N-1,2)+" I0.14 CB DC TRIP"
    PRINT #3 "?P01";STR$(N,2); STR$(N-1,2)+" I0.14 CB DC TRIP"
    N = N+1
    IF N > 4 RETURN: ENDIF
ENDIF

IF DM[7] AND Z = 3
    'SETLCD N,1, STR$(N-1,2)+" I0.15 CB TH TRIP"
    PRINT #3 "?P01";STR$(N,2); STR$(N-1,2)+" I0.15 CB TH TRIP"
    N = N+1
    IF N > 4 RETURN: ENDIF
ENDIF

IF DM[8] AND Z = 3
    SETLCD N,1, STR$(N-1,2)+" I0.01 ESTOP ACTIVE"
    PRINT #3 "?P01";STR$(N,2); STR$(N-1,2)+" I0.01 ESTOP"
    N = N+1
    IF N > 4 RETURN: ENDIF
ENDIF

IF DM[9] AND Z = 3
    'SETLCD N,1, STR$(N-1,2)+" I0.16 PSU VOLTS FAIL"
    PRINT #3 "?P01";STR$(N,2); STR$(N-1,2)+" I0.16 PSU V FAIL"
    N = N+1
    IF N > 4 RETURN: ENDIF
ENDIF

IF DM[10] AND Z = 3
    'SETLCD N,1, STR$(N-1,2)+" I0.17 PUMP DRY RUN"
    PRINT #3 "?P01";STR$(N,2); STR$(N-1,2)+" I0.17 PUMP DRY"
    N = N+1
    IF N > 4 RETURN: ENDIF
ENDIF

IF DM[11] AND Z = 3
    'SETLCD N,1, STR$(N-1,2)+" I0.18 MOTOR SAVER TRIP"
    PRINT #3 "?P01";STR$(N,2); STR$(N-1,2)+" I0.18 MOTOR SAVER"
    N = N+1
    IF N > 4 RETURN: ENDIF
ENDIF

IF DM[12] AND Z = 3
    'SETLCD N,1, STR$(N-1,2)+" I0.19 COMM'S FAIL"
    PRINT #3 "?P01";STR$(N,2); STR$(N-1,2)+" I0.19 COMM'S FAIL"
    N = N+1
    IF N > 4 RETURN: ENDIF
ENDIF


IF ADC(1) <= 100 AND Z = 3
    'SETLCD N,1, STR$(N-1,2)+" AI 0.1 SENSOR ERROR L"
    PRINT #3 "?P01";STR$(N,2); STR$(N-1,2)+" AI 0.1 SENSOR LOW"
    N = N+1
    IF N > 4 RETURN: ENDIF
ENDIF


IF ADC(1) >= 4000 AND Z = 3
    'SETLCD N,1, STR$(N-1,2)+" AI 0.1 SENSOR ERROR H"
    PRINT #3 "?P01";STR$(N,2); STR$(N-1,2)+" AI 0.1 SENSOR HIGH"
    N = N+1
    IF N > 4 RETURN: ENDIF
ENDIF