SoftPlc7Net.dll

SUMMARY

The SoftPLC7Net.dll contains all communication functions to interchange data between different SoftPLC7s.

CONTENTS

  1. Introduction
  2. Configuration
  3. Server connections
  4. P_SND_RK and P_RCV_RK
  5. Diagnosis
  6. Redundance
  7. SoftPLCNet.ini
  8. SoftPLC7.ini

Introduction

The SoftPlcNet.dll holds the entire functionality for the communication between several SoftPLC7. Like the original Simatic S7, SoftPLC7s can interchange data. Thereby the used system functions are replaced by HLL-Functions.

The following PLC to PLC communication DBs are supported by SoftPLC7
Module Function name Send/Recv Interface SHM Interface UDP Interface Replaces the default in a SoftPLC7
FC5 AG_SEND yes yes yes no
FC6 AG_RECV yes yes yes no
FC50 AG_LSEND yes yes yes no
FC60 AG_LRECV yes yes yes no
SFB12 BSEND yes yes yes yes
SFB13 BRCV yes yes yes yes
SFB14 GET yes yes no yes
SFB15 PUT yes yes no yes
SFB22 STATUS yes yes no yes
SFB23 USTATUS yes yes no yes

In principle any (S)FC and (S)FB can be replaced by any HLL-Function with appropriate parameters. The settings therefore are made in the SoftPLC7.ini file. If entry’s for SFBs are missing the standard functions of SoftPLCNet.dll are used as a default. The functions FC5, 6, 50 and 60 will not be replaced automatically, since they not necessarily comply with the PLC functions. In that case a manual entry must be made.

Configuration

The connections for communication between the original Simatic S7 must be investigated and the SoftPLC7s must be set up accordingly.
The parameters must be defined in the SoftPLCNet.ini file.
For the connections it must be distinguished between the standard send/receive interface, the special SHM-Interface and the UDP-Interface. To use the send/receive interface “ISO Ind. Ethernet” must be defined as the interface to be used.
After restoring a snapshot all connections are resetted.

Server connections

Contrary to the functions PLC_(L)SEND, PLC_(L)RECV or BSEND,BRCV the functions GET, PUT, STATUS and USTATUS has to be executed asynchronously. In the remote PLC there is no equivalent to the call PLC_(L)RECV or BRCV; incoming telegrams are analyzed and answered telegrams are send back, on which the local PLC reacts. To start the server functionality the SoftPLC7.ini file must be amended in the section [Plugin-Functions] - see below.

P_SND_RK and P_RCV_RK

For simulation of a CP341 the HLL-Functions “PRCV_RK” and P_SND_RK” are available to replace FB7 and FB8 out of the SIMATIC-Library “CP Ptp”. The only driver supported is the ASCII-driver. No control signals like RTS/CTS are send, the end of a telegram is recognized by an adjustable ‘no data’ gap.
Communication is done via a RS-232-Interface. To use a RS-485-Interface an Interface-Converter is needed; it must be configured for 2 wires and self-controlling.

The SoftPLC7.ini file must be amended in the section [HLL-Functions]

The SoftPLCNet.ini file must be amended in the sections [Startup] and [ComDriver<n>] - see below.

Diagnosis

Via the pull-down menu ‘Extras’, item ‘Connections..’ all connections defined for the SoftPLC7 can be inspected. The last 2 columns show the total amount of send and received bytes since program start and they are still updated when watching.

Redundance

When using the SHM-Interface, also redundant connections can be created.

Example:
CPU1 and CPU2 got 2 CPs each. The addresses are 0x1000, 0x1100 (CPU1) and 0x2000, 0x2100 (CPU2).
Data should be send redundant by FC50 from CPU1 to CPU2.
The SoftPlcNet.ini configurations of the SoftPLC7s might look alike:

Entries at CPU1
[Settings]
LAddr1=1000
LAddr2=1100
[SR-Connections]
Con_1=(1;2;AG1;AG2;n;1; ;2000)
Con_2=(1;2;AG1;AG2;n;2; ;2100)
			  

Entries at CPU2
[Settings]
LAddr1=2000
LAddr2=2100
[SR-Connections]
Con_1=(1;2;AG2;AG1;n;1; ;1000)
Con_2=(1;2;AG2;AG1;n;2; ;1100)
			  


Packages send by CPU1 via AG_LSEND(ID=1, LADDR=W#16#1000) are received by CPU2 via AG_LRECV(ID=2,LADDR=W#16#2000).
Packages send by CPU1 via AG_LSEND(ID=1, LADDR=W#16#1100) are received by CPU2 via AG_LRECV(ID=2,LADDR=W#16#2100).

Sending packages via a connection with a remote LAddr<>0 defined are accepted remotely only if there no LAddr-Index is specified, or the specified one match's the ‘remote LAddr’ exactly.
Sending packages via a connection with no specific remote LAddr (LAddr=0) defined are accepted at the remote end if just the local Conn_Id match's.

If the functions GET, PUT, STATUS and USTATUS to be used on redundant communication with a remote LAddr defined, the corresponding Server-Connections pointing to that LAddr must be created.
On CFB, BSEND and BRCV the remote LAddr is not checked, since the R_ID is unique.

INI-FILES

SoftPLCNet.ini

Section [Startup]

Entry Type Description / Example Default
Window integer
Defines whether an Info Window should be opened
  • 0 - do not open window
  • 1 - open window
0
ComDriverCount integer
Number of used CP 341
0

Section [Settings]

Entry Type Description / Example Default
SR-Entrypoint integer
Access point for the connection
LAddr integer
Board identifier according to the settings of the SIMATIC Manager. Value=hex-format
0
AG_Typ integer
AG-Typ i.E. 300, 318, 400, 416 etc
400
SR-Entrypoint<n>
(1 <= n <=4)
integer
4 access points for hardware connections
LAddr<n>
(1 <= n <=4)
integer
4 board identifier for hardware connections according to the settings of the SIMATIC Manager. Value is written in hex-format.

Section [SR-Connections]

Entry Type Description / Example Default
Count integer
Number of connections
99
Conn_<n> string
For the send/rec-Interface (ISO):
(<localConn-Id>;<MAC-Address>;<local TSAP>;<remote TSAP> ;<link connection>;<LAddr-Index>;<ServerConn>)

For the send/rec-Interface (ISO over TCP / RFC 1006):
(<localConn-Id>;<IP-Address>;<local TSAP>;<remote TSAP> ;<link connection>;<LAddr-Index>;<ServerConn>)

For SHM-interface:
(<localConn-Id>;<remoteConn-Id>;AG<local AG-Number>;PLC<remote AG-Number> ;<link connection>;<LAddr-Index>;<remote LAddr>;<fast connection>)

For UDP-interface:
(<localConn-Id>;UDP=[<local IP-Address>:]<remoteIP-Address> ;<local Port>;<remote Port>;<LAddr-Index>)


For TCP/IP-interface:
(<localConn-Id>;TCP=[<local IP-Address>:]<remoteIP-Address> ;<local Port>;<remote Port>;<link connection>;<LAddr-Index>)

Parameter Description
localConn-Id Address of local PLC
remoteConn-Id Address of remote PLC
MAC-Address MAC address of remote PLC
IP-Address IP address of remote PLC
local TSAP Transport Service Access Point of local PLC
remote TSAP Transport Service Access Point of remote PLC
local AG-Number Instance number local PLC
remote AG-Number Instance number remote PLC
local Port Port UDP-packages are send from
remote Port Port UDP-packages are send to
link connection SHM-Interface: 'n'- without acknowledge Send/Recv= and TCP/IP-Interface:
'a' - activ connection
'p' - passive connection
LAddr-Index Defines the hardware connection: LAddr<n>
ServerConn '1' defines a server connection; important for GET, PUT, STATUS, USTATUS
remote LAddr LAddr of target PLC
local IP-Address Address the socket-function 'bind' refers to. The parameter (with colon) may be omitted, 0.0.0.0 (=INADDR_ANY)than is taken as address
remote IP-Address Target address UDP-packages are send to. IP-Address 255.255.255.255 is identified as BROADCAST. For multicast the address area 224.0.1.0 to 239.255.255.255 may be used
fast connection So fare for SHM-connections PLC_(L)SEND and BSEND only:
'f' (fast connection) -used as default-; no rising edge is needed to start sending, value 1 is sufficient. The mission is marked ‘completed’ after 2 cycles.

‘s’ (slow connection) needs a rising edge to start sending, value 1 is not sufficient. The mission is marked ‘completed’ after 3 cycles.

Consequence on PLC_(L)SEND:
<P> setting ‘f’:
An error free action responds with:
(ACT,DONE,STATUS)=(1,0,0x0000).
<P> setting ‘s’:
An error free action responds with:
(ACT,DONE,STATUS)=(1,0,0x8181),(0,0,0x8181),(0,1,0x0000).

Consequence on BSEND:
<P> setting ‘f’:
An error free action responds with:
(REQ,DONE,STATUS)=(1,0,25), (0,1,0x0000).
<P> setting ‘s’:
An error free action responds with:
(REQ,DONE,STATUS)=(1,0,25),(0,0,025),(0,1,0)
UDPMax integer
The maximum of UDP-packages that can be gathered in the buffer (per connection)
1024

Section [Run]

Entry Type Description / Example Default
Trace integer
Archiving of debug information
  • 0 - no archiving
  • 1 - Informations are written to a file named 'SoftPlcNet_<PLC-Number>.log' in the SoftPLC7 working directory
0
InfoMask integer
The mask defines which messages are displayed in the window.
'-1' allows any message to be displayed.
0
ListBox integer
defines whether messages are displayed in the window, '0' - no messages

Section [Interface]

Entry Type Description / Example Default
SendReceive string
Name of a DLL for the Send/Recv-Interface.
The Send/Recv-Interface is used to set up ISO-on-TCP connections between SoftPLC7s.
s7_sr.dll
SharedMemory string
Name of a DLL for the SHM-Interface.
The SHM-Interface is user-specific and not at common disposal.
For any package send a shared-memory-area is allocated that is made available for other SoftPLC7s.
schshm.dll

Section [ComDriver<n>]

<n> for n=1,2,...
A plausibility check of the entries is performed and if necessary modified to a reasonable value.
Entry Type Description / Example Default
ComPort integer
Used COM-Port. Possible values: 1-4 for COM1 – COM4
1
LAddr integer
LAddr on the CP. (value in hex)
0
DelayTime integer
'no data'- gap depends on the baud rate also
4
MaxTeleCount integer
Max. Number of buffered telegrams (1-250)
250
PreventOverwriting integer
Overwrite old telegrams? 0=no; 1=yes ;(for MaxTeleCount=1 only)
1
BaudRate integer
Baud rate: 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 76800
9600
DataBits integer
Number of data bits: 7 or 8
8
StopBits integer
Number of stop bits: 1 or 2
1
Parity string
Parity used: N=no, O=odd, E=even
E

SoftPLC7.ini

Section [HLL-Functions]

Entry Type Description / Example Default
(FB |FC |SFB |SFC )<num> string
Defines the DLL-Function that replaces the Program-Module with the following syntax: <dll, function>
Example
FC13=MyDll, MyFunction
				

For "P_SND_RK and P_RCV_RK" the entries must look like:
[HLL-Function]
FB7=SoftPlcNet,P_RCV_RK
FB8=SoftPlcNet,P_SND_RK
			        

Section [Plugin-Functions]

Entry Type Description / Example Default
Func<n> string
Activates Plugin-Functions of the SoftPLC7.
Example
Func1=S7Sync,S7SyncControl
				
Note:
This function is called up by the same fixed cycle that the OBs are synchronized with. It waits for the token, hands over the control to the S7-threads and on cycle end it passes on the token.

For server connection
[Plugin-Functions]
Func1=SoftPlcNet,ProcessSharedMemory   ;if  shared memory interface is used
or
Func1=SoftPlcNet,ProcessSendRecv       ;if Send/Recv interface is used
			        

Both interfaces may be used concurrently; in that case different function numbers have to be used.
UDP-Interface does not support server connection.

If the Send/Recv-Interface is used both PLCs must have the corresponding entry in the SoftPlcNet.ini file.