SCL-Templates fuer alle Typen mit Referenz-Aufrufstelle (Schritt 5)

- neue Templates: FB_ILS_MTRO_1Sep (TRO100), _Vario (TRO115),
  _Vario_workStation (TRO421), _1Sep2Swi (TRO267), _1Sep_SSCC (TRO105),
  _PinStore_Auto (TRO208); zusammen mit dem Pilot 1Sep1Swi 7 von 11 Typen.
  2Sep1Swi, EmptyCarrBuffer, LoadingBoom, 2Sep2Swi bleiben generisch
  (keine reale Aufrufstelle)
- scl_context: Felder nur fuer die Templates - Cognex-Verdrahtung je
  Scanner, part_sensor, carriers/data je Staubereich, jam_in/jam_out (dieselben
  Objekte wie erster Ein-/Ausgang), error_quit, automatic, is_border,
  correction_station, Bloecke sscc/work_station/store (PinStore: eine Linie je
  Speicherbahn aus dem Layout statt der 19 aus dem Katalog)
- _macros: cognex_in/cognex_out/cognex, correction, todo_mehr
- tests/test_scl_templates.py: Rundlauf je Template gegen seine Referenz
  (PinStore: von der Referenz abgekuerzte Teile ausgenommen); Normalisierung
  vereinheitlicht ":="/"=>"-Abstaende
- Golden-Files *_templates neu geschrieben (gewollt: mehr TROs aus Templates);
  generische Golden-Files unveraendert
- Doku: SCL_Templates.md (§6 Entscheidungen je Template, §11 Schritt 5, §13
  offene Fragen 9-12), Python_Scripts.md, CLAUDE.md, README.md

Zeilenentscheidungen sind Vorschlaege, noch mit den SPS-Kollegen zu
bestaetigen. Geprueft: 39 Tests gruen, jede Rundlauf-Pruefung erkennt eine
geaenderte Zeile; tro_flow --json + scl_skeleton --templates auf allen 8 CSVs
ohne Fehler.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Samer Ayadi
2026-10-12 13:13:55 +02:00
co-authored by Claude Opus 5.5
parent 5764df1ac8
commit 41df841317
15 changed files with 2044 additions and 491 deletions
+52 -17
View File
@@ -1,7 +1,9 @@
# SCL Generation from Parameterised Templates — Concept
**Status:** steps 1–3 of §11 done — pilot template `FB_ILS_MTRO_1Sep1Swi` usable with
`--templates`, default output unchanged · **As of:** 2026-10-09
**Status:** steps 1–3 and 5 of §11 done — templates for all 7 types with a reference call
site (`1Sep`, `1Sep1Swi`, `1Sep2Swi`, `1Sep_SSCC`, `Vario`, `Vario_workStation`,
`PinStore_Auto`) usable with `--templates`, default output unchanged; the line decisions
(§6) are proposals still to be confirmed by a PLC engineer · **As of:** 2026-10-12
This is the plan for moving `scl_skeleton.py` from hard-coded SCL (Python f-strings in
the `emit_*` functions) to **parameterised templates**: the SCL structure for each FB
@@ -54,13 +56,13 @@ Coverage per catalog type (`lib/tro_catalog.py`):
| Catalog type | FB | Call site | FB source | Template possible |
|---|---|---|---|---|
| `1Sep` | `FB_ILS_MTRO_1Sep` | yes (TRO 100) | — | yes |
| `1Sep1Swi` | `FB_ILS_MTRO_1Sep1Swi` | yes (TRO 107) | — | yes — **first pilot** |
| `1Sep2Swi` | `FB_ILS_MTRO_1Sep2Swi` | yes (TRO 267) | — | yes |
| `1Sep_SSCC` | `FB_ILS_MTRO_1Sep_SSCC` | yes (TRO 105) | — | yes |
| `Vario` | `FB_ILS_MTRO_Vario` | yes (TRO 115) | — | yes |
| `PinStore_Auto` | `FB_ILS_MTRO_PinStore_Auto` | yes (TRO 208) | — | yes (outlier, largest) |
| `Vario_workStation` | `FB_ILS_MTRO_Vario_workStation` | yes (TRO 421, `_CallSite.scl`) | yes | yes, with interface check |
| `1Sep` | `FB_ILS_MTRO_1Sep` | yes (TRO 100) | — | ✅ done |
| `1Sep1Swi` | `FB_ILS_MTRO_1Sep1Swi` | yes (TRO 107) | — | ✅ done (first pilot) |
| `1Sep2Swi` | `FB_ILS_MTRO_1Sep2Swi` | yes (TRO 267) | — | ✅ done |
| `1Sep_SSCC` | `FB_ILS_MTRO_1Sep_SSCC` | yes (TRO 105) | — | ✅ done |
| `Vario` | `FB_ILS_MTRO_Vario` | yes (TRO 115) | — | ✅ done |
| `PinStore_Auto` | `FB_ILS_MTRO_PinStore_Auto` | yes (TRO 208) | — | ✅ done (outlier, largest) |
| `Vario_workStation` | `FB_ILS_MTRO_Vario_workStation` | yes (TRO 421, `_CallSite.scl`) | yes | ✅ done (interface check §8.2 still open) |
| `2Sep1Swi` | `FB_ILS_MTRO_2Sep1Swi` | **no** | yes | from interface only — needs a real call site |
| `EmptyCarrBuffer` | `FB_EmptyCarrBuffer` | **no** | yes | from interface only — needs a real call site |
| `LoadingBoom` | `FB_LoadingBoom_INBOUND` | **no** | yes | from interface only — needs a real call site |
@@ -103,8 +105,13 @@ sps_skel/
│ ├── scl_naming.py NEW: reads the naming config, resolves names
│ └── scl_templates/ NEW: the parameterised templates
│ ├── _macros.scl.j2 shared blocks (separator, switch, jam, call, direction)
│ ├── FB_ILS_MTRO_1Sep.scl.j2 ✅
│ ├── FB_ILS_MTRO_1Sep1Swi.scl.j2 pilot ✅
│ └── ... one per FB, named exactly like fbType
│ ├── FB_ILS_MTRO_1Sep2Swi.scl.j2 ✅
│ ├── FB_ILS_MTRO_1Sep_SSCC.scl.j2 ✅
│ ├── FB_ILS_MTRO_Vario.scl.j2 ✅
│ ├── FB_ILS_MTRO_Vario_workStation.scl.j2 ✅
│ └── FB_ILS_MTRO_PinStore_Auto.scl.j2 ✅ (one per FB, named exactly like fbType)
├── cfg/
│ ├── scl_naming.ini NEW: default naming rules (from the reference plant)
│ └── <project>_scl_naming.ini NEW, optional: per-project override
@@ -260,11 +267,31 @@ template as a comment. For the pilot `1Sep1Swi` (TRO107):
| `nTo1Destinations := 3` (TRO107 has **2** exits) | number of exits, marked `pruefen` — the reference suggests it counts destinations, not exits (§13) | `switches[].to1_destinations` | open |
| `stInPriorityManager.xReleaseOk` (generic only) | not written — not in the reference | — | to confirm |
The same table is filled in for every template before it is switched on (§11, step 3).
The same decisions were made for the other six templates (step 5). Each template's
header comment lists them in full; this is the summary of what deviates from "copy the
reference line":
Effect on the open-value count with `--templates`: mubea 282 → 302, HundM05 323 → 377
`TODO(E-Planung)`. More reference lines are written and every open value is now marked;
it drops again with the naming rules (step 4).
| Template (reference) | Decisions to confirm |
|---|---|
| `1Sep` (TRO100) | times 600/200 ms and `tSenFree`/`tSenWait` 1500/4000 ms as in the reference (`pruefen`); `xInCarouselRun` always written as TODO; `xInRelease := "DB_TRO_TEST".<id>` as in the reference |
| `Vario` (TRO115) | times 800/300 ms, `xPluggedJam FALSE`, `tSenFree`/`tSenWait` 2000/5000 ms, `tRasterHigh/Low` 5 s (`pruefen`); `stInSettings.xIsBorner := TRUE` marked TODO (meaning unclear); `JamEntr` = first predecessor, `JamFinger` = first successor; `xInErrorQuit`/`xInAutomatic` open |
| `Vario_workStation` (TRO421) | `xPluggedScanner FALSE` although the catalog lists a scanner (it sits at the work station, not the separator — `pruefen`); work-station sensor, release and `xBeladenError` sensor open |
| `1Sep2Swi` (TRO267) | separator without times, `xPluggedPart TRUE` + `stSenPart` as in the reference; **switch 2 has no `nSwitchNo` in the reference** — written as a commented-out proposal; `nTo1Destinations` per switch open (split of the exits); `bSepType.%X2 := TRUE` marked `pruefen`; one `xInCarouselRun<n>` per switch; **no `FC_Direction`** at this place in the reference — only the destination list as a comment; no `nOutStateLast` (not in the reference) |
| `1Sep_SSCC` (TRO105) | second (SSCC) camera with its own interface structure, end-measurement sensor and HMI key open; `xInRelease` written as `"DB_TRO_TEST".<id>` with a TODO (the reference releases via the WCS connection); `FC_CARR_GLOB_CORRECTION` with `nInStation` open; the WCS telegram region of the reference is only noted as TODO |
| `PinStore_Auto` (TRO208) | **number of lines from the layout** (one per storage lane, `nNoOfLines`), not the 19 of the reference; all plant constants (encoder, destinations, stations, thresholds, storage DB, removal handshake) open; pin separator times 0/50 ms (`pruefen`); simulation settings `stSimu` of the reference not written; the FB has one `JamEntr`/`JamExit` — a store with more feeds/exits (mubea: 2/2) gets a TODO in the REGION header |
New context fields for these templates (`lib/scl_context.py`): Cognex wiring per scanner
(`interface`, `tag`, `hw_results`), `part_sensor` per separator, `carriers`/`data` per jam
area (handover jams use their own variables), `jam_in`/`jam_out` (same objects as the
first entry/exit), `error_quit`, `automatic`, `is_border`, `correction_station`, and the
blocks `sscc`, `work_station`, `store` (with one `SclStoreLine` per lane). The generic
path does not use them — its golden files are unchanged.
Effect on the open-value count with `--templates`: with the pilot only, mubea 282 → 302
and HundM05 323 → 377; with all seven templates mubea → 489 and HundM05 → 475
`TODO(E-Planung)` (HundM05 now comes completely from templates, mubea except the
`2Sep2Swi`). More reference lines are written and every open value is marked; the count
drops again with the naming rules (step 4).
---
@@ -392,8 +419,8 @@ With `--templates` the console summary gets a `Templates` line (implemented); th
`Namensregeln` line follows with step 4. Real output for mubea today:
```
Templates = 1 von 5 Typen (generisch: FB_ILS_MTRO_1Sep, FB_ILS_MTRO_2Sep2Swi, FB_ILS_MTRO_PinStore_Auto, FB_ILS_MTRO_Vario)
Offene Stellen = 302 (Marker 'TODO(E-Planung)')
Templates = 4 von 5 Typen (generisch: FB_ILS_MTRO_2Sep2Swi)
Offene Stellen = 489 (Marker 'TODO(E-Planung)')
```
---
@@ -424,7 +451,7 @@ Each step ends with all tests green and is usable on its own.
| 2 ✅ | `scl_context.py`: build the render context from `TroDocument`; `emit_*` read from it — `tests/test_scl_context.py` | golden files byte-identical (also checked on dematic and showroom, with and without `--start`) |
| 3 ✅ | Pilot `FB_ILS_MTRO_1Sep1Swi.scl.j2` + `_macros`; switches `--templates`, `--strict`; class-C table (§6) filled with proposals — **still to be confirmed by a PLC engineer**; round-trip test | round trip against TRO107 passes; only the 1Sep1Swi REGIONs (+ header) differ from the generic golden files |
| 4 | `scl_naming.py` + `cfg/scl_naming.ini`; switch `--naming` | naming tests pass; Mubea renders with names instead of TODOs where a rule exists |
| 5 | Remaining call-site templates one by one (`1Sep`, `Vario`, `1Sep2Swi`, `1Sep_SSCC`, `Vario_workStation`, `PinStore_Auto`), each with round trip; interface check for the FB-source types | each type moved off the fallback |
| 5 ✅ | Remaining call-site templates (`1Sep`, `Vario`, `1Sep2Swi`, `1Sep_SSCC`, `Vario_workStation`, `PinStore_Auto`), each with round trip against its reference (`PinStore_Auto`: the parts the reference abbreviates are left out of the comparison); decisions in §6 — **still to be confirmed by a PLC engineer**. Interface check (§8.2) for `Vario_workStation` still open | every round trip passes; HundM05 fully from templates, mubea except `2Sep2Swi` |
| 6 | Templates on by default; new `--no-templates` keeps the old path for one release | golden files updated and reviewed; one import into TIA Portal (as for Mubea) |
| 7 | Remove `emit_*` once every type in use has a template (`2Sep2Swi` needs a call site first) | fallback only for types without FB |
@@ -490,3 +517,11 @@ jam-area DBs) until an E-Planung export exists, and the `pruefen` timings.
destinations — the per-exit target lists in the skeleton could supply them.
8. `xInCarouselRun1`: how do we know a TRO sits at a carousel? `tro_flow` would need to
mark it (e.g. a carousel neighbour per TRO); today the line is always written as TODO.
9. `1Sep2Swi` (TRO267): switch 2 has no `nSwitchNo` and the REGION has no
`FC_Direction` call — omission in the reference, or intended (direction elsewhere)?
10. Meaning of `stInSettings.xIsBorner` (Vario) and `stInSettings.bSepType.%X2`
(`1Sep2Swi`) — always `TRUE`, or depending on the location?
11. `PinStore_Auto` with more than one feed/exit (mubea: 2/2): the FB has one
`JamEntr`/`JamExit` plus `JamBypass` — how are the others connected?
12. `Vario_workStation`: is `xPluggedScanner FALSE` right in general (scanner at the work
station, not at the separator)?