Real-time behaviour of Ethernet on the example of PROFINET Heitzer Bernhard#1 1 bernhard.heitzer@stud.hs-regensburg.de # Maschinenfabrik Reinhausen Falkensteinstrasse 8 93059 Regensburg Jürgen Mottok#2 2 Juergen.Mottok@hs-regensburg.de # Laboratory for Save and Secure Systems, HS-Regensburg Seybothstrasse 11 93059 Regensburg Abstract: Ethernet is used more and more in industrial environment. In these applications it is a basic requirement to provide real-time communication. This paper describes the limitations why standard Ethernet cannot be used as a real-time system and which additions have to be implemented to make it real-time capable. As example the real-time Ethernet system PROFINET is described in this paper along with an illustration of some performance measures. Keywords: Ethernet, real-time, PROFINET, automation, performance 1. INTRODUCTION The usage of Ethernet in automation has grown continuously in the last years, where Real-time Ethernet systems represent the main factor for its strong use. Ethernet is not only used because of its real-time ability, but rather because of the possibility for an easy integration in an existing IT-network. In automation many different requirements have to be met for real-time. Also, there are various basic approaches to accomplish real-time ability for Ethernet. The first part of this paper describes the most important requirements in a real-time Ethernet application. Furthermore fundamental problems are considered which must be addressed to create a real-time Ethernet system which meets the given requirements. The last chapter shows the principles of the real-time Ethernet system PROFINET and which measures are taken to meet the real-time requirements. Additionally some theoretical performance examples illustrate transmission times of real-time Ethernet frames and update times in a PROFINET system. 2. REQUIREMENTS FOR A REAL-TIME ETHERNET SYSTEM A function in a system is executed within a defined interval, this is the specification for real-time. This interval is defined between R (Release), the earliest start time of the function, and D (Deadline), the latest end time for the function. If the function is not finished within this interval the processed data is corrupted. Real-time is given when the demands of punctuality and simultaneity are met. Punctuality means the function is finished before D and simultaneity describes the cyclic occurrence of an event in a given interval. The update time of the process data is divided in three classes (Table 1. Quality of Service (QoS)). These definitions are based on existing application-classes from fieldbus-systems. Table 1. Quality of Service (QoS) QoS Class Application QoS Latency 1 Controller-toController Distributed I/ODevices Motion Control 100ms 2 3 10ms <=1ms 3. FACTORS WHICH INFLUENCE A REAL-TIME ETHERNET SYSTEM An entire switched Ethernet network could be seen as a system of queuing devices which influence the quality of communication. The scheduling strategies to be used in these devices are defined in the IEEE Standard. Possible strategies are first-come first-serve (FCFS) and nonpreemptive priority queuing (PQ) algorithms. FCFS schedules all frames in an equal way. The forwarding time is short because of the fact that this algorithm is very simple. The PQ algorithm allows to prefer specific frames, where frames with a high priority are forwarded first. However this could lead to longer forwarding times for some frames, especially in huge Networks with Line topology. Also protocol runtimes and the time for frame generation have to be taken into consideration for the transmission time. Category A Systems are based on the standard Ethernet TCP/IP protocol and use standard HW. They can be used in normal IT-Networks and allow a simple integration in a corporate network. The communication is not deterministic and mainly influenced by the TCP/IPProtocol runtimes. Devices are identified by the IP-Address and for this it is also possible to transmit frames beyond the local network. 4. IMPLEMENTATION OF REAL-TIME ETHERNET In a standard Ethernet system the CSMA-CD protocol is used, which can lead to unpredictable behavior because of the collision detection. In modern Ethernet systems only full-duplex switched-Ethernet is used and for this there are no frame-collisions on the wire. Priority based scheduling like PQ could be implemented by using IEEE802.1D/Q. So it is possible to separate time critical frames and non-critical frames from each other to fulfill the QoS class 2 requirements. In a switched network the transmission time for time critical frames increases with the amount of switches. This is why a standard Ethernet system cannot be used for time-critical applications like motion control (QoS Class 3). To use Ethernet in QoS Class 3 applications a method like TDMA has to be used. With TDMA the bus cycle is divided in different time-slots. The advantage of this method is that the transmission time can be calculated from the beginning on. A bus cycle has to start at the same time on every device to coordinate the time critical and non-critical time-slots. In order to achieve that synchronization between the devices is necessary. A common standard for time synchronization is the Precision Time Protocol (PTP). PROFINET for example uses its own synchronization protocol which is called PTCP. This algorithm is nearly identical to PTP. By using PTCP in a switched Ethernet system a jitter <1µs is possible. Common available real-time Ethernet systems can be assigned into three categories. Distinguishing features are the grade of compliance to the Ethernet standard (which includes the possible use of standard Ethernet HW) and the performance (Figure 1). Figure 1. Categorization of real-time Ethernet systems In category B time-critical frames are not sent with the IP-Protocol anymore. This results in shorter protocol runtimes in the devices. Devices are now identified by the MAC-Address. Non-time critical frames can be sent in addition with IP-based services also beyond the local network. The category A and B systems both use prioritization of the time-critical frames within the VLAN-tag which is defined in IEEE802.1D/Q. Sending time-critical frames in category C is also performed without the IP-Protocol. Besides that TDMA is used in this category for scheduling and therefore standard Ethernet HW cannot fulfill these requirements anymore. Here both facts shorter protocol-runtime and a deterministic access lead to meet the requirements of QoS Class 3. Identical to category B it is also possible to send non-critical frames. 5. REAL-TIME ETHERNET SYSTEM PROFINET PROFINET is a Master-Slave system. The Master (IOMaster) can send frames to all devices in the network as well as receive frames from all devices. A Slave (IODevice) has the possibility to send frames to the IO- Master only. Cross traffic to other IO-Devices is only possible non-cyclically. The communication concept of PROFINET is designed modular. Functionalities in communication differs in the way of data transfer to meet the different performance requirements. PROFINET IO specifies the transfer of I/O-Data for peripheral devices such as sensor or actor. PROFINET IO includes real-time (PROFINET RT) and isochronous realtime (PROFINET IRT) communication with the periphery. For a simpler use of PROFINET IO in applications three application classes are specified. Each application class has its own minimum requirements. Their categories are: • Applications with unsynchronized communication. • Bus-synchronization with unsynchronized applications. • Synchronous applications. In addition to the application requirements there are additional determinations for the devices, method of communication (RT, IRT), transmission medium and redundancy. A. Conformance Class A Conformance Class A allows the usage of standard Ethernet Hardware. CC-A includes cyclic RTcommunication and acyclic TCP/IP-communication. RT-frames are priorized as described in IEEE802.1D/Q and transmitted on base of the MAC-address. These frames are preferred against non time-critical TCP/IPframes. The cycle for the transmission of an RT-frame has to be defined by the user. There is no synchronization between the devices. In PROFINET this method of sending RT-frames is called RT-Class 1 (RTC1). Further PROFINET features are: • Alarms/Diagnosis • Automatic address-resolution • Neighborhood detection • 100Base Tx/Fx • Wireless-communication B. Conformance Class B CC-B includes the functionalities from CC-A plus the additional features: • IO-Device cross transmission • Device swap-out without engineering tool • Media-redundancy-protocol MRP C. Conformance Class C Conformance Class C extends the functionalites of CCB with the fundamental difference of the synchronization between the IO-Devices. In PROFINET this method of communication is called isochronous real-time (IRT). Cyclic and acyclic communication is separated by TDMA as it is shown in Figure 2. The first time-slot is reserved for the cyclic IRT-communication. Every IODevice has to send his cyclic RT-frames within the IRTinterval. For the acyclic TCP/IP communication there is a reserved second time-slot. Using CC-C it is possible to reach bus-cycles of 250µs. Figure 2. PROFINET TDMA process Synchronization of the IO-Devices in CC-C is implemented with the PTCP and so all IO-Devices work with the identical time-base. Using PTCP it is possible to synchronize the IO-Devices with max. Jitter of <1µs. The IRT-communication uses two different methods for sending RT-frames, RTC2 and RTC3, which differ in performance. D. RT-Class-2 For the transmission in the IRT-interval all switches create an address-table on start-up. With this table it is possible to route RT-frames on base of their source- and destination-MAC-address. The routing mechanism on base of the MAC-address allows to change the topology of the network, but it must be ensured that the transmission of an RT-frame is finished within the IRTinterval. This is the reason why in RTC2 the IRT-interval has an additional time reserve as it is shown in Figure 3. The capacity of the available bandwidth is not optimal amongst others in RTC2 because of the throughput time (ca. 10µs) in the switch. This period of time is needed to evaluate the source and destination MAC-address. This duration is called Propagation Delay pmax . The Propagation Delay can be determined exactly by using the PTCP. G. Bridge Delay: q The throughput time for a frame from one port to another port in a switch is called Bridge Delay q . An estimated value for the Bridge Delay in PROFINET Figure 3. PROFINET IRT RTC2 switches is q max = 10 µs for RTC1/RTC2 and ca. qmin = 3µs for RTC3 (the exact value is given in the E. RT-Class-3 In RTC3 there is no time reserve left in the IRT-interval. This will only work under the prerequisite that the topology of the network is known before startup. On base of this information the communication plan hast to be calculated before. The calculation with an engineeringtool, that also requires throughput times of the switches. In RTC3 this throughput time is approximately 3, 5µs. The exact throughput times for RTC1/RTC2/RTC3 are available in the PROFINET GSD-file which can be processed by the engineering-tool. Every PROFINET manufacturer has to offer a GSD-file for the produced Device, so throughput times for every Device are known by the engineering-tool. Forwarding of RT-frames in RTC3 is not based on MAC-addresses anymore. The network topology is planned with the engineering-tool before startup and with this information the engineering-tool creates a table for the RT-frame routing. This table is stored on every involved switch. Now it is possible to make accurate predictions when and where a specific RT-frame is forwarded. This means that the communication is deterministic. Worst-case scenario for IRT-communication is a line topology. In this case the defined send order causes that the RT-frame for the last IO-Device in the line-topology to be sent first. When the first RT-frame is on its way, the second RT-frame is sent to the second to the last IODevice. 6. PERFORMANCE CALCULATION F. Propagation Delay: p The Ethernet standard specifies a maximal section length of 100m between switches for cooper wire. Electrical signals spread at a speed of ca. 200000km/s in cooper. The maximal duration to send one bit within one section is: 100 ÷ 200000 km / s = 0 ,5 µs GSD-file). For further calculation also a variable d is specified which represents the number of IO-Devices in the network. H. Transmission Delay: t One Ethernet-frame has a specified header-length of 34 Bytes and has an additional CRC-value with 4 Bytes. The data-field has a minimum size of 46 Byte and therefore the minimum size of one Ethernet-frame is 84 Byte. If the data-field is completely filled the maximal size of one Ethernet-frame is 1538 Byte. The PROFINET system runs with a speed of 100Mbit/s. The calculated transmission time for one Ethernet-frame with minimum size t min is: 84 Byte ÷ 100 MBit / s = 6 , 72 µs and for one Ethernet-frame with maximum size t max : 1538 Byte ÷ 100 MBit / s = 123 ,04 µs I. Transmission Time without waiting Time: Tmin The example in Figure 4 shows a calculation for the transmission time of one PROFINET frame (minimal size 84 Byte) from the IO-Master to the IO-Device 4. The Mathematical formula for the calculation in Figure 4 is: Tmin = d * (qmax + p ) + t min Since the bridge delay is 10µs and because of this a RTC1 or RTC2 communication must be used. Nevertheless, it could happen that a RTC frame has to wait until another frame is transmitted on the wire, as shown in the next example. RTC-frame. The IO-Master transmits four RTC3-frames (minimum size 84 Byte) one for each IO-Device. The Mathematical formula for the calculation in Figure 6 is: U = d * t min + q RTC 3 + p 4 * (10 µs + 0 ,5 µs ) + 6 ,72 µs = 48 ,72 µs Figure 4. Min. Transmission Time J. Transmission Time with waiting Time: Tmax The example in Figure 5 shows a calculation for the transmission time of one PROFINET frame (minimal size 84 Byte) from the IO-Master to the IO-Device 4. The Mathematical formula for the calculation in Figure 5 is: Since IO-Device 2, 3 and 4 receive the frames before the IO-Master transmission is finished, q and p are considered only once. The previous examples calculate how long it takes to transmit one PROFINET-frame. In practice it is common that more than one frame is sent in one bus-cycle. Every time more than one frame shall be sent the second and further frames are queued until the previous frame has been forwarded. In Figure 6 RTC3 communication with the TDMA method is used and, additionally the IOMaster has knowledge of the network topology. As described earlier the IO-Master builds a send order. The frame for the last IO-Device in the line is transmitted first. This method saves time, because the forwarding time is optimized. Tmax = d * (q max + p ) + t min + (d − 1) * (t max + q max ) The calculation is influenced by the fact that the RTC frame has to wait before it can be forwarded. Again a bridge delay of 10µs is used. In this worst case the transmitted frame has to wait at every IO-Device until a maximum UDP-frame (size 1538 Byte) is transmitted on the wire. The UDP-frame was sent just before the PROFINET frame has arrived. This leads to a waiting time for the PROFINET frame of 123, 04µs at every IODevice. 4 * 6,72 µs + 0 ,5 µs + 3 µs = 29 ,93 µs Figure 6. Updating time !"#$% !"#$% !"#$% & !"!' ( 4 * (10 µs + 0,5µs ) + 6,72 µs + ( 4 − 1) * (123,04 µs + 10µs ) = 447,84µs Figure 5. Max. Transmission Time K. Updating Time with RTC3: U The example in Figure 6 shows a calculation for the Update time of the process data. This is the time how long it takes that every IO-Device in the network gets one The Update time also gives a reference for the duration of a bus-cycle for a specific number of IO-Devices. In opposite it is also possible to calculate how many IODevices can be connected to a PROFINET network with a given bus cycle time. The Mathematical formula for the maximal number of IO-Devices for a given bus-cycle is: d = (t cycle − p − q min/ max ) ÷ t min/ max E.g. how many IO-Devices can be updated with a buscycle time of 250µs if every IO-Device is updated with a minimum RTC3 frame? (250 µs − 0,5µs − 3µs ) ÷ 6,72 µs = 36,68 ≈ 36 Solution: With RTC3 it is possible to update 36 IODevices with a bus-cycle time of 250µs (the result has to adjust downward). CONCLUSIONES As described Ethernet especially real-time Ethernet, can be considered as an adequate communication system for automation and it is suitable even for applications with hard real-time requirements a short cycle-times (e.g. motion control).For automation applications the advantage to integrate the communication in existing ITnetworks without losing the real-time characteristic gives additional benefit. The real-time Ethernet system PROFINET was explained in some of the most important details. The final practice view from the application side covers especially how it is implemented and the performance of the realtime communication. REFERENCES [1] K. Werner, T. Heimbold and D. Telschow “Bustechnologien für die Automation” Hüthig Verlag Heidelberg, 2000 [2] K. Frithjof, V. Oestereich und V. Volz „Industrielle Kommunikation mit Feldbus und Ethernet“ VDEVerlag, 2010 [3] M. Popp, „Industrielle Kommunikation mit PROFINET“ PROFIBUS Nutzerorganisation e.V., 2007 [4] B. Heitzer, „Evaluierung von EchtzeitKommunikationssystemen für die Automatisierung in der Sekundärtechnik“ 2011 [5] P. Ferrari, A. Flammini, D. Marioli, A. Taroni „Experimental evaluation of PROFINET performance“ Dept. of Electronics for Automation and PCC Italy University of Brescia, 2004