Internet PLC Forum

General => Technical support => Topic started by: Petty_boy on April 29, 2009, 03:23:18 PM

Title: Alarm List
Post by: Petty_boy on April 29, 2009, 03:23:18 PM
Hi,

I would like to create an alarm list utilising the MDS display, when I generate an alarm i.e. input 1 = CB trip. I want to display the message on the MDS display, this works however,  I have to specify what  line on the LCD the text is displayed, therefore I can only specify four alarms, one on each line.

Is it possible to have each alarm displayed on different lines on the LCD display as an active alarm list? when each alarm is cleared the list moves up one line.

Alternatively if I assign each alarm a DM value and use a simple program to display the text for that value i.e. DM[1]10 =  LCD text "Alarm",  DM[1]11 = LCD text "Trip", DM[1]12 = LCD text "Error" etc,  I still have the problem of having the active alarms displayed on multiple lines.

Any Ideas?

Kind regards.



Title: Re:Alarm List
Post by: support on April 29, 2009, 10:13:32 PM
I don't quite understand what you are trying to achieve.  How many potential alarm events are you keeping track?

Lets assume you have 10 alarm events and you keep them in DM[1] to DM[10] like you said, and using the numerical value to represent what the text should be displayed for each value. A value = 0 means the alarm event is cleared.

So you can run a periodic scan (e.g. every second) of these 10 DMs and refresh the display of only those event that are active:

SETLCD 1,1, 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

The LCD display will display the first four active alarms it found using the example format

    01:Alarm
    03:Trip
    07:Error
    08:Trip

So your list will display the event number 01 to 10 and the error type.  
       
However, since the LCD only has 4 lines the maximum number of alarm you can display at any one time is 4 if you use one line per alarm event.  So the FOR NEXT loop will quit when 4 lines has already been displayed. You therefore should put higher priority event on the first few DM[]s so that the high priority event will be displayed first if more than 4 alarms occurred simultaneously.
Title: Re:Alarm List
Post by: Petty_boy on May 02, 2009, 02:13:21 AM
Hi,

Thanks for the response.

I don't need a high or low priority, if the alarm is active it will be in the list, if the list is full (4 alarms) any additional alarms will not be displayed.

when one of the four alarms in the list is cleared, any alarms not currently displayed will now appear in the list.

I only have around 10 alarms.

is the code the same as above??
Title: Re:Alarm List
Post by: support on May 02, 2009, 10:26:05 AM
Yes.

The code is meant for T100MD+ or F-series using built-in LCD display. If you are using the RS485 based MDS100 (http://www.tri-plc.com/mds100.htm)  then you need to change the SETLCD to PRINT #3 "?Pyyxx" followed by the text. yy is the column number and xx is the row number, which when used with SETLCD will be SETLCD xx, yy, textstring

Title: Re:Alarm List
Post by: Petty_boy on May 03, 2009, 12:23:05 PM
Ok thank you.

I'll give it a go and let you know.

Cheers.
Title: Re:Alarm List
Post by: Petty_boy on May 13, 2009, 03:58:37 PM
Hi,

I've been playing around with the above code and I'm having some errors.

When the last alarm is cleared, the LCD does not clear?

Also, I would like to change the functionality a little, I will try to explain what I would like to achieve, please bare with me!

if DM[1] = 1 I want to set the LCD "CB Trip"  if DM[1] = 0 No alarm.

if DM[2] = 1 I want to set the LCD "Pump Error" if DM[2] = 0 No alarm.

if DM[3] = 1 I want to set the LCD "Sensor Error" if DM[3] = 0 No alarm.

ETC ETC for the entire list of alarms DM 1 - 20 for example.

I still want the "moving list" function i.e alarm one  is displayed on line one,   alarm two is displayed on line two, if alarm one is cleared, alarm two will "move" into line one.

If each alarm can be prefixed with a number i.e 01: CB Trip, 02: Pump Error that would be grand.

Many thanks.
Title: Re:Alarm List
Post by: support on May 13, 2009, 09:32:19 PM
From your other threads seems like you are using MDS100 and not SETLCD. To clear screen in MDS100, send the command "?C". the rest of the codes just change the SETLCD to PRNT #3 and swap the XX and YY with the SETLCD command as explained in previous thread. If you want 20 DMs, then change FOR NEXT to 20.

E.g. Instead of  

        SETLCD N,1, STR$(I,2)+":"

change to:
 
         PRINT #3 "?P01";STR$(N,2);STR$(I,2);":"

Title: Re:Alarm List
Post by: Petty_boy on May 14, 2009, 02:43:22 AM
Hi,

I'm not worried about the type of screen, once I have the code right I will change from setlcd to print command.

The above code allows me to have multiple message text per alarm i.e alarm 1 can be "trip" or "error" depending on the DM value.

I don't need this functionality,  each alarm has one text message only i.e. if DM[1] = 1 the alarm is active and the displayed text is "CB Trip".

If the DM[1] = 0 the alarm is cleared.

I do want the functionally to display active alarms on different lines of the LCD, as thes alarms are cleared the list moves up one space.

Does that make sense?

Cheers
Title: Re:Alarm List
Post by: support on May 14, 2009, 04:06:13 PM
The code I proposed would clear the screen every time and start to display the alarm from the first active alarm to the 4th active alarm. So although it doesn't really "move" up one line per se it will appear to be so when executed.
Title: Re:Alarm List
Post by: Petty_boy on May 17, 2009, 12:58:50 AM
HI,

I really appreciate the help but either I'm completely unclear or your missing the point.

I Have  two problems with the code:-

#1

I would like each DM variable to have its own text NOT "Alarm" if DM 1 - 10 = 11.

i.e

if DM[1] = 1 I want to set the LCD "CB Trip"  if DM[1] = 0 No alarm.

if DM[2] = 1 I want to set the LCD "Pump Error" if DM[2] = 0 No alarm.

if DM[3] = 1 I want to set the LCD "Sensor Error" if DM[3] = 0 No alarm.

ETC ETC for the entire list of alarms DM 1 - 20 for example.

As above, I still want the "moving list" function i.e alarm one  is displayed on line one,  alarm two is displayed on line two, if alarm one is cleared, alarm two will "move" into line one.

I appreciate the list doesn't move it just looks that way.

#2

When the the alarms "move up" i.e. from line 3 to line 2, line 3 isn't cleared.

I hope that's clear.  

Thanks again for the help.


Title: Re:Alarm List
Post by: support on May 17, 2009, 01:11:21 AM
Do you actually have the PLC to test? If not, what programming language are you writing in?
Title: Re:Alarm List
Post by: Petty_boy on May 17, 2009, 02:06:33 AM
Hi,

Yes I have three 2424's and I'm looking to use this alarm list in the final code of a pumping system product.

Once I have finished the code, logic part is done just struggling with some of the basic code in the custom functions i.e alarm list!

I havn't downloaded the provided code, just using the simulator to test, when it works how i need it I will add it to my main code.

Cheers
Title: Re:Alarm List
Post by: support on May 17, 2009, 09:26:11 AM
How many different messages do you have? There are two ways of displaying different text for different alarm. One is to hardcode them using a lot of IF THEN statement without using a "FOR..NEXT" loop. This may be easiest to implement if you have as many different text messages as the number of DM.

A second method is to use a different array that correspond to each DM, but in the second array you will put the text message number.

E.g. DM[1] to DM[20] has twenty alarms.  1 means alarm, 0 means no alarm.

Say you have 4 text messages:  Alarm1, Alarm2, Alarm3 and Alarm4, in an init function, store them in variable string array $$[n]

$$[1] = "Alarm1"   ' this is same location as A$
$$[2] = "Alarm2"
$$[3] = "Alarm3"
$$[4] = "Alarm4"  ' this is same location as D$

DM[21] to DM[40] use to keep the text message number. So if DM[1] should use text "Alarm2", and DM[2] use Alarm 1, etc, stores the text number in DM[21], DM[22], respectively in the INIT function:

DM[21] = 2
DM[22] = 1
....
DM[40] = ??   ' whatever text type

So now instead of displaying a hard-coded text inside the FOR..NEXT loop, you will display $$[DM[I+20]]. This will give each alarm a different text depending on what number has been assigned to DM[21] to DM[40]. It can be very clean if you wish to assign a different text string to be displayed.

As for the moving up effect, try to modify the code and transfer to the PLC and see the resulting effect. The simulator sometime may not fully simulate all the function of the SETLCD command.

In any case this support forum is to point you to "how" to do certain thing but you really have to be one to write the final working program. I am sure this will not be the only thing you want to do with the PLC and without figuring out how to program it yourself you will be back asking for more working code again and again.  If this is too much for you you may consider hire a software programmer to help you put up a working program.



 
Title: Re:Alarm List
Post by: Petty_boy on May 17, 2009, 10:45:21 AM
Hi,


Can you please provide a working example of the above array type code.

I think this will suit my purpose but if I'm honest,  there's more chance of Bush being re elected than me getting that working!

Cheers.

Ps couldn't find any info in the cust list for int function.



Title: Re:Alarm List
Post by: support on May 17, 2009, 11:08:13 AM
See last para above. Thanks.

In the section on String variables A$ to Z$, it is mentioned that they can be referenced as an index variable $$[1] to $$[26] which makes it easier to use in a For NEXT loop.

Title: Re:Alarm List
Post by: Petty_boy 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.






Title: Re:Alarm List
Post by: support 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
Title: Re:Alarm List
Post by: Petty_boy 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
Title: Re:Alarm List
Post by: support 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
 
Title: Re:Alarm List
Post by: Petty_boy 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
Title: Re:Alarm List
Post by: support 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.
Title: Re:Alarm List
Post by: Petty_boy 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.
Title: Re:Alarm List
Post by: Petty_boy 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