![]() |
ALPHA-VISION® content: OPCServer |
Before a SoftPLC7 OPC Server can be brought into operation it must be registered. This is done by the command “SoftPLC7OPCServer.exe –regserver”. Deregistration is done via the parameter ‘unregserver’
In order to provide actual data for the SoftPLC OPC Server the section [HLL-Functions] of the SoftPLC7.ini file must be amended.
The exact Syntax for an OPC-Item is:
SoftPLC7:[<Instance Number>]<Area><Type><Offset>,<Number>
| Area | Description | Remark |
|---|---|---|
| DB<nr> | Data block with number | Is the DB with number<nr> nonexistent than the item is BAD |
| M | Flag | Independent of the CPU-Type always 16 KB are addressable |
| I | Input | Independent of the length of the defined process image 16 KB are addressable |
| O | Output | Independent of the length of the defined process image 16 KB are addressable |
| PI | Peripheral Input | Independent of the really allocated Peripheral bytes always 16KB are addressable |
| PO | Peripheral Output | Independent of the really allocated Peripheral bytes always 16KB are addressable |
| Type | Description | Offset | Number |
|---|---|---|---|
| B BYTE CHAR |
Byte (unsigned) | <Byte index of first Byte> | <Number of Bytes> |
| W WORD INT |
Word (signed) | <Byte index of first Word> | <Number of Words> |
| D DWORD DINT |
DWord (signed) | <Byte index of first DWord> | <Number of DWords> |
| REAL | 32 Bit Floating Point | <Byte index of first Floating Point digit> | <Number of Floating Point digits> |
| x | Bit | <Byte index of the Bit>.<Bit Number (0...7)> | 1 |
Alternatively synonyms may be used to form the prefix 'SoftPLC7:[nn]' of the OPC item name.
Synonyms are defined in section [OPC-Items] of the SoftPLC7OPCServer.ini file.
The file always resides in the same folder as the SoftPLC7OPCServer.exe application.
The format for a synonym definition reads as follows:
WantedText=SubstitutedText
If, for example,
an OPC-Item should be defined:
'S7:[Control3]MB0,1' instead of 'SoftPLC7:[15]MB0,1'
the following 2 entries are necessary
[OPC-Items]
S7=SoftPLC7
Control3=15
| OPC Item | Description |
|---|---|
| SoftPLC7:[01]DB60,B10,11 | From Instance 01 11 bytes starting at Index10 are read out of DB60 |
| SoftPLC7:[01]DB60,REAL20,4 | From Instance 01 4 floating digits starting at Index20 are read out of DB60 |
| SoftPLC7:[01]DB10,X20.5,1 | From Instance 01 bit 5 from byte 20 is read out of DB10 |
| SoftPLC7:[02]EX20.5,1 | From Instance 02 the input bit 5 from byte 20.5 is read |
| SoftPLC7:[03]PEDWORD20,2 | From Instance 03 the DWORDs 20 and24 are read out of the Peripheral input. |
On a new project it is helpful to get messages on specified actions. Hence the environment variable SOFTPLC7_OPCSERVER_DEBUG must be set to TRUE. The message ‘Trying to create <OPC-Item> … OK’ is issued on creating a new OPC-Item. The annex 'found' implies that the item already exists. A write access returns the message ‘Write request on <OPC-Item>: Value=<value>’.
After the test phase the messages should be suppressed to increase performance. Hence the environment variable SOFTPLC7_OPCSERVER_DEBUG must be set to FALSE, or deleted at all.
In addition the outputs may be written to the file ‘SoftPlc7OPCServer.err’. Although the environment variable SOFTPLC7_DEBUG_FILE has to be set to maximum length for the log file. Value=0 implements that no log file is written. A length of 10 MBs is recommended.
Normally SoftPLC7OPCServer, SoftPLC7 and OPC-Clients reside in a LAN whereas the applications may run on several PCs. To keep up UDP-Communication the following entries must exist:
| 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 Entry for the SoftPlc7OPC Server: [HLL-Function] PY0,0=SoftPlc7OPCServerDll,DoDataExchangeUDP |
| Entry | Type | Description / Example | Default |
|---|---|---|---|
| UpdateTimeFactor | integer |
Defines the interval for CPU update related to a time slice.
The value 5 at a given time slice of 200 ms leads to a refresh rate of 1 sec.
|
1 |
| LocalAddr | string |
Defines the IP address used for calling up the function “blind”
|
0.0.0.0 |
| RemoteAddr | string |
Defines the target IP address the UDP packages for the SoftPLC7 OPC server are send to.
IP address 255.255.255.255 stands for BROADCAST and may be used within a LAN. IP address 127.0.0.1 stands for LOCAL HOST and has to be used if the system is not part of a LAN Example
RemoteAddr=127.0.0.1 Note:
To keep sockets from allocating the whole address area when using the
function ’bind’ a special local IP-Address can be selected.
|