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
| Type | Name | Default | Description |
|---|---|---|---|
| SI.Time | samplePeriod (from DiscreteBlock) | Sample period of component | |
| SI.Time | startTime (from DiscreteBlock) | 0 | First sample time instant |
| Integer | nin (from DiscreteMIMO) | 1 | Number of inputs |
| Integer | nout (from DiscreteMIMO) | 1 | Number of outputs |
| String | IP_Address (from PartialTCPCommunicator) | "127.0.0.1" | IP address or name of server |
| Integer | port (from PartialTCPCommunicator) | 27015 | Port on server |
| Modelica.Units.SI.Time | samplePeriodExample | 1 | Sample period how often a telegram is send |
| Modelica.Units.SI.Time | startTimeExample | 0 | Start time when sampling starts |
| String | IP_AddressExample | "127.0.0.1" | IP address or name of Server |
| Integer | portExample | 27015 | Port on server |
| Integer | nSend | 1 | Number of data points to be written |
| Integer | nRecv | 1 | Number of data points to be read |
| Modelica_DeviceDrivers.Utilities.Types.ByteOrder | byteOrder | Modelica_DeviceDrivers.Utilities.Types.ByteOrder.LE | Byte order |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| 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