Connecting a MELSEC PLC over SLMP

A MELSEC CPU (Q, L, iQ-R or iQ-F) answers SLMP on its Ethernet module. The simulator uses this to write the scene's sensors into the CPU's devices and read its outputs back, while your program runs on the CPU. A part's PLC tag is the CPU's own device address: M10, Y10, D100.

SLMP has no authentication and no encryption. Use it on this machine or a test bench, not a plant network.

You need

1. Build the scene

In the desktop app, start a new scene and place three parts from the library:

  1. A Belt Conveyor.
  2. A Box, sitting on the belt near the end it starts from.
  3. A Photo Eye beside the belt, about two thirds of the way along, facing across it.

2. Wire the parts to device addresses

Select each part, and in the Inspector's Comms group type its device address:

PartFieldType inOn the CPU
Photo EyePresence TagM10Internal relay M10. The simulator writes it.
Belt ConveyorRun TagY10Output Y10. The simulator reads it.

Nothing is mapped or offset: the tag is the device address, spelled the way the CPU's own tools spell it.

In the sceneOn the CPUThe simulator
XnXn, an inputwrites it if a part publishes it, reads it if a part is driven by it; on a real CPU use X addresses no input module occupies
YnYn, an outputreads it, or writes it if a part publishes it
MnMn, an internal relaywrites it if a part publishes it, reads it if a part is driven by it
DnDn, a data register: INT, DINT or REALthe same; see step 6
BnBn, a link relay, and SBn its special relay (hex)the same as M
WnWn, a link register, and SWn its special register (hex)the same as D
SMn / SDnSMn special relay, SDn special registerthe same; mind that some of these run the CPU's own functions
TSn / TCn / TNnA timer's contact, coil and current valuebits for TS/TC, a register for TN
CSn / CCn / CNnA counter's contact, coil and current valuebits for CS/CC, a register for CN
STS / STC / STNAn accumulated timer's contact, coil and current value (also spelled SS/SC/SN)as the timer's
Sn / Ln / Fn / VnStep, latch, annunciator and edge relaysthe same as M
DXn / DYnDirect access I/O (hex)the same as X and Y
Rn / ZRn / ZnFile registers and the index registerthe same as D

3. Set up the CPU

Configure and download the CPU in its own engineering software; its documentation shows where each setting lives. This guide needs the CPU to answer SLMP, to be reachable, and to run the program below.

3a. Allow SLMP

  1. The CPU's Ethernet settings have an SLMP connection: the protocol this speaks is the 3E frame, binary, over TCP. Give it the port you will type in step 4; the standard is 5000.
  2. The CPU has an IP address this computer can reach. Note it for step 4.
  3. The CPU is in RUN, so it answers at all.

3b. The program

In a new program, two labels on the devices the scene uses, and one line in the main task:

Y10 := NOT M10;

(In ladder: a normally closed contact on M10 driving a coil on Y10.) Download it and put the CPU in RUN.

4. Point the simulator at the CPU

Open Simulation > PLC Controllers… and set:

  1. Runs on: An external PLC.
  2. How the PLC connects: SLMP.
  3. PLC: the CPU's IP address from step 3a.
  4. Port: 5000, or the port its SLMP connection answers on.

The list underneath should read M10  written to the PLC and Y10  read from the PLC.

The first time you press Play with a CPU on the network, the app asks whether to allow the connection: Allow Open Industry Project to connect to a PLC at 192.168.0.1:5000? Choose Allow. The app remembers it for that address.

5. Run it

With the CPU in RUN, press Play. The status line says Reading and writing the CPU's devices at 192.168.0.1 with a count of requests, the box rides to the sensor, and the CPU stops the belt.

If the CPU refuses the requests

The connection comes up but the requests are refused, and the status line says Waiting for the PLC at 192.168.0.1: the CPU refused a read of D200 (end code 0xC056): the device number is past what this CPU reaches. The end code is the CPU's own reason: 0xC056 is an address past this CPU's devices, 0xC05B a device it will not let a client write (an input, X). The simulator asks again every second, so the belt starts once the CPU answers.

6. Values in data registers

A program often keeps its simulated signals in data registers rather than on bits. A D tag carries its type from the program variable behind it:

TagCarriesRegisters
D100INTone, D100
D100DINTtwo, D100-D101, low word first
D100REALtwo, D100-D101, its IEEE 754 bits, low word first

Two tags cannot share a register: a DINT at D100 takes D101 too, and the dialog reports and leaves out whichever tag arrives second. A tag that asks a D register to carry a BOOL is reported and left out as well: a BOOL travels on M, X or Y.

Troubleshooting

The connection options are greyed out.
You are in a browser tab. Connecting to a PLC needs the desktop app.
"Waiting for the PLC at ...: nothing is listening"
Nothing answered on that port at that address. Check the IP address and the port, that the CPU is powered and in RUN, and that its Ethernet settings carry the SLMP connection. The simulator tries again every second.
"... end code 0xC056: the device number is past what this CPU reaches"
A tag addresses a device this CPU does not have. Ranges depend on the CPU model: an iQ-R reaches X/Y ≤ X1FFF, M ≤ 65535, D ≤ 32767.
"... end code 0xC05B"
The CPU cannot execute the request: the device cannot be written there, or the CPU is in a state that refuses it (stopped, or protected). If it names an input (X) on a real CPU, wire the part to an address no input module occupies, or to M, Y or D.
"... end code 0x4031"
The CPU does not carry that device in its configuration. The step relay (S), the accumulated timer (STS/STC/STN) and the file registers (R, ZR) answer this on a CPU without those settings (file registers need their parameter), to reads as well as writes. Use M, D, TN or CN instead, or configure the device in the CPU.
It connects, but the belt never stops.
The eye's address is not the one the program reads. Watching M10 online in the engineering software shows whether it ever turns true. Remember X and Y count in hexadecimal and M and D in decimal.
A part's address is not listed.
The dialog lists what it cannot carry, and why: a D register asked to carry a BOOL, or two tags on one register, for example.