pfbDiagStatus

pfbDiagStatus — queries the diagnostic status of the card.

Synopsis

(pfbDiagStatus card_id [clear])
  

Parameters

card_id
The target card ID (0..3).
clear
(Optional) If set to t, then the diagnostic counters are cleared (after returning the current values).

Returns

If succesful:

(pfbDiagStatus card_id stat_gen stat_dpm stat_dps
               stat_msg stat_sap stat_aspc2 stat_misc)

Each type of statistic is represented by a parenthesized list of name-value pairs (Lisp syntax), as detailed immediately below, with the individual statistics detailed in the Description.

  • stat_gen are the statistics relating to the overall operation of the card, as:
    (GeneralStatistics (errLanOffline value) (diagConf value) (diagInd value)
      (errNotOk value) (diagTokHldTime value) (diagMinTokHldTime value) )
  • stat_dpm are the statistics pertaining to the operation of the card as a DP master, as:
    (DPMasterBlockStatistics (diagMasterUpdate value) (errMasErr value)
      (errReConfig value) (diagMasScanTime value_ms value_us)
      (diagMasMaxScanTime value_ms value_us) )
  • stat_dps are the statistics pertaining to the operation of the card as a DP slave, as:
    (DPSlaveStatistics (diagSlaveUpdate value) (errSlvErr value)
      (errSlvTout value) )
  • stat_msg are the statistics pertaining to FDL message block exchanges, as:
    (Layer2MsgStatistics (diagLay2MsgOk value) (errLay2MsgNotOk value) )
  • stat_sap are the statistics pertaining to SAP requests, as:
    (Layer2SAPStatistics (diagLay2SapOk value) (errLay2SapNotOk value)
      (errLay2SapTout value) )
  • stat_aspc2 are the statistics maintained by the ASPC2 LAN controller, as:
    (ASPC2ProfibusStatistics (errInvReqLen value) (errFifo value)
      (errRxOverun value) (errDblTok value) (errRespErr value)
      (errSyniErr value) (errNetTout value) (errHsa value) (errStn value)
      (errPasTok value) (errLasBad value) )
  • stat_misc are additional miscellaneous diagnostics, as:
    (MiscDiagnostics (errInternal value) (errArg value) (errEventOverun value) )

Otherwise one of the following error messages:

(error "pfbStnStatus DR_ERR_CARD_INVALID (time) invalid card: card_id")
(error "pfbStnStatus PFB_ERR_NO_CARD (time) Card not available")
(error "pfbStnStatus PFB_ERR_ERROR_STATUS_CLEAR_TIMEOUT (time)
        Error clearing error counters (timeout)")

Description

This command provides the values of all the diagnostic counters and status indicators of the card. An optional argument causes the statistics to be cleared, after the current values are returned.

Due to the large number of values returned, and to facilitate future additions, the result is structured using a Lisp syntax. Each statistic is reported as a name-value pair (a list in Lisp), or in some cases as a longer list if there is more than one value associated with the statistic. Statistics are divided into categories, represented as a list whose first element is the category name. Values are reported as unsigned decimal integers, except as noted.

Formatting the reply as a nested parenthesized list faciliates parsing the information using either C/C++ or gamma. The Example contains a code fragment that parses the returned string.

The following table provides a description of each of the statistics returned by the command:

NameDescription
errLanOfflineIncremented when LAN errors cause card to go offline.
diagConfCounts total number of successful messages from this station, including DP master, FDL and FMS messages.
diagIndCounts total indications (unsolicited messages) to this station, including DP master, FDL and FMS messages.
errNotOkCounts total bad replies or unsolicited messages.
diagTokHldTimeContains the instantaneous token hold time, in bit-times. This is the time available to send messages when thee card gets the token.
diagMinTokHldTimeThe minimum value of diagTokOldTime since it was last cleared. A value of 0 may indicate the target token rotation time should be increased.
diagMasterUpdateThe number of complete I/O scans completed by the master.
errMasErrThe number of DP master to DP slave communication errors.
errReConfigThe number of times a DP slave when offline and had to be reconfigured as a result of the master receiving a faulty message while updating a slave.
diagMasScanTimeThe instantaneous master scan time, as a floating point number of milliseconds, followed by the save value as integer microseconds.
diagMasMaxScanTimeThe maximum value of diagMasScanTime since it was last cleared, as a floating point number of milliseconds, followed by the save value as integer microseconds.
diagSlaveUpdateThe number of complete I/O updates received from the master.
errSlvErrIncremented if an error detected during parameteriation of a slave.
errSlvToutIncremented if slave does not receivea message from the master within the master timeout period.
diagLay2MsgOkIncremented when an FDL message is successfully sent and acknowledged.
errLay2MsgNotOkIncremented when an FDL message fails to be acknowledged.
diagLay2SapOkIncremented when an FDL SAP request is processed without error.
errLay2SapNotOkIncremented if there is an error receiving a SAP request.
errLay2SapToutIncremented when a SAP timeout occurs.
errInvReqLenCounts invalid request length errors, which are internal and should never occur.
errFifoCounts FIFO overflow errors, which are internal and should never occur.
errRxOverunCounts receive overrun errors, which are internal and should never occur.
errDblTokCounts double token errors, typically caused by a faulty network hardware or duplicate nodes.
errRespErrCounts response errors, when a message fails or there was no response from the destination, indicating faulty network hardware.
errSyniErrCounts general network errors, indicating problems on the network not yet sever enough to cause a timeout error.
errNetToutCounts network timeout errors.
errHsaIncremented when a station is detected on the network that has a station number higher than the high station address configured for the card.
errStnIncremented when a duplicate station is detected.
errPasTokIncremented when card unable to pass the token, usually caused by network wiring problems.
errLasBadIncremented when the active station list is invalid because of multiple network errors.
errInternalReserved, may indicate cause of fatal error if one occurs.
errArgReserved, may indicate cause of fatal error if one occurs.
errEventOverunIncremented when a new event occurs before the last one was processed.

Example

The command:

(pfbDiagStatus 0)

returns:

(pfbDiagStatus card_id
    (GeneralStatistics
        (errLanOffline 0) (diagConf 188) (diagInd 0) (errNotOk 261)
        (diagTokHldTime 495872) (diagMinTokHldTime 0) )
    (DPMasterBlockStatistics
        (diagMasterUpdate 165) (errMasErr 9) (errReConfig 0)
        (diagMasScanTime 2.348 2348) (diagMasMaxScanTime 2.461 2461) )
    (DPSlaveStatistics
        (diagSlaveUpdate 0) (errSlvErr 0) (errSlvTout 0) )
    (Layer2MsgStatistics
        (diagLay2MsgOk 2) (errLay2MsgNotOk 0) )
    (Layer2SAPStatistics
        (diagLay2SapOk 0) (errLay2SapNotOk 0) (errLay2SapTout 0) )
    (ASPC2ProfibusStatistics
        (errInvReqLen 0) (errFifo 0) (errRxOverun 0) (errDblTok 0)
        (errRespErr 0) (errSyniErr 0) (errNetTout 2) (errHsa 0)
        (errStn 0) (errPasTok 0) (errLasBad 0) )
    (MiscDiagnostics
        (errInternal 0) (errArg 0) (errEventOverun 0) ))

The following C/C++ code fragment uses Cogent C API functions to obtain and then parse the diagnostic information from a card:

int	i, j, k;
char	cmd_buf[64];
char	*grp_argv[16], *stat_argv[16], *val_argv[8];
int	grp_argc, stat_argc, val_argc;

printf ("   Diagnostic Status:\n");

sprintf (cmd_buf, "(pfbDiagStatus %d)", card_id);
result = DR_ApCommand (cmd_buf, data, 1024, &error_str);
if (result == ST_OK)
{
    UT_LispParse (data, 16, &grp_argc, grp_argv);
    for (i=2; i<grp_argc; i++)
    {
        UT_LispParse (grp_argv[i], 16, &stat_argc, stat_argv);
        printf ("     %s\n", stat_argv[0]);
        for (j=1; j<stat_argc; j++)
        {
            UT_LispParse (stat_argv[j], 8, &val_argc, val_argv);
            printf ("       %s =", val_argv[0]);
            for (k=1; k<val_argc; k++)
                printf (" %s", val_argv[k]);
            printf ("\n");
        }
    }
}

It generates the following output:

Diagnostic Status:
  GeneralStatistics
    errLanOffline = 0
    diagConf = 45869
    diagInd = 0
    errNotOk = 404
    diagTokHldTime = 496384
    diagMinTokHldTime = 0
  DPMasterBlockStatistics
    diagMasterUpdate = 45771
    errMasErr = 27
    errReConfig = 0
    diagMasScanTime = 0.416 416
    diagMasMaxScanTime = 3.203 3203
  DPSlaveStatistics
    diagSlaveUpdate = 0
    errSlvErr = 0
    errSlvTout = 0
  Layer2MsgStatistics
    diagLay2MsgOk = 2
    errLay2MsgNotOk = 0
  Layer2SAPStatistics
    diagLay2SapOk = 0
    errLay2SapNotOk = 0
    errLay2SapTout = 0
  ASPC2ProfibusStatistics
    errInvReqLen = 0
    errFifo = 0
    errRxOverun = 0
    errDblTok = 0
    errRespErr = 0
    errSyniErr = 0
    errNetTout = 2
    errHsa = 0
    errStn = 0
    errPasTok = 0
    errLasBad = 0
  MiscDiagnostics
    errInternal = 0
    errArg = 0
    errEventOverun = 0