Abstract

In order to contrast and analyze the real-time performance of the powertrain system of a plug-in hybrid electric vehicle, a mathematical model of the system delay is established under the circumstances that the transmission adopts the CAN (controller area network) protocol and the TTCAN (time-triggered CAN) protocol, respectively, and the interior of the controller adopts the foreground-background mode and the OSEK mode respectively. In addition, an experimental platform is developed to test communication delays of messages under 4 different implementation models. The 4 models are testing under the CAN protocol while the controller interior adopts the foreground-background mode; testing under the CAN protocol while the controller interior adopts the OSEK mode; testing under the TTCAN protocol while the controller interior adopts the foreground-background mode, and testing under the TTCAN protocol while the controller interior adopts the OSEK mode. The theoretical and testing results indicate that the communication delay of the OSEK mode is a little longer than the one of the foreground-background mode. Moreover, compared with the CAN protocol, the periodic message has a better real-time performance under the TTCAN protocol, while the nonperiodic message has a worse one.

1. Introduction

The controlling and managing system of a plug-in hybrid electric vehicle controls the main assemblies through bus and makes full use and coordination of advantages of each part, so that the vehicle can get the best operating condition. The system adopts network-based control mode, which affects the real-time performance. References [15] 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 different network-induced latency, and pointing out that it is necessary to consider network-induced delays in the choice of control algorithms. The controlling and managing system of the plug-in hybrid electric vehicle is a typical distributed real-time control system. Calculation delay of the controller interior and arbitration and transmission delay during the network communication process have a significant effect on the performance of the system. Nowadays, the mainstream bus of the vehicle distributed real-time control system is CAN bus, while the TTCAN bus is adopted in some condition asking for a high-quality real-time performance. The controller interior mainly adopts the foreground-background mode and the OSEK mode.

The delay of the bus communication can be divided into 4 parts: generating delay, queue delay, transmission, and receiving delay [6]. According to the influencing factors, the delay can be divided into two parts. The first one is on-line delay, which includes queuing delay and transmission delay. This sort of delay is related to the process of data transmitting on the network. Concretely, it is related to the priority setting of data, the type of communication network, and the protocol. The second one is on-chip delay, which includes generating delay and receiving delay. This sort of delay is related to the behaviors in controller nodes. Specifically, it is related to hardware indexes like the operating frequency and the software indexes such as the realization of the control algorithm and the task priority setting of the controller.

On the aspect of the on-line delay of CAN bus, [713] put forward the worst transmission delay and the queue delay models aimed at periodic massages. The queue delay models built by the abovementioned references are the same, while the transmission delay models are a little different. Reference [14] presents 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 nonpreemptive 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. However, there is no actual test of the delay in [14]. References [15, 16] assume that the arrival of message accords with Poisson process and take the transmission process of CAN message as an M/G/1 queuing process to be analyzed. A mathematical model of average delay of message is deduced.

On the aspect of the on-line delay of TTCAN bus, [17, 18] develop a TTCAN experimental platform which can realize the sending and receiving of massages on LEVEL1 which is stipulated by the TTCAN protocol. To periodic messages, the delay time of CAN and TTCAN bus is contrasted and analyzed through measurement. It is pointed out that the real-time performance of periodic messages transmitting on the TTCAN bus cannot be influenced by other nodes, which means that the real-time property of the network is improved. Reference [12] sends nonperiodic messages through arbitration windows. Assuming that the generating moments of nonperiodic messages accord with uniform distribution and then considering the effects of monopolized windows and free windows, a mathematical expectation model for on-line delays of nonperiodic messages with TTCAN protocol is established. The average delays of messages with different IDs are tested through experiments. After contrasting and analyzing the measured and theoretical values as well as the delay time of nonperiodic messages under CAN and TTCAN modes, it is pointed out that TTCAN protocol degrades real-time performance of the nonperiodic messages.

Most of the studies on the vehicular network delay have paid attention to the on-line delay, while they have ignored the on-chip delay [812, 1518]. They point out that the on-chip delay can be neglected for the delay of the vehicular network. If aiming at the message adopted the CAN protocol, meanwhile the processing speed of the chip is fast and the sending-and-receiving priority level of the CAN message is high, the statement can be tenable. But the on-chip delay cannot be ignored when these conditions are not satisfied. At the same time, if adopting the TTCAN protocol, the task scheduling inside the nodes need to match up with the TTCAN task window; otherwise, it will cause the exacerbation of the delay of the TTCAN message.

On the aspect of the on-chip delay based on the foreground-background mode, [8] thinks that the generating delay of messages is permanent without considering the preemption of multiple interrupts in nodes. It is stressed that the receiving delay firstly depends on the receiving mode being roll-polling mode or interrupt trigger mode and secondly depends on the multiple interrupt scheduling methods in nodes. A mathematical model of receiving delay is given out, but there is no measured delay data.

And for the analysis on the aspect of the on-chip delay based on the OSEK mode, aiming at general static embedded real-time operating system, [19, 20] point out that the RM scheduling algorithm is the best scheduling algorithm, and the schedulable rules of the RM arithmetic are given as well. References [21, 22] discuss the burden of microcontroller caused by the embedded kernel and give out the cost time of alarming, triggering tasks, scheduling tasks, and terminating tasks in the OSEK mode. Meanwhile, the worst responding time of fixed priority/first-in-first-out (FP/FIFO) scheduling policy in the OSEK mode is given, separately adopting the preemptive and nonpreemptive mechanisms. And the difference of theoretical responding time is contrasted and analyzed in the condition of considering and not considering the burdens of microcontroller caused by embedded kernel of OSEK. The difference between measured and theoretical responding time is also contrasted, taking the burdens of microcontroller caused by embedded kernel of OSEK into consideration. Then, the necessity of considering the burdens of microcontroller caused by embedded kernel of OSEK is pointed out. References [23, 24] consider that the use of OSEK model can improve the efficiency of the transplant and achieve the reuse of software modules. However, the burden added to the MCU caused by the OSEK system is not taken into consideration.

In this paper, the delay characteristic of the vehicular distributed real-time control system is analyzed, including the on-line delay and the on-chip delay. To finally achieve a better performance of the system, the overall delay model which adopts the different on-chip mechanisms and the different networking protocols is analyzed, and the cooperation of the on-chip scheduling and the network scheduling is also taken into consideration.

2. The Powertrain Network of Plug-In Hybrid Electric Vehicles

2.1. Topology Structure of the Powertrain System

The power comes from three parts: vehicle engines and power units in an APU system, power battery pack, and plug-in charging system. However, the actual power for the running vehicle is mainly supplied by the APU system and the vehicle-mounted power battery pack. The composition of the plug-in controlling system is shown in Figure 1.

In Figure 1, the light-color segments represent signal transmission, including the figure signals, analog signals, and messages on the CAN bus, while the dark-color segments represent driving connections, including high-voltage signals and mechanical connection signals. Powertrain system network is connected with CAN bus, and the transmission rate is 250 Kbits/s. The powertrain CAN network includes 5 nodes which are vehicle controller, motor controller, variable-speed controller, battery controlling system, and APU controller. In the test, they can be realized by the 5 nodes in the network hardware nodes system correspondingly in the experimental platform testing the CAN communication delay. To the driver instrument node in Figure 1, the node does not belong to the powertrain part, but the node is in the powertrain network in the real vehicle to function on monitoring and display. The node only receives messages from the network, but it does not send messages through the network. It can be realized by the upper computer nodes in the experimental platform testing the CAN communication delay, and the purpose here is to monitor the time parameter of the network message transmission.

2.2. Definition of Parameter Groups of Each Node in the Powertrain

The powertrain system of a plug-in hybrid electric vehicle consists of 5 nodes, and the setting conditions of parameter groups of each node are given out in Table 1.

According to Table 1, the powertrain CAN network transmits 44 messages with different IDs, and the priorities of messages are the same with the numbers, which means that the priority of the message ID01 is the highest and the priority of the message ID44 is the lowest. The messages include 39 periodic messages, and the longest sending period among them is 80 ms, while the shortest is 10 ms. There are also 5 nonperiodic messages whose generating process is assumed to be a Poisson process.

3. Theoretical Model of Communication Delay

The bus adopts the CAN transmission and TTCAN protocol, and the interior of controller nodes adopts the foreground-background mode and the OSEK mode, respectively, to realize the total communication delay of the powertrain distributed real-time controlling system of a plug-in hybrid electric vehicle under these 4 working conditions. Considering the specific application to be a passenger car, the vehicle communication should be corresponding to protocol SAEJ1939. Therefore, the massage form is defined as expanding frame form.

3.1. Composition of Communication Delay

Aiming at the distributed real-time controlling system based on the CAN bus, [7] gives out the composition of the communication delay of point-to-point messages, which is shown in Figure 2.

The communication delay of the bus can be divided into 4 parts, which are generating delay, queue delay, transmission delay, and receiving delay [6].

The generating delay: the period from the moment of microcontroller that sends node receiving the request from the same node to the moment of writing the prepared data into the sending cache queue of the CAN controller.

The queue delay: the period from the moment of massage entering the sending cache queue of the CAN controller to the moment of the massage obtaining controlling right of the bus.

The transmission delay is the period from the moment of massage occupying the bus to the moment of massage leaving the bus.

The receiving delay is the period from the moment of massage leaving the bus to providing the effective data to the microcontroller that receives nodes.

To describe it easier, this paper divided the communication delay into two parts: on-line delay which includes queue delay and transmission delay and on-chip delay which includes generating delay and receiving delay.

3.2. Mathematical Model of Communication Delay
3.2.1. The Model of the On-Line Delay

For the periodic message, the queue delay could be expressed with an iteration formula as follows:

In the previous formula, represents the iteration. When , the iteration is convergence, and the result value is supposed to be the average queue delay. is the gather of message frames whose priority is higher than . is the transmission period of the periodic message frame . is the maximum error of message frame s period. is the transmission delay of the message frame . is the time needed to transmit a bit on the transmission media.

The transmission delay of message is , and the transmission delay of the expending message frame is expressed as follows:

In the previous formula, is the number of bytes contained by the message data field and is an integer between 0 and 8. is a constant related to the electrical specification of the bus physical medium.

The average queue delay and transmission delay are independent of each other, and the average on-line delay is the sum of the two:

In the previous formula, is the average on-line delay.

Substituting (1) and (2) into (3), we can acquire that

To the nonperiodic messages, according to the priorities ranking from high to low, the highest-priority message is called type 1 message; the second high-priority message is called type 2 message, and so on, while the lowest-priority message is called type message.

Firstly, consider type 1 message, which means the problem of the average queue delay of messages with the highest-priority.

When a type 1 message requests to transmit on the bus, its average waiting time   is

In the previous formula, represents the average waiting time of the type 1 message, which means the period from the moment of requesting to transmit to the moment of occupying the bus. is the average remaining time of the massage that is transmitted currently when type 1 message arrives. represents the amount of the message types. is the requesting rate of type message. represents the transmission time of type message and is a random variable.

Then, consider the problem of the average queue delay of type messages.

When a type message requests to transmit on the bus, its average waiting time is

In the previous formula, , is a parameter of the Poisson process and is the reciprocal of the average servicing time.

Then, consider the transmission delay; the on-line delay of the message is

What is different from the analysis of on-line delay of the periodic CAN messages is that every periodic TTCAN message transmits in the appointed exclusive-time window, ensuring that the bus is free when each periodic massage gets triggered by scheduling the overall time. Therefore, the queue delay of the periodic message will not exist any longer. As a result, under the TTCAN protocol, the on-line delay of the periodic message is just transmission delay. Substituting into (3), the mathematical model of the average on-line delay of the periodic TTCAN message can be acquired, and is shown as follow:

Nonperiodic TTCAN messages are all assumed to be scheduled in the arbitration time window. Based on the analysis of average on-line delay of the CAN nonperiodic message, the effects of exclusive-time window and free-time window are taken into consideration. When the nonperiodic message generates in a certain exclusive-time window , it could only be sent when it is delayed to a following certain arbitration time window.

Set the number of the exclusive-time windows (or the free-time windows) within the average arriving period of nonperiodic massages to be and the length of the time window to be . In that way, the average delay caused by the nonperiodic messages which are affected by the exclusive-time window (or the free-time window) is supposed to be

In the previous formula, represents the time length of the exclusive-time window (or the free-time window) .

According to (9) and (7), the average on-line delay formula based on the queue theory should be

3.2.2. On-Chip Delay Model

In the node of the controller, the average performing time of the task can be expressed as follows:

In the previous formula, is the average performing time of task , is the set of the tasks whose priorities are higher than those of task , is the performing time of task , and is the period of task . The first part on the right side of (11) means the performing time when there is only task, and the second part means the disturbing time caused by the performing of the task with a higher priority.

The generating delay of messages means the time needed from the moment of sending node requesting to generate message to the moment of writing the generated message into the sending cache of bus controller, which means the period from the moment that the message sends the task to the moment that the task is finished in the node. Message receiving delay means the time needed from the moment that the message leaves from the bus to the moment that the carried data is provided to the target task of receiving nodes, which means the period from the moment that the message receives the task to the moment that the task is finished in the node.

4. Experimental Study of Communication Delay

4.1. Experiment Environment
4.1.1. Basic Experiment Environment

The bus adopts the CAN and TTCAN transmission protocols, respectively, and interior of the controller nodes adopts the foreground-background mode and the OSEK mode, respectively. The overall communication delay of the powertrain distributed real-time controlling system of a plug-in hybrid electric vehicle under these four working conditions is analyzed. The specific experiment environment is expressed as follows.

The bus baud rate of the communication delay testing platform is set to be 250 Kbit/s, and the expanding data frame form is adopted to write communication programs of the 5 nodes shown in Figure 1. In order to simplify the analysis process, assumptions of the node program of the vehicle controller are put forward as follows.(1)The program is divided into 5 tasks, which is used for realizing the transmission of 3 periodic messages and 1 nonperiodic message as well as the receiving of messages.(2)The controlling strategy related to each task is finished inside the task.(3)The priority of the receiving tasks of messages in the node is the highest, and the priority of tasks sending from the message equals the priority of the message.

Table 2 gives out the measured performing time of the 5 tasks of the vehicle controller nodes under the foreground-background mode.

Table 3 gives out the measured performing time of the 5 tasks of the vehicle controller nodes under the OSEK mode.

According to Tables 2 and 3, for the same task, the performing time under the OSEK mode is longer than that under the foreground-background mode, which is related to the task scheduling structure inside the OSEK system. And this indicates that load to microcontroller in the OSEK mode is larger than that in the foreground-background mode.

4.1.2. The Establishment and the Schedulable Analysis of the TTCAN Matrix Period

When the transmission protocol adopts the TTCAN mode, the matrix period, the basic period, and the width of the time window which means the transmission column width in the matrix period should be determined.

Firstly, assume that the matrix includes lines and columns. The transmission column width of a column must guarantee the transmission of a package of whole messages, and, for the expanding frame message, the width is supposed to be

In the previous formula, is the transmission column width of the column , and is the line column of the matrix period.

Length of the basic period is usually set as the greatest common divisor of all message periods, while the length of the matrix period is usually set as the least common multiple of all message periods. The calculated matrix period needs a schedulable analysis in order to explain whether the matrix period is enough for scheduling all of the messages or not. Reference [25] puts forward a sort of scheduling algorithm based on the AL (average loading) without considering the effects of nonperiodic messages. Modify the algorithm, and then give out an AL scheduling algorithm which considers periodic messages and nonperiodic messages at the same time.

In advance, is defined to be the number of periodic messages, periodic is set to be , and is defined to be the number of the periods. The number of the message whose periodic is among them is , . is the number of nonperiodic messages. It is defined that the reaching process of nonperiodic messages is accorded with a Poisson process whose average rate is . Then,

Let the width of each column in the matrix period be the same, and the width is

Let the basic period be the greatest common divisor (GCD) of the period:

Let the matrix period be the lowest common multiple (LCM) of the period:

The ratio of the message period and the basic period is

The number of the basic periods is

The number of the time window needed in a basic period is

Let be equal to 0; the largest message number which could be transmitted in a basic period is

In the previous formula, is the length of the time window of referential message.

If the schedulable condition is satisfied: then we can reach a conclusion that the message can be scheduled. According to this, the qualified matrix period can be established.

For the messages sent by each node of the powertrain of a plug-in hybrid electric vehicle which is defined in Table 1, according to (12), can be get and then substitute it to (14), and . According to (15), , and, according to (16), . According to (18), , and, according to (19), . Let , according to (20), . Therefore, the conditions of (21) are met, and then a conclusion can be reached that the message can be scheduled, and the matrix period established is shown in Figure 3.

In Figure 3, AW stands for the arbitration window, and FW stands for the free window. The matrix period includes 8 basic periods, and the length of each basic period is 10 ms, so the length of the matrix period is 80 ms. Moreover, the width of each column is the same, which is 1 ms. Nonperiodic messages ID1~ID5 are transmitted in the arbitration window.

4.1.3. The On-Chip and On-Line Combined Scheduling of the Periodic Message under the TTCAN Mode

For the periodic message, the transmission under the TTCAN mode needs the cooperation of the interior scheduling of the node and the window scheduling on the bus.

The periodic message is sent from window of the matrix period, that is, when the message is sent from line column of the matrix period. The beginning moment of window is defined as ; then, inside the node, the best beginning moment of task that is, sending periodic message is defined, which means the phase of task . It is shown as follows:

In the previous formula, is the worst performing time of task .

The cooperation of the trigger phase of the sending task and the transmission window of the corresponding message on the bus can be realized by the overall time stamp provided by the reference message. According to the trigger phase defined by (22), on one hand, it could guarantee that the data could be written into the cache before the sending window of the periodic message reaching; on the other hand, it could guarantee that the data written in the sending cache are the newest data.

4.2. Testing Results

Then, the tests of the communication delay of the powertrain of a plug-in hybrid electric vehicle are conducted in 4 working conditions separately, which are the following: testing under the CAN communication protocol while the controller interior adopts the foreground-background mode; testing under the CAN communication protocol while the controller interior adopts the OSEK mode; testing under the TTCAN communication protocol while the controller interior adopts the foreground-background mode; testing under the TTCAN communication protocol while the controller interior adopts the OSEK mode.

4.2.1. The Testing Results of Communication Delay under the Foreground-Background Mode with the CAN Protocol

Under the foreground-background mode, 3 timer interruptions control the sending of 3 periodic CAN messages, an exterior triggered interruption controls the sending of a nonperiodic CAN message, and a CAN receiving interruption controls the real-time receiving of the CAN message. Figure 4 gives out the communication delay of the nonperiodic message, and Figure 5 gives out the communication delays of the 3 periodic messages under this mode. The communication delay is the delay summation of the four parts including generating, queue, transmission, and receiving.

According to Figures 4 and 5, the average communication delay of each ID message can be acquired after the statistic analysis, which is shown in Table 4.

4.2.2. The Testing Results of Communication Delay under the OSEK Mode with the CAN Protocol

Under the OSEK mode, the sending and receiving of the message are directly controlled by OSEK tasks. The communication delay of nonperiodic messages is shown in Figure 6, and the communication delays of the 3 periodic messages are shown in Figure 7.

According to Figures 6 and 7, the average communication delay of each ID message can be acquired after the statistic analysis, which is shown in Table 5.

4.2.3. The Testing Results of Communication Delay under the Foreground-Background Mode with the TTCAN Protocol

Figure 8 gives out the communication delay of the nonperiodic message, and Figure 9 gives out the communication delays of 3 periodic messages.

For the communication delay of the periodic message shown in Figure 9, the sending and receiving delay parts are only disturbed by the sending task of the nonperiodic message inside the node, while the other periodic tasks and the receiving tasks are all finished inside their own region, which have no effect on the sending of periodic messages.

According to Figures 8 and 9, the average communication delay of each ID message can be acquired after the statistic analysis, which is shown in Table 6.

4.2.4. The Testing Results of Communication Delay under the OSEK Mode with the TTCAN Protocol

Under the OSEK mode, the sending and receiving of the message are directly controlled by OSEK tasks. Figure 10 gives out the communication delay of the nonperiodic message, and Figure 11 gives out the communication delay of the 3 periodic messages.

According to Figures 10 and 11, the average communication delay of each ID message can be acquired after the statistic analysis, which is shown in Table 7.

4.3. The Data Analysis of the Communication Delay

The following analysis results can be acquired according to Tables 4 to 7.(1)According to the measured transmission process of messages, the matrix period and the schedulable analysis proposed in Section 4.1.2 are verified to be true. The schedule of messages can be finished.(2)Under all kinds of the working conditions and modes, the theoretical and the measured results are approaches. The maximal error is just −7.78%, which indicates that the theoretical model is reasonable.(3)Under the CAN protocol, for the same message no matter it is periodic or nonperiodic, the average communication delay under the OSEK mode is longer than the one under the foreground-background mode. The reason is that the generating delay and the receiving delay (on-chip delay) under the OSEK mode are longer than the ones under the foreground-background mode.(4)Under the CAN protocol, the longest communication delay of each message under the OSEK mode is not consistently longer than the longest communication delay under the foreground-background mode, which means that the longest communication delay has more randomness than the average communication delay.(5)Under the TTCAN protocol, for the same message no matter it is periodic or nonperiodic, the communication delay under the OSEK mode is longer than the one under the foreground-background mode. The reason is that the generating delay and the receiving delay (on-chip delay) under the OSEK mode are longer than the ones under the foreground-background mode.(6)For the periodic message, no matter it is the foreground-background mode or the OSEK mode, the communication delay under the TTCAN protocol is shorter than the one under the CAN protocol. It is mainly because the queue delay of the communication delay under the TTCAN protocol is 0, which makes the integral communication delay decline.(7)For the nonperiodic message, no matter it is the foreground-background mode or the OSEK mode, the communication delay under the TTCAN protocol is much longer than the one under the CAN protocol. It is mainly because only arbitration window in the network bandwidth allows the sending of the nonperiodic message under the TTCAN protocol. As a result, the exclusive window and the free window enlarge the queue delay of the nonperiodic message and delay the transmission of the nonperiodic message, which causes the increase of the communication delay of nonperiodic messages.

The analysis results above are acquired under the conditions that the periodic message and the nonperiodic message are transmitted in the network at the same time and that the working conditions of the sending delay and the receiving delay inside the node under the foreground-background mode and the OSEK mode are considered at the same time.

5. Conclusion

Regarding the powertrain network system of a plug-in hybrid electric vehicle as the studying target, the communication delay of the message is tested. Firstly, the topological structure and the definition of the parameter set of each node of the powertrain system of this plug-in hybrid electric vehicle are given out. The bus is established adopting the CAN protocol and the TTCAN protocol, respectively, and the delay model of the foreground-background mode and the OSEK mode systems are adopted inside the node. The schedulable rules under the TTCAN protocol based on the average loading arithmetic which takes the periodic message and the nonperiodic one into consideration at the same time are established. According to the rules, the matrix period of message transmission in the powertrain system of a plug-in hybrid electric vehicle is established as well. Through the measured message transmission process, it could be acquired that the matrix period is enough to finish the schedule of messages, verifying the accuracy of the scheduling algorithm. The on-chip and on-line united scheduling problem of the periodic message under the TTCAN mode is analyzed, and the best on-chip phase of the sending task of the periodic message is defined. Then, the communication delay of the message is tested under the foreground-background mode and the OSEK mode, using the CAN and TTCAN as the transmission protocol, respectively. In the 4 working conditions above, after analyzing the test data, it could be concluded that the communication delay time of the OSEK mode is a little longer than the one of the foreground-background mode in the same condition. The real-time performance of the periodic message under the TTCAN protocol is better than the one under the CAN protocol, while the real-time performance of the nonperiodic message is worse than the one under the CAN protocol. The data of the measured average communication delay is very similar to the theoretical one, and the maximal error is just −7.78%, which means that the theoretical model is reliable.

Conflict of Interests

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

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).