Send data over UDP network to specified remote machine
Instrument Control Toolbox
The UDP Send block sends data from your model to the specified remote machine using the UDP protocol.
You need a license for both the Instrument Control Toolbox™ and Simulink® software to use this block.
The UDP Send block has one input port and it accepts both 1-D vector and matrix data. This block has no output ports. The block inherits the data type from the signal at the input port.
This block supports the use of Simulink Accelerator™ mode, but not Rapid Accelerator or code generation.
The block supports the use of model referencing, so that your model can include other Simulink models as modular components.
For more information on these features, see the Simulink documentation.
You can enter MATLAB variables in the text edit fields in the UDP Send Block Parameters dialog box, except for these fields: Local address and Remote address.
Specify the IP address, name, or the Web server address of the machine to which you need to send data. This field is empty by default.
Specify the remote port on the host you need to send the data
to. The default port value is
9090. Valid port
Specify the IP address, name, or the Web server address of the local
host. This is the same as the UDP interface
property. This field is empty by default.
Specify the port to bind on the local machine. The default value
-1, which automatically binds to an available
Use to enable port sharing. UDP ports can be shared by other
applications to allow for multiple applications to listen to the UDP
datagrams on that port. You can bind a UDP object to a specific
LocalPort number, and in another application bind
a UDP socket to that same local port number so both can receive UDP
broadcast data. Enabling this option allows other UDP sockets to bind to
the UDP object’s
LocalPort. It is off by
Click this button to:
Check if the specified remote address is correct.
Establish connection with the specified remote address and port.
Use to set the
The UDP packet size is controlled by the
OutputDatagramPacketSize property. You can
specify the size, in bytes, between 1 and 65,535, and the default value
is 512. You can increase or decrease the packet size if
When using binary or binblock format with more than 8 bits, you can
specify the instrument's byte order for the data. Your options are
Specify if you want to block the simulation while sending data. This option is selected by default. Clear this check box if you do not want the write operation to block the simulation.
The following diagrams show the difference between sending data using blocking mode and nonblocking mode.
In this example, you start the simulation at time (t=0). At time step (T1), data output is initiated and simulation stops until the block of data (B1) is sent to the specified remote address and port. After the data is sent, simulation resumes until time step (T2), where the block initiates another data output and simulation is blocked until the block of data (B2) is sent to the remote address and port, and the simulation resumes.
Nonblocking Mode – Scenario 1
In this scenario, the data output outpaces the simulation speed. Data output is initiated at the first time step (T1) and the corresponding block of data (B1) is sent to the specified remote address asynchronously. The simulation runs continuously in this mode.
Nonblocking Mode – Scenario 2
In this scenario, the simulation is nonblocking and occurs faster than the data initiation.
At time step T1: The block of data (B1) is sent to the specified remote address and port asynchronously.
At time step T2: The simulation is blocked until the block of data (B1) is sent completely. When the (B1) is completely sent, the new block of data (B2) is sent asynchronously, and the simulation resumes.
Several factors, including network connectivity and model complexity, can affect the simulation speed. This can cause both nonblocking scenarios to occur within the same simulation.