检测函数
CANoe为用户提供了多种检测函数(Check Descriptions),主要包括以下几个方面的检测。
(1)Signal Evaluation(信号验证):包括信号的数值有效性、周期和稳定性等检测。
(2)Message Evaluation(报文验证):包括报文丢失、周期、数据长度、错误帧等检测;
(3)Time Evaluation(时间验证):包括连续帧及超时等检测。
信号测试函数
// **checkSignalInRange** 检测信号的值是否在给定的范围内
long result;
result = checkSignalInRange(Node_SUT::Velocity, 60, 100);
if (result != 1)
{
TestStepFail("Value of signal is not in the allowed range!");
}
// CheckSignalMatch检测获取的信号值是否与输入/制定的值相同
long result;
result = CheckSignalMatch(Node_SUT::Velocity, 80);
if (result != 1)
TestStepFail("Value of signal matches not the value ‘80’!");
testfunction SignalCheck(signal * sig, float compareValue)
{
// checks if the value of the signal matches a specified value
long result;
result = CheckSignalMatch(sig, compareValue);
if (result != 1)
TestStepFail("Value of signal matches not the value");
}
// check reaction of signal “LockState” after crash
$CrashDetected = 1;
TestWaitForTimeout(100);
if ($LockState != Unlocked)
TestStepFail(“Doors are locked after crash is detected!”);
// reset test signals of node “SUT”
//用于将一个节点的所有发送信号重置到初始值
TestResetNodeSignalValues(SUT);
TestWaitForTimeout(200);
//getSignal用于获得一个信号的物理值
if((getSignal(UltraRdrSnsrWorkSts_F)== 1)&&(getSignal(UltraRdrSnsrWorkSts_R) == 1)&&(getSignal(AudBpRate)== 0))
{
result=1;
write("******1*****");
}
else
{
result=0;
write("******0*****");
}
}