Author Topic: Alarm List  (Read 43020 times)

Petty_boy

  • Jr. Member
  • **
  • Posts: 53
  • I'm a llama!
    • View Profile
Alarm List
« 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.




support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Alarm List
« Reply #1 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.
« Last Edit: April 29, 2009, 10:16:38 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 #2 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??

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Alarm List
« Reply #3 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

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 #4 on: May 03, 2009, 12:23:05 PM »
Ok thank you.

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

Cheers.

Petty_boy

  • Jr. Member
  • **
  • Posts: 53
  • I'm a llama!
    • View Profile
Re:Alarm List
« Reply #5 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.
« Last Edit: May 14, 2009, 02:34:54 AM by Petty_boy »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Alarm List
« Reply #6 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);":"

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 #7 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

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Alarm List
« Reply #8 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.
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 #9 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.



support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Alarm List
« Reply #10 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?
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 #11 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

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Alarm List
« Reply #12 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.



 
« Last Edit: May 17, 2009, 11:10:17 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 #13 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.




support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Alarm List
« Reply #14 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.

« Last Edit: May 17, 2009, 11:11:59 AM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS