modelTestSerialPackager_UDPAutoBufferSize

Example for combining UDP and SerialPackager blocks with activated autoBufferSize / useBackwardPropagatedBufferSize

Extends from Modelica.Icons.Example (Icon for runnable examples).

Information

The uDPSend block sends to the local port 10002. The uDPReceive block starts a background process that listens at port 10002. Consequently, the uDPReceive block receives what the uDPSend block sends.

Note: There is no causality between the uDPSend block and the uDPReceive block. Therefore the execution order of the blocks is not determined. Additionally, the uDPReceive block starts an own receiving thread, so that the time the data was received is not equal to the time the external function within the uDPReceive block was called. This indeterminism may also show up in the plots.

This example sends data to address 127.0.0.1, which is a special-purpose IPv4 address and is called the localhost or loopback address. When you have to transfer data to another computer you have to use in uDPSend that computer's IP. You've also to set the port number of the remote computer you want to send to.

When you want to receive data from another computer, you have set in uDPReceive the actual port number of the local computer you a willing to receive data to.

Components

TypeNameDefaultDescription
Modelica_DeviceDrivers.Blocks.Packaging.SerialPackager.Packagerpackager
Modelica_DeviceDrivers.Blocks.Packaging.SerialPackager.AddRealaddReal
Modelica.Blocks.Sources.RealExpression[3]realExpression
Modelica_DeviceDrivers.Blocks.Communication.UDPSenduDPSend
Modelica_DeviceDrivers.Blocks.Packaging.SerialPackager.AddIntegeraddInteger
Modelica.Blocks.Sources.IntegerExpressionintegerExpression
Modelica_DeviceDrivers.Blocks.Communication.UDPReceiveuDPReceive
Modelica_DeviceDrivers.Blocks.Packaging.SerialPackager.GetRealgetReal
Modelica_DeviceDrivers.Blocks.Packaging.SerialPackager.GetIntegergetInteger
Packaging.SerialPackager.AddFloataddFloat
Packaging.SerialPackager.GetFloatgetFloat
Modelica.Blocks.Sources.RealExpression[2]realExpression1