Professional Documents
Culture Documents
2016-01-25
SN-IND-021_GraphicalDefinitions_ExpectedCurves.pdf
Table of contents
In the table below you will find the icon conventions used throughout the Support Note.
Symbol Utilization
This icon indicates notes and tips that facilitate your work.
2 Overview
This document describes a way how to graphically define an expected value curve for checking the
behavior or outputs of an ECU.
3 Introduction
In vTESTstudio the graphical definition of expected curves can be done with the following design
steps:
Within the Waveform Editor graphically define the expected curve for each ECU output value to be
checked.
SN-IND-021_GraphicalDefinitions_ExpectedCurves.pdf 1
Graphical Definition of Curves for Expected Values
Define a test system variable for each expected curve. This is needed to provide the expected
value for checking purposes in the test code. The curve’s values are transferred to the test system
variable by a Waveform Stimulus command.
Define CAPL event handlers to trigger the check of the ECU’s output value against the expected
value. The check can be triggered either
o cyclically with a fixed period or
o when either the value to be checked (ECU output) or the expected value changes
Define a CAPL function that implements the check of the ECU’s output value against the expected
value defined in the curve.
Activate the test in the test sequence within a Test Table.
The velocity dependent locking of the door lock function as shown in the
vTESTstudio demo project “DoorControlUnit” shall be tested. The door control
unit is stimulated using a graphical definition of the vehicle’s velocity. The
expected value of the door lock signal is defined in a graphical curve as well.
The door shall be locked when the velocity reaches 50 km/h.
Use vTESTstudio’s Waveform Editor to define the velocity over the time. The velocity is used to
stimulate the ECU. Define a curve with the expected value of the signal “LockState” in the same
waveform file (“ExpectedLockState”).
SN-IND-021_GraphicalDefinitions_ExpectedCurves.pdf 2
Graphical Definition of Curves for Expected Values
To provide the expected value for the check function a test system variable, for example
“LockStateReference”, is needed. The current value at a specific point in time of the expected curve is
available as value of this test system variable.
The following CAPL code is used to perform cyclic checking of the ECU’s output value against the
expected value:
variables
{
mstimer gCheckTimer; // cyclic timer
const int gCheckCycleTime = 20; // cycle time
}
SN-IND-021_GraphicalDefinitions_ExpectedCurves.pdf 3
Graphical Definition of Curves for Expected Values
The following CAPL code is used to perform checking of the values when either the ECU’s output
value changes or the value of the expected curve changes:
variables
{
mstimer gCheckTimer; // timer to delay the check
int gTestActive = 0; // flag to indicate that the check is active
}
SN-IND-021_GraphicalDefinitions_ExpectedCurves.pdf 4
Graphical Definition of Curves for Expected Values
To perform a value tolerant check the tolerance has to be provided and used in the check expression.
The tolerance will be set in the activate function.
on timer gCheckTimer
{
char failText[255];
double minValue, maxValue;
minValue = @ReferenceValues::LockStateReference - gValueTolerance;
maxValue = @ReferenceValues::LockStateReference + gValueTolerance;
To perform a time tolerant check the checking has to be delayed for the tolerance time. To perform a
time and value tolerant check the following global variables are needed:
variables
{
int gTestActive = 0; // global test active flag
mstimer gFailTimer; // timerfor delayed, time tolerant checking
int gFailTimerActive = 0; // flag indicates that a time tolerent check
// is running
double gValueTolerance = 0; // value tolerance
long gTimeTolerance = 0; // time tolerance in ms
}
SN-IND-021_GraphicalDefinitions_ExpectedCurves.pdf 5
Graphical Definition of Curves for Expected Values
If either the value to be checked (signal “LockState”) or the expected curve (test system variable
“LockStateReference”) changes, the check will be performed. If they do not match, a delay reporting of
failure will be actived (timer “gFailTimer”), because the value may match within the time tolerance
(time before the timer ellapses). If the value matches and the timer is active (gFailTimerActive), the
value matches within the time tolerance band and the fail timer has to be canceled:
on signal LockState
{
if (gTestActive) {
if (!CheckVelocityAgainstReference())
{
if (!gFailTimerActive)
{
gFailTimerActive = 1;
setTimer(gFailTimer, gTimeTolerance);
}
} else {
gFailTimerActive = 0;
cancelTimer(gFailTimer);
}
}
}
on sysvar sysvar::ReferenceValues::LockStateReference
{
if (gTestActive) {
if (!CheckVelocityAgainstReference())
{
if (!gFailTimerActive)
{
gFailTimerActive = 1;
setTimer(gFailTimer, gTimeTolerance);
}
} else {
gFailTimerActive = 0;
cancelTimer(gFailTimer);
}
}
}
If the fail timer ellapses, the values do not match within the time tolerance band and a failure has to be
reported:
on timer gFailTimer
{
char testFailText[256];
gFailTimerActive = 0;
snprintf(testFailText, elcount(testFailText),
"CAN Signal 'LockState' == %d (Actual = %d)",
@ReferenceValues::LockStateReference, $LockState);
testStepFail(testFailText);
}
int CheckVelocityAgainstReference()
{
double minValue, maxValue;
minValue = @ReferenceValues::LockStateReference - gValueTolerance;
maxValue = @ReferenceValues::LockStateReference + gValueTolerance;
if (($LockState < minValue) || ($LockState > maxValue)) {
return 0;
}
return 1;
}
SN-IND-021_GraphicalDefinitions_ExpectedCurves.pdf 6
Graphical Definition of Curves for Expected Values
In the Test Table Editor activate the test, use the [Waveform Stimulus] command to replay the
expected curve (“LockState”) on the test system variable (“LockStateReference”) and finally deactivate
the test:
5 Example
The example project “CheckVelocityLocking.vtsoproj” contains the sources for
a test using a graphical curve for an expected value:
ValueCurves.vwf: Waveform file with expected curve for signal “LockState” and stimulation curve
for “Velocity”
CAPL code to perform time and value tolerant checking. Configure one of the following CAPL files
in the test project:
o WaveformCheckCyclic.can: Perform cyclic checks
o WaveformCheckEvent.can: Perform checks when values change
o WaveformCheck.can: Perform time and value tolerant checks when values change
VelocityTest.vtt: Test Table file to activate the stimulation and the test
Definition of the test system variable “LockStateReference” in the project configuration
The executable test unit “CheckVelocityLocking.vtuexe” can be configured in the CANoe configuration
“CentralLockingSystem.cfg” provided as demo with vTESTstudio.
6 Contacts
Please find the contacts of Vector Informatik GmbH and all subsidiaries worldwide via:
http://www.vector.com/vi_addresses_en.html
SN-IND-021_GraphicalDefinitions_ExpectedCurves.pdf 7