Hardware alarm indication

There are some limited hardware alarms that I would like to display for the operator.  Is there a way to read the particular alarms and trigger another category?  I don't want all of the hardware alarms inthe general list, but I would like to alarm if a particular standby (or primary) I/O server has lost communications.  I may just be looking at this from the wrong angle.

Parents
  • Usually, what I see is that customers create Advanced alarms to call IODeviceInfo() for each device. If you have redundancy or other complications, you may need to create a Cicode function to return the device's status. Here's an example for a redundant project:


    //Returns TRUE if the specified device is not online on either the primary or standby server
    //This can be called from a client or server
    //
    //sDeviceName Name of the primary or standby device
    //
    INT FUNCTION IODeviceOffline(STRING sDeviceName)
      INT cDevClientState = 3;
      INT cDevRunning = 1;
      INT cDevStandby = 2;
      INT cDevNumber = 11;

      INT nDevice = IODeviceInfo(sDeviceName, cDevNumber);
      INT nState = IODeviceInfo(nDevice, cDevClientState);
      INT bRunning = (nState BITAND cDevRunning) OR (nState BITAND cDevStandby);

      RETURN NOT bRunning;
    END

    It can also be helpful to create alarms for server processes as Olivier suggested.

    Make sure to test your alarms. Sometimes you don't get the results you expect with these info functions. For example, IODeviceInfo may combine 2 or more states in the client state value. That's why my Cicode function uses BITAND to check for specific states.

    Also, some modes may not work because you need to run the command from within the server process you're querying, or the code may need to block to retrieve data so it can't be used in foreground code, like an alarm expression. That's why I used IODeviceInfo mode 3 (client I/O device state) instead of mode 10 (I/O server I/O device state).

Reply
  • Usually, what I see is that customers create Advanced alarms to call IODeviceInfo() for each device. If you have redundancy or other complications, you may need to create a Cicode function to return the device's status. Here's an example for a redundant project:


    //Returns TRUE if the specified device is not online on either the primary or standby server
    //This can be called from a client or server
    //
    //sDeviceName Name of the primary or standby device
    //
    INT FUNCTION IODeviceOffline(STRING sDeviceName)
      INT cDevClientState = 3;
      INT cDevRunning = 1;
      INT cDevStandby = 2;
      INT cDevNumber = 11;

      INT nDevice = IODeviceInfo(sDeviceName, cDevNumber);
      INT nState = IODeviceInfo(nDevice, cDevClientState);
      INT bRunning = (nState BITAND cDevRunning) OR (nState BITAND cDevStandby);

      RETURN NOT bRunning;
    END

    It can also be helpful to create alarms for server processes as Olivier suggested.

    Make sure to test your alarms. Sometimes you don't get the results you expect with these info functions. For example, IODeviceInfo may combine 2 or more states in the client state value. That's why my Cicode function uses BITAND to check for specific states.

    Also, some modes may not work because you need to run the command from within the server process you're querying, or the code may need to block to retrieve data so it can't be used in foreground code, like an alarm expression. That's why I used IODeviceInfo mode 3 (client I/O device state) instead of mode 10 (I/O server I/O device state).

Children
No Data