PLC connection reference

Defaults, address rules, timings and what each protocol carries. The step-by-step guides link here for the details.

1. Connection types

All of them are in Simulation > PLC Controllers…, and all need the desktop app, because a browser tab cannot open a network connection or listen on a port.

In the dialogWho servesCarriesGuide
The PLC polls the simulatorThe simulator, Modbus TCPPoints, by I/O addressModbus TCP
The simulator polls the PLCThe PLC, Modbus TCPRegisters, by I/O addressA PLC that serves, part A
OPC UA, tags by nameThe PLC, OPC UAVariables, by nameA PLC that serves, part B
EtherNet/IP, tags by nameA Logix controller, EtherNet/IPController tags, by nameNone yet
S7 PUT/GETAn S7-1200 or S7-1500, port 102I, Q, M and data blocks, by addressS7-1200 / S7-1500
SLMPA MELSEC CPU (Q, L, iQ-R, iQ-F), port 5000X, Y, M and D devices, by addressMELSEC
ADS, tags by nameA TwinCAT runtime, through the TwinCAT router on this PCVariables, by nameTwinCAT

A fourth connection, OPC UA server, can run beside any of them. It publishes the program running in the simulator to a SCADA or HMI (guide). In all the others, Play hands the scene to the PLC and the program in the PLC panel does not run; the simulation speed is held at real time.

2. Defaults

These are saved on each computer, not in the scene.

SettingDefault
Port the simulator serves Modbus on5020
PLC address, when the simulator polls it127.0.0.1
PLC port, when the simulator polls it502
Holding register 0 is %IW0
Input register 0 is %QW0
PLC's OPC UA server, tags by nameopc.tcp://127.0.0.1:4840
Where the OPC UA tag browse startsempty: Objects
Logix or Micro800 controller's address, EtherNet/IP127.0.0.1
Route to the controller, EtherNet/IP (not used for a Micro800)1,0
Controller family, EtherNet/IP: logix or micro800logix
S7 CPU's address (a new CPU's)192.168.0.1
S7 CPU's port102
S7 CPU's rack0
S7 CPU's slot1
MELSEC CPU's address, SLMP192.168.0.1
MELSEC CPU's SLMP port5000
TwinCAT PLC's AMS Net IDempty: the runtime on this PC
TwinCAT PLC's AMS port (the first PLC project)851
Port of the simulator's own OPC UA server4843

Every server the simulator opens listens on this computer only, until Reachable from the network is ticked; Windows then asks to let the app through its firewall.

3. The simulator as a Modbus TCP server

In the dialog this is "The PLC polls the simulator". Each I/O address lands on one Modbus point by a fixed rule. The PLC reads the inputs (%I) and writes the outputs (%Q). Addresses are 0-based protocol addresses; the unit ID is ignored.

AddressModbus pointThe PLC
%IXb.nDiscrete input b×8 + nreads it (FC2)
%QXb.nCoil b×8 + nwrites it (FC5 / FC15)
%IWnInput register nreads it (FC4)
%QWnHolding register nwrites it (FC6 / FC16)
%IDnInput registers 2n, 2n+1reads them (FC4)
%QDnHolding registers 2n, 2n+1writes them (FC16)

Examples:

AddressModbus point
%IX0.0discrete input 0
%IX1.2discrete input 10
%QX100.0coil 800
%IW3input register 3
%QW7holding register 7
%ID50input registers 100-101
%QD50holding registers 100-101

4. The simulator as a Modbus TCP client

In the dialog this is "The simulator polls the PLC". A PLC's Modbus server device exposes its process image as registers. The simulator writes holding registers (the PLC's inputs) and reads input registers (its outputs). A bit is a bit of the register that holds its byte, so a bit and that word clash. The two base settings say which %IW and %QW the device's register 0 is.

AddressRegister, from the baseThe simulator
%IXb.nHolding register b div 2, bit (b mod 2)×8 + nwrites it (FC16)
%IWnHolding register nwrites it (FC16)
%IDnHolding registers 2n, 2n+1writes them (FC16)
%QXb.nInput register b div 2, bit (b mod 2)×8 + nreads it (FC4)
%QWn / %QDnInput register(s), as abovereads them (FC4)

Examples, with both bases at 0:

AddressRegister
%IX0.0holding register 0 bit 0
%IX1.3holding register 0 bit 11
%QX0.0input register 0 bit 0
%IW2holding register 2
%ID1holding registers 2-3

The simulator moves the whole holding block with one FC16 and reads the whole input block with one FC4 per cycle, split past 123 and 125 registers.

5. Where Assign I/O puts addresses

Simulation > Assign I/O Addresses gives every tag a part is wired to by name an address, declares it in the program, and rewires the parts, as one undo step. The same scene always gets the same addresses, skipping any already taken. When the PLC polls the simulator, the first of each size is:

A tag that isTypeFirst address
published by a part (a sensor)BOOL%IX0.0
read by a part (a motor)BOOL%QX0.0
published by a partINT%IW0
read by a part (a speed)REAL%QD50

Double words start at %ID50, registers 100 and up, so a hundred words fit below them. When the simulator polls the PLC instead, points are packed from the device's first register up, each at the first free spot. A constant, and anything that cannot travel, are left alone, each reported with the reason.

6. Timing and the watchdog

WhatValue
Silence after which the PLC's outputs are held off1000 ms
How often the simulator polls a PLC, in every mode where it connects to one20 ms
How long it waits for an answer500 ms
How often it retries a PLC that is not there1000 ms

7. The simulator's OPC UA server

PropertyValue
Endpointopc.tcp://<this computer>:4843, security policy None, anonymous login
Server nameOpen Industry Project simulator
Browse pathObjects > PLC > one folder per dot in the variable's name, so Main.Start is PLC > Main > Start
NodeIdThe variable's name, like ns=1;s=Main.Start, the same across runs, program edits and computers
WritableWhat an operator could change. A variable a part feeds, a constant and a function block's output are read only, and a write to one gets BadNotWritable.
While stoppedEvery value reads BadOutOfService and a write gets BadInvalidState. Subscriptions survive Stop and Play.
Update rateThe same 10 Hz mirror as the watch table. A subscription samples at 50 ms at the fastest.
IEC typeOPC UA type
BOOLBoolean
SINTSByte
USINT, BYTEByte
INTInt16
UINT, WORDUInt16
DINTInt32
UDINT, DWORDUInt32
REALFloat
LREALDouble
TIME, DATE, TOD, DTDouble
STRINGString

A TIME is milliseconds. DATE and DT are milliseconds since 1970-01-01 UTC and TOD since midnight. An enumeration is an Int16.

8. OPC UA tags by name

9. S7 PUT/GET

A part's address is the CPU's own: S7 memory is byte-addressed exactly as I/O addresses are, so nothing is mapped or offset. A data block address uses the S7 data-block spelling, without the %. The S7 guide has the CPU's side.

Scene tagOn the CPUTravels asThe simulator
%IX100.0I100.0BOOLwritten to the PLC
%QX100.0Q100.0BOOLread from the PLC
%IB2IB2BYTEwritten to the PLC
%QW4QW4INTread from the PLC
%ID84ID84REALwritten to the PLC
%QD8QD8DINTread from the PLC
%MX10.0M10.0BOOLwritten to the PLC
%MW20MW20INTread from the PLC
DB10.DBX0.0DB10.DBX0.0BOOLwritten to the PLC
DB10.DBD6DB10.DBD6REALread from the PLC

Not carried, each reported in the dialog with the reason:

Scene tagWhy
%IL0A 64-bit value
DB0.DBX0.0Data blocks are numbered from 1
DB10.DBW4.1Only a bit address has a .bit

10. SLMP devices

A part's tag is the CPU's own device address. The MELSEC guide has the CPU's side. SLMP has no authentication and no encryption: use it on this machine or a test bench.

Scene tagOn the CPUTravels asThe simulator
X1AX1ABOOLwritten to the PLC
Y10Y10BOOLread from the PLC
M10M10BOOLwritten to the PLC
D100D100INTwritten to the PLC
D200D200-D201DINTread from the PLC
D300D300-D301REALwritten to the PLC
B1AB1ABOOLwritten to the PLC
W10W10INTwritten to the PLC
SM10 / SD5SM10, SD5BOOL / INTthe direction the parts use them in
TS3 / TC3 / TN3TS3, TC3, TN3BOOL / BOOL / INTA timer's contact, coil and current value
CS1 / CC1 / CN1CS1, CC1, CN1BOOL / BOOL / INTA counter's contact, coil and current value
STS0 / STC0 / STN0STS0, STC0, STN0BOOL / BOOL / INTAn accumulated timer; also spelled SS/SC/SN
S0, L0, F0, V0S0, L0, F0, V0BOOLStep, latch, annunciator and edge relays
SB1A, SW1A, DX0, DY0SB1A, SW1A, DX0, DY0BOOL / INTLink special and direct access I/O
R0, ZR0, Z0R0, ZR0, Z0INTFile registers and the index register

Not carried, each reported in the dialog with the reason:

Scene tagWhy
X2000Past the last X address an iQ-R reaches (X1FFF)
M1AM addresses are decimal
D400Asked to carry a BOOL: a BOOL travels on a bit device
LTS0A long device: only the extended frame names it

11. ADS tags by name

The simulator reads and writes a TwinCAT 3 PLC's variables through the TwinCAT router on its own PC, with Beckhoff's own ADS library, so TwinCAT has to be installed there. A PLC on another computer is reached through the router's routes, as TwinCAT XAE reaches it. The ADS guide has the setup.

A tag is the variable's full symbol path, starting with the program or global variable list it is declared in:

Scene tagCarried
MAIN.Eyeyes
GVL.Station.Runyes
MAIN.Lane[3]yes
Eyeno: it names no program or list
%IX0.0no: an I/O address, not a name

On Play the simulator asks the runtime for each symbol's type, and carries these:

The PLC's typeCarried
BOOL, SINT, USINT, INT, UINT, DINT, UDINT, REAL, LREALyes
LINT, ULINTno: a scene number cannot hold every 64-bit value exactly
STRING, WSTRING, a structure or arrayno: not a single bit or number

12. The I/O list

File > Export I/O List (.csv) writes the points the scene serves, one per row, with the columns Tag,Address,Type,Direction,Modbus point,Device. Device names the part and parameter on the point; Tag is blank where the program declares nothing at that address.

File > Import I/O List… reads tag names against addresses, in any column order, comma, semicolon or tab separated, and reads its own export unchanged. A row is refused, with its line number, when its address is malformed, memory or 64-bit, contradicts the part's direction, does not fit the declared type, collides with another row, or names a tag nobody uses.