SICK OPEN TCP RA V1 0 en
SICK OPEN TCP RA V1 0 en
SICK OPEN TCP RA V1 0 en
SICK
Open TCP Connection
Add-On Instruction
Date: 25.10.2012
SICK Open Connection
Operating Instructions Add-On Instruction
Table of contents
1 About this document........................................................................................................ 3
1.1 Function of this document ............................................................................................ 3
1.2 Target group ................................................................................................................ 3
2 General information ......................................................................................................... 4
2.1 Block specifications...................................................................................................... 5
2.2 Supported PLC systems .............................................................................................. 5
3 Integration of the AOI in RSLogix5000............................................................................ 6
3.1 AOI import.................................................................................................................... 6
3.2 Configuration of the Create Socket message parameter .............................................. 6
3.3 Configuration of the Delete Socket message parameter .............................................. 7
3.4 Configuration of the Open Connection message parameter......................................... 8
3.5 AOI functions ..............................................................................................................10
3.5.1 Connect................................................................................................................10
3.5.2 Disconnect ...........................................................................................................12
3.6 TCP connection loss ...................................................................................................12
3.7 Behavior when error occurs ........................................................................................12
3.8 Parameters .................................................................................................................13
4 Error description .............................................................................................................15
5 Example ...........................................................................................................................16
5.1 Connect ......................................................................................................................16
5.2 Disconnect ..................................................................................................................17
2
SICK Open Connection
Operating Instructions Add-On Instruction
3
SICK Open Connection
Operating Instructions Add-On Instruction
2 General information
The Add-On Instruction (AOI) “SICK_OPEN_CONNECTION” simplifies the establishment of
a TCP connection between a SICK sensor and an RSLogix5000 controller.
The function block makes it possible create a socket service and open a TCP
connection.
Transactions:
- Create socket
- Open connection
- Close connection
SICK_OPEN_CONNECTION AOI
Message
(CreateSocket)
TCP
(Port 2112) Message Message
Device
(OpenConnection) (DeleteSocket)
Instance Tag
UDT
(SICKTCPData)
Instance Tag
4
SICK Open Connection
Operating Instructions Add-On Instruction
The AOI works asynchronously, i.e. processing occurs over several PLC cycles.
For more information see the Rockwell EtherNet/IP Socket Interface document.
5
SICK Open Connection
Operating Instructions Add-On Instruction
6
SICK Open Connection
Operating Instructions Add-On Instruction
7
SICK Open Connection
Operating Instructions Add-On Instruction
8
SICK Open Connection
Operating Instructions Add-On Instruction
9
SICK Open Connection
Operating Instructions Add-On Instruction
The AOI needs a socket interface to open a TCP connection between the SICK device and
the Logix5000 controller. The socket interface is implemented via the socket object in the
EtherNet/IP module. The PLC program communicates with the socket object via message
instructions (MSG).
Please note:
The socket interface, via messaging, is not well suited for real-time control as communication
with this method is not scheduled or deterministic.
3.5.1 Connect
The connect action creates a new socket instance and opens a TCP connection with a
specified destination address.
The following diagram shows the sequence of socket interface transactions with the
Logix5000 controller acting as a TCP client. Each transaction between the Logix5000
controller and the EtherNet/IP module is a MSG instruction.
10
SICK Open Connection
Operating Instructions Add-On Instruction
Before a TCP connection can establish, some parameters must be entered in the
SICKTCPData tag.
The connect action starts by calling up the AOI with a positive trigger (signal change from
FALSE to TRUE) at the bConnect input bit. As long as there is no valid answer the output
bBusy is TRUE. In case the timeout period is excided, a timeout error will be generated and
the thread will be terminated. The bDone (=TRUE) output shows that the transaction was
successful. Now the requested socket instance is available at the iSocketInstance output.
The outputs retain its states as long as there is no new positive trigger at the bConnect or
bDisconnect input.
If you use a local port number that is already in use by the EtherNet/IP module, you receive
an error. The EtherNet/IP module uses these port numbers:
- 20,21: FTP
- 25: SMTP
- 80: HTTP
- 123: NTP
- 161: SNMP
- 2222: EtherNet/IP
- 44818: EtherNet/IP
11
SICK Open Connection
Operating Instructions Add-On Instruction
Please note:
Each socket instance has an inactivity timeout with a default of 5 minutes. If a socket
instance receives no service requests for the amount of time specified by the inactivity
timeout, the socket instance is deleted. If you then try to use the socket instance, the MSG
instruction receives the error class or instance not supported.
You can change the timeout by setting the inactivity time-out attribute via the Set Attribute
service. For more information see the Rockwell EtherNet/IP Socket Interface document.
3.5.2 Disconnect
The disconnect action close the specified connection and deletes the associated socket
instance.
The “iSocketInstance” input/output specifies which socket should be closed. The disconnect
action starts by calling up the AOI with a positive trigger (signal change from FALSE to
TRUE) at the bDisonnect input bit. As long as there is no valid answer the output bBusy is
TRUE. In case the timeout period is excided, a timeout error will be generated and the thread
will be terminated. The bDone (=TRUE) output shows that the transaction was successful.
The outputs retain its states as long as there is no new positive trigger at the bConnect or
bDisconnect input.
In some cases the connection established automatically (unplugged network cable). But if
the target device switched off and switched on again, the connection must be reestablished
(create a new socket instance and open a TCP connection).
12
SICK Open Connection
Operating Instructions Add-On Instruction
3.8 Parameters
Parameter Declara- Data type Description
tion
EnableIn INPUT BOOL Enable input (only in the FBD view)
msgCreate IN/OUT MESSAGE The Socket Create service creates an instance
Socket of the socket object.
Example:
iTimeout = 5000
bConnect INPUT BOOL Positive trigger creates a new socket instance
and opens a TCP connection with a specified
destination address.
13
SICK Open Connection
Operating Instructions Add-On Instruction
14
SICK Open Connection
Operating Instructions Add-On Instruction
4 Error description
The parameter ERRORCODE contains the following error information:
- AOI error codes
- Rockwell specific error codes generated by the message blocks (SocketCreate,
DeleteSocket, OpenConnection)
15
SICK Open Connection
Operating Instructions Add-On Instruction
5 Example
Picture 13 shows an example configuration of the SICK_OPEN_CONNECTION AOI.
5.1 Connect
The connection parameters are entered into the “SICKTCPData.OpenConnectionSource” tag
which is defined by the SICKTCPData UDT.
16
SICK Open Connection
Operating Instructions Add-On Instruction
5.2 Disconnect
To disconnect the current connection with the socket instance (iSockInstance = 25177) call
the SICK_OPEN_CONNECTION AOI with a positive trigger at the “bDisconnect” input bit.
The bDone (=TRUE) output shows that the disconnection was successful.
17