UDP blocks to facilitate communication between real-time SimWB and non-real-time Simulink®.
UDP Block Library: simwbUDPBlocklib
The UDP Blocks are template blocks that facilitate the creation of an UDP interface between
SimWB and Simulink.
The
Enter the number of ports for the block. Other blocks parameters change depending on this setting. The block is automatically resized to fit the number of ports.
A cell array of port names. These names are displayed on the block and are used to generate the SimWB UDP interface. Changing the number of ports changes the port names by default.
This is the IP address of the system running the Simulink model in which this block is placed. This IP address will be used in the SimWB UDP interface. So that the real-time host knows where to send the UDP data. This IP address is used by the SimWB UDP interface.
This is the IP port of the system running the Simulink model in which this block is placed. This value defaults to 25000. The value can be in [1, 65535] range. Simulink will listen to this port for data sent by SimWB. This port number is used by the SimWB UDP interface.
This is the IP address of the real-time host system which will send data to the Simulink model. Specify the IP address from which to accept packets. Entering a specific IP address blocks UDP packets from any other address. To accept packets from any IP address, enter '0.0.0.0'. This value defaults to '0.0.0.0'.
Make the reception buffer large enough to avoid data loss caused by buffer overflows.
This block uses the double data type as default and, so for one output port
with data type double the buffer size is automatically set to 8 bytes.
Increasing the number of ports to two will automatically change the
Specify the maximum length, in vector elements, of the data output vector.
Set this parameter to a value equal or greater than the data size of any UDP packet.
The system truncates data that exceeds this length.
This block uses the double data type as default and so for one output port with a data type double the
For each sample, wait this length of time for an UDP packet before returning control to the scheduler. This value defaults to inf, which indicates to wait indefinitely.
Specify how often the scheduler runs this block. Enter a value greater than zero. In real-time operation, setting this option to a large value reduces the likelihood of dropped UDP messages. This value defaults to a sample time of 0.01 s.
Containing a cell array, each element in the array specifies the dimension that the MATLAB size function returns for the corresponding signal. Usually you use the same dimensions as you set for the corresponding Byte Pack block in the model. Entering one value means that the block applies that dimension to all data types. This field is automatically populated based on the number of ports.
Specify the data types for the different input signals to the Pack block. The block supports all Simulink data types — single, double, int8, uint8, int16, uint16, int32, and uint32, and Boolean. The entry here is the same as the Input port data types parameter in the Byte Pack block in the model. You can enter one data type, and the block applies that type to all output ports. This field is automatically populated based on the number of ports.
This option specifies how to align the data types to form the input uint8 vector. Match this setting with the corresponding Byte Pack block alignment value of 1, 2, 4, or 8 bytes.
Specify the IP address or host name to which the block sends the message. To broadcast the UDP message, retain the default value, '255.255.255.255'. This will be the address of the real-time host.
Specify the port to which the block sends the message. The port value must be in the [1, 65535] range. The Default value is 25000. This will be the port of the real-time host.
Specify the data types for the different signals as part of the parameters. The block supports all Simulink data types except characters. Enter the data types as Simulink types in the cell array, such as 'double' or 'int32'. The order of the data type entries in the cell array must match the order in which the data arrives at the block input. This block determines the signal sizes automatically. The block always has at least one input port and only one output port.
This option specifies how to align the data types to form the uint8 output vector. Select one of the values in bytes from the list. Alignment can occur on 1, 2, 4, or 8-byte boundaries depending on the value you choose. The value defaults to 1. Given the alignment value, each signal data value begins on multiples of the alignment value. The alignment algorithm ensures that each element in the output vector begins on a byte boundary specified by the alignment value. Byte alignment sets the boundaries relative to the starting point of the vector.