Skip to main content

Test Service Library: Status Report Functions

Open topic with navigation CAPL Functions » Test Service Library » Status Report Functions Valid for: CANoe DE • CANoe:lite DE • CANoe4SW DE • CANoe4SW:lite DE In order to query information about a check, generic and check specific status report functions are implemented. The general status report functions are working with all types of checks. The check specific status report functions are working only with a special part of the checks. If a check specific status report function is called for a check that does not support this function, a warning will be displayed in the Write Window.

Mode of Operation

The goal of the following functions is to give a value for the quality of the system, but the quality depends heavily on the runtime of the check. For statistical reasons, all values are derived in a way that an error event is supposed just before the check has been started and just after the check has been stopped. So the maximum time between events will never be greater than the time between the event and check start and the time between the event and check stop. At first, session 1 is performed. The red arrows are marking error events, the yellow triangles are marking particular times, the following description will refer. After the first session, the following statistical values could be queried at the time “query #1”:
  • min distance = t1
  • max distance = t2
Then the session 2 is started without resetting the check. At the time “query #2”, the following statistical values could be queried (while the check is running).
  • min distance = t1
  • max distance = t10a
After this session at “query #3”, the following results will occur:
  • min distance = t12
  • max distance = t10

Generic Status Report Functions

These functions return statistics on the number of events that any check generated since its creation or reset. They also include functions to convert the check status to a string, for logging. Generic status report functions are available for all check types. These query functions may not raise an error class that leads to a measurement stop.

Statistic Data Collection

The following functions return a timely distance given in the actual precision. The decimal places are cut. To get a value with more decimals (more exact value), the precision can be modified with ChkConfig_SetPrecision.

Generic Textual Status Report Functions

The following functions allow the easy writing of the status text to different output sinks.

Check Specific Status Report Functions

The check-specific status report functions permit querying of information that is only available for some types of checks. Which queries are possible and meaningful depend on the purposes of the individual checks. Included in the description of individual check types are definitions of which check-specific Status Report functions are supported.

MOST Specific Functions

  • ChkQuery_NumRequests: Returns the total number of requests that occurred during the current observation period.
  • ChkQuery_NumTimedoutRequests: Returns the number of requests within the current observation period for which no corresponding response message was observed during the specified timeout.
  • ChkQuery_RequestDstAdr: Returns the destination address of the request message, which last led to a protocol violation.
  • ChkQuery_RequestFBlockId: Returns the FBlock of the request message, which last led to a protocol violation.
  • ChkQuery_RequestFunctionId: Returns the FunctionID of the request message, which last led to a protocol violation.
  • ChkQuery_RequestInstId: Returns the InstID of the request message, which last led to a protocol violation.
  • ChkQuery_RequestOpType: Returns the OpType of the request message, which last led to a protocol violation.
  • ChkQuery_RequestSrcAdr: Returns the source address of the request message, which last led to a protocol violation.
  • ChkQuery_RequestTimestamp: Returns the reception time stamp of the request message, which last led to a protocol violation.
  • ChkQuery_StatAvResponseTime: Returns the average time lag between the request and corresponding response messages.
  • ChkQuery_StatMaxValidResponseTime: Returns the longest time lag between the request and corresponding response message that occurred during the current observation period.
  • ChkQuery_StatMinResponseTime: Returns the shortest time lag between the request and corresponding response message that occurred during the current observation period.

LIN Specific Functions

Asynchronous Evaluation

Special care must be taken when the checks are evaluated asynchronously and status values are to be queried. Since the values are not available in the RT kernel they need to be requested explicitly before each use. The status values are requested with the function testWaitForCheckQuery. For every status report function (for example ChkQuery_EventStatus) there is a corresponding function with the same name and the suffix _AsyncResult (for example ChkQuery_EventStatus_AsyncResult) which retrieves the requested values from the asynchronous evaluation. A call to testWaitForCheckQuery retrieves all possible status values from the asynchronous evaluation for the given check. Therefore, it is possible to query multiple values with a single call to testWaitForCheckQuery. The following example code shows how status report functions can be used for checks that are evaluated asynchronously.
dword checkId;
dword res;
double doubleRes;
int eventTimestamp;
int numEvents;
checkId = ChkStart_SignalValueChange(sysvar::TestCheckQuery::MySysVar);
// ... test execution
// query values after test execution
res = testWaitForCheckQuery(checkId, 1000);
doubleRes = ChkQuery_EventSignalValue_AsyncResult(checkId);
eventTimestamp = ChkQuery_EventTimestamp_AsyncResult(checkId);
numEvents = ChkQuery_NumEvents_AsyncResult(checkId);
Please be aware that the retrieved information should be used only at the (simulation) time when the function testWaitForCheckQuery resumed. A warning will be triggered if you use any of the TestWaitFor… functions before you actually query any of the information. The following example will give you such a warning message.
dword checkId;
dword res;
int numEvents;
checkId = ChkStart_SignalValueChange(sysvar::TestCheckQuery::MySysVar);
// ... test execution
// query values after execution
res = testWaitForCheckQuery(checkId, 10000000);
testWaitForTimeout(10);
// the following call will trigger the following warning in the test report:
// Result of CheckQuery might be outdated.
numEvents = ChkQuery_NumEvents_AsyncResult(checkId);
The function testWaitForCheckQuery together with ChkQuery_<function name>_AsyncResult can also be used when the checks are evaluated synchronously. In this case testWaitForCheckQuery returns immediately.