经常需要使用CANoe分析离线数据,offline 模式下可以使用Programming Node进行数据分析,Programming Node关联一个CAPL脚本,可以使用CAPL编程进行各种处理。
/*@!Encoding:936*/
includes
{
}
variables
{
long ICM_TotalOdometer;
long ICM_VehRunningTime;
long ICM_FuelAverageConsumed;
long ODOCount;
long TripA;
int EMS_EngSt;
long wheelPulseTotal;
long wheelPulse;
long pre_wheel_pulse;
long odo_pulse_inc;
long fuelPulseTotal;
long fuelPulse;
long pre_fuel_pulse;
long fuel_pulse_inc;
long ACU_Time_Year;
long ACU_Time_Month;
long ACU_Time_Day;
long ACU_Time_Hour;
long ACU_Time_Min;
long ACU_Time_Sec;
msTimer printer;
}
on preStart
{
//NMStartOffline();
//setTimer(printer, 1000);
}
on Start
{
ICM_TotalOdometer = 0;
ODOCount = 0;
EMS_EngSt = 0;
wheelPulseTotal = 0;
wheelPulse = 0;
pre_wheel_pulse = 0;
odo_pulse_inc = 0;
fuelPulseTotal = 0;
fuelPulse = 0;
pre_fuel_pulse = 0;
fuel_pulse_inc = 0;
// setTimer(printer, 10000);
setTimerCyclic(printer, 10000);
}
on preStop
{
cancelTimer(printer);
}
on message GW_BCS_5_B
{
if (this.BCS_RLWheelSpdEdgesSumVD == 1)
{
if(this.BCS_RLWheelSpdEdgesSum >= pre_wheel_pulse){
odo_pulse_inc = this.BCS_RLWheelSpdEdgesSum - pre_wheel_pulse;
}
else{
odo_pulse_inc = 4096 - pre_wheel_pulse + this.BCS_RLWheelSpdEdgesSum;
}
pre_wheel_pulse = this.BCS_RLWheelSpdEdgesSum;
wheelPulseTotal += odo_pulse_inc;
wheelPulse += odo_pulse_inc;
ODOCount = wheelPulseTotal/43280;
TripA = wheelPulse/43280;
}
}
on message GW_EMS_1_B
{
if (this.EMS_EngSt == 1)
{
EMS_EngSt = 1;
if(this.EMS_FuelPulse >= pre_fuel_pulse){
fuel_pulse_inc = this.EMS_FuelPulse - pre_fuel_pulse;
}
else{
fuel_pulse_inc = 65536 - pre_fuel_pulse + this.EMS_FuelPulse;
}
pre_fuel_pulse = this.EMS_FuelPulse;
fuelPulseTotal += fuel_pulse_inc;
fuelPulse += fuel_pulse_inc;
}
else
{
if (EMS_EngSt == 1)
{
TripA = 0;
wheelPulse = 0;
//pre_wheel_pulse = 0;
odo_pulse_inc = 0;
fuelPulse = 0;
//pre_fuel_pulse = 0;
fuel_pulse_inc = 0;
EMS_EngSt = 0;
}
}
}
on message ACU_10_B
{
ACU_Time_Year = this.ACU_Time_Year;
ACU_Time_Month = this.ACU_Time_Month;
ACU_Time_Day = this.ACU_Time_Day;
ACU_Time_Hour = this.ACU_Time_Hour;
ACU_Time_Min = this.ACU_Time_Min;
ACU_Time_Sec = this.ACU_Time_Sec;
}
on message ICM_1_B
{
ICM_TotalOdometer = this.ICM_TotalOdometer;
}
on message ICM_2_B
{
ICM_FuelAverageConsumed = this.ICM_FuelAverageConsumed;
}
on message ICM_3_B
{
ICM_VehRunningTime = this.ICM_VehRunningTime;
}
on timer printer
{
write("20%d/%d/%d %d:%02d:%02d "
"EMS_EngSt:%d, ICM_TotalOdometer: %ld, ODOCount: %ld, TripA: %ld, "
"fuelPulse: %ld "
"ICM_FuelAverageConsumed:%d, ICM_VehRunningTime: %02ld:%02d:00",
ACU_Time_Year,ACU_Time_Month,ACU_Time_Day,ACU_Time_Hour,ACU_Time_Min,ACU_Time_Sec,
EMS_EngSt, ICM_TotalOdometer, ODOCount, TripA,
fuelPulse,
ICM_FuelAverageConsumed, ICM_VehRunningTime/60, ICM_VehRunningTime%60);
// setTimer(printer, 10000);
}
log打印如下,也可以export到文本使用其他编辑器进行分析