Skip to content

Show the logic of changed ladder rungs - #5

Merged
DanShinde merged 1 commit into
mainfrom
feat/rung-logic
Nov 25, 2026
Merged

DanShinde merged 1 commit into
mainfrom
feat/rung-logic

Conversation

@DanShinde

Copy link
Copy Markdown
Owner

What

A changed rung now also says what changed in its logic. The rung text is decoded into the condition each output instruction runs under: instructions in series are AND, branch legs are OR, and contacts, comparisons, LIM/CMP, one-shots and AFI are inputs. Every other instruction is an output.

Program MainProgram / Routine MainRoutine (RLL)
  ~ Rung 0   +XIO(EStop)
      - [XIC(StartPB) ,XIC(Running) ]XIC(StopPB)OTE(Running);
      + [XIC(StartPB) ,XIC(Running) ]XIC(StopPB)XIO(EStop)OTE(Running);
      logic:
      - OTE(Running) when (StartPB OR Running) AND StopPB
      + OTE(Running) when (StartPB OR Running) AND StopPB AND NOT EStop
  • New module plcdiff/rll.py: rung_logic(text) and logic_delta(old, new). Nested operands (Arr[i,j], Tank[Idx[1]]) stay whole.
  • Change.logic_delta() feeds the text report, the Markdown report (# logic: lines) and the JSON report (a logic list on rung changes).
  • A comment-only change, an unchanged rung, or a rung that doesn't parse adds no logic lines.

Verified

  • uv run pytest: 64 passed (16 new in tests/test_rll.py)
  • ruff check, ruff format --check, mypy: clean

Generated by Claude Code

Decode rung text into the condition each output instruction runs
under (series = AND, branch = OR, comparisons and one-shots as inputs)
and, for a changed rung, list each output whose condition changed,
before and after, in the text, Markdown and JSON reports.
@DanShinde
DanShinde merged commit bbd4820 into main Nov 25, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant