Manually generating alarm messages at runtime

2012-11-27
2012-11-29
  • MusashiAharon - 2012-11-27

    I have several identical subsystems that can have many different fault conditions. It would be extremely time-consuming and error-prone if I put separate alarm conditions for each subsystem in the alarm configuration:

    Expression                            Type     Class      Message
    PLC_PRG.systems[0].material.consumed  DIG=1    WARNING    Material depleted on system 0
    PLC_PRG.systems[0].material.jammed    DIG=1    INTERLOCK  Material jammed on system 0
    PLC_PRG.systems[0].sensor.blocked     DIG=1    INTERLOCK  Sensor blocked on system 0
    ...
    PLC_PRG.systems[1].material.consumed  DIG=1    WARNING    Material depleted on system 1
    PLC_PRG.systems[1].material.jammed    DIG=1    INTERLOCK  Material jammed on system 1
    PLC_PRG.systems[1].sensor.blocked     DIG=1    INTERLOCK  Sensor blocked on system 1
    ...
    PLC_PRG.systems[2]....
    ...
    PLC_PRG.systems[3]....
    ...
    

    Is there a way that I could use placeholders like this?

    Where i := 0 TO 5
    Expression                              Type     Class      Message
    PLC_PRG.systems[$i$].material.consumed  DIG=1    WARNING    Material depleted on system $i$
    PLC_PRG.systems[$i$].material.jammed    DIG=1    INTERLOCK  Material jammed on system $i$
    PLC_PRG.systems[$i$].sensor.blocked     DIG=1    INTERLOCK  Sensor blocked on system $i$
    ...
    

    I would be okay with using some function to manually add the alarm to the alarm table, too. Something like:

    FOR i := 0 TO 5 DO
      IF systems[i].material.consumed THEN
        message := CONCAT('Material depleted on system ', SINT_TO_STRING(i));
        NewAlarm(
          expr := 'PLC_PRG.systems[i].material.consumed',
          type := ALARMTYPE_DIG1,
          class := 'WARNING',
          priority := 0,
          msg := message
          );
      END_IF
      ...
    END_FOR
    

    As long as I don't have to change six pieces of code to fix one bug!

     

    Related

    Talk.ru: 1
    Talk.ru: 2
    Talk.ru: 3

  • shooter - 2012-11-28

    apart from the expr where you use [i] (which will not work) it is good.
    you will have to keep in your own array the status as this is lost due to the loop.

     
  • MusashiAharon - 2012-11-29

    shooter hat geschrieben:
    apart from the expr where you use [i] (which will not work) it is good.
    you will have to keep in your own array the status as this is lost due to the loop.

    The NewAlarm function doesn't really exist. I just put it there to show what kind of function I'm looking for. (In the real thing, I'm going to CONCAT the value of i into expr -- provided that something like NewAlarm really exists.) I am already storing the status in my own array; I am trying to cause an alarm whenever any subsystem faults. The difficult thing is, I want to:
    1) Have the message show which of the many subsystems faulted, and
    2) Not have to maintain six different copies of the alarm, the only difference being the i variable.
    My question again: Is there a way to do this?

     

Log in to post a comment.