The Simulink® Real-Time™ software supports communication from the target computer to other systems or devices using Transmission Control Protocol (TCP). TCP provides ordered and error-checked packet transport.
TCP is a transport protocol layered on top of the Internet Protocol (IP). It is commonly known as TCP/IP.
Stream — TCP is a stream-oriented protocol.
TCP is a long stream of data that flows from one end of the network to the other. Another long stream of data flows in the other direction. The TCP stack at the transmitting end is responsible for breaking the stream of data into packets and sending those packets. The stack at the receiving end is responsible for reassembling the packets into a data stream using information in the packet headers.
Connection — TCP is a connection-based protocol.
In TCP, the two ends of the communication link must be connected throughout the communication.
Error Detection — TCP detects errors.
TCP packets contain a unique sequence number. The starting sequence number is communicated to the other side at the beginning of communication. The receiver acknowledges each packet, and the acknowledgment contains the sequence number so that the sender knows which packet was acknowledged. Therefore, packets lost on the way can be retransmitted. The sender knows that they did not reach their destination because the sender did not receive an acknowledgment. The receiver can reassemble in order packets that arrive out of sequence. Timeouts can be established, because the sender knows from the first few packets how long it takes to transmit a packet and receive its acknowledgment.
TCP communication is like a telephone conversation. A continuous connection is required, and two-way streaming data (the words spoken by each party) are exchanged.
When describing TCP, the words Reliable and Unreliable have a specific meaning.
Reliable means that if a packet is not acknowledged, it is retransmitted. It does not mean that the protocol always succeeds.
Unreliable means that if too many packets are not acknowledged, the protocol can time out. It does not mean that the protocol packets usually fail to arrive.
You can construct a packet from Simulink data types such
or a combination of these data types. The
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 can then be used
in a Simulink model.
The preceding discussion applies to both communication with a shared Ethernet board and communication with a dedicated Ethernet board. Consider adding a dedicated Ethernet board for enhanced performance over communication using a shared Ethernet board. Shared TCP communication shares bandwidth with the link between the development and target computers.