Trying to understand difference in performance of signal based routing and PDU based routing in AUTOSAR.
As per my understanding,
What is the difference in performance between these two.Because anyway routing is handled as PDU. Some note could see that signal based routing having low latency. Why so? Whether signal based routing is overhead or not?
If my understanding is correct, there is a huge difference between PDU-based routing and signal-based routing. The PDU-based should be much faster.
Signal based routing -> The signal need to be converted to I-PDU and routed
PDU based routing -> The PDU directly routed
Seems pretty correct to me, so let's check an example with a CAN FD frame with several PDUs.
Byte 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
PDU [-------PDU_1------] [--PDU_2--]
Signal II II II
Signal_1 Signal_2 Signal_3
4 bits 3 bits 1 bit
If the PDU_1 is routed using PDU-based routing, from the software perspective, it's just a matter of copying the 7 bytes of PDU_1 to another PDU with the same structure. No need to highlight how fast it is to copy a few bytes from a memory location to another memory location. You can find this case when you have a gateway in Automotive translating PDUs from CAN FD to Flexray and back.
If we use signal-based routing, it's another topic, much more complicated if we consider the software implementation. The software will need to extract the value of Signal_1 and Signal_2 from the the byte fields, then use the factor and offset to determine its physical value with floating points numbers and then convert back to the destination signal which might not have the exact same factor or offset. There are much more calculations involved and this has a strong impact on the performances if the number of signal is important. If you need this, you probably want a MCU with a floating point unit.
static uint32_t GW_GetSignal_1 (uint8_t *Data)
{
uint32_t Byte_0 = Data[0];
uint32_t Bytes = (Byte_0 >> 3);
uint32_t SignalValue = (Bytes & 0xF); /* 0000.1111 */
return SignalValue;
}
static uint32_t GW_GetSignal_2 (uint8_t *Data)
{
uint32_t Byte_0 = Data[0];
uint32_t Bytes = (Byte_0 >> 0);
uint32_t SignalValue = (Bytes & 0x7); /* 0000.0111 */
return SignalValue;
}
static float Raw32ToPhysical (uint32_t RawValue, float Factor, float Offset)
{
float PhysicalValue = ((float)RawValue) * Factor + Offset;
return PhysicalValue;
}