hw_import --dxf: gemeinsame Zeichnung (Layout + E-Planung) als Hardwarequelle
hw_import liest mit --dxf statt der Positionsdatei eine DXF, in der Layout
und E-Planung zusammen liegen (Dematic): jeder Block mit Attribut IO ist ein
E-Bauteil (IO/VERW/BEZEICHNUNG/KENNZEICHNUNG, Einfuegepunkt), schon in
Layout-Koordinaten (HardwareDocument.layoutCoordinates). --conveyor-from-motor
nimmt den Foerderer aus der Motornummer, wenn kein K0102/#106 dasteht
("Motor KR-MA0055" -> K0055); "ILS-VARIO" zaehlt als Strecke.
merge_hw_layout: bei layoutCoordinates kein Lagebezug (Identitaet, nichts
abgelegt); --rules findet einen blossen Namen in SKEL_CFG. Neue Regeldatei
cfg/e_planning_dematic.ini (Sensor/Stopper gleiche Nummer, Weichenventil =
Nummer des Stausensors, Abstaende an dematic_merge..dxf gemessen).
Fehler behoben: zwei Antriebs-TROs auf einem Layout-Foerderer (Dematic VF_6,
TRO04/TRO06) bekamen beide denselben Vario-Motor. Jetzt Widerspruch mit
Vorschlag; scl_context faellt dann nicht auf den Motor des Foerderers zurueck.
Dematic: 115 Namen im FB_Main (alle im TIA-Import), offene Stellen 730 -> 615.
cfg/dematic_merge_tro_ids.ini: TRO-IDs der Dematic-Anlage.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+52
-9
@@ -746,9 +746,19 @@ positions file exists.
|
||||
```
|
||||
*_TIA.xlsx (PLC Tags + Constants) ─┐
|
||||
├─► hw_import.py ──► <project>_hw.json (HardwareDocument, sps_skel-hw-v1)
|
||||
*_positionsconv.json (optional) ────┘ ──► <project>_hw.md (report: devices, drives, checks)
|
||||
*_positionsconv.json (optional) ────┤ ──► <project>_hw.md (report: devices, drives, checks)
|
||||
or merged drawing *.dxf (--dxf) ───┘
|
||||
```
|
||||
|
||||
- **Merged drawing** (`--dxf`, instead of `--positions`; Dematic): layout and
|
||||
E planning in one DXF. Every model-space block with a BMK in the attribute
|
||||
`IO` is an E device (`IO` → BMK, `VERW`, `BEZEICHNUNG`, `KENNZEICHNUNG`,
|
||||
insert point → position). Blocks without `IO` (layout parts, bus modules,
|
||||
the green motor labels `ILS_Motorkennzeichnung*`) are ignored — the motor
|
||||
symbol is authoritative. The positions are already layout coordinates;
|
||||
`layoutCoordinates: true` tells `merge_hw_layout` to skip the registration.
|
||||
A BMK drawn twice is a warning (the entry with `VERW` wins).
|
||||
|
||||
- **TIA import**: sheets are recognised by their header row, not their name
|
||||
(English and German TIA exports): a sheet with `Logical Address` /
|
||||
`Logische Adresse` holds tags, one with `Value` / `Wert` constants. Read with
|
||||
@@ -762,6 +772,10 @@ positions file exists.
|
||||
`K0104` (kind `Kreisel`); `CONVEYOR-#103` and `CONVEYOR-K0103` are the same
|
||||
conveyor and both become `K0103` (kind `Strecke`) — the four-digit conveyor
|
||||
number of the SCL naming scheme (`DB_JamArea0103`, `fbCarousel0102`).
|
||||
With `--conveyor-from-motor` (Dematic) a text without `K…`/`#…` that names a
|
||||
motor gives the conveyor by motor number: `Motor KR-MA0055`, `Rad dreht
|
||||
ILS-KR (MA0046)` → `K0055`, `K0046`; `ILS-VARIO` counts as kind `Strecke`.
|
||||
Not for Mubea, where motor `MA0203` drives conveyor `K0103`.
|
||||
- **Drives**: motor `MA` ↔ motor protection `FC` (same number), conveyor and
|
||||
kind from their texts, encoder `GF…` of the same conveyor.
|
||||
- **Cross-check** (`checks`, also printed as `?` lines): BMK only in the
|
||||
@@ -772,7 +786,8 @@ positions file exists.
|
||||
through.
|
||||
|
||||
Switches: `--tia NAME` (required), `--positions NAME` (optional; without it no
|
||||
positions), `--project NAME` (default from the positions file name:
|
||||
positions), `--dxf NAME` (merged drawing instead of `--positions`),
|
||||
`--conveyor-from-motor`, `--project NAME` (default from the positions file name:
|
||||
`Mubea_positionsconv.json` → `Mubea`). Names resolve against `%SKEL_DATA%`,
|
||||
also with a sub-folder. Exit `0` (findings are in the report), `1` on input or
|
||||
read errors.
|
||||
@@ -782,10 +797,17 @@ Result on Mubea (`mubea-1_TIA.xlsx` + `Mubea_positionsconv.json`): 238 devices,
|
||||
11 drives all with motor protection and conveyor (encoder `GF20000` at K0102);
|
||||
checks: `QA7000` only in the positions file, `BG0514` without controller.
|
||||
|
||||
Result on Dematic (`dematic_hw-2_TIA.xlsx` + `dematic_merge..dxf`,
|
||||
`--conveyor-from-motor`): 1022 devices, 278 from the drawing, 267 in both
|
||||
sources; 44 drives, all with motor protection and conveyor. Only in the drawing:
|
||||
the network devices `BX2100–2108` (scanners), `GF2200` (encoder), `BC2050`
|
||||
(RFID). 378 field devices only in TIA (areas not drawn).
|
||||
|
||||
Tests: `tests/test_hw_import.py` (xlsx reader with shared/inline strings,
|
||||
header-based sheet detection, conveyor texts, merge per BMK, drives, every
|
||||
cross-check, TIA-only run, JSON round trip, CLI with a sub-folder in
|
||||
`%SKEL_DATA%`). The test builds its own small TIA xlsx.
|
||||
header-based sheet detection, conveyor texts incl. motor numbers, merge per
|
||||
BMK, drives, every cross-check, TIA-only run, JSON round trip, CLI with a
|
||||
sub-folder in `%SKEL_DATA%`, merged drawing). The test builds its own small TIA
|
||||
xlsx and DXF.
|
||||
|
||||
## 5e. `merge_hw_layout.py` — merge layout and hardware planning into the plant JSON
|
||||
|
||||
@@ -809,8 +831,14 @@ Steps:
|
||||
layout separators), stored with the SHA-256 of the positions file. Warning
|
||||
when fewer than `registration_min_share` of the separators find a partner —
|
||||
a sign that layout and E drawing are different planning states.
|
||||
A merged drawing (`layoutCoordinates`, `hw_import --dxf`) needs none:
|
||||
identity, nothing stored. The symbols' offset beside their part (Dematic
|
||||
~600 mm) is drawing distance, covered by the rules' `max_mm`/`soll_mm`.
|
||||
2. **Rules** from `e_planning.ini`, unchanged logic (spatial with maximum /
|
||||
target distance, numbering rule `MB = BG + 1`).
|
||||
target distance, numbering rule `MB = BG + 1`). Per project another file
|
||||
via `--rules` — Dematic: `cfg/e_planning_dematic.ini` (`In Sep n` / `Sep n`
|
||||
with the same number, `Weiche Abzw. n` = number of `Stau n`, distances
|
||||
measured on the merged drawing).
|
||||
3. **Slots**: each assignment goes to the slot role of the TRO that holds the
|
||||
part — key **TRO-ID + slot + role**. A `PinStore_Auto` now has a slot per
|
||||
storage line (`line1` … `lineN`, same split as `scl_context._store`);
|
||||
@@ -828,7 +856,11 @@ Steps:
|
||||
layout conveyor. This gives motor, motor protection and encoder per layout
|
||||
conveyor (`AnlageDocument.conveyor_for("0010-R")` → the TROs on that
|
||||
Kreisel, i.e. `xInCarouselRun`) and fills `drive.motor` /
|
||||
`drive.motorProtection` of Vario TROs.
|
||||
`drive.motorProtection` of Vario TROs. When several TROs have a drive slot
|
||||
on the same layout conveyor (Dematic VF_6: two Vario TROs), the drive is a
|
||||
`widerspruch` with the conveyor's motor as a suggestion — each TRO has its
|
||||
own motor; set it in `hw_overrides.ini`. `scl_skeleton` then keeps
|
||||
`MA____` instead of falling back to the conveyor's motor.
|
||||
5. **Corrections** from `hw_overrides.ini` (last):
|
||||
`[<csv>.bindings] TRO01.separator1.sensor = BG0532` (or `= -` to clear) and
|
||||
`[<csv>.conveyors] K0102 = 0010`.
|
||||
@@ -838,7 +870,8 @@ Steps:
|
||||
Every binding carries `constant` and `address` from the TIA import.
|
||||
|
||||
Switches: `--tro NAME`, `--hw NAME` (both required, resolved against
|
||||
`%SKEL_RESULTS%`), `--rules FILE`, `--overrides FILE`, `--re-register`. Exit
|
||||
`%SKEL_RESULTS%`), `--rules FILE` (a bare name resolves against `%SKEL_CFG%`),
|
||||
`--overrides FILE`, `--re-register`. Exit
|
||||
`0` also when not everything was assigned; `1` on input errors, an old
|
||||
TRO-JSON without `parts`, or an unprovable registration. Parameters:
|
||||
`cfg/parameter.ini [merge_hw_layout]`.
|
||||
@@ -852,6 +885,14 @@ K0105 = Kreisel1 (2/3)**, each with motor and motor protection. The other
|
||||
conveyors (Aufgabestation #100/#101, Vario #106–#109) are outside the CSV or
|
||||
have a single vote and stay open.
|
||||
|
||||
Result on Dematic (`dematic_merge_tro.json` + `dematic_hw.json`, rules
|
||||
`e_planning_dematic.ini`): 113 slot roles assigned (all 27 storage lines with
|
||||
sensor and stopper, 23 of 25 separators, 5 of 6 switch valves, 6 Vario drives),
|
||||
39 open (Vario sensors, scanners, VF_4/VF_6 where mechanical parts are still
|
||||
missing), 4 contradictions (the two Vario TROs on VF_6). Then
|
||||
`scl_skeleton --templates --strict`: 115 names inserted, all known in TIA,
|
||||
open gaps 730 → 615.
|
||||
|
||||
**Stage 4:** `scl_skeleton --json <csv>_anlage.json` reads the plant JSON
|
||||
directly (§5b). `--eplan` still works for a TRO-JSON and is phased out together
|
||||
with `e_planning.py`.
|
||||
@@ -860,7 +901,9 @@ Tests: `tests/test_merge_hw_layout.py` (sensor spatial / stopper by number,
|
||||
contradiction, open roles, part without slot, conveyor majority with
|
||||
overlapping boxes, Vario drive, too few votes, corrections incl. moving a BMK
|
||||
and clearing a conveyor, storage-line slots, missing `parts`, JSON round trip,
|
||||
fingerprint of the stored registration, CLI end to end with a real offset).
|
||||
fingerprint of the stored registration, CLI end to end with a real offset,
|
||||
merged drawing without registration, two drive TROs on one conveyor, Dematic
|
||||
rules file).
|
||||
|
||||
## 6. `tro_catalog.py` — TRO type catalog (library, no CLI)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user