MOULDLKnowledge BaseElectrical Knowledge Base3D Model DownloadsMembership
中文版Model Store »
Knowledge Base › Electrical Knowledge Base › How do you keep data from being lost when you modify a program online?
HomeModels
Table of contents

On this page

PLC & Programming (100 articles)

Quick Reference

  • PLC & Programming
  • Electrical & Electronic Basics (monthly)(每月更新中)
  • Electrical Control & Drawings (monthly)(每月更新中)
  • Drives & Actuators (monthly)(每月更新中)
  • Sensors & Detection (monthly)(每月更新中)
  • Industrial Communication & Networks (monthly)(每月更新中)
  • HMI & Host Systems (monthly)(每月更新中)
  • Industrial Robots & Motion Control (monthly)(每月更新中)
  • Mechatronic System Integration (monthly)(每月更新中)
  • Fault Diagnosis & Standards (monthly)(每月更新中)

How do you keep data from being lost when you modify a program online?

The biggest hidden risk of online modification is not writing wrong code but sweeping data away with it: calibration values, recipes and production counts in retained areas evaporate during one casually ticked "program + data download". Keeping data safe takes four defences: the download scope chosen right, retention attributes set right, timing chosen right, and backups taken first. Each follows.

1. Defence one: tick only what the download needs

Download sceneTickNever tick
Daily logic editsProgram (differential write)Device memory / DB initial values
Parameter changes (timer settings etc.)Program or parametersRetained-area current values
First download / full program replacementProgram + parameters (data separately)A full download only when no valid field data exists

Key awareness: on many platforms a "download" pushes the data block's initial values over the running values — retained accumulators and HMI-edited parameters get overwritten by whatever sits in the editor. Wherever the platform distinguishes "program download" from "program + data download", logic edits always take the former. Read the confirmation dialog line by line before pressing OK — two seconds buying an insurance policy.

2. Defence two: retention attributes set right at design time

Whether data survives downloads and outages depends on storage retention: retained areas (DB retention, holding D areas, retentive M) keep values through most downloads and outages; non-retained areas clear. At design time, produce the "data classification table": calibration, recipes, counts → retained area; intermediates → non-retained. Deciding this after the code exists means re-addressing the whole program — do it before writing code.

3. Defence three: timing and technique for DB edits

OperationRiskSafe practice
Changing DB structure online (adding variables)Data re-laid out; retained values misreadStopped-machine change + structure-change record + verify after
Changing a DB variable's initial valueNext full download overwrites the running valueCheck retention: retained variables' initial values do not touch running values
Downloading while the HMI writes parametersThe write is cut mid-wayAvoid operator parameter sessions when downloading
PLC restart after parameter downloadNon-retained data cleared, flow resetRestart only with the machine stationary

Structure changes (adding fields, changing types) are the data-loss heartland: some platforms re-lay storage offsets online, so old retained data read under the new layout is gibberish. The rule: structure changes are stopped-machine operations — export existing data first, import and verify item by item after.

4. Defence four: backup first

Before any online modification, take a full "read from PLC" backup (program + parameters + data), named with the date — two minutes of cost, and the only defence that rescues a change that already went wrong. Read back a second copy after the change (the post-edit version). Export recipes and calibration as CSV separately. Of the four defences, backup is the only one that undoes damage; the other three prevent it.

5. Verification: the three-item data check after editing

Immediately after any online modification: ① sample 3~5 key retained values (calibration, recipe number, accumulators) against pre-edit values; ② spot-check HMI parameter pages display correctly; ③ run one empty cycle and confirm runtime data accumulates. All three pass and production resumes; any failure restores the pre-edit backup at once — recovery is cheapest while memory is fresh.

6. Incident table

IncidentRoot causePrevention
Calibration all reset to defaultsFull download flushed initial valuesProgram only + backup before download
Production counts clearedRetention never set; lost with the outageData classification table at design time
Recipe data gibberishOnline DB structure change re-laid offsetsStopped-machine structure changes + export/import
HMI parameter write interruptedEngineer downloaded during an operator sessionAvoid the window; announce the download

7. Notes

Data preservation is about the boundary between "program space" and "data space", and making every download act precisely on the former. The four defences in one line: scope right (no data ticks), attributes right (retained areas), timing right (avoid operators), backup first (a way back). All four up, and online modification earns its "maintenance without stopping" promise.

8. References

Download modes and retention behaviour follow the platform manuals (Mitsubishi GX Works write scopes, Siemens download and retentive memory, CODESYS download behaviour); retentive-memory mechanisms follow each platform's storage documentation; safety during modification follows GB 5226.1 / IEC 60204-1 (no spontaneous restart after reset; parameters verified after change).

9. Cautions

⚠️ Three traps to avoid:
① One-click "program + data" download — calibration and recipes overwritten by initial values;
② DB structure changed online with the machine running — retained data read as gibberish under new offsets;
③ No pre-edit backup — nothing to return to when it goes wrong.

Write the standard sequence on the commissioning PC: backup-read → download-scope check → post-edit three-item data check.

Related reading

Related 3D models: Ready to build it? Download free 3D models & CAD drawings at MOULDL »
MOULDL · Electrical Knowledge Base · free self-study reference for electrical & automation engineers, 3D CAD models at MOULDL