(pfbDiagStatus card_id [clear])
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.
(GeneralStatistics (errLanOffline value) (diagConf value) (diagInd value) (errNotOk value) (diagTokHldTime value) (diagMinTokHldTime value) )
(DPMasterBlockStatistics (diagMasterUpdate value) (errMasErr value) (errReConfig value) (diagMasScanTime value_ms value_us) (diagMasMaxScanTime value_ms value_us) )
(DPSlaveStatistics (diagSlaveUpdate value) (errSlvErr value) (errSlvTout value) )
(Layer2MsgStatistics (diagLay2MsgOk value) (errLay2MsgNotOk value) )
(Layer2SAPStatistics (diagLay2SapOk value) (errLay2SapNotOk value) (errLay2SapTout value) )
(ASPC2ProfibusStatistics (errInvReqLen value) (errFifo value) (errRxOverun value) (errDblTok value) (errRespErr value) (errSyniErr value) (errNetTout value) (errHsa value) (errStn value) (errPasTok value) (errLasBad value) )
(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)")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:
| Name | Description |
|---|---|
| errLanOffline | Incremented when LAN errors cause card to go offline. |
| diagConf | Counts total number of successful messages from this station, including DP master, FDL and FMS messages. |
| diagInd | Counts total indications (unsolicited messages) to this station, including DP master, FDL and FMS messages. |
| errNotOk | Counts total bad replies or unsolicited messages. |
| diagTokHldTime | Contains the instantaneous token hold time, in bit-times. This is the time available to send messages when thee card gets the token. |
| diagMinTokHldTime | The minimum value of diagTokOldTime since it was last cleared. A value of 0 may indicate the target token rotation time should be increased. |
| diagMasterUpdate | The number of complete I/O scans completed by the master. |
| errMasErr | The number of DP master to DP slave communication errors. |
| errReConfig | The 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. |
| diagMasScanTime | The instantaneous master scan time, as a floating point number of milliseconds, followed by the save value as integer microseconds. |
| diagMasMaxScanTime | The maximum value of diagMasScanTime since it was last cleared, as a floating point number of milliseconds, followed by the save value as integer microseconds. |
| diagSlaveUpdate | The number of complete I/O updates received from the master. |
| errSlvErr | Incremented if an error detected during parameteriation of a slave. |
| errSlvTout | Incremented if slave does not receivea message from the master within the master timeout period. |
| diagLay2MsgOk | Incremented when an FDL message is successfully sent and acknowledged. |
| errLay2MsgNotOk | Incremented when an FDL message fails to be acknowledged. |
| diagLay2SapOk | Incremented when an FDL SAP request is processed without error. |
| errLay2SapNotOk | Incremented if there is an error receiving a SAP request. |
| errLay2SapTout | Incremented when a SAP timeout occurs. |
| errInvReqLen | Counts invalid request length errors, which are internal and should never occur. |
| errFifo | Counts FIFO overflow errors, which are internal and should never occur. |
| errRxOverun | Counts receive overrun errors, which are internal and should never occur. |
| errDblTok | Counts double token errors, typically caused by a faulty network hardware or duplicate nodes. |
| errRespErr | Counts response errors, when a message fails or there was no response from the destination, indicating faulty network hardware. |
| errSyniErr | Counts general network errors, indicating problems on the network not yet sever enough to cause a timeout error. |
| errNetTout | Counts network timeout errors. |
| errHsa | Incremented when a station is detected on the network that has a station number higher than the high station address configured for the card. |
| errStn | Incremented when a duplicate station is detected. |
| errPasTok | Incremented when card unable to pass the token, usually caused by network wiring problems. |
| errLasBad | Incremented when the active station list is invalid because of multiple network errors. |
| errInternal | Reserved, may indicate cause of fatal error if one occurs. |
| errArg | Reserved, may indicate cause of fatal error if one occurs. |
| errEventOverun | Incremented when a new event occurs before the last one was processed. |
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 = 0Copyright © 1995-2006 by Cogent Real-Time Systems, Inc. All rights reserved.