plc_program_xref
Find every read, write, call, or declare site of a symbol or address in an exported PLC program, with verbatim source lines for accurate citation.
Instructions
[READ][risk=low] Cross-reference one symbol in an exported PLC program.
Finds every read/write/call/declare site of a symbol or absolute address
(e.g. Motor_Run, "FB_Conveyor", DB10.DBX0.1, M0.0, Tank[2].Level) in one
exported file, quoting the surrounding source line verbatim so the agent
cites real code. Access classification is heuristic (op/regex based, not
data-flow analysis): SCL ':='→write, '('→call; AWL T/=/S/R→write,
L/A/O…→read, CALL→call; L5X OTE/OTL/OTU/RES and MOV-dest→write. For L5X,
line is the rung number.
Args:
path: Exported program file (.st/.scl/.awl/.l5x/.txt; must exist, ≤5 MB).
symbol: Symbol / tag / absolute address to trace (word-bounded match).
Returns dict: {source_file, format, symbol, hit_count,
hits:[{symbol, access, block, source_file, line, source_line}] (≤200),
hits_truncated, by_access:{read, write, call, declare, reference}}.
Example: plc_program_xref(path="~/exports/OB1.awl", symbol="M10.0").
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| symbol | Yes |