Abstract

In order to analyze the online communication delay of nonperiodic CAN message, the mathematical model of average on-line delay is established based on M/G/1 queuing theory and an experimental platform is designed to analyze the delay of CAN communication, with which the on-line delays of messages with a different ID are tested at different load ratios. The results show that the model is very close to the actual situation indicating the high accuracy of the model. In the results, for the same message, the average and maximum online delays both increase with the raise of load ratio. At the same load ratio, the maximum on-line delay increases with the decrease of the message priority, and the average on-line delay remains almost unchanged.

1. Introduction

The vehicle distributed real-time control system is a specific application of distributed real-time control system, which is a closed-loop feedback control system consisting of a sensor, a controller, and an actuator on a real-time network. Its network medium is generally shared by several control loops which is obviously different from the traditional mode. This type of networked control mode is superior to the traditional point-to-point centralized control mode, because of its sharing of information resources, much decrease of connecting wiring harness, digitization and modularization of control assembly and components, and being easier to expand and maintain as well as high efficiency, reliability, and flexibility, and so forth [19]. On the other hand, the use of networked control impacts on system performance. References [1014] analyze the relationship between network-induced delays and system performance, introducing network-induced delay in the system modeling, considering the network-induced delays and random data missing occurrence, analyzing the problem of stability control under a different network-induced latency, pointing out that it is necessary to consider network-induced delays in the choice of control algorithms.

In the network control system, apart from the transmission of the time-triggered periodic message, the event-triggered nonperiodic message is suggested to be taken into account. The generation of nonperiodic message is not related to time and as a result its transmission delay cannot be analyzed according to the transmission mode of periodic message. Nonperiodic message generally is not the regular input and output information in the network control system. Its generating frequency is much lower than the periodic one. If this type of message is sent as periodic message, the load of the network will get greatly increased. However, this type of message is usually some detection data of the system, like the warning message. Therefore, the request for the reliability and real-time performance is much higher than the periodic one. For example, considering the warning signal of the battery in the monitoring system of an electric vehicle, the sensor sends a binary warning signal when the battery breaks down. If this message could not be sent to the monitoring center in time, the consequence caused is more serious than the transmission problems caused by regular controlling information (like rotate speed, electricity, etc.). Therefore, there is a high necessity to analyze the transmission delay of nonperiodic message.

Nowadays, the mainstream bus of the vehicle distributed real-time control system is Controller Area Network (CAN) bus. The delay of CAN communication can be divided into four parts: generating delay, queue delay, transmission delay, and receiving delay [15]. Considering that the queue delay and transmission delay are related to the process of message transferring on the bus, these two parts should be defined as on-line delays. In order to obtain the communication delay of nonperiodic CAN message, two problems need to be figured out. First of all, what kinds of laws are the generating process of nonperiodic message consistent with? Secondly, what characteristics dose the queue process possess when the nonperiodic message with specific generating laws transmits on the CAN network? Scholars around the world have already done some research work on the communication delay of nonperiodic CAN message [1532].

References [1519] take the nonperiodic message as periodic one and consider the minimum value of interval time between two transmissions of the message frame as its period. References [2023] utilize a dynamic priority strategy to enhance the real-time performance of nonperiodic message. Reference [24] adopts the time-triggered mode and analyzes the scheduling and real-time problems of CAN. Reference [25] builds an experimental platform for analyzing the real-time performance of CAN. Reference [26] assumes that the occurrence of error frame accords with Poisson process and analyzes the influence on network-induced delays caused by error frames; nevertheless, there is only theoretical analysis but no experimental data. Reference [27] analyzes the waiting time and the length of the queue of messages applying the M/M/1 queuing process but does not provide corresponding experimental data. References [28, 29] do not differentiate between periodic and nonperiodic messages and uniformly adopt an M/G/1 queuing process to establish the mathematical model of average delay. Reference [30] puts forward a buffered estimation method aimed at the System on Chip (SoC) based on a priority-ranked queuing model and builds a buffered queuing model. The queue is an M/G/1 queue with several different client levels and non-preemptive arbitration. A mathematical model of average waiting time is deduced, which can provide some reference value for us to build the average waiting time model of the nonperiodic message on CAN bus.

In this paper, a mathematical model of average on-line delay of nonperiodic message is built using the queuing theory. Moreover, on-line delays of messages with different priorities at different load ratios are tested separately. After analyzing and contrasting the measured and theoretical values, basic characteristics and laws of the on-line delay of nonperiodic CAN message are acquired.

2. Basic Introductions about Online Delay of Nonperiodic CAN Message Modeling

2.1. Markov Process and Poisson Process

In classical mechanics, the track at a given moment can be solved using the state at some moment without knowing the state before moment . Such principle can be adopted in systems following probability rules but not decisive rules, which means when the state of the process at moment is known, the state at moment dose not correlate with the state before moment . Such feature that there is no relationship between “future” and “past” with the knowledge of “present” is called Markov property or nonaftereffect property. A process possessing this property is usually called a Markov process.

A Markov process is an important type of random process in both theory and in practical applications. It is widely applied in network simulation [31].

As for a Markov process, the following definitions should be given.

A random process is present; if considering any moments of the parameters, , then this random process can be called a Markov process. The property shown by expression (1) is named Markov property or nonaftereffect property.

The value of in the Markov process is called state. means that the process is in a state at a moment , and the whole value set in the process is called state space. If both the parameter set and the state space are discrete Markov processes, it can be called a Markov chain.

A Poisson process is defined as follows.

If the counting process that takes nonnegative integer value meets the following conditions:(1);(2)having independent increment;(3)for any , is accorded with the Poisson distribution whose parameter is ,

Then the random process is called a (homogeneous) Poisson process whose parameter (or average ratio, intensity) is .

The following processes are typical cases of Poisson process. During the time interval .(1)The number of customers arriving at a supermarket .(2)The number of machines breaking down in a workshop .(3)The number of error codes in a communication system .

Suppose to be the number of times of event happening during the interval , to be a Poisson process with a parameter and to be the moment of the event happening the 1st, 2nd, …, time. represents the waiting time until the event happens the time, and represents the separation distance between the and the appearance,

As can be proved, the variables in the interval sequence are all independent and identically distributed random variables, which are changed by exponential distribution with a parameter ,

2.2. Queuing and Serving Process

Queuing is a common phenomenon in our daily life. For example, people queue up to wait for buses when on and off duty and customers line up to shop in the stores. Obviously, the queue consists of two parties. One party asks for getting service and the other party tries to provide service. The people or things (like equipments) that require service are generally called customers and the service staff or service agency that provide service is called service staff or service counter. Then the customers and the service counter form a queuing and serving system, which can also be called a stochastic service system.

A queuing system is determined by many conditions. While for the sake of simplicity, 3~5 English letters with diagonal lines between them are usually used to indicate a queuing system. The first letter represents the distribution pattern of input variables, the second one represents the distribution pattern of the service time, the third one represents the number of service counter, and the forth one represents the capacity of service system. Sometimes a fifth letter may be used to represent the customer number in the customer source. M/M/1 means that the input process is a Poisson current, the service time follows a negative exponential distribution, and the system has only one service counter. The M/M/1 queuing and serving system has a quite good Markov property at any moment. M/G/1 means that the input process is a Poisson current, the service time is independent and follows a probability distribution, and the system has only one service counter, whereas M/G/1 queuing and serving system has the Markov property only at some special random moments but not any moment. These random moments are called regeneration points which means that the system restarts since the moment. Utilizing regeneration points, a common queuing and serving system can be turned into a Markov chain and get solved with relevant methods. This kind of method is called imbedding Markov chain approach [32].

In an M/G/1 queuing and serving process, the customers arrive in Poisson current whose parameter is , which means the sequence showing interval time of adjacent arrival is independent and is accorded with negative exponential distribution.

The sequence of the service time that customers need is independent and follows a general distribution , and is taken as the average service time. There is only one service counter in the system. When a customer arrives, he can accept service at once if the counter is free. Otherwise, he should wait in line and accept service according to the arrival order. He leaves the new system as soon as the service ends. In addition, the arrival process and the service process are still independent of each other.

Set to be the number of customers in the system (the queue length) at the moment . In an M/G/1 queuing system, considering that the service time follows a general distribution, the service for a customer who is accepting his service at an optional moment could be unfinished. Because the remaining service time distribution does not have the no-memory property any more since the moment , the queue length does not have Markov property consequently. However, if is set to be the number of the customers left in the system when the customer finishes his service and leaves, which means the rest queue length, , it can be proved that the sequence is a Markov chain and should be called an imbedding Markov chain of the queue length process . It can also be proved that the necessary and sufficient condition of the chain being positive recurrence is . When the chain is positive recurrence, it is acknowledged that the sequence owns the only stationary distribution,

As can be proved, when , the limit of the -step transition probability of the imbedding Markov chain always exists and is a positive value which does not depend on the initial state. That is to say, it is a stationary distribution. When , no matter how large the positive integer is, the probability of the number of customers left in the system as the customer finishes his service and leaves is always tending to 0 . This indicates that the queue will get longer and longer and the system cannot reach a statistical balance. In an M/G/1 queuing system, if , then the generating function of the stationary distribution , is

Thereinto, .

Assume that customers get served according to the first-come-first-serve (FCFS) rule and set and to represent the waiting and stay time distribution under the statistical balance; the inverse Laplace transforms of them are

Then the specific expressions of and in an M/G/1 queuing system are deduced under the condition .

Apparently, under a statistical balance, the number of customers left in the system as a customer finishes his service and leaves equals the number of customers reaching the system during his stay, which means

Therefore,

According to the formula (7) and (10), it can be deduced that

Set and the following expression can be obtained:

The stay time equals waiting time plus service time , which means . Moreover, and are independent of each other. Therefore,

According to the formula (12) and (13), the following expression can be obtained:

Based on the formula (14), utilize the inverse Laplace transform,

Thereinto, represents the equilibrium distribution of service time , and is the -fold convolution of , .

According to the formula (15), under the condition , the average waiting time of the M/G/1 system is supposed to be

Thereinto, represents the random variable of service time.

Formula (16) expresses the average waiting time deduced under the FCFS rules which can be divided into two parts,

Apparently, the first part on the right side of the equal sign in the formula (17) means the waiting time of customers existing in the queue when a new customer arrives, and the second part represents the current customer’s average rest service time when a new customer arrives. Under the FCFS rules, it can be deduced that when a new customer arrives, the current customer’s rest service time is supposed to be

Because the average stay time equals average waiting time plus average service time, the average stay time is

3. Modeling for Online Delay of Nonperiodic CAN Message

The average on-line delay time of nonperiodic message in a CAN bus system can be figured out with the knowledge of queuing theory. The CAN bus communication system is taken as a queuing and serving system. Each node that sends information frame is the generation source of information. According to the analysis in Section 2 as well as some relevant introductions in [28, 30], the nonperiodic message’s generation process on each node is a Poisson process. The intervals of the node’s request correspond to the customers’ arrival intervals, the transmission time of the bus after node’s request corresponds to the service time in queuing theory, and the CAN bus corresponds to a service staff. As a result, the system can be described to be a queuing model which is shown in Figure 1, and nodes can be taken as the arrival sequence of customers.

The features of the queuing model include the following ones.(1) arriving currents in the queuing model share one public queue and the queue network is open loop. (2)Customers have grade identification and the priorities are from high to low. The service mechanism adopts non-preemptive discrimination with priorities. (3)The arrivals of customers are all Poisson arrivals, and the speed of the arrivals are .(4)To enhance the adaptability of the model, it is assumed that the service time follows a general random distribution. The average service time for customers in different levels is .

In conclusion, the response time model for nonperiodic messages in a CAN bus system can be taken as a non-preemptive priority M/G/1 queue.

Meanwhile, the following instructions for message transmitting in CAN bus are put forward.(1)For real-time information, there is no local queuing delay, which means that there is no sending buffer for the message with the same ID. (2)Considering the transmission process of the protocol frame with the priority and the uniqueness of identifier of CAN protocol frame, and there are no local queues, the time from a CAN message’s reaching the network queue to getting sent successfully consists of two parts. One part is called blocking time that represents the remaining transmission time of the message who is getting transmitted as the frame arrives at the network. Another part is the interference time of the protocol frames with higher priority reaching the network during this period of time. (3)According to the message priority, the message with the highest priority is called class 1 message and the one with a higher priority is called class 2 message. And so on, the message with the lowest priority should be class message.

Firstly, considering class 1 message, which means the average queue delay problems of highest priority messages.

When a class 1 message requests to pass the bus and transmit, its average waiting time is expressed as follows.

(1) When a message requests to transmit, the remaining transmission time of the messages (regardless of its priority class) who are transmitting through the bus is supposed to be

Thereinto, represents the average waiting time of the class 1 message which means the time quantum from requesting for transmission to taking the bus and represents the average remaining time of the messages who are transmitting when the class 1 message reaches.

According to the formula (18), the average remaining service time of the current customer is supposed to be

Thereinto, represents the sum of message categories, represents the request speed of class message, and represents the transmission time of class message which is a random variable.

Then, take class 2 message into consideration, which means the average queue delay problems of higher priority messages.

When a class 2 message requests to pass the bus to transmit, its average waiting time is expressed as follows.(1) is the remaining time of the messages (regardless of its priority class) who are taking the bus to transmit when the message requests for transmission.(2)The total transmission time of class 1 messages in the queue before the message’s arrival is supposed to be (3)The total transmission time of class 1 messages that reach during the message’s waiting period is supposed to be

According to the formula (20), (22), and (23), it can be deduced that the waiting time of class 2 message is to be

Finally, consider the average queue delay problem of the class message.

When a class message requests to transmit through the bus, its average waiting time is derived in the following possibilities:(1) is the remaining time of the messages (regardless of its priority class) who are taking the bus to transmit when the message requests for transmission. (2)Before the mentioned class message arrives, the total transmission time of messages with priorities higher than is defined as : (3)During the waiting period of the mentioned class message, the total transmission time of the arriving messages whose priorities are higher than , is defined as : According to the formulas (25), and (26), it can be deduced that the waiting time of class message is to be

Then consider the transmission delay of messages, the on-line delay is supposed to be which is corresponding to the customer’s average sojourn time in the queuing theory. In this paper, extended data frame is adopted. The first part of the right side of formula (28) can be computed according to the following expression:

Thereinto, represents the byte numbers included in the data field of message , which should be an integer between 0 and 8. All eight bytes of data field are used in the paper, so the value should be 8. represents a constant related to electrical specifications of physical media of a bus and the value for per meter length of shielded twisted-pair cable could be 5 ns. represents the time that is needed for a data bit to transmit on the transmission medium. The Baud rate of the network in this paper is 250 kbit/s, so the value for should be 4 μs.

4. Testing Analysis of Communication Delay of Nonperiodic CAN Message

The trigger process of actual working conditions are simulated under the circumstance of taking the external event trigger mode as the trigger mode of nonperiodic CAN messages. The specific way to carry out is described concisely. Firstly, a pulse signal whose interval is an index distribution with a parameter is built. Then the pulse signal is plussed to the external interrupt interface of the singlechip and trigger CAN messages according to the level of fluctuation of the interface. Finally, the communication delay of nonperiodic CAN message at different load ratios is analyzed by changing the value of parameter .

4.1. Topological Structure Design of Test Platform

In order to test and verify the above-mentioned mathematical model for online delay during the process of periodic messages transmitting in the bus, an experimental platform is developed and designed to test the communication delay of CAN message, which is shown in Figure 2. Meanwhile, Figure 3 is a real photograph of using the experimental platform.

The experimental platform consists of computer network node system and network-induced delays testing system. The node system is made up of 5 CAN controller nodes. All nodes are designed by ourselves and the structures are exactly the same. The testing system is used to track the sending and receiving process of CAN message. The system uses a CAN network analyzer SE70000 from company NEC to finish the test, with which the sending and receiving process of message, recording the sending and receiving moment of message, recording the message ID, and counting the average and peak load ratio of the bus and some other functions can be realized.

4.2. Testing Results of Online Delay at Different Load Ratios

The test and analysis is carried out on the experimental platform for testing communication delay of CAN message which is shown in Figure 2. The on-line delays of messages with a different ID at different load ratios are tested in an actual communication process and are compared with the theory model for on-line delay which is built in Section 3.

4.2.1. Testing Results of Online Delay at a Load Ratio 13.33%

The load ratio being 13.33% is measured by SE70000. Under such working condition, the data of network part measured in real time is shown in Table 1.

Every actual receiving moment of message with a different ID is obtained. Apparently, the difference between two receiving moments of the same message is the actual receiving interval. The difference between the actual receiving interval and the actual trigger interval is the queue delay in the transmission process. The transmission delay in the transmission process of message with different ID can be tested with an oscilloscope. The sum of the measured transmission delay and the queue delay should be the on-line delay of message. The measured on-line delays data of messages with a different ID at a load ratio 13.33% are shown in Figure 4. The abscissa of the figure represents the sending times of message. 300 sets of data are tested totally, which means that the message with a same ID transmits for 300 times. And the ordinate represents the on-line delay size of transmission process with a different ID. After statistics and analysis, the average on-line delays of messages with different ID are acquired as well, which are shown in Table 2.

In Table 2, the theoretical average on-line delay is computed according to the formula (28). As can be seen in Table 2, the maximal difference value between the theoretical value and the measured value is 5.38%, which indicates that the theoretical average on-line delay model is practicable and has a high accuracy.

4.2.2. Testing Results of Online Delay at a Load Ratio 27.64%

The measured on-line delays data of messages with a different ID at a load ratio 27.64% are shown in Figure 5. After statistics and analysis, the average on-line delays are acquired as well, which are shown in Table 3.

In Table 3, the theoretical average on-line delay is computed according to the formula (28). As can be seen in Table 3, the maximal difference value between the theoretical value and the measured value is 7.89%, which indicates that the theoretical average on-line delay model is practicable and has a high accuracy.

4.2.3. Testing Results of Online Delay at a Load Ratio 37.92%

The measured on-line delays data of messages with a different ID at a load ratio 37.92% are shown in Figure 6. After statistics and analysis, the average on-line delays are acquired as well, which are shown in Table 4.

In Table 4, the theoretical average on-line delay is computed according to the formula (28). As can be seen in Table 3, the maximal difference value between the theoretical value and the measured value is 18.50%, which indicates that the theoretical average on-line delay model is practicable and has a high accuracy.

4.3. Analysis for Testing Data of On-Line Delay

Charts are drawn to show the measured average and maximal values of on-line delays of messages at different load ratios based on Tables 2 to 4 and Figures 4 to 6, which are shown in Figures 7 and 8.

The analysis results are given based on Tables 2 to 4 and Figures 7 to 8. (1)The average on-line delay values calculated with the mathematical model is very close to the measured ones for the messages with all priorities at three kinds of load ratios. The maximal error is 18.50%, indicating that the theoretical model is reasonable. (2)For the same message, the measured average and maximal on-line delays are both increasing with the increase of load and reaching speed, which means that it conforms to the law that on-line delay increases when the load increases. (3)To the same load, the priority has little impact on the average on-line delay. This phenomenon indicates that the queue delay for nonperiodic message comes from no arbitration delay mostly, which is in line with the characteristic of small trigger probability in the same phase position for nonperiodic message. (4)The on-line delay of message consists of queue delay and transmission delay. For the extended frame message whose data field is 8 bytes, the length of a single frame is generally the same and the difference of transmission delay is small. Queue delay consists of arbitration delay and no arbitration delay. The arbitration delay means the delay of the message with a lower priority caused by the one with a higher priority when two messages are sent simultaneously, which includes the arbitration delay in the nodes and the one on the bus. The arbitration delay is related to the message priorities. The no-arbitration delay is a delay for the message frame because of there having been other message frames transmitting on the bus (no matter the priority of the message is high or low). The no-arbitration delay is independent of the message priorities. At a low load ratio, the probability for several messages triggering at a same phase position is extremely small. That is to say, priority has little influence on the maximal on-line delay value. While at a high load ratio, the probability for several messages triggering at the same phase position increases, which is to say, priority has a large influence on the maximal on-line delay value. Therefore, the priority affects the maximal on-line delay value a little at a low load ratio but a lot at a high load ratio. This result indicates that the probability of messages with a different ID getting triggered at the same time increases with the increase of load, which results in the message with a high priority getting arbitration and then reducing the on-line delay. (5)In a few cases, the on-line delay of the message with a higher priority is higher than that with a lower priority at the same load ratio. This is because the transmission cycle is different for each message. Then the collision chance of some higher priority message is great, making the no-arbitration delay of higher priority message high. (6)In a few cases, for the same message, the maximal on-line delay decreases with the increase of the load ratio. That is because the probability of collision is related to message’s transmission interval and transmission phase. The increase of the load does not guarantee more collision chances of multiple messages at the same time. Consequently, the condition of low on-line delay at a high load ratio for a message could happen. (7)The average on-line delay can reflect the trend of load ratio affecting on-line delay better than the maximal one.

5. Conclusion

In this paper, a Poisson process is adopted to simulate the reaching process of nonperiodic message in vehicle network system and a mathematical model is built to analyze the average on-line delay of nonperiodic real-time CAN message based on queuing theory. In addition, the reliability of the model is tested and verified with the measured data. For the messages with each priority at different load ratios, the values of average on-line delays which are computed by the mathematical model are very close to the measured values. That is to say, the theoretical model is quite reasonable. To the same message, the measured average and maximal on-line delays are both increasing with the increase of load and reaching speed, which means that it conforms to the law that on-line delay increases when the load increases. To the same load, the priority has little impact on the average on-line delay. This phenomenon indicates that the queue delay for nonperiodic message comes from no arbitration delay mostly, which is in line with the characteristic of small trigger probability in the same phase position for nonperiodic message. The priority affects the maximal on-line delay value a little at a low load ratio but a lot at a high load ratio. This result indicates that the probability of the messages with a different ID getting triggered at the same time increases with the increase of load ratio, which results in the message with a low priority losing arbitration and then increasing the on-line delay.

Conflict of Interests

The authors declare that there is no conflict of interests regarding the publication of this article.

Acknowledgments

This work is sponsored by the Aerospace Support Technology Fund (2013-HT-HGD09), the National Laboratory for Electric Vehicles Foundations (NELEV-2013-004), Shandong Province Outstanding Young Scientists Research Award Funds (BS2012NJ001), and Beijing Science and Technology Project (Z121100005612001).