TIA V17, CPU 1214C on a mixer we shipped last year. Customer asked for a small change, so I added one Static Bool to FB_Recipe and downloaded software in RUN. Compile clean, download clean.
Every setpoint in the instance DB went to zero. Batch sizes, mix times, the lot, and the operator had typed those in by hand on the panel over a year. The customer thinks I've restored an old backup over their values, which I haven't. I checked the Retain setting on the instance DB and the setpoints are all retentive, and I uploaded the DB from the CPU to be sure, still zeros.
I've done interface changes on FBs before and don't remember losing values. What did I do differently this time? Any ideas. edit: forgot to say, that download was software only.
Aren't retentive values supposed to survive? I set Retain on my bench DB for exactly this reason. Why didn't it protect them?
Retentive protects against a power cycle, not a new interface. The download made a new DB with a new layout and the old values had nowhere to go. Pretty sure that's it, but I'm waiting for someone who knows the mechanism properly.
Your understanding is right. A changed interface is a changed DB layout, and a normal download of that initialises the DB from start values. Retain doesn't come into it.
The way round it on S7-1200 and S7-1500 is the memory reserve. Block properties of the FB in V17, Download without reinitialization, enable the reserve and give it some bytes. There's a second tick for the retentive part and you want that one too, since your setpoints are retentive. New Statics then land in the reserve and the download keeps the values. The reserve has to be enabled and downloaded before the interface change, not after, so enabling it now costs you one more reinit.
Values go back in from the recipe sheet, then enable the reserve before the next change.
This covers the same fault: https://plctr.com/tia-portal-download-without-reinitialization/
Re-entered the values from the customer's recipe sheet, took the operator an hour and I owe him a coffee for it. Then enabled Download without reinitialization on FB_Recipe in V17, 100 byte reserve plus the retentive tick, downloaded once more with the values in, and tested a second Static. Values stayed this time.
So the interface change rebuilt the instance DB from start values, nothing more mysterious than that. Memory reserve enabled before the change is the answer for next time. My own default, again.
Not sure how big to make the reserve, 100 bytes was a guess. Thanks pnina.
Marking solved.
plctr.com team