PLC connection reference
Defaults, address rules, timings and what each protocol carries. The step-by-step guides link here for the details.
Defaults, address rules, timings and what each protocol carries. The step-by-step guides link here for the details.
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 dialog | Who serves | Carries | Guide |
|---|---|---|---|
| The PLC polls the simulator | The simulator, Modbus TCP | Points, by I/O address | Modbus TCP |
| The simulator polls the PLC | The PLC, Modbus TCP | Registers, by I/O address | A PLC that serves, part A |
| OPC UA, tags by name | The PLC, OPC UA | Variables, by name | A PLC that serves, part B |
| EtherNet/IP, tags by name | A Logix controller, EtherNet/IP | Controller tags, by name | None yet |
| S7 PUT/GET | An S7-1200 or S7-1500, port 102 | I, Q, M and data blocks, by address | S7-1200 / S7-1500 |
| SLMP | A MELSEC CPU (Q, L, iQ-R, iQ-F), port 5000 | X, Y, M and D devices, by address | MELSEC |
| ADS, tags by name | A TwinCAT runtime, through the TwinCAT router on this PC | Variables, by name | TwinCAT |
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.
These are saved on each computer, not in the scene.
| Setting | Default |
|---|---|
| Port the simulator serves Modbus on | 5020 |
| PLC address, when the simulator polls it | 127.0.0.1 |
| PLC port, when the simulator polls it | 502 |
| Holding register 0 is %IW | 0 |
| Input register 0 is %QW | 0 |
| PLC's OPC UA server, tags by name | opc.tcp://127.0.0.1:4840 |
| Where the OPC UA tag browse starts | empty: Objects |
| Logix or Micro800 controller's address, EtherNet/IP | 127.0.0.1 |
| Route to the controller, EtherNet/IP (not used for a Micro800) | 1,0 |
| Controller family, EtherNet/IP: logix or micro800 | logix |
| S7 CPU's address (a new CPU's) | 192.168.0.1 |
| S7 CPU's port | 102 |
| S7 CPU's rack | 0 |
| S7 CPU's slot | 1 |
| MELSEC CPU's address, SLMP | 192.168.0.1 |
| MELSEC CPU's SLMP port | 5000 |
| TwinCAT PLC's AMS Net ID | empty: the runtime on this PC |
| TwinCAT PLC's AMS port (the first PLC project) | 851 |
| Port of the simulator's own OPC UA server | 4843 |
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.
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.
| Address | Modbus point | The PLC |
|---|---|---|
| %IXb.n | Discrete input b×8 + n | reads it (FC2) |
| %QXb.n | Coil b×8 + n | writes it (FC5 / FC15) |
| %IWn | Input register n | reads it (FC4) |
| %QWn | Holding register n | writes it (FC6 / FC16) |
| %IDn | Input registers 2n, 2n+1 | reads them (FC4) |
| %QDn | Holding registers 2n, 2n+1 | writes them (FC16) |
Examples:
| Address | Modbus point |
|---|---|
| %IX0.0 | discrete input 0 |
| %IX1.2 | discrete input 10 |
| %QX100.0 | coil 800 |
| %IW3 | input register 3 |
| %QW7 | holding register 7 |
| %ID50 | input registers 100-101 |
| %QD50 | holding registers 100-101 |
%IW101 and %ID50) is a conflict; the wiring check reports it before Play.%IB), 64-bit values (%IL) and memory (%M) are not sent.
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.
| Address | Register, from the base | The simulator |
|---|---|---|
| %IXb.n | Holding register b div 2, bit (b mod 2)×8 + n | writes it (FC16) |
| %IWn | Holding register n | writes it (FC16) |
| %IDn | Holding registers 2n, 2n+1 | writes them (FC16) |
| %QXb.n | Input register b div 2, bit (b mod 2)×8 + n | reads it (FC4) |
| %QWn / %QDn | Input register(s), as above | reads them (FC4) |
Examples, with both bases at 0:
| Address | Register |
|---|---|
| %IX0.0 | holding register 0 bit 0 |
| %IX1.3 | holding register 0 bit 11 |
| %QX0.0 | input register 0 bit 0 |
| %IW2 | holding register 2 |
| %ID1 | holding 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.
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 is | Type | First address |
|---|---|---|
| published by a part (a sensor) | BOOL | %IX0.0 |
| read by a part (a motor) | BOOL | %QX0.0 |
| published by a part | INT | %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.
| What | Value |
|---|---|
| Silence after which the PLC's outputs are held off | 1000 ms |
| How often the simulator polls a PLC, in every mode where it connects to one | 20 ms |
| How long it waits for an answer | 500 ms |
| How often it retries a PLC that is not there | 1000 ms |
| Property | Value |
|---|---|
| Endpoint | opc.tcp://<this computer>:4843, security policy None, anonymous login |
| Server name | Open Industry Project simulator |
| Browse path | Objects > PLC > one folder per dot in the variable's name, so Main.Start is PLC > Main > Start |
| NodeId | The variable's name, like ns=1;s=Main.Start, the same across runs, program edits and computers |
| Writable | What 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 stopped | Every value reads BadOutOfService and a write gets BadInvalidState. Subscriptions survive Stop and Play. |
| Update rate | The same 10 Hz mirror as the watch table. A subscription samples at 50 ms at the fastest. |
| IEC type | OPC UA type |
|---|---|
| BOOL | Boolean |
| SINT | SByte |
| USINT, BYTE | Byte |
| INT | Int16 |
| UINT, WORD | UInt16 |
| DINT | Int32 |
| UDINT, DWORD | UInt32 |
| REAL | Float |
| LREAL | Double |
| TIME, DATE, TOD, DT | Double |
| STRING | String |
A TIME is milliseconds. DATE and DT are milliseconds since 1970-01-01 UTC and TOD since midnight. An enumeration is an Int16.
Eye or Main.Eye. A NodeId written out (ns=4;s=...) is taken as it is.... is an OPC UA discovery server, not a PLC and names the servers it lists.
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 tag | On the CPU | Travels as | The simulator |
|---|---|---|---|
| %IX100.0 | I100.0 | BOOL | written to the PLC |
| %QX100.0 | Q100.0 | BOOL | read from the PLC |
| %IB2 | IB2 | BYTE | written to the PLC |
| %QW4 | QW4 | INT | read from the PLC |
| %ID84 | ID84 | REAL | written to the PLC |
| %QD8 | QD8 | DINT | read from the PLC |
| %MX10.0 | M10.0 | BOOL | written to the PLC |
| %MW20 | MW20 | INT | read from the PLC |
| DB10.DBX0.0 | DB10.DBX0.0 | BOOL | written to the PLC |
| DB10.DBD6 | DB10.DBD6 | REAL | read from the PLC |
Not carried, each reported in the dialog with the reason:
| Scene tag | Why |
|---|---|
| %IL0 | A 64-bit value |
| DB0.DBX0.0 | Data blocks are numbered from 1 |
| DB10.DBW4.1 | Only a bit address has a .bit |
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 tag | On the CPU | Travels as | The simulator |
|---|---|---|---|
| X1A | X1A | BOOL | written to the PLC |
| Y10 | Y10 | BOOL | read from the PLC |
| M10 | M10 | BOOL | written to the PLC |
| D100 | D100 | INT | written to the PLC |
| D200 | D200-D201 | DINT | read from the PLC |
| D300 | D300-D301 | REAL | written to the PLC |
| B1A | B1A | BOOL | written to the PLC |
| W10 | W10 | INT | written to the PLC |
| SM10 / SD5 | SM10, SD5 | BOOL / INT | the direction the parts use them in |
| TS3 / TC3 / TN3 | TS3, TC3, TN3 | BOOL / BOOL / INT | A timer's contact, coil and current value |
| CS1 / CC1 / CN1 | CS1, CC1, CN1 | BOOL / BOOL / INT | A counter's contact, coil and current value |
| STS0 / STC0 / STN0 | STS0, STC0, STN0 | BOOL / BOOL / INT | An accumulated timer; also spelled SS/SC/SN |
| S0, L0, F0, V0 | S0, L0, F0, V0 | BOOL | Step, latch, annunciator and edge relays |
| SB1A, SW1A, DX0, DY0 | SB1A, SW1A, DX0, DY0 | BOOL / INT | Link special and direct access I/O |
| R0, ZR0, Z0 | R0, ZR0, Z0 | INT | File registers and the index register |
Not carried, each reported in the dialog with the reason:
| Scene tag | Why |
|---|---|
| X2000 | Past the last X address an iQ-R reaches (X1FFF) |
| M1A | M addresses are decimal |
| D400 | Asked to carry a BOOL: a BOOL travels on a bit device |
| LTS0 | A long device: only the extended frame names it |
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 tag | Carried |
|---|---|
| MAIN.Eye | yes |
| GVL.Station.Run | yes |
| MAIN.Lane[3] | yes |
| Eye | no: it names no program or list |
| %IX0.0 | no: 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 type | Carried |
|---|---|
| BOOL, SINT, USINT, INT, UINT, DINT, UDINT, REAL, LREAL | yes |
| LINT, ULINT | no: a scene number cannot hold every 64-bit value exactly |
| STRING, WSTRING, a structure or array | no: not a single bit or number |
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.