modelTCPCommunicatorExample

Example model to show TCP communication with simple server

Extends from BaseClasses.PartialTCPCommunicator (Partial Model of TCP-Interface, minimum code which needs additional information).

Information

Simple TCP Communicator Example

This is a small example block which allows to establish a TCP connection between a client (i.e., Dymola or SimulationX by ESI) and an external server. It sends the value of input u[1] as a floating-point number to the server and receives a floating-point number. Check SocketCommunication.Examples.ExampleClientLoop for an executable example.

Parameters

TypeNameDefaultDescription
SI.TimesamplePeriod (from DiscreteBlock)Sample period of component
SI.TimestartTime (from DiscreteBlock)0First sample time instant
Integernin (from DiscreteMIMO)1Number of inputs
Integernout (from DiscreteMIMO)1Number of outputs
StringIP_Address (from PartialTCPCommunicator)"127.0.0.1"IP address or name of server
Integerport (from PartialTCPCommunicator)27015Port on server
Modelica.Units.SI.TimesamplePeriodExample1Sample period how often a telegram is send
Modelica.Units.SI.TimestartTimeExample0Start time when sampling starts
StringIP_AddressExample"127.0.0.1"IP address or name of Server
IntegerportExample27015Port on server
IntegernSend1Number of data points to be written
IntegernRecv1Number of data points to be read
Modelica_DeviceDrivers.Utilities.Types.ByteOrderbyteOrderModelica_DeviceDrivers.Utilities.Types.ByteOrder.LEByte order

Connectors

TypeNameDefaultDescription
Modelica.Blocks.Interfaces.RealInput[nin]u (from DiscreteMIMO)Connector of Real input signals
Modelica.Blocks.Interfaces.RealOutput[nout]y (from DiscreteMIMO)Connector of Real output signals

Revisions

  • August 25, 2018  by Thomas Beutlich:
    Utilize TCPIPSocketClient_ functions from Modelica_DeviceDrivers library. This is for:#277
  • June 01, 2013  by Georg Ferdinand Schneider:
    Implemented
  • September 03, 2013  by Georg Ferdinand Schneider:
    Revised and updated