Modeling Bus Load On CAN: Master Report, IDE 1250, July 2012
Modeling Bus Load On CAN: Master Report, IDE 1250, July 2012
Musab Al Hayani
Master report, IDE 1250, July 2012
Master Thesis
Embedded and Intelligent Systems Master Program
School of Information Science, Computer and Electrical Engineering
Halmstad University
July 2012
Musab Al Hayani
School of Information Science, Computer and Electrical Engineering
Halmstad University
The Author
Jan Lindman
System Architecture (RESA)
Research and Development, Scania AB
The Supervisor
Tony Larsson
Professor of Embedded Systems
Halmstad University
The Examiner
I
Preface
This titled master thesis has been done at the Research and Development/System
Architecture Dept. in Scania Technical Center, Södertälje, Sweden as a result of my
studies at Halmstad University, Halmstad, Sweden.
I take this opportunity to thank several people who gave me their support during my
Thesis preparation days at Södertälje and during my Post graduation at Halmstad.
Deep and special thanks go first to Jan Lindman, my supervisor at Scania, for his
intensive comments, instructions, guidance, testing and tracking.
To Prof. Tony Larsson, my supervisor and examiner at Halmstad University for his
patience and unlimited explanations, valuable instructions and support.
To David Holmgren, the RESA Group Manager for his instructions and comments.
To my father, mother and wife, I have received intensive and unlimited support from
them.
Musab Al Hayani
II
Abstract
The existence of high load and latency in the CAN bus network would indeed lead to a
situation where a given message crosses its deadline; this situation would disturb the
continuity of the required service as well as activating fault codes due to delay of
message delivery, which might lead to system failure.
The outcome and goal of this thesis is to research and formulate methods to determine
and model busload and latencies, by determining parameters such as alpha and
breakdown utilization, which are considered as indications to the start of network
breakdown when a given message in a dataset start to introduce latency by crossing its
deadline which are totally prohibited in critical real time communications.
The final goal of this master thesis is to develop a TOOL for calculating, modeling,
determining and visualizing worst case busload, throughput, networks’ breakdown
points and worst case latency in Scania CAN bus networks which is based on the J1939
protocol.
SCANLA (The developed CAN busload analyzer tool in this thesis) is running as an
executable application and uses a Graphical User Interface as a human-computer
interface (i.e., a way for humans to interact with the tool) that uses windows, icons and
menus and which can be manipulated by a mouse.
The CAN Tool consists of: CAN_TOOL.fig (The Human-Tool Interface), CAN_TOOL.m,
CAN_App.m, mydatabase.m, Plotting.m, BreakDown.m, ResponseTime.m, logfiles,
associated databases and accompanying documents, such as this thesis report. This Tool
is hoped that it will be useful but without any warranty.
For a description and instructions on how to use the tool, read intensively the report.
Please let the producer of the mentioned tool know of any improvements, changes or
modifications that might be made.
III
Table of Contents
PREFACE ............................................................................................................................................................ II
ABSTRACT......................................................................................................................................................... III
TABLE OF CONTENTS.................................................................................................................................... IV
IV
CHAPTER 6. TEST RESULTS & ANALYSIS ......................................................................................... 28
6.1 TEST 1, A REALISTIC TEST BASED ON CAN LOG FILE FROM T VEHICLE ................................................ 29
6.1.1 Resulted Breakdown Utilization & alpha ................................................................................... 31
6.1.2 Encountered Latencies ................................................................................................................ 31
6.1.3 Suggested Solution ...................................................................................................................... 31
6.2 RUNNING TEST 2 ON THE REPAIRED YELLOW BUS ................................................................................ 32
6.2.1 Resulted Breakdown Utilization & alpha ................................................................................... 32
6.2.2 Discussion ................................................................................................................................... 32
6.3 REFERENCE TEST ................................................................................................................................. 33
6.3.1 Resulted Breakdown Utilization & alpha ................................................................................... 34
6.3.2 Test Inferences ............................................................................................................................ 34
REFERENCES .................................................................................................................................................... 41
List of Tables
Table 1 CAN bus bit rate / length......................................................................................................................... 9
Table 2 Test1 Resulted Breakdown Utilization & alpha.......................................................................... 31
Table 3 Test2 Resulted Breakdown Utilization & alpha.......................................................................... 32
Table 4 Ref. Test Resulted Breakdown Utilization & alpha.................................................................... 34
Table 5 Ddiagnostic Test, Resulted Breakdown Utilization & alpha .................................................. 38
V
Table of Equations
Equation 1 - - - - Message transmission time ...................................................................................................... 16
Equation 2 - - - - Message Waiting time / Relative ............................................................................................ 16
Equation 3 - - - - Message Max. Blocking time / Relative ............................................................................. 17
Equation 4 - - - - Number of message invoications ........................................................................................... 18
Equation 5 - - - - Message Busy Period ................................................................................................................... 18
Equation 6 - - - - Message Response time / Relative ........................................................................................ 19
Equation 7 - - - - Message worst case response time........................................................................................ 19
Equation 8 - - - - Message Latency time ................................................................................................................. 19
Table of Figures
Figure 1 Typical CAN Bus ............................................................................................... 5
Figure 2 Schematic Diagram of Scania CAN Bus Networks ................................................ 8
Figure 3 Standard J1939 network model ......................................................................... 9
Figure 4 Typical Format of J1939-21 Message ................................................................10
Figure 5 CAN Dominant (0) & Recessive (1) in term of Voltage ........................................12
Figure 6 Typical CAN J1939 messages arbitration ...........................................................13
Figure 7 Flowchart of the ‘Mathematical Solution’ to model CAN bus load .......................15
Figure 8 Flowchart of CAN Tool code to model bus load on CAN ......................................22
Figure 9 Snapshot of the Produced Human –CAN_TOOL Interface using of GUI ................25
Figure 10 Sample of the red bus traffic report. ..................................................................26
Figure 11 Sample of the red bus response time analysis ....................................................26
Figure 12 Sample of the different networks’ breakdown point ...........................................27
Figure 13 Sample of a green bus latency/response time plot .............................................27
Figure 14 Response Time (Test1) of Green Bus Messages Invocation 1 ..............................29
Figure 15 Response Time (Test1) of Red Bus Messages Invocation 1 .................................29
Figure 16 Response Time (Test1) of Yellow Bus Messages Invocation 1 .............................30
Figure 17 Response Time (Test1) of Yellow Bus Messages Invocation 2 .............................30
Figure 18 Response Time (Test2) of Yellow Bus Messages Invocation 1 .............................32
Figure 19 Response Time (Ref. Test) of Red Bus Messages Invocation 1 .............................33
Figure 20 Response Time (Ref. Test) of Red Bus Messages Invocation 2 .............................33
Figure 21 Response Time (Diagnostic Test) of Red Bus Messages Invocation 1...................36
Figure 22 Response Time (Diagnostic Test) of Green Bus Messages Invocation 1 ...............36
Figure 23 Response Time (Diagnostic Test) of Yellow Bus Messages Invocation 1 ..............37
Figure 24 Response Time (Diagnostic Test) of Yellow Bus Messages Invocation 2 ..............37
VI
TERMS & DEFINITIONS
CAN Controller Area Network
ECU Electronic Control Unit
SA Source Address
PG Parameter Group
PGN Parameter Group Number
COO Coordinator to isolate buses & gateway specific messages.
BP Busy Period
Tr Response Time
Td Deadline Time
Tp Cycle Time
Node Group of related functions allocated in one physical ECU
CANalyzer CAN Analyzer tool for testing & visualizing real time bus
response time
MATLAB Programming Environment
OSI Open Systems Interconnection model, which gives standard
layers for communication functions.
J1939 Heavy vehicle standard for communication over CAN bus.
TTR CAN Traffic Technical Report
Latency Time remaining (which need to be used) to finish a message
execution after its deadline
Utilization Percentage of the achieved throughput over baud rate.
Alpha Indication of how much useful slack time there is in the system
Breakdown Utilization Bus breakdown point which happens when bus start to
introduce latencies.
Priority in CAN Message Importance value statically given to CAN messages.
Blocking Time Time Delay of Message Execution due to suspension by higher
priority message or due to wait for a free resource to use
OBD On Board Diagnostic
DTC Diagnostic Trouble Code
KWP2000 Keyword Diagnostic protocol
GUI Graphical User Interface
SCANLA SCANIA CAN Bus Load Analyzer (The Produced CAN Tool)
VII
Modeling Bus Load on CAN
CHAPTER 1. INTRODUCTION
1.1 PROBLEM STATEMENT
As the development in automotive industry is growing rapidly, more sensors, CAN
signals and CAN messages are added to the vehicle CAN bus networks and therefore
more electronic control modules (ECUs) are added to those networks, which means
more CAN bus networks are added to the vehicle.
As a result higher load will be introduced and should be calculated and checked to see its
impact on CAN messages which could vary from delaying message delivery (latency) or
stop delivering of those messages.
To get a better understanding of the nature of those CAN messages in Automation, let us
assume the following examples in both hard and soft real time CAN messages; check out
the following two examples:
Ex1, if a specific hard real time CAN bus has received a load that drove some messages
to cross deadlines; in other words, latency is introduced, such as:
Failing to deliver messages of hard real time nature could lead sometimes to serious
consequences such as AirBagSgnMsg hard real time airbag message in example-1 which
is considered as a disaster to vehicle industry that could lead to multi hundred million
Krona loss as well as loss of lives, while a better case could lead to system failure such as
GearBoxTrMsg hard real time gear box change message in example-1.
Ex2, if a specific soft real time CAN bus has received a load that drove some messages to
cross deadlines; in other words, latencies are introduced, such as:
Page 1
Modeling Bus Load on CAN
The delay in delivering soft real time CAN messages is somehow tolerated but lead to
reduction in system efficiency but without dangerous consequences.
The consequences of latency in soft real time message is a reduction in the performance,
efficiency and ability to provide continuous comfort service of the vehicle such as in
WindowLeftMsgsoft real time left window motor message in example-2.
The existence of a relatively high bus load in the CAN bus will drive messages to cross
their deadlines and therefore to introduce messages latencies.
High bus load on CAN some messages will cross deadlines Latency introduced
System faults/Failure.
Latency will delay or stop delivering instructions (messages) to critical real time
communication to ECUs like BMS (Brake management system) which could lead to
system failure.
One more consequence of message latency is the setting of Diagnostic Trouble Code DTC
after a specific message delay, which is unacceptable because those codes should refer to
a system fault.
1. If we can get a response time analysis of message set that are arbitrating on the
targeted CAN bus, then we will get to know exactly whether a specific message is
introducing latency or not, therefore the dangerous consequences in section 1.1
when a hard real time message AirBagSgnMsg crosses deadlines could be
located and specified.
2. If we can tune and move that response time analysis for different cycle time of
same message set in a way that lead to get the response time analysis of
breakdown point where the CAN bus network starts for the first time to
introduce latency then we will get to know exactly the utilization point that a CAN
network shall be kept under that utilization point.
3. If we can modify the attributes of the CAN message set just prior to run the
mentioned response time analysis then we will be able to test any given
attributes and retest again in a way that fulfils the needs in our design as well as
keeping our CAN networks un hurt by latencies, therefore the dangerous
consequences in section 1.1 when hard real time message AirBagSgnMsg crosses
deadlines could be prevented.
Page 2
Modeling Bus Load on CAN
1- For hard real time CAN signals and messages, preventing system faults and failures
of latency causes (that could lead sometimes to disaster to vehicle industry).
2- For soft real time CAN signals and messages, preventing the reduction in the system
efficiency which caused by latency in those CAN signals and messages
It is important to keep all CAN messages delivered within their correspondent deadlines
to ensure the continuity of the service especially for hard real time CAN messages;
therefore I decided to built a tool that can analyze CAN networks to see its load,
breakdown load and catching latency if exists.
2- Showing latencies if they exist in the bus network. Most of normally loaded CAN bus
networks introduce latencies; while the lightly loaded CAN bus networks of course
are free from latencies. Some latencies can be tolerated while the others can’t be
tolerated and should be prevented based on the how much critical are the timing
behavior of the signals embedded in those late CAN messages).
4- Showing how much useful free slack time is there in the network
5- Testing a given network to determine by how much it could handle an extra load
The Tool should be able to model and visualize the busload and latencies of Scania CAN
buses/messages using multiple combinations of Scania’s (User Functions) Messages, and
apply them in their worst case scenario.
The ability to visualize latency of each message will intensively help to locate the point
in time when a given message or a bunch of messages would cross their deadlines and as
a result, visualizing latency would indeed help to overcome the reason behind it.
Page 3
Modeling Bus Load on CAN
Calculation of the Breakdown Utilization will give us a value which indicates how much
slack time there is in the network.
One of the main expected results is to determine parameters like ‘breakdown utilization’
and ‘alpha’ which are considered as an indications to the start of network breakdown
when a given message in a dataset starts to cross deadline which is not allowed in
critical real time communications.
MATLAB is widely used in applications like signal and image processing, control design,
communications, test and measurement, modeling and analysis, and computational
biology.
Page 4
Modeling Bus Load on CAN
CHAPTER 2. BACKGROUND
Controller Area Network (CAN bus network) is a serial communications bus network
which is basically designed and manufactured to support simple and robust
communications for Bosch’s inVehicle bus networks.
In a regular vehicle, there exists tens of thousands of unique and distinct signals and
most of them have the nature of real time and some of them are critical real time, where
the CAN bus network have replaced their thousands of point to point wiring methods
and integrated them into one to seven bus networks .
The CAN bus network is set among multiple electronics which helps translation and
interfaces between multiple systems. Those electronics include CAN gateways, CAN
embedded controllers, Hardware interface, and CAN converters.
Heavy duty vehicles did identify the CAN bus (especially the J1939 protocol) as powerful
and the most reliable bus network ever used in what is known as (inVehicle
communications).
Today every vehicle that is made in USA, Japan, Europe and Korea is equipped with at
least two CAN bus networks [1]
In some countries such as the USA, implementing and using of CAN bus network is
obligatory.
Can Device
CAN H
120R
CAN L
Ground
120R
Can Device
The above figure shows a typical CAN bus topology, here I shall say that it is necessary to
terminate the bus at both ends with 120 Ohms. Those two resistors used to prevent
reflections and to unload the open collector transceiver drivers.
Page 5
Modeling Bus Load on CAN
If we have a CAN bus network and there exist two nodes which want to transmit at
exactly the same time, then the higher priority message (higher important message) will
win the arbitration to seize the bus and therefore a guarantee to deliver a message in
CAN bus network and as a result CAN bus is a deterministic network and is preferred in
automotive communication where we have critical real time traffic which has to use a
deterministic network to communicate , while the competitor network (Ethernet) is a
nondeterministic network
5. Extremely high security level and high error detection and correction,
The CAN bus produces an extremely high security level with a high error detection
rate and we can assume that no data will be lost.
6. Continuity and reliability of the CAN bus even if node fail happens.
The CAN bus will continue to run even if one or more nodes failed and a central
node does not exist in the CAN bus network.
Page 6
Modeling Bus Load on CAN
There exist three main CAN bus networks in Scania trucks (Red, Yellow and Green which
are divided, based on their relative importance) that are interconnected with a
coordinator gateway. SCANIA in addition has some other minor CAN buses for different
purposes..
The first CAN bus network (Red Bus) is used for critical real time communications, this
bus network connects powertrain ECUs, like the engine management system EMS,
transmission management system TMS, Brake management system BMS.
The second CAN bus network (Yellow Bus) is used for less critical real time
communications that connect chassis related ECUs, like All Wheel Drive system AWD,
Locking and Alarm system LAS, Body Work system BWS, Body Chassis system BCS, and
Extension to Body Builder Truck\Bus, as well as Visibility and Air processing systems
and some other ECUs.
The third CAN bus network (Green Bus) is used for soft real time communications that
connect Body ECUs, such as RTI Road Transport Informatics System, CSS Crash Safety
System, AUS Audio System, CSS Automatic Climate Control, Auxiliary Heater System air
to air and water to air, CTS Clock and Timer System
Some ECUs that are located on different bus networks may request data\messages from
another bus network’s ECUs; it is then gatewayed through high capacity ECU known as
the Coordinator which connects different CAN buses together.
Page 7
Modeling Bus Load on CAN
Diagnostic Bus
ATA LAS
Auxiliary Heater Locking & Alarm
ISO1199212
System System
Air to Air
ICL
WTA Instrument Cluster
Auxiliary Heater System
System 7-pole
Water to Air
VIS
Visibility System
CTS
Clock & Timer
System TCO
Tachograph
System
RTI
Road Transport
Informatics APS
System Air Processing Trailer
System
RTG
Road Transport BWS
Informatics Body Wok Body Builder Truck
Gateway System
BCS
Body Chassis Body Builder Bus
System
The J1939 standard defines how information is transferred across a CAN bus network to
allow different ECUs to communicate in-vehicle message information. The J1939 could
be thought as a software specification that rides on top of a CAN bus.
Page 8
Modeling Bus Load on CAN
• 1 Mbit/s 3o m 1µs
• 500 Kbit/s 100 m 2 µs
• 250 Kbit/s 250 m 4 µs
The max line length of the CAN bus network is calculated primarily based on:
The decrease in signal amplitude due to the CAN bus line resistance
The differences in the bit time 𝒯 caused by the tolerance oscillation between CAN
nodes
Page 9
Modeling Bus Load on CAN
• SOF
It is a single dominant bit (start of frame, SOF) which marks the start of the frame
message, and the main job for this bit is to synchronize all nodes located on the bus
after idle case.
Identifier
• CAN Identifier ID
The Extended CAN consists of 29 bits identifier which determines the message priority
and identity.
The lower the identifier value, the higher the priority value.
• RTR
It is a single remote transmission request, RTR, a dominant when another node
requests information.
• DLC
It is a 4 bits data length code, DLC and it contains the number of bytes of data to be
transmitted.
• Data
1 Up to 64 bits of data to be transmitted.
Page 10
Modeling Bus Load on CAN
• CRC
It is a 16 bits cyclic redundancy check, CRC which contains the number of transmitted
bits of the data for error detection.
• ACK
It is a 2 bits field, which consists of ACK slot bit and ACK delimiter
The sender of a given frame transmits both of those bits with recessive status. While
the receiver, when it receives the message correctly, would send back to the sender by
sending a dominant bit in the ACK Slot.
• EOF
It is a 7 seven recessive bits which is known as end of frame field, EOF, and the main
job is to mark the end of a frame and to disable the bit stuffing.
The 29-Bit message identifier is partitioned into three main blocks and another 4 sub
blocks:
• 18 bits of PGN, Parameter Group Number to identify the use of the PG field, which
is divided into four more sub blocks:
Page 11
Modeling Bus Load on CAN
In the j1939 CAN bus architecture when more than one ECU starts their transmission at
exactly same time after having sensing that the bus is idle, a Carrier Sense Multiple
Access with Collision Avoidance CMSA/CD is applied for accessing the bus. Each
message has 29 bits of ID or identifier and each ECU sends bit after bit of its identifier
while monitoring the bus voltage level. As long as the transmitted bits from those ECUs
are similar, nothing happens.[12]
Volt
2.5 2.5 V
CAN Low
1.25
Time
Data 1 0 1
There are two voltage levels: the first is low and called dominant and the second is high
and called recessive. The dominant bits will always win the bus and at that time if the
ECU which transmits the recessive bit while encountering a dominant bit in the bus,
then this ECU will directly stop transmitting and wait until the bus returns to idle.
Therefore at the end, only one identifier will win the arbitration and gets the bus and as
a result we see that the lower the identifier, the higher the priority.
Page 12
Modeling Bus Load on CAN
29 bits identifier
Arbitration
Start
of Header
Control Data
Feild Feild
CAN Bus
Control Data
Feild Feild
Message 2
Loss arbitration
Message 3
1- Max busload utilization 80% of the CAN bus network (so that enough slack time
are there for diagnostic messages, error message, overload message, etc ) [13]
4- Max. 30 ECUs could participate at a time in any given CAN bus network[16]
Manufacturers have set a standard for the setting of ‘Diagnostic Trouble Codes’, after a
specific amount of time such that for wake up mode, Tdtc> Tdtc_wakeup ms while in
normal running mode, Tdtc> Tdtc_normalrun if a given a message that hasn’t got into
the bus network (deadlines crossed), those DTC Codes refer normally to either 1) a
specific system fault or 2) simply the CAN bus has been loaded to the point that
prevented a specific message from getting into the bus.
Therefore, it is recommended to examine why a given DTC Code was sat and what is the
reason behind it. Searching through scientific papers did not show such a tool to
Page 13
Modeling Bus Load on CAN
determine the breakdown utilization that helps in preventing the setting of DTC Codes
(of high load reason). Instead, the case is to examine some other factors (such as priority
level of a given message which sets the DTC code, or the cyclic speed of that given
message) and by changing those factors, this will overcome the reason and switch off
that DTC Code if the reason was a high busload which introduces latency.
Prepared by:
Prepared by:
Those above papers make it possible for a researcher to get benefits from the
Scheduability Analysis of CAN bus (first paper) which was developed to determine the
worst case response time of any message within the CAN network and as a result it
would be possible to calculate message latency (second and third papers) that are
valuable in our goal towards preventing the network from falling under non schedulable
network case.
Page 14
Modeling Bus Load on CAN
START
Assumption of
’message arrival time’
Applying the Scheduability Analysis to calculate:
o Busy period for each message
o Blocking Time for each message invocation
o Waiting Time for each message invocation
o Response Time for each message invocation
A scenario is assumed where all messages arrive at the same time, this case would
introduce the longest busy period of response time for those messages.
Page 15
Modeling Bus Load on CAN
=
Equation 1 - - - - Message transmission time
• Waiting time starts at some time when a message of priority m or higher is queued
ready for transmission and there are no messages of priority m or higher waiting to
be transmitted that were queued strictly before time and is given by the following
recurrence relation [1]
Page 16
Modeling Bus Load on CAN
= Initial value
• It is a contiguous interval of time during which any message of priority lower than m
(queuing time) is unable to win arbitration and to start transmission.[4]
• It ends at the earliest time when the bus becomes idle, ready for the next round of
transmission and arbitration, yet there are no messages of priority m or higher
waiting to be transmitted that were queued strictly before time . [1]
However, a higher priority message can be forced to wait for transmission when
message m completes transmission and therefore the busy period can become longer
due to the fact that CAN bus does apply the Fixed priority non preemptive scheduling,
therefore we have to check for multiple instances of a message m that would become
ready for transmission, just before the end of the busy period is per the recursive
relation below [1]:
Page 17
Modeling Bus Load on CAN
• The length of the priority m message’s busy period that would be examined is
given the following recurrence relation [1]
= Initial value
The relative response time of a priority m message for each instance is given by:
Page 18
Modeling Bus Load on CAN
The worst case response time for priority m message through all invocations is given by:
Page 19
Modeling Bus Load on CAN
Typically, Latency for a specific message invocation is equal to the subtraction of relative
deadline D for priority m message from its relative response time R.
Latency visualizing helps the User to know exactly how messages behave during the
wake up mode and in the run mode which is considered one of the outcomes and goals
of this thesis.
3.5.2 Definition
3.5.3 Translation
The translation of the said definition is by having for example a network with ‘existed
load= 24%’ and ‘alpha =2’ means that the breakdown point is 2x24% = 48%
a value of alpha close to but greater than 1 indicates that although the system is
schedulable, there is little room for increasing the load. The 0 value for alpha for the bus
speed indicates that no value for breakdown utilization can be found (a non schedulable
system) [2]
‘alpha’ is an indication factor of how much useful free slack time there is in the network
which an extra load could benefit from until network introduces latency, it is a
maximum value such that when the message periods are divided by alpha the system
remains schedulable (i.e. all latency requirements are met). [5]
Page 20
Modeling Bus Load on CAN
3.5.4 Possibilities
alpha=0 A non schedulable system, no value for breakdown utilization can be found
alpha=1 A schedulable system and there is no useful room for increasing the load.
alpha>1 The system is schedulable, and there is a useful room for increasing the
load based on the how much alpha is greater than 1. (The greater the
‘alpha’, the greater the useful free slack time in the network, the greater the
load we could add)
3.5.5 Modeling
We start a new simulation by running the scheduability analysis and checking the
scheduability of a network after another, If the system is schedulable (the normal case),
then we start by dividing each message cycle in a given bus network with step counter
called Beta (started with 1 and increased with a counter ‘resolution’ of 0.1) then we run
the mathematical scheduability analysis and check results, if the latency requirements
still met, continue by increasing the step counter and running the mathematical
scheduability analysis and check results until the latency introduced in the bus.
The value of that step counter at this point is our targeted ‘alpha’ of that bus and the bus
utilization at this point is the ‘Breakdown Utilization’ of that bus.
if the given network is not schedulable (the non-normal case), then its associated ‘alpha’
is equal to zero (a non schedulable system).
Breakdown utilization is the bus breakdown point, which happens when the bus starts
to introduce latencies, and computed by the percentage of max throughput (achieved
using alpha point) over the bus bit rate.
The error messages load on the bus would be neglected in calculation, error messages
are initiated when one node in the bus discovers an error in the incoming message,
because of bit error rate BER in CAN bus is equal to 3*10-11 , which could be
approximated to zero [13].
Messages with a sporadic nature, such as request messages (which are not allowed at all
in the Scania red bus) would be also neglected in the busload calculations, due to the fact
that their load is approximated to zero [9]
Page 21
Modeling Bus Load on CAN
Page 22
Modeling Bus Load on CAN
1- Data Log File is a log file that resulted from testing with CANalyzer that contains
all possible CAN message logs in the network during the period of test and it
should be in xlsx file format.
2- Diagnostic Log File is a log file that resulted from testing with CANalyzer while
initiating of all possible diagnostic functions, it should be in xlsx file format.
3- Network Database file is a database file that contains all possible CAN messages
along with its name, attribute, ID, source node, arbitration field and message type
and transmitter ECU, this file is come in xls format.
Page 23
Modeling Bus Load on CAN
4- The simulation mode allows User to interrupt the simulation, while the Tool will
be on wait, then User will get all TTR reports printed in excel on newly created
folder, so he can add, remove or modify any message attribute he may want and
then resumes simulation and modeling by changing Simulation Mode to ‘Resume
Mode’ in the main tool’s dashboard.
The first (Main) pushbutton (RUN) to run the modeling and mathematical
solution
The second pushbutton (Plotting) is to plot out the models for each bus on bmp
files
The forth pushbutton (Response Time Analysis) is to produce an xls file called
‘[Link]’ which contains tables of Response Time Analysis of all
message of each of the targeted bus networks.
The fifth pushbutton (Help & Support), clicking on this pushbutton will show a list
of topics to get help on each one by selecting with mouse.
The sixth pushbutton (Delete O/P) is to delete the produced excel TTR xls files &
Breakdown/response time analysis txt files.
The seventh pushbutton (Contact), clicking on this pushbutton will show contact
details of the producer.
Page 24
Modeling Bus Load on CAN
Tool Name and Version Tool’s Pushbuttons Main Input Edit Fields
SCANLA (The developed CAN busload modeling tool) is running from executable
application and could be installed on different computers direct from one single .exe
application file.
It is able to map different CAN bus log files that resulted of testing with CANalyzer, such
that the tool is digging deep into those log files and searches all possible data inside
them to locate and analyze all messages, even if those log files contained hundreds of
thousands of messages logs
Also it is able to access Scania CAN database and define all busses & messages
parameters including name, type, priority, timing parameters, Etc.
SCANLA (
Simulation Mode
Figure 9 Snapshot of the Produced Human –CAN_TOOL Interface using of GUI
The developed CAN busload modeling tool) is running from executable application and
could be installed on different computers direct from one single .exe application file.
It is able to map different CAN bus log files that resulted of testing with CANalyzer, such
that the tool is digging deep into those log files and searches all possible data inside
them to locate and analyze all messages, even if those log files contained hundreds of
thousands of messages logs
Also it is able to access Scania CAN database and define all busses & messages
parameters including name, type, priority, timing parameters, Etc.
Page 25
Modeling Bus Load on CAN
Figure 10 is built by analyzing data log file and mapped to CAN red database file and
contains message name, message ID, source node, relative priority, cycle time and
message type. Note that these reports could be modified by the user to build a
simulation that matches his own desire.
Page 26
Modeling Bus Load on CAN
Figure 11 is built by applying our mathematical solution to the data set of figure 10 in
order to calculate response time analysis of those data set including busy period length,
waiting time, blocking time response time and latency
Figure 12 is a showing the bus utilization of those networks tested in figure 10 and 11
and their respective breakdown utilization points.
Figure 13 shows plot of message response time and message latency in logarithmic scale
of millimeters of each message invocations during busy period of those messages tested
in figures 10, 11 and 12
Page 27
Modeling Bus Load on CAN
There exist 19 subsystems equipped in the Scania T Vehicle as per the following:
The CAN networks connecting those ECU subsystems are required to handle more than
200 messages, some of them come with sporadic nature, while most are considered
control data with fixed periodic nature and absolutely, the latency should be kept less
than an associated period. While the sporadic messages do have an offline latency
requirement that has been fixed prior to network setup, for instance all messages that
are sent due to the driver interaction to get a latency requirement of 25ms[2], that
would imply the response should show up to the driver immediately. Any given sporadic
message should be given a period that represents a maximum inter arrival rate at the
rate they may occur). [3]
Appendix 1 shows the TTR Benchmark tables of Scania T vehicle Red, Yellow and Green
bus network (messages’ requirements in order to get scheduled), those messages, some
of them do have fixed periodic, but some do come sporadically in response to an
external or internal event).
Page 28
Modeling Bus Load on CAN
Page 29
Modeling Bus Load on CAN
Page 30
Modeling Bus Load on CAN
Alpha does detail the breakdown utilization of the system for the given bus speed. While
the breakdown utilization is the largest value of alpha such that when all the message
periods are divided by alpha the system remains schedulable (i.e. all latency
requirements are met).
It is an indication of how much slack there is in the system: a value of alpha close to but
greater than 1 indicates that although the system is schedulable, there is little room for
increasing the load. The 0 value for alpha for the bus speed indicates that no value for
breakdown utilization can be found (an unschedulable system)
In figure 12 of the Yellow bus response time plot, we have notice that the following
message (refer to Appendix 1)
Message ID 0x18FFXXXX
This Message does not meet deadline requirements and is not able to seize the bus in the
desired cycle time, and it introduced latency.
Repairing the said network breakdown could be done by modifying either the cycle time
(not preferred due to strict timing behavior of its signals) or modifying the message
priority level (relatively preferred).
Message ID 0x18FFXXXX
Page 31
Modeling Bus Load on CAN
6.2.2 Discussion
We have seen in test 1 that although yellow bus utilization is relatively low, look at table
2 (about 46%), the breakdown utilization is reached and bus network starts to
introduce latency, using the tool enabled us to visualize and locate the reason behind
that breakdown, it is a critical real time message called X46 which has a fast cycle and a
relative low priority.
The tool was helpful in repairing the said network breakdown, by modifying either the
cycle time (not preferred due to strict timing behavior of its signals) or modifying the
message priority level (relatively preferred).
Page 32
Modeling Bus Load on CAN
Note: The purpose of this test is to visualize the response time of red bus messages when
the bit rate decreased to the half of its value, the response time in this case would be one
more piece of evidence of how far the network is from the breakdown point.
Page 33
Modeling Bus Load on CAN
Message ID CFFXXXX
Message ID 18F0XXXX
Message ID 18FFXXXX
The Inferences of this test are showing how the bus network would behave in the case of
reduction of its bit rate to the half value (table 4 and figure 15), in other words, it is
showing which messages are most critical with respect to the introduction of latencies
(the tool is producing complete tables of response time analysis for all messages and bus
networks).
The test helps to focus on those failed messages to try to modify their priority level in a
way to prevent red bus network from falling into breakdown.
Page 34
Modeling Bus Load on CAN
In reality, a minimum of two servers are initiated at a time, which are sending multi
packet messages with transport protocol [14], and therefore their load could be:
For a worst case scenario, there is a maximum of eight servers in the red bus, twenty
servers in the yellow bus and thirteen servers in the green bus, initiated at the same
time, which are sending multi packet messages with transport protocol and therefore
their load could be modeled as below.:
= 4.96%
= 24.8%
= 16.12%
The purpose of this test is to visualize the response time of CAN messages when a lot of
diagnostic messages/commands have been initiated, the response time in this case
would give us better understanding of how the far network is from breakdown point,
when the vehicle is under diagnostic.
Page 35
Modeling Bus Load on CAN
Page 36
Modeling Bus Load on CAN
Page 37
Modeling Bus Load on CAN
7.2.2 Discussion
We found out (figure 18 and table 5) that the following diagnostic message is on the
edge of introducing Latency; a small extra load would push it to introduce latency, refer
to alpha value in table5 which is closed to 1.
Message ID 18DAXXXX
We found out (figure 19 & 20 and table 5) that the following 7 messages are on the edge
of introducing Latency; a small extra load would push them to introduce latencies.
Also, the X46 would introduce much more latency than in TSET1
Message ID 18FFXXXX
Message ID 18DBXXXX
Message ID 18EBXXXX
Message ID 18FFXXXX
Message ID 18FFXXXX
Page 38
Modeling Bus Load on CAN
Message ID 18FFXXXX
Message ID 18FFXXXX
Message ID 18FFXXXX
We found out (figure 17 and table 5) that the following 3 messages are on the edge of
introducing Latency, A small extra load would push them to introduce latencies
Message ID CFFXXXX
Message ID 18F0XXXX
Message ID 18FFXXXX
7.2.3 Inference
The test helped us locate 11 messages that are at risk of introducing latencies (look at
figures 17, 18 & 19) in the case of a light load added to the network (resulting in alpha
value closed to 1 as in table5 and compare with table2), a good way to translate this
conclusion in reality is by modifying the priority level of those 11 messages so that they
will be located far away from that critical edge.
Page 39
Modeling Bus Load on CAN
CHAPTER 8. CONCLUSIONS
The CAN Tool developed in this thesis which run as an executable application and based
on MATLAB programming environment proved its ability to model busload for all
possible Scania bus networks, ECU and messages combinations (by showing identical
results with another results measured by SCANIA Test Department).
The Tool achieved modeling and visualizing messages latencies for each message
invocation during the whole of a busy period.
The CAN tool is able to access Scania CAN databases to define the whole buses and
messages attributes and parameters, and avoiding stimulating them manually in order
to keep the whole thing running automatically.
The CAN Tool is built with Graphical User Interface as a human-computer interface. A
major advantage of GUIs is that it makes computer operation more intuitive.
The CAN Tool is able to map different CAN bus log files a result of testing with
CANalyzer, such that the tool is digging deep into those log files and searches all possible
data inside them to locate and analyze all messages with their actual response time and
IDs, even if those log files contained hundreds of thousands of messages logs, such as the
one we used in Test1.
Page 40
Modeling Bus Load on CAN
REFERENCES
[1] Controller Area Network (CAN) Schedulability Analysis: Refuted, Revisited and Revised, Robert
I. Davis and Alan Burns Real-Time Systems Research Group, University of York, England
[2] GUARANTEEING MESSAGE LATENCIES ON CONTROL AREA NETWORK, Ken Tindell & Alan
Burns, Real-Time Systems Research Group, University of York, UK
[4] M.G. Harbour, M.H. Klein, J.P. Lehoczky. “Fixed priority scheduling of periodic tasks with
th
varying execution priority” In 18 Proceedings 12 IEEE Real-Time Systems Symposium, pp. 116-
128, IEEE Computer Society Press, December 1991
[5] J. Lehoczky. “Fixed priority scheduling of periodic task sets with arbitrary deadlines”. In
Proceedings 11th IEEE Real-Time Systems Symposium, pp. 201–209, IEEE Computer Society
Press, December 1990.
[7] Modeling and Simulation of Systems Using MATLAB and Simulink, By: Devendra K.
Chaturvedi
[8] CAN Network Utilization, Busload calculations for SESAMIM – Red Bus, RESA09002 Internal
Scania doc.
[9] Data communication requirements & control units by Magnus Gustavsson, TB4262, Internal
Scania doc.
[11] CAN (Controller Area Network) Bus Communication System Based on Matlab/Simulink,
Author: Fang Li , Issue Date : 12-14 Oct. 2008,
[12] Evaluation and Comparison of the Real-Time Performance, of CAN [Link], Gerth
[13] Vehicle data acquisition using CAN, By Henning Olsson, 8801 East Hampden Avenue Suite
210, Denver, Colorado, 80231 USA
[14] Keyword Protocol 2000 KWP2000, SSF 14230, Implementation Standard Road Vehicles -
Diagnostic Systems, Author: L. Magnusson Mecel AB
Page 41
APPENDIX A INSTRUCTIONS ON HOW TO USE SCANLA
This Tool is developed and hoped that it will be useful but without any warranty. For a
description and instructions on how to use, read intensively this sheet.
1- STARTING APPLICATION
It could be started simply by double click on [Link].
1- Data Log File is a log file that resulted from testing with CANalyzer that contains all
possible CAN message logs in the networks (CAN Messages IDs + Bus Number)
during the period of test and it should be in xlsx file format.
2- Diagnostic Log File is a log file that resulted from testing with CANalyzer while
initiating of all possible diagnostic functions, it should be in xlsx file format.
3- Network Database file is a database file that contains all possible CAN messages
along with its name, attribute, ID, source node, arbitration field and message type
and transmitter ECU, this file is come in xls format.
1- RESUME mode will run the simulation without allowing any interruption during
modeling
2- STOP mode allows User to interrupt the simulation, while the Tool will be on wait,
then User will get all CAN TTR reports printed in excel on newly created folder, so
he can add, remove or modify any message attribute he may want and then
resumes simulation and modeling by changing Simulation Mode to ‘Resume Mode’
in the main tool’s dashboard.
Page 42
4- RUNNING THE ANALYSIS TOOL
This could be done easily by clicking on the ‘RUN’ pushbutton and only after finishing
with steps 1 and 2.
Functionality
Networks’ Baud Tool’s Name Tool’s Pushbuttons Main Input
Rates & Version Help & Support Edit Fields
Simulation Mode
Snapshot of SCANLA
The developed CAN busload analyzer
Page 43
5- PRODUCING THE OUTPUT
Refer to tool’s Interface figure; there are seven pushbuttons in the Interface:
The first and main pushbutton (RUN) is to run the modeling and mathematical
solution as the first stage of in our tool (second, third and fourth pushbuttons are
only allowed after finishing with RUN).
The second pushbutton (Plotting) is to plot out models for each bus on bmp files
The forth pushbutton (Response Time Analysis) is to produce an xls file called
‘[Link]’ which contains tables of Response Time Analysis of all message
of each of the targeted bus networks.
The fifth pushbutton (Help & Support), clicking on this pushbutton will show a list
of topics to get help on each one by selecting with mouse.
The sixth pushbutton (Delete O/P) is to delete the produced excel TTR xls files,
Breakdown txt file, response time analysis txt file and the plot bmp files.
The seventh pushbutton (Contact), clicking on this pushbutton will show contact
details of the producers.
Note that for each simulation run, an automatic simulation unique number and date are
stamped for archiving purpose.
SCANLA is the name of the developed CAN busload analyzer tool in this thesis which is
running as an executable application and uses a Graphical User Interface as a human-
computer interface.
Please let the producers of the mentioned tool know of any improvements, changes or
modifications that might be made. <musab_alhidithy@[Link]>
Page 44
APPENDIX B SCANIA T, CAN TRAFFIC TTR REPORTS
Page 45
Page 46
Page 47
APPENDIX C SCANIA T, CAN RESSPONSE TIME ANALYSIS
Page 48
Page 49
Page 50