The short answer: document a PLC program as a traceability chain with five records: the approved control basis, the I/O and tag meaning, the routine or rung intent, the controlled change, and the test evidence. Each record should identify the next one by a stable ID and revision. If a technician can read the logic but cannot discover why it exists, what field signal it represents, what changed, or how the deployed version was tested, the program is not maintainable yet.
Rung comments matter, but they are only one link. They should explain the purpose and non-obvious reason close to the logic. They should not become a second control narrative, a stale copy of a live setpoint, or the only surviving record of a commissioning change.
Scope and last check: reviewed September 5, 2026. This checklist covers documentation and traceability for ordinary industrial-control software. It does not define a safety lifecycle, validate a safety function, authorize an online edit, or replace the controller vendor's current instructions and the site's change-control procedure.
Why comments alone do not document a PLC
A comment is attached to one implementation location. The reason may live in a control narrative, cause-and-effect chart, drawing, equipment instruction, or operating requirement. The physical signal may be owned by an I/O list; the proof may live in a factory or site acceptance record. Copying all of that into comments creates several plausible versions of truth. Omitting the links leaves code that says what the controller evaluates but not why, from where, or under which approved revision.
The current IEC 61131-3:2025 language standard defines Structured Text, Ladder Diagram, Function Block Diagram, and Sequential Function Chart elements. It standardizes programming representations; it does not turn a source file into the complete design, change, and validation record. The documentation system has to connect those records deliberately.
The five records every review should connect
| Record | Question it answers | Minimum identity | Do not hide here |
|---|---|---|---|
| 1. Control basis | Why must the machine or process behave this way? | Document ID, revision, section, owner | Unapproved design decisions |
| 2. Signal and tag map | What real or calculated condition does this value mean? | Device/tag, channel or source, units, healthy state | Guessed wiring or polarity |
| 3. Program intent | Where is the requirement implemented, and why this structure? | Controller, task, program, routine, rung/network | A duplicate specification |
| 4. Change record | Who authorized this difference, when, and for what reason? | Change ID, approver, affected revision, deployment identity | Temporary edits with no owner |
| 5. Test evidence | What input conditions were exercised, and what actually happened? | Test ID, tested version, expected/actual result, witness | “Tested OK” with no case or version |
1. Name the approved control basis
Begin with the document that owns the behavior: for example, a control narrative, sequence of operations, cause-and-effect chart, or approved equipment requirement. Record its exact ID, revision, and relevant section. “Per spec” is not traceability; it forces the next reviewer to search every specification and guess which issue was used.
Keep the basis where the decision is owned. A process setpoint belongs in the approved design or controlled configuration; a safety response may belong in a safety requirements specification. The PLC comment should point to that authority, not replace it.
2. Make every tag state what it means
For physical I/O, connect the field device, drawing or I/O-list tag, module/channel, PLC tag, units, scaling basis, and normal or healthy state. For derived data, identify the source tags and transformation. Names such as Run, Fault, or Level are ambiguous without equipment and state context.
Siemens' 2025 SIMATIC programming style guide recommends consistent identifiers whose names communicate their meaning in the source-code context; its examples use state-revealing Boolean names such as isConnected. The exact house style can differ, but the review test is portable: can a reader tell what an asserted Boolean claims without reverse-engineering every use?
3. Explain purpose at the implementation point
At the program level, describe the responsibility and boundaries. At the routine, rung, network, or block level, explain the purpose, any non-obvious order or latch, the controlling reference, and the condition that should make the output true. Do not narrate obvious syntax line by line.
Rockwell's Logix 5000 ladder manual explicitly supports rung comments that explain a rung's purpose, tag and component descriptions, multiple documentation languages, and routine verification. Those are useful storage surfaces, not proof that the record is complete. The same manual separates verification errors from the human decision about whether the implemented behavior is the right behavior.
A useful comment template is:
Purpose: [condition this logic establishes or action it commands]
Basis: [document ID · revision · section]
Exception: [non-obvious priority, timing, fallback, or none]
Change: [latest material change ID, if the site requires it here]
Safety boundary: [ordinary control / reference to approved safety requirement]4. Bind every deployed change to an identity
A change record should say what changed, why, who approved it, which records were affected, what version reached the controller, and whether the change is permanent or time-bounded. “September change” in a comment identifies none of those things.
Storage also needs an explicit decision. Rockwell's download-performance guidance explains that Studio 5000 can include rung comments, tag descriptions, and extended properties in controller downloads; it recommends enabling project documentation for upload and multi-user workflows, while also recommending maintained project backups. That is platform-specific evidence for a broader rule: know which location is authoritative, verify what survives an upload, and keep a recoverable controlled copy.
5. Close with reproducible test evidence
The test record must bind the requirement and deployed version to explicit initial conditions, steps, expected results, actual results, exceptions, and witness. A screenshot of a green rung proves only what was visible at that moment. It does not show the tested project identity, field state, forced values, timing, alarm behavior, or reset path unless those facts are recorded.
Separate syntax or compile verification from behavioral testing. Then separate ordinary functional checks from any safety validation required by the project. One successful normal-path test cannot close a fault-path requirement.
Worked example: a duty pump start request
Assume an ordinary process-control example—not a protective or safety function. Approved control narrative CN-104 Rev C §4.2 says duty pump P-101 may receive an automatic start request when tank level is above the controlled high threshold, the pump is in Auto, and no pump fault is active.
The traceability chain would record:
- Basis:
CN-104 Rev C §4.2, owned by process controls. The threshold is controlled as parameterSP-17; the narrative does not hard-code its current numeric value into the logic description. - Signal map: field transmitter
LT-101maps through the approved I/O list to scaled tagLT101_PV_pct;P101_AutoandP101_FaultActivename asserted states. - Program: controller
PLC-01, programArea100, routineP101_Control, rung 12. The comment says the rung creates the ordinary auto-start request and citesCN-104 Rev C §4.2. - Change:
CR-218identifies the authorized edit, affected narrative and HMI parameter record, reviewed project checksum, approver, and deployment time. - Test:
SAT-32records the tested project checksum and exercises below-threshold, above-threshold, Manual, Fault, reset, and communications-bad cases with expected and actual results.
The program may implement the requirement in ladder, Structured Text, or a function block. The documentation contract does not depend on the language: the same five IDs must lead a reviewer from field meaning to approved behavior and back from a test failure to the exact implementation.
What belongs in code—and what should stay outside
Put information close to the code when it is stable, needed to interpret the implementation, and unlikely to acquire a different owner. Put it in a controlled external record when it is a requirement, approval, live configuration value, field installation fact, or test result.
| Information | Best home | Code-side connection |
|---|---|---|
| Why a sequence or priority exists | Approved control basis | Short reason plus document ID and revision |
| What an asserted Boolean means | Tag name and description | Use the same stable identity in logic |
| Current adjustable setpoint | Controlled configuration or HMI parameter record | Reference parameter ID; do not copy a drifting value |
| Installed terminal and cable | I/O list and electrical drawing | Map physical address to the logical tag |
| Reason, approver, and deployment | Change-management record | Reference the change ID where site practice requires |
| Expected and observed behavior | FAT, SAT, or commissioning record | Bind the test to the exact program identity |
Common documentation failure modes
- The comment repeats the rung. “If Auto and High then Start” adds no reason, source, exception, or boundary.
- The comment becomes stale configuration. A numeric setpoint changes in the HMI or recipe, while the comment preserves an old value that looks authoritative.
- Tag names describe devices but not states.
Stopcan mean button pressed, circuit healthy, stop request active, or motor stopped. - The drawing and code use different identities. A technician cannot connect
Pump_3toP-101, its output channel, or its HMI faceplate without tribal knowledge. - Online edits have no closeout path. The controller differs from the controlled project, and the reason exists only in a shift log or one person's memory.
- The test result has no version. “Passed SAT” cannot establish which source, parameters, firmware, or controller image was tested.
- Ordinary comments are treated as safety validation. Clear documentation helps review; it does not establish risk reduction, diagnostic coverage, or required integrity.
Pre-handover PLC documentation checklist
- Every program and routine has a stated responsibility and boundary.
- Every material behavior points to an approved basis with ID and revision.
- Physical and derived tags expose equipment, meaning, units, source, and asserted state.
- Non-obvious rungs, networks, states, and calculations explain why—not merely what.
- Drawing tags, HMI tags, alarm IDs, and PLC tags have an explicit mapping.
- Live parameters are referenced by controlled ID instead of copied into comments.
- The authoritative project location, controller-resident documentation policy, and backup are known.
- Every deployed edit has an approved change ID and exact program identity.
- Test cases include normal, boundary, fault, reset, and communications conditions that apply.
- Test evidence records expected and actual results against the deployed version.
- Temporary forces, bypasses, overrides, and provisional notes have owners and removal criteria.
- Safety-related logic follows the project's separate approved lifecycle and validation requirements.
Limitations and next step
Controller families store comments, symbols, source, and online changes differently. Older hardware may not retain the same project documentation that modern platforms can upload. Vendor version, firmware, safety certification, cybersecurity controls, owner standards, and regulated change procedures can add requirements beyond this checklist. Verify the current platform behavior before choosing the controller as the authoritative copy.
Start by drawing the five-record chain for one routine that is hard to troubleshoot. Use stable IDs rather than prose-only arrows. If a link has no owner or revision, fix that documentation boundary before adding more comments. ChatDiagram's ladder logic diagram maker can help turn the reviewed Boolean conditions into an editable rung, but the approved basis, real I/O mapping, deployed project, and witnessed test remain the controlling evidence.