1

I am using CANalyzer 7.0 and an trying to figure out how to determine in CAPL if the CAN bus has gone to sleep (no more messages being sent). How can I do this?

I tried to read BusLoad using sysGetVariableInt() but it always returned zero. Perhaps I had the wrong namespace/variable name. Where can I find all system variables?

Edit - I've tried this:

BusLoad = sysGetVariableInt("_Statistics", "CAN1::Busload");

I've also tried changing the namespace but not sure where to find list of system namespaces.

SimpleOne
  • 1,066
  • 3
  • 12
  • 29
  • To check whether you had used the wrong namespace, it would be very helpful if you could share what you have done. Please show your code. – MSpiller Aug 02 '20 at 12:56

1 Answers1

1

Accessing statistics via system variables was introduced with CANalyzer/CANoe version 8.0.

As your are using version 7.0, try the following:

BusLoad = canGetBusLoad(1);

Starting from version 7.1, you would use:

BusLoad = CAN1.BusLoad;

From 8.0 onwards, you can use the systemvariables as in your initial question.

To answer your second question, you can get a list of all system variables from the Symbol Explorer.

MSpiller
  • 3,500
  • 2
  • 12
  • 24
  • Thanks...I get a parse error when I try ```CAN1.BusLoad```. Also, I don't seem to have a Symbol Explorer in my CAPL browser – SimpleOne Aug 03 '20 at 11:08
  • I don't now, when the symbol explorer was introduced. Maybe that was after version 7.0. What exactly does the parse error say? – MSpiller Aug 03 '20 at 11:09
  • It just says 'parse error' and it highlights the '.' in ```CAN1.BusLoad``` – SimpleOne Aug 03 '20 at 11:11
  • I just checked the documentation `CAN1.BusLoad` was only introduced in 7.1, sorry for that. You have to use `canGetBusLoad(1)`. I have edited the answer. – MSpiller Aug 03 '20 at 11:15
  • Sorry, it says that is an unknown function – SimpleOne Aug 03 '20 at 11:17
  • Then, the last resort would be, that you open the documentation of CANalyzer 7.0 and search for _BusLoad_. I only have the docs of version 10.x at hand and there it says, that `canGetBusLoad` should work in 7.0 – MSpiller Aug 03 '20 at 11:19
  • Searching for BusLoad only mentions MOST related functions so it seems that is not available in my version. Is there another way to know if BUS is asleep (no more messages)? – SimpleOne Aug 03 '20 at 11:31
  • The only other option would be, that you do the complete statistics yourself. I.e. count the messages per time and by that calculate the bus load. `canGetBusLoad` cannot be found in the documentation? – MSpiller Aug 04 '20 at 13:08
  • Thanks...I think I may have to write my own function then I guess. No, ```canGetBusLoad``` is not in the docs – SimpleOne Aug 05 '20 at 09:19