<< Click to Display Table of Contents >> Navigation: »No topics above this level« Formulas for Sample Checksum calculation |
The following formulas can be used as templates and can copied from this help file into the formula editor using copy & paste:
Formula 1 (Simulation start, initialization)
Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/Sig:Signal") = 23500;
Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/Sig:Signal1") = 125;
Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/Sig:Signal2") = 1550;
Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/Sig:Signal3") = 2000;
Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/Sig:Signal4") = 230;
Formula 2 (before sending, cyclic value change)
Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/Sig:Signal") =
Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/Sig:Signal") + 1 +
Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/Sig:Signal") / 2;
Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/Sig:Signal1") =
Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/Sig:Signal") - 1;
Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/Sig:Signal2") =
Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/Sig:Signal2") +
Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/Sig:Signal");
Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/Sig:Signal3") =
Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/Sig:Signal2");
Formula 3 (after formula 2, calculates checksum)
checksum = MsgByte("//DB/Channel:Channel/Node:ECU/Msg:Message",1)
^ MsgByte("//DB/Channel:Channel/Node:ECU/Msg:Message",2);
Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/Checksum",0) = checksum;
Formula 4 (after formula 3, manipulates signal)
Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/Sig:Signal") =
Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/Sig:Signal") - 1;
Formula 5 (after sending, verify checksum)
checksum = MsgByte("//DB/Channel:Channel/Node:ECU/Msg:Message",1)
^ MsgByte("//DB/Channel:Channel/Node:ECU/Msg:Message",2);
Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/FaultChecksum",0) =
checksum != Sig("//DB/Channel:Channel/Node:ECU/Msg:Message/Checksum");