
Lesson 15
PLC Maintenance: Changing a Running System, Compare, Backups and Retentive Memory
One change at a time, comparing before guessing, going back to a backup, trusting a value from the network, what a power cut keeps, and the shift note.
From Usta's field manual in Meridian Works, a story-driven PLC course: chapter 15, “Working on a Running System”. What to know before you touch a running machine: one change, the last good version, going back to a backup, a value from the network, retentive memory and the shift note.
One change at a time
Programming a new machine is easy, because there is nothing to break. Touching a running machine is different work. That program does somebody's job every day. Many small things you cannot see are working correctly inside it.
On a running program the rules are these:
- Change one thing at a time. If you change two things together and the machine turns odd, you cannot know which one did it.
- Keep what works. Do not rewrite rungs to make them look nicer. Apart from the change you were asked for, every rung stays as it is.
- Test the old as well. The job is not done because the new feature works. Show that the machine still does everything it did yesterday. This is called a regression test.
- Have a way back. Before the change, take a backup of the working program. If things go wrong, you must be able to go back within a few minutes.
Both platforms let you load a change into a running CPU. On the Siemens side a block can be downloaded without stopping the CPU. On the Rockwell side a rung is edited online, tested and then accepted. Both are powerful and both are dangerous. If the machine is running at the time, your change reaches the plant at that moment. So before an online change, know what state the machine is in.
In this simulator, downloading the program again is a cold start. Memory is cleared and the machine starts from the beginning. On a real plant this is not always so.
Breaking one thing while fixing another is worse than not fixing it at all. Because after that, nobody trusts the machine.
Compare before you guess
If a machine that worked yesterday does not work today, there are two possibilities. Either something changed in the field or something changed in the program. For the field you run a fault hunt. For the program you compare first.
The last good version is the most valuable document there is. When you find it, stop guessing and compare rung by rung:
- First look at the number of rungs. Is a rung missing, or is there an extra one?
- Then read each rung's comment. Has a comment changed?
- Then look inside the rung: contacts, coils, boxes and the values in the boxes.
Small differences usually come in one of four shapes:
| Difference | How it looks |
|---|---|
| NO/NC swapped | The contact reads the same tag, but asks the opposite. |
| Preset changed | The timer or counter is where it was, but its number is different. |
| Coil moved | The same coil is on another rung, or behind another condition. |
| Contact missing | A permissive has left the rung. Usually it was bridged "for a test". |
Both platforms have a tool for comparing versions. The tool finds the difference, but it does not say why the difference was made. Only the notes and the people can say that.
In this simulator the previous version comes as a printout: the "Previous version" attachment. Its networks are drawn in function-block view. The ladder on the bench and the boxes on the printout show the same logic in two forms. Contacts in series are the inputs of an AND (&) box. Parallel branches are the inputs of an OR (≥1) box. An NC contact is drawn as a small circle on the input.
Whoever restores the backup without finding the difference only postpones the fault by a day. The next day the same person makes the same change again.
Not every difference is a mistake
A comparison gives you a list. Not every line on that list is a mistake. Somebody made some of the differences on purpose, and rightly. Others were forgotten.
To tell which is which, ask three questions:
- Who asked for it? Is there a work order, a request or a shift note?
- Is it written down? Has the rung comment changed? Is it in the version note? A requested change usually arrives with its comment. A forgotten change is silent.
- What does it do to the machine? If the change removes a protection or a permissive, count it as a mistake unless somebody asked for it in writing.
Then undo only the wrong difference. Taking the whole program back to the old version is easy, but it is wrong. The right change goes too. The person who asked for it calls again a week later, and the trouble starts over.
The thing most often forgotten during commissioning is a bridge. Somebody takes a permissive out of a rung for a test, or forces it. The job ends and they leave. The bridge can stay for months. Nobody notices, until the day that permissive is really needed. And the rung comment still describes the old permissive. When the comment and the rung do not agree, stop there and look.
Every change that removes a protection is either written down or a mistake. There is no third possibility.
Going back to a backup
One day a CPU fails. The new CPU fitted in its place usually comes up empty. On that day the only thing you have is the backup. Loading a backup is easy. The hard part is knowing what the backup does not know.
A backup is the program of the day it was taken. Every change made after that day is not in it. So start a restore with the date, not with the backup:
- Find the latest backup and look at its date.
- Read the lines in the shift log and the version notes after that date.
- Load the backup as it is. Change nothing.
- First test the backup's behaviour. Does the machine work as it did yesterday?
- Then make the changes from the log again, one at a time. Test each one on its own.
- When the job is done, take a new backup. Write its name in the log.
Not every line in the log is work to be done again. Some lines bring back a state from before the backup. That state is already in the backup. Before you make a line again, check whether it is already in the backup.
A backup brings the program back. But it usually does not bring back today's values of counters, running hours and recipes. Those values live in the CPU's retentive memory, and they go with the CPU. The way to save them is to write them down somewhere before it fails.
On both platforms the program can also live on a memory card. On the Siemens side an S7-1500's program is on the CPU's memory card. If the card is sound, it can go into the new CPU. On the Rockwell side, loading from the SD card at power-up can be set up too. If there is no card, or the card went as well, all you have is the backup on the computer.
In this simulator a backup is loaded with the Load this backup onto the bench button under the "Previous version" attachment. Read the printout before you load it. A backup loaded without knowing what it brings back can be a second fault.
A backup remembers the day it was taken. The log remembers the rest.
Trusting a number from the network
A number from the network can be wrong in two ways. Either it arrives wrong, or it stops arriving. Both are silent.
A number that arrives wrong usually comes from a driver setting. The three old friends from Chapter 12 apply here too:
| Symptom | Look at this first |
|---|---|
| The number is plausible but wrong | The address may be one register out. |
| A 32-bit number is absurdly large or small | The word order may be the wrong way round. |
| The link never comes up, error 11 | The gateway does not answer to the unit id. |
When a device is replaced, these settings may change as well. The old gateway may send the high word first, and the new one the low word. The driver stays the same, and one morning the number jumps into the millions. Read with its halves swapped, 60 becomes 60 × 65 536 = 3 932 160. If you see a number like that, ask whether a device has been replaced.
A number that stops arriving is more dangerous. When the link drops, the value in the tag does not change. The last number that arrived stays there. Its type is right and its range is right, but it is no longer true. Only the driver's status bit knows.
So the rule is this:
- Every rung that uses a number from far away also reads the link's status bit.
- If there is no link, the machine goes to a safe state and says so with an alarm.
- When the link comes back, the machine does not go back to its old state by itself. Somebody sees the alarm and acknowledges it.
The safe state is not the same on every machine. For a pump it may be stopping. Elsewhere it may be right to carry on with the last good value for a while, or to fall back to a local value. The person who knows the machine says which one is right, and says it in writing.
On both platforms the status is ready to use. On the Siemens side MB_CLIENT has the DONE, ERROR and STATUS outputs. On the Rockwell side the MSG instruction has the .DN, .ER and .ERR fields. Most programs written in a hurry do not read them.
In this simulator a link's ok tag becomes TRUE when the last poll round completes. When the cable comes out, it goes FALSE after at most the poll interval + (retries + 1) × timeout.
A number that does not arrive is a wrong number too. It is only harder to notice.
What a power cut keeps
A PLC's memory comes in two kinds. Non-retentive memory starts from zero at every power-up. Retentive (retain) memory keeps its value when the power goes.
You decide what is remembered:
- Must be remembered: running hours, start counts, total production, recipe values. These build up over weeks. If they clear at every outage, they mean nothing.
- Must not be remembered: seal-in bits, the state of a running step, motor commands. When the power comes back, a motor must not start by itself. The machine must start from a clean and safe state.
A download and a power cut are not the same thing. In a power cut, retentive memory stays. Loading the program from scratch, on the other hand, often takes retentive memory back to its start values too. The easiest way to lose a counter is to download the whole program again for a small fix. Before you do that, write the counter's value down somewhere.
The two platforms do this differently. On the Siemens side you mark the variables that are to be kept. An unmarked variable goes back to its start value at power-up. On the Rockwell side tags keep their values already. You clear the ones that must reset at power-up yourself, with the first-scan bit. The defaults are opposite.
One more warning: the "retentive" in 5.5's retentive timer is a different thing. That timer keeps its total when its rung goes false. What happens when the power goes depends on how the memory is marked.
In this simulator:
- Tags marked Retain in the symbol table survive a power cut. The others are cleared.
- The input image is never retentive. The field writes it again on every scan.
- A retentive bit keeps its neighbours in the same byte along with it. The simulator says so with a warning.
- The "⚡ Power cut" button on the toolbar cuts the power and gives it back. It is not a download.
Know what stays when the power goes, before the power goes.
A note for the next shift
Every change you make to a program needs a note. The note is as important as the change itself. A change without a note turns into a riddle six months later.
A good note is short and answers five questions:
- What changed? Which block, which rung, the old value and the new value.
- Why? Who asked for it, and for which problem?
- Who did it, and when?
- How was it tested? The new behaviour, and the old behaviour that was kept.
- How is it undone? The name and place of the backup.
Example:
12.03 · Boiler feed pump · Main block, rung 3
Dry-run delay 2 s → 5 s.
Why: the float bobs during softener regeneration. Asked by: Nurcan.
Tested: a 4 s drop did not trip, a 6 s drop did. Thresholds and AUTO tried.
Backup: boiler_feed_11-03
Write the note in two places. One is inside the program: the rung comment and the version note. The other is the shift log. The note in the program lives with the program. The note in the log reaches the people who never open the program.
When you undo a change, write a note too. Undoing is a change as well.
The morning shift must know what was done in the night without asking anybody.