vector.com|Contact
Search tips

apple banana
Find rows that contain at least one of the two words.

+apple +juice
Find rows that contain both words.

+apple macintosh
Find rows that contain the word 'apple', but rank rows higher if they also contain 'macintosh'.

+apple -macintosh
Find rows that contain the word 'apple' but not 'macintosh'.

+apple ~macintosh
Find rows that contain the word 'apple', but if the row also contains the word 'macintosh', rate it lower than if row does not. This is "softer" than a search for '+apple -macintosh', for which the presence of 'macintosh' causes the row not to be returned at all.

+apple +(>turnover >strudel)
Find rows that contain the words 'apple' and 'turnover', or 'apple' and 'strudel' (in any order), but rank 'apple turnover' higher than 'apple strudel'.

apple*
Find rows that contain words such as 'apple', 'apples', 'applesauce', or 'applet'.

"some words"
Find rows that contain the exact phrase 'some words' (for example, rows that contain 'some words of wisdom' but not "some noise words").

By continuing to use this site you agree to the use of cookies. For more information and to find out how to change this click here. Accept Cookies
Please enable cookies in your browser for this website.
Search:
Advanced search

How to Calculate Latency of CAN Gateway

Last updated: 2020-02-06
Question:

How can I calculate the latency (time difference) between messages for CAN gateway applications with VN hardware?

Answer:

In the first instance of Tx in CAN1, EOF (timestamp) is considered.

And the SOF is considered for the first instance of Rx in CAN2.

Then the latency should be obtained by subtracting the EOF of tx from the SOF of rx.

Example:

From the screenshot we read

  • the EOF of tx = 34.996617707 s
  • the SOF of rx = 34.996633388 s

Result: Latency = 34.996633388 s - 34.996617707 s = 0.000015681 s = 15.681 µs.

Code Example:

variables
{
  message msgName msgObj_1;
  message can2.msgName msgObj_1;
  int64 endTimeTxFrame;
  int64 startTimeRxFrame;
}
on message *
{
  if(this.id==msgObj_1.id && this.can == 1) 
  {
    endTimeTxFrame = this.SOF + this.frameLen;
    write("CAN1 StartOfFrame= %I64d",this.SOF);
    write("CAN1 FrameLength= %ld",this.frameLen);
    write("CAN1 endTimeTxFrame is %I64d",endTimeTxFrame);
  }
  if(this.id==msgObj_2.id && this.can == 2 && endTimeTxFrame != 0) 
  {
    startTimeRxFrame = this.SOF;
    write("CAN2 startTimeRxFrame is %lld",startTimeRxFrame);
    write("Latency Time is %d microsconds", (startTimeRxFrame - endTimeTxFrame)/1000);
    endTimeTxFrame = 0;
  }
}

 
Article Options
2020-02-06
Views: 148