Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 6, No. 2, 2023 73 Research on Communication of PROFIBUS Single‐ master System Wei Pei, Geng Liang, Xuying Gao and Xiangyu Feng School of North China Electric Power University, Beijing, China Abstract: Through the understanding of PROFIBUS-DP bus protocol, this paper analyzes the communication process according to the communication principle of fieldbus, establishes a communication model of single-master system, and studies the relationship between target token cycle time, packet loss rate and number of slaves. Keywords: Single-master system, Target token cycle time, Packet loss rate. 1. Introduction Fieldbus is a kind of industrial data bus that has developed rapidly in recent years, which can enable data transmission between devices in the industrial field and advanced control equipment in the control room to achieve information transmission problems, and establish a digital, serial, multi- point communication communication network. Typical fieldbus technologies are: FF fieldbus, WorldFIP fieldbus, CAN fieldbus, PROFIBUS fieldbus and DeviceNet fieldbus. Among them, PROFIBUS fieldbus with its advantages of PROFIBUS-DP, PROFIBUS-PA, PROFIBUS-FMS three compatible versions, can meet the automation needs of many fields, such as: manufacturing automation, process control automation, electric power, railway transportation, etc. Therefore, PROFIBUS is a fieldbus standard for automation technology, which does not depend on any equipment manufacturer, is not limited to a specific interface method, even the products of different equipment manufacturers, can also carry out data transmission functions in the same communication network.[1] The PROFIBUS protocol structure is based on ISO international standards, using the Open System Internet as a reference model[2], which has seven layers, as shown in Figure 1: User layer DP device profile FMS equipment profile PA equipment profile Basic functionality Extended functionality Basic functionality Extended functionality DP User Interface Direct Data Link Imager Application layer interfaces DP User Interface Direct Data Link Imager 7th floor (Application Layer) Fieldbus Message Specification (FMS) Floors 3-6 Layer 2 (Data Link Layer) Fieldbus information link (FDL) IEC interface Tier 1 (Physical Layer) RS485, optical fiber IEC1158-2 Figure 1. PROFIBUS protocol structure 2. Communication process analysis 2.1. System structure of PROFIBUS-DP The PROFIBUS-DP system consists of a master and a slave, and there are two types of DP masters, divided into Class 1 DP masters and Class 2 DP masters. The Class 1 DP master is the central controller that periodically accesses the designated slave according to the polling table and shares data. The Class 2 DP master is a programming device in the DP network that also has diagnostic and management functions. PROFIBUS fieldbus single-master multi-slave systems generally consist of a Class 1 DP master and multiple DP slaves. 2.2. Communication protocol layering of PROFIBUS-DP As can be seen from Figure 1, PROFIBUS-DP defines layers 1, 2 (physical layer and data link layer) and user layer. This protocol is used for efficient transmission of data information between devices, and this protocol optimized for high-speed transmission of user data is especially suitable for communication between programmable controllers and field- like decentralized I/O devices. The physical layer is a transmission medium that provides a physical connection for the data link layer to transmit data information, generally using RS485 or optical fiber two transmission cables. The physical layer defines the interface type of the physical device and the transmission rate of various transmission media, and its main function is to transmit the bit stream, which is transmitted by the analog quantity of the current to represent the digital quantity "1" and "0", and then reach the transmitter and then convert it into a digital quantity. The data link layer controls the transmission and access of data through the necessary communication protocols, 74 transmits the interference information received from the physical layer to the network layer, and sends the data transmitted by the network layer to the link. The data link layer has error detection and correction capabilities to ensure high reliability of data transmission.[3] The application layer mainly defines the functions, profiles and extension functions of DP. 2.3. Basic functions of PROFIBUS-DP PROFIBUS-DP can communicate with decentralized field devices (such as valves, drives, etc.) through a high-speed serial bus, the master needs to access the input information of the slave at fixed intervals, and also send information at fixed intervals like the slave, and the bus cycle time must not exceed the master program cycle time. In addition, smart field devices require asynchronous communication for configuration, diagnostics, and alarm handling. 3. Single Master System Communication Model PROFIBUS-DP is widely used at the industrial site level because of its advantages of high-speed data transmission, making it ideal for completing telegram transmission tasks that require high real-time performance in small-scale networks. There are two main time parameters related to the real-time nature of the PROFIBUS-DP bus: one is the time when the master polls each slave, and the other is the rotation time of the token between the masters. There are many factors related to these two times, in addition to the properties of the system itself and the characteristics of the protocol, the user's setting of network parameters also plays a key role. The PROFIBUS-DP protocol uses the polling principle (master/slave mode) to communicate data in the form of messages. After a master obtains the token, it controls and manages the entire network in a master-slave manner, and schedules and assigns them according to priority. After the DP slave receives the request from the master, the information is exchanged between the master and slave, and the message transmission is organized in a circular manner, in addition to the global control function, each message loop includes a request frame of the master and a reply frame of the slave. The PROFIBUS-DP protocol uses high priority and low priority messages, all request packets are sent with high priority, except for the slave's response packet when there is a new diagnostic information in the DP slave with high priority, in all other cases the slave sends response packets with low priority.[4] A key function of the data link layer is to control the cycle time of tuning tokens. The token passes a polling cycle on the logical ring with a setting of the target token cycle time 𝑇 . The time for the token to actually pass a polling cycle on the logical ring is the actual token cycle time 𝑇 , which refers to the difference between the time when a master receives two tokens from the time it receives one token to the end when the next token is received. The token holding time of a site, 𝑇 , is defined as the difference between the target token cycle time 𝑇 and the actual token cycle time 𝑇 , i.e. 𝑇 𝑇 𝑇 . The master starts calculating 𝑇 after receiving the token. If 𝑇 >0, that is, the actual token cycle time is less than the target setting, if there are high-priority packets that need to be processed, the high-priority packets are processed first, otherwise the low-priority packets are processed. If 𝑇 <0, that is, the actual token cycle time is more than the target setting, if there are high-priority packets that need to be processed, the high-priority packets are processed first, otherwise the low-priority packets are processed. The processing cycle of data information for each data exchange between the master and slave sites is called the measurement and control cycle, which is recorded as 𝐷 , [5]which includes the delay of four parts: (1) information generation delay 𝑇 : the time when the sending task node generates the application task and joins the task to the transmission queue, which is mainly affected by the performance of the sending end. (2) Message queuing delay 𝑇 : After the packet arrives at the queue, it waits for the token to arrive and be processed, which is mainly affected by the information transmission mechanism and the size of the payload. (3) Data transmission delay 𝑇 : the time from the sender to the receiver receiving the return, the delay is mainly affected by the communication rate and the length of the message frame, that is, the single message transmission cycle (4) Transmission delay 𝑇 : The time spent on data processing and being forwarded mainly refers to the time occupied by message decoding and reassembly. Therefore, the expression of a task transmission measurement and control cycle is as follows: 𝐷 =𝑇 +𝑇 +𝑇 +𝑇 (1) Information generation and information retransmission are mainly determined by the performance of the host or controller, while the message queuing delay 𝑇 and data transmission delay 𝑇 are mainly determined by the bus transmission medium and the number of stations and the load of each site during engineering. In practical engineering applications, with the improvement of hardware technology, the delay 𝑇 and transmission delay 𝑇 are generally negligible when evaluating bus communication performance. Therefore, equation (1) can be simplified to 𝐷 𝑇 +α𝑇 (2) The value of the Ξ± in the formula is 1.1[6] When evaluating the communication performance of PROFIBUS single-master multi-slave system, the following performance indicators are generally selected: Packet loss rate 𝑇 : The efficiency of sending information to the site with address i. It is generally expressed by the ratio of the number of failed packets 𝑆 to the number of destination transmitted packets 𝑆 , as shown in the equation: 𝑇 = (3) 𝑆 - The total number of messages transmitted by the target 𝑆 - The number of messages that failed to transmit Bus transmission efficiency 𝑇 : When the polling period is L, the actual number of successful transmitted packets accounts for the proportion of all packets, as shown in the equation: 𝑇 = βˆ‘ βˆ‘ (4) 75 𝑀 and 𝑁 are the total number of high-priority and low- priority packets that are completed by all slave responses when the polling period is L 4. Single Master System Communication Simulation Set the number of slaves to 10, set the number of high and low priority packets to a random integer between 0 and 5, and the polling period is 20. Plot the relationship between the target token cycle time 𝑇 and bus transmission efficiency. Figure 2. The relationship between target token time and bus transmission efficiency Set the number of slaves to 10, set the number of high and low priority packets to a random integer between 0 and 5, and the polling period is 20.Plot the relationship between the target token cycle time 𝑇 and packet loss rate. Figure 3. The relationship between target token time and packet loss rate Set the target token cycle time to 40ms, set the number of high and low priority packets to a random integer between 0 and 5, and set the polling period to 15. Plot the relationship between the number of slaves and the packet loss rate. Figure 4. The relationship between the number of slaves and the packet loss rate 5. Conclusion It can be seen from the above figure that when the target token cycle time is small, the transmission efficiency of the bus is low, the packet loss rate of message transmission is high, and with the increase of the target token cycle time, the bus transmission efficiency is also increasing, and finally tends to a stable state, and the packet loss rate is also decreasing, and finally tends to a stable state. The packet loss rate is positively correlated with the number of slaves, and the greater the number of slaves, the greater the packet loss rate. Therefore, the higher the target token cycle time and the lower the number of slaves within a certain range, the higher the data transmission efficiency and the lower the packet loss rate. References [1] ZHAO Lei. Research on slave of PROFIBUS-DP fieldbus [D]. Jiangsu University of Science and Technology, 2015. [2] TONG Dongbing,CAO Hai,CAI Lecai. Design and implementation of ETHERNET/PROFIBUS-DP bus gateway based on embedded [J]. Microcomputer Information, 2010, 26 (16): 73-75. [3] ZHANG Taijie. Research and design of fieldbus PROFIBUS- DP and WiFi integrated gateway[D]. East China Jiaotong University, 2016. [4] CHEN Mei, YAO Qiyun, LI Xin, CHEN Wei, LIU Zhenying. Research on real-time performance of Profibus-DP single master system[J]. Industrial and Mining Automation, 2011, 37(01): 64-67. [5] An Xin. Simulation study on Profibus Fieldbus communication performance[D].North China Electric Power University (BEIJING),2020.DOI:10.27140/d.cnki.ghbbu.2020.000201. [6] Tovar E , Vasques F . Cycle Time Properties of the PROFIBUS Timed Token Protocol[J]. Computer Communications, 1999, 22(13):1206-1216.