KEPServerEX 6.x here, Siemens TCP/IP Ethernet driver, talking to a CPU 1516-3 PN/DP on line 2. We've pulled DB1 off that CPU for two years, forty items, all good quality.
The OEM added DB5 last week for the new reject counter and sent me the offsets, so I added DB5,W0 and DB5,DBD4 exactly the way the DB1 items are, and every DB5 item comes back Bad quality. The event log says it can't read the block at DB5,W0, address out of range, or close to that. DB1 carries on fine on the same device.
PUT/GET is on in the CPU's Protection and Security, has been since day one. I restarted the runtime, no change, then tried DB5,X0.0 as a single bit in case it was the width. Same Bad quality. They're on TIA V17 their side. DB1 carrying on fine on the same device is what I keep coming back to, is there something about a block added in V17 that DB1 wouldn't have?
In TIA, does DB5 show an Offset column?
Opened their project on the engineering laptop. DB1 has an Offset column, 0.0, 2.0, 4.0 straight down the list. DB5 has no Offset column at all, just Name and Data type. Not sure that means anything, but there it is. The OEM built DB5, not me.
It matters completely. DB5 has optimized block access. An optimized DB has no absolute addresses, the CPU places the variables itself, so DB5,W0 does not name anything and the driver gets out of range back. DB1 was created non-optimized, that is why it has offsets and works.
Two fixes. DB5, Properties, Attributes, untick Optimized block access, compile, download. Then the Offset column appears and your DB5,W0 items read. Or leave DB5 optimized and read it symbolically through the CPU's own OPC UA server with the OPC UA client driver instead of the S7 driver.
There's a writeup on both routes here: https://plctr.com/introduction-to-opc-open-platform-communications-for-plc-integration/
Unticked it on the laptop and went to download. TIA warns DB5 gets reinitialised on download and the actual values go with it. Line's running and the reject counter lives in that block, so its either lose the count or wait for a stop. I guess that's me stuck till Sunday. Any way round it?
There isn't one, changing the access type rebuilds the block. Snapshot the actual values into start values first, then download at the next stop. Or do the OPC UA route now and the untick at the stop.
Did it at the Sunday stop. Snapshot to start values, compile, download, and the counter kept its value. Every DB5 item Good quality on Monday morning.
So DB5 was optimized all along and had no absolute addresses for the driver to ask for. Untick Optimized block access, snapshot the values first, download at a stop, and the items read.
What I'm not happy about is the six other optimized DBs the OEM left in that CPU, and nobody will say which one the MES wants next. Each one of those is another stop. Thanks kiran_s, pnina.
Six more is the argument for the OPC UA route. Next stop, not this one.