The Simulink® Real-Time™ software supports communication from the target computer to other systems or devices by using User Datagram Protocol (UDP) packets. UDP is a transport protocol that provides a direct method to send and receive packets over an IP network. UDP uses this direct method at the expense of reliability by limiting error checking and recovery.
UDP is a transport protocol layered on top of the Internet Protocol (IP). It is commonly known as UDP/IP.
Packet — UDP is a packet-oriented protocol. You divide the data into packets and the protocol sends them to the receiver.
Connectionless — UDP is a connectionless protocol. The protocol sends a packet to the receiver without checking to see if the receiver is ready to receive a packet. If the receiver is not ready, the packet is lost.
No Error Detection— UDP does not support error detection. The protocol sends packets and does not track them. If packets arrive out of sequence, or are lost in transmission, the receiving end or the sending end does not know.
UDP communication requires that the sender identifies the receiver. If the receiver is not found or the communication is lost in transit, the packet is discarded.
When describing UDP, the words reliable and unreliable have a specific meaning.
Reliable means that the protocol is not guaranteed to succeed. It does not mean that the protocol always succeeds.
Unreliable means that protocol packets can fail to arrive without the system detecting that the packets did not arrive. It does not mean that the protocol packets usually fail to arrive.
UDP continues to receive packets while the receiver is active and processes data as quickly as it arrives.
UDP is a commonly used transport layer because of its lightweight nature. When used from Simulink Real-Time, UDP gives the real-time application a good chance of succeeding in real-time execution. Also, the datagram nature of UDP is optimal for sending samples of data from the real-time application generated by the Simulink Coder™ software. If the real-time application cannot process the data as quickly as it arrives, only the most recent packet is used. The earlier packets are ignored.
You can construct a packet from Simulink data types such as
uint8, or a combination of these data
types. The Simulink
Real-Time block library provides blocks for combining various signals into one
packet (packing), and then transmitting it. It also provides blocks for splitting a
packet (unpacking) into its component signals that you can then use in a Simulink model.
The preceding information applies to communication with a shared Ethernet board and communication with a dedicated Ethernet board. Consider adding a dedicated Ethernet board for enhanced performance over communication by using a shared Ethernet board. Shared UDP communication shares bandwidth with the link between the development and target computers.