CHAPTER 5 Quotient Remainder Compression Algorithm for CAN based VCN 5.1 Introduction Increasing the number of ECUs in a CAN based VCN creates problems as there is increase in busload. One of the solutions is the use of DR techniques (Sections 2.3 and 2.4). Sections 5.3 to 5.7 describe a new DR algorithm, Quotient Remainder Compression algorithm (QRC) for VCN using CAN. 5.2 Motivation for Development of DR Algorithms A DR algorithm enables reduction of busload on CAN in a VCN and gives a greater chance to the lower priority messages to get bus access and increases the probability of these messages reaching the destination in time. DR algorithms reduce the time taken by the messages on bus thus also reduce noise on the bus. [94], [96][101]. Motivation for developing a new DR algorithm is to find a better method for reduction in busload and also find the situations in which new algorithm functions better than the earlier ones. ECUs in automotives communicate with each other through serial communication buses such as CAN bus. Automotive parameters are transmitted among the ECUs in the VCN. Examples of parameters transfer on a CAN bus are Oil temperature, tyre pressure, gear position and engine speed, etc. These parameters change over time. It is required that this change in parameter value is communicated to target ECU(s) well before the deadline. QRC aims at reducing the size of these parameters before they are sent on the CAN bus and at the receiver, retrieving the parameter exactly without any loss. 5.3 Quotient Remainder Compression Algorithm (QRC) [72] 5.3.1 Introduction and Types of Parameters QRC uses the first byte of data field in the CAN data frame, similar to that used by EDR [101]. However, QRC completely differs in usage of additional bits provided 85 per parameter. QRC uses the basic idea of division and hence the name QRC (Quotient Remainder Compression) algorithm. Data field of CAN data frame is of the size of 8 bytes [16]. First byte of the data field will be called Compression Information Byte (CIB) by QRC. The remaining seven bytes will contain the parameter values in some form depending upon whether there is compression or not. Algorithm groups the parameters into two categories. GE5 Parameters: These parameters are of size 5 bits or more. E.g., 6 bits, 10 bits, i. 12 bits or 16 bits. A GE5 parameter might represent engine temperature, tyre pressure or vehicle speed of the automotive. Parameters grouped under this category are QR (Quotient Remainder) compressed. The QRC can provide up to 40% compression with 60% bits overhead, for the parameter size of 5 bits. For the parameters below 5 bits in size, the overhead is greater than 60% hence not considered for QR compression. L5 Parameters: These parameters are less than 5 bits in size. They will be ii. indicating the status of gear, fuel level indicator, etc. in an automotive. These parameters are not QR compressed. 5.3.2 Types of Compressions in QRC Compression of the parameters occurs at transmitter node and decompression occurs at the receiver node. Initially, all the parameters in the message are sent completely. The QR compression starts only from the next cycle. Every GE5 or L5 parameter is allocated one bit from CIB. Consider GE5 parameters: Logic ‘1’ for the allocated bit in CIB indicates that the corresponding parameter is either QR compressed or fully compressed. When CIB bit allocated to a GE5 is at Logic ‘0’, then the GE5 parameter is not compressed in any form and sent completely or sent uncompressed. Details of QR compression and full compression are as follows. QR Compression: This happens when the parameter value is changed from its earlier value and falls within the compression range. Then the parameter becomes eligible for QR compression. The details of QR compression technique are given in Section 5.3.3. Full Compression: This happens when the parameter is not changed from its earlier value. Therefore, the GE5 parameter is not sent in this type of compression. 86 Consider L5 parameters: Logic ‘1’ for allocated bit in CIB indicates that the parameter is not sent, as its current value is same as the earlier value. This is called full compression. Logic ‘0’ for the allocated bit in CIB indicates the corresponding L5 parameter is sent completely or sent uncompressed. Fig. 5.1 shows the data field of CAN data frame interpreted for QRC. Author considers four GE5 and L5 parameters. Fig. 5.1 shows all the CIB bits are zeros indicating all parameters transmitted in uncompressed form. The actual parameters follow the CIB bits. The CIB definition is same as that of Data Compression Code (DCC) of EDR [101]. Four GE5 parameters are of 10-bits, 12-bits, 10-bits and 16-bits and called as Para1, Para2, Para3 and Para4. Four L5 parameters are of 2-bits, 2-bits, 3-bits and 1bit in size and called as BPara1, BPara2, BPara3 and BPara4. The arrangement of parameters is such that four L5 parameters follow the GE5 parameters. The reason for considering such combination of parameters is that when the GE5 and L5 parameters are sent uncompressed, they occupy the complete 64-bit data field of CAN data frame. 5.3.3 Details of QRC QR compression method is as follows: Each GE5 parameter is allocated with two bits, called QR bits. They are not part of CIB but precede the compressed form of the parameter. Figure 5.1: GE5 and L5 Parameters Sent Completely (Uncompressed) 87 QR algorithm requires the transmitter and receiver to have the understanding of the divisor of each GE5 parameter. A divisor value of GE5 is based on the size (in bits). Each parameter is divided by the predefined divisor for the compression, and is sent in the form of QR bits followed by remainder of the division in the form of ‘Rem bits’ (Fig. 5.2). The figure shows CIB bits as ‘11110000’. This means four GE5 parameters are either QR compressed or fully compressed while L5 parameters are in uncompressed form. Following discussion explains the QR compression of GE5 parameters. Fig. 5.2 shows all the GE5 parameters, namely Para1, Para2, Para3 and Para4 QR-compressed and all the L5 parameters sent without any compression. Table 5.1 shows predefined divisors, remainder sizes and remainder values for GE5 parameters. Latest quotient value at the end of compression and decompression for the parameter along with parameter value is stored at both transmitter and receiver ends. This is done to enable the algorithm compare the current GE5 parameter value with the earlier value and make appropriate selection of compression type. Explanation for different statuses of QR bits is as follows. If QR bits of a GE5 parameter are equal to ‘00’, it means the current quotient value calculated after the division of current parameter with the predefined divisor, is same as the earlier quotient value. Figure 5.2: GE5 Parameters QR Compressed, L5 Sent Completely 88 Table 5.1 GE5 parameter size, remainder size, remainder values, divisor values along with range provided by each GE5 parameter GE5 RemaindParameter er size size (bits) (bits) Remainder value Divisor value 5 6 7 8 9 10 11 12 13 14 15 16 1 3 3 7 7 15 15 31 31 63 63 127 2 4 4 8 8 16 16 32 32 64 64 128 1 2 2 3 3 4 4 5 5 6 6 7 QR-range values (lower-side) Min Max -2 -3 -4 -7 -4 -7 -8 -15 -8 -15 -16 -31 -16 -31 -32 -63 -32 -63 -64 -127 -64 -127 -128 -255 QR-range values (upper-side) Min Max +2 +3 +4 +7 +4 +7 +8 +15 +8 +15 +16 +31 +16 +31 +32 +63 +32 +63 +64 +127 +64 +127 +128 +255 If equal to ‘01’, the current quotient value is equal to the earlier quotient value plus one and if equal to ‘10’, the current quotient value is equal to the earlier quotient value minus one. If QR bits are equal to ‘11’, the current value of the GE5 parameter is same as the earlier value, hence fully compressed. If QR bits are found to be equal to ‘00’, ‘01’ or ‘10’ After the division of the current value of parameter during QR compression, then the transmitter sets the appropriate QR bits and adds the remainder bits after the QR bits. If after the division of the current value of the parameter, QR bits are found to be equal to ‘11’, then only the QR bits are sent and no other data bits are sent for the parameter. This condition of QR bits indicates that, the earlier value is equal to the current value. QR compression for a GE5 parameter is indicated by Table 5.2. Table 5.2 Compression of GE5 parameter indicated by CIB bit and QR bits CIB Bit 0 1 1 1 QR Compression Type Operation Bits Performed at the Transmitter before Transmission 00 No compression Parameter sent completely 01 QR compression Rem bits are sent along with QR bits 10 QR compression Rem bits are sent along with QR bits 11 Full compression Rem bits are not sent, only QR bits are sent Operation Performed at the Receiver to Retrieve Parameter Parameter received completely [(Quotient+1)* Divisor] + Rem bits [(Quotient–1)* Divisor] + Rem bits Current Parameter = Earlier parameter 89 Whenever a GE5 parameter does not fit to one of the above said conditions of QR bits, the parameter is sent completely on the CAN bus. QR bits for all four GE5 parameters are either ‘00’ or ‘01’ or ‘10’ in Fig. 5.2. This means these GE5 parameters are QR compressed as explained above. Divisor value for Para1 and Para3 is 16 and the remainder size is 4-bits, Para1 and Para3 being 10-bits in size (Table 5.1). The divisor value of Para2 is 32 and the remainder size is 5-bits, as Para2 is 12-bits in size (Table 5.1). Similarly, the divisor value of Para4 is 128 and the remainder size is 7-bits, as Para4 is 16-bits in size (Table 5.1). Fig. 5.2 shows an arrangement of QR-bits and ‘Rem bits’ for Para1, Para2, Para3 and Para4. All the L5 parameters namely, BPara1, BPara2, BPara3 and BPara4 are uncompressed and are sent completely as shown in Fig. 5.2. Therefore, in this case, total number of bits sent is 44. Data area of the data frame will always hold the GE5 parameters first and then the L5 parameters. L5 parameters are either sent completely or not sent at all in QRC. When current value of L5 parameter is same as the earlier value, the L5 parameter is not sent at all. If the current value of L5 parameter is different than the earlier value, the L5 parameter is sent completely. CIB is checked for compression status of the GE5 parameters along with L5 parameters at the receiver, the. When CIB bit for a L5 parameter is found to be Logic ‘0’, the complete L5 parameter is received. The receiver updates the copy of L5 parameter for the future use. When CIB bit for a L5 parameter is found to be Logic ‘1’, that means L5 parameter is not sent by the transmitter, i.e., when the L5 parameter is fully compressed. Then the receiver assumes the current value to be equal to the earlier value for L5 parameter. When CIB bit for GE5 parameter is found to be Logic ‘0’, the receiver understands that the parameter is sent completely. The receiver reads and updates the copy of GE5 parameter value and its quotient. Else, when CIB bit for a GE5 parameter is found to be Logic ‘1’, the parameter is taken to be compressed. The receiver assumes the current value to be the same as the earlier value when QR bits are found to be equal to ‘11’. When QR bits are ’00’, ‘01’ or ‘10’, the receiver calculates the current value of the parameter based on the status of the QR bits. If QR bits are found equal to ‘00’, the bits after QR bits are read as ‘Rem bits’. This remainder value is added with the product of quotient and the divisor for that 90 particular GE5 parameter. Thus the parameter is retrieved completely at the receiver end. Else, if QR bits are found to be equal to ‘01’, the remainder value is added with the product of earlier quotient plus one and the divisor. Thus the parameter is retrieved completely and the quotient is updated. If, QR bits are found to be equal to ‘10’, the remainder value is added with the product of earlier quotient minus one and divisor. Thus the parameter is retrieved completely and the quotient is updated. The QR algorithm considers only the periodic parameters which are required to be sent on the CAN bus. Fig. 5.1 shows the condition where all the GE5 and L5 parameters are sent completely without any compression. In this case, total number of bits sent is 64. Fig. 5.3 shows full compression scenario for all four GE5 and L5 parameters. Here, CIB bits are ‘11111111’ meaning, all four GE5 parameters are either QR compressed or fully compressed and L5 parameters are fully compressed. In Fig. 5.3, GE5 parameters are fully compressed as QR bits of these parameters are ‘11’. Therefore, in this case, total number of bits sent is 16. 5.4 Mathematical Representation of Compression Range Provided to GE5 Parameter in QRC The divisor for GE5 parameter is calculated using the formula, Divisor (D) = 2[(n/2) –1]. (5.1) Figure 5.3: GE5 and L5 Parameters Fully Compressed 91 where n is the size of the GE5 parameter in bits and (n/2) is equal to the Quotient value of the division n/2. Thus, the divisor values for different GE5 parameters are as shown in Table 5.1. The parameter, say vehicle speed, can vary while automobile is in motion. This variation can be on either side, i.e., increased or decreased from the earlier value of the parameter. If the compression algorithm can accommodate this variation, then it is not necessary to send the parameter completely. Instead, it can be sent in compressed form. This reduces the number of bytes sent per message on the bus. The QRC [72] provides at least same range on both the sides as compared to EDR [101]. But it can also provide maximum range up to twice that of EDR on both the sides. The following discussion proves this claim. Let N = Value of the GE5 parameter, D = Divisor for the GE5 parameter, REMMax = Maximum value of the remainder and MOD(N/D) = Remainder value of the division (N/D). Then, Quotient (Q) = [N – MOD(N/D)] / D. (5.2) QRC uses the quotient value to determine boundary conditions for compression. A contiguous range of parameter values will have same quotient with the fixed or predefined divisor. This is the basis for defining maximum and minimum range values for the parameter. For example, for vehicle speed, defined by 12-bit GE5 parameter, consider a range of values; say from 96 km/h to 127 km/h, where the quotient value for these values is 3 for a predefined divisor as 32 as per Table 5.1. The relationship between 96 and 127 can be generalized as, N2 = N1+ REMMax. (5.3) where N1=96 for which Q=3 with MOD(N/D) = 0 and N2 is 96+REMMax=127 with REMMax=31. Therefore, the expressions for the maximum and minimum range values for negative and positive boundary conditions for QRC are as follows: (Negative range boundary value)Min =N1–D. (5.4) (Negative range boundary value)Max=N2–(D+REMMax). (5.5) (Positive range boundary value)Min=N2+(REMMax+1). (5.6) 92 (Positive range boundary value)Max=N1+(D+REMMax). (5.7) Let us consider a 12-bit GE5 parameter whose values are in the range, 96 to 127. The quotient for parameter values between 96 and 127 is 3 with divisor as 32. The REMMax value for 12-bit parameter is 31.Then the minimum negative boundary range is 32 as per (5.4), when the parameter value N1 is 96. Therefore, the minimum negative boundary value is 96–32 = 64. This means the parameter will be sent in compressed form even if its value falls from 96 to 64. The maximum negative boundary range is when the parameter value is N2=127. i.e., 127–(32+31) = 64. This means, even if the parameter value falls from 127 to 64, the parameter will be sent compressed. This gives the range as 63 as per (5.5). The positive boundary range will be minimum when the parameter value is N2=127 and as per (5.6) the positive boundary value is equal to 127+(31+1)=159. The positive boundary range is maximum when the parameter value is N1=96 and is equal to 96+(32+31)=159 as per (5.7). Thus when parameter varies from 96 to 127, the parameter is sent compressed and the positive range varies from maximum to minimum. Table 5.1 shows the predefined values of divisor, remainder, and range for different sizes of GE5 parameter. 5.5 Comparison of QRC with EDR Fig. 5.4 shows the comparison based on maximum and minimum number of bits sent when using EDR and QRCs. Fig. 5.4 shows that the number of bits for maximum compression condition for all the sixteen combinations in case of QRC is same as EDR. The minimum number of bits for compression condition for the all sixteen combinations for QRC is more than that of EDR. But, when seen in the form of bytes, they are same as EDR except for three out of sixteen combinations of CIB namely, 0011xxxx, 1001xxxx and 1011xxxx. The comparison is made for all sixteen binary combinations for four GE5 parameters namely, ‘0000’ to ‘1111’ along with L5 parameters. Maximum and minimum conditions for four GE5 parameters have been included. Maximum is when QR bits for the compressed GE5 parameters are ‘00’, ‘01’ or ‘10’, i.e. when the GE5 parameters are QR compressed. Minimum condition is when the QR bits are ‘11’, i.e. when GE5 parameters are fully compressed. Let us consider a combination for four GE5 parameters and four L5 parameters as shown in Fig. 5.1, Fig. 5.2 and Fig. 5.3. 93 a Figure 5.4: Comparison Between QRC and EDR Based on Maximum and Minimum Number of Bits Sent The GE5 parameters considered are Para1, Para2, Para3 and Para4. The L5 parameters considered are BPara1, BPara2, BPara3 and BPara4. Fig. 5.5 shows the comparison based on maximum and minimum number of bytes sent which generate due to compression using the EDR and QRC. Let us consider Compression Information Byte (CIB) as ‘1100xxxx’ to find out the maximum and minimum number of bits generated due to QRC. Here, ‘1100xxxx’ means Para1, Para2 are sent in compressed form and Para3, Para4 are uncompressed or completely sent. In case of calculating the maximum number of bits, ‘xxxx’ for L5 parameters means, all the L5 parameters are sent in uncompressed form or sent completely. In case of calculating the minimum number of bits, ‘xxxx’ for L5 parameters means, they are fully compressed and not sent at all. Number of bits is highest when QR bits of Para1 and Para2 are equal to ‘00’/ ‘01’ / ‘10’ and all four L5 parameters are sent. Number of bits is lowest when QR bits of Para1 and Para2 are equal to ‘11’ and all the L5 parameters are fully compressed, hence not sent. The L5 parameter compression will remain the same for QRC and EDR algorithms. Thus the compression of L5 parameters does not have any effect while comparing QRC with EDR. Table 5.3 shows the maximum and minimum number of bytes sent by QRC and EDR. 94 Figure 5.5: Comparison Between QRC and EDR Based on Maximum and Minimum Number of Bytes Sent Table 5.3 Comparison of QRC with EDR CIB Values 0000xxxx 0001xxxx 0010xxxx 0011xxxx 0100xxxx 0101xxxx 0110xxxx 0111xxxx 1000xxxx 1001xxxx 1010xxxx 1011xxxx 1100xxxx 1101xxxx 1110xxxx 1111xxxx Bytes Sent by EDR Bytes Sent by QRC Min 7 6 6 4 6 4 5 3 6 4 5 3 5 3 4 2 Min 7 6 6 5 6 4 5 3 6 5 5 4 5 3 4 2 Max 8 8 8 7 8 7 7 6 8 7 7 7 7 6 7 6 Max 8 8 8 7 8 7 7 6 8 7 7 7 7 6 7 6 Average Average Bytes % Compression Sent Ratio EDR QRC EDR QRC 8 8 0 0 7 7 12 12 7 7 12 12 6 6 25 25 7 7 12 12 6 6 25 25 6 6 25 25 5 5 37 37 7 7 12 12 6 6 25 25 6 6 25 25 5 6 37 25 6 6 25 25 5 5 37 37 6 6 25 25 4 4 50 50 The calculation of minimum and maximum bytes is performed based on the above explanation. CAN protocol uses data frame to send the information. Therefore, 95 calculation of number of bytes sent by both the algorithms seems appropriate. Table 5.3 gives average of minimum and maximum bytes sent for both QRC and EDR. Also, the percent compression ratios of these average bytes sent are calculated. It can be seen that percent compression ratio of average bytes sent for QRC and EDR remains the same for all the combinations of CIB except for 1011xxxx. This means the compression provided by QRC is comparable to EDR. 5.6 Results and Discussions 5.6.1 Implementation of QRC in Case of Four Nodes QRC has been implemented using four embedded hardware units based on Renesas M16C/6N4 group microcontroller [106]. The bus activity is captured using Vector CANalyzer and the results have been verified [110], [111]. Here, periodic messages are sent from four nodes at a baud rate of 500 kbps. The message timings are 10 ms, 20 ms, 100 ms and 500 ms. Fig. 5.6 shows the bus activity on the CAN bus when messages are sent from four nodes with QR compression or full compression or no compression. Fig. 5.7 shows the bus activity on the CAN bus when only fully compressed messages are sent on the bus. Figure 5.6: Vector CANalyzer Screenshot During Messages on CAN Bus from Four Different Nodes Implementing the QRC 96 Figure 5.7: Vector CANalyzer Screenshot During Fully Compressed Messages From Four Different Nodes Implementing QRC 5.6.2 Implementing QRC for Five Nodes QRC was continuously simulated using five nodes. Here, five nodes are sending the messages continuously, with and without QRC alternately. The baud rate used for continuous simulation is 125 kbps. Peak load, busload and number of messages sent on the bus at a random time 223 seconds are recorded. Comparison of results with simulation run was done when messages were sent uncompressed. Table 5.4 shows busload and peak load observed at 223 seconds with continuous simulation. Significant reduction in busload and peak load was observed when QRC was used while sending the fully compressed messages. The improvement in peak load and busload was 42.97% and 43% respectively when QRC was used. Fig. 5.8 Shows the Peak Load Captured for Uncompressed Messages and Also for Messages Sent Using QRC. Table 5.4 Percentage peak load, percentage busload when continuously simulated-with and without QRC. Values captured at time=223 seconds No. of Messages Sent on the Bus Uncomp- With ressed QRC % Peak Load (uncompressed) % Peak Load (with QRC) % Busload (uncompressed) % Busload (with QRC) 189317 82.18 46.86 82.56 47.02 190048 97 Significant reduction in peak load was found when QRC was used for sending the messages. Table 5.5 shows the values for the peak load when a set of fully compressed messages were sent with and without the use of QRC with the baud rate of 125 kbps. 5.7 Conclusions The important conclusion is, in case of CAN, even if the compression results in reduction of number of bits due to DR algorithms, the effect of compression can only be compared in terms of bytes amongst DR algorithms. This is because the CAN controller hardware sends data with the help of data frame on the CAN bus and the unit of sending data on the CAN bus using data frame is bytes only. Figure 5.8: Comparison of Peak Load Percentage with and without QRC, when Number of Messages Transmitted Table 5.5 Percentage peak load v/s number of messages sent on the CAN bus with and without QRC No. of Messages Sent on the Bus 30 50 103 156 203 Peak Load % (uncompressed) 2.89 4.83 10.23 14.68 19.61 Peak Load (with QRC) % 1.86 2.95 6.03 8.56 11.36 % Improvement 35.64 38.92 41.05 41.69 42.07 98 Table 5.1 gave the range provided by the QRC, which is same or twice for positive and negative variations for GE5 parameters. The divisor value for a GE5 parameter is selected using Table 5.1 based on the size of the automotive parameters such as vehicle speed, engine RPM, engine temperature etc. Based on the sensor hardware of the automotive application, the parameter size is decided. Table 5.3 gave the maximum and minimum number of bytes sent by QRC and EDR. Table gave average of minimum and maximum bytes sent and the percent compression ratios of average bytes sent are calculated. Table 5.3 shows the compression provided by QRC [72] is comparable to EDR [101]. The divisor value used for an automotive parameter will be based on the parameter size. The results in Table 5.1 indicate that the variations in GE5 parameters are well absorbed by QRC than EDR and hence the GE5 parameters are sent compressed often by QRC than EDR. CAN protocol is known for its robustness, flexibility and cost effectiveness. It can be easily configured for different applications. FlexRay protocol with its fault tolerant features along with better bandwidth is expected to be used in many automotive applications [74]. But configuring FlexRay is found to be complex and a time consuming task [74].Therefore, CAN protocol with its limited bandwidth will remain an attractive proposition for automotive applications, by making use of DR algorithms such as QRC. 5.8 Postscript A new algorithm, QRC has been developed and details are presented in Sections 5.3 to 5.7. Following chapters will describe few new developed DR algorithms and their comparison with EDR. 99
© Copyright 2026 Paperzz