feat: Eingang/Ausgang-Symbole als eigene CSV-Zeile + in TrackIds
Die Materialfluss-Ein-/Ausgangssymbole (Bloecke Eingang_<DIM>/Ausgang_<DIM>,
eingefuegt ueber ils-insert-station) erscheinen jetzt NUR im CSV-Export als
eigene TeileArt-Zeile ("Eingang"/"Ausgang", Merkmale wie BTMT). Wie
Separator/AS/ES nehmen sie als freie Umlauf-Punkte (KREISEL_UMLAUF_TEILEARTEN)
an der TrackIds-Spalte teil und tauchen so auch auf Kreiseln auf, auf deren
Bahn sie liegen. Der Sivas-Export schliesst sie bewusst aus.
- cfg/export.cfg: pattern_eingang/pattern_ausgang
- Lisp/export.lsp: csv:collect-export-blocks sammelt beide Muster
- Lisp/ssg_id.lsp: ssg-id-collect-blocks erfasst sie (ssg-id-check-all fuellt
das nachgetragene ID-ATTDEF, dokumentiert in data/ils/allocations.json)
- lib/export_csv.py: Klassifikations-Zweige Eingang/Ausgang
- lib/export_neighbors.py: KREISEL_UMLAUF_TEILEARTEN um Eingang/Ausgang erweitert
- lib/export_sivas.py: Eingang/Ausgang uebersprungen (kein Sivas-Eintrag)
- Tests: test_export_eingang_ausgang.py + Kreisel-Umlauf-Test
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
52b0699862
commit
1d082ccde7
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
test_export_eingang_ausgang.py - Eingangs-/Ausgangssymbole im Export.
|
||||
Laeuft komplett ohne BricsCAD (reine Python-Logik).
|
||||
|
||||
Kundenwunsch: die Materialfluss-Ein-/Ausgangssymbole (Bloecke
|
||||
Eingang_<DIM>/Ausgang_<DIM>, eingefuegt ueber ils-insert-station) sollen
|
||||
- NUR im CSV-Export - als eigene Zeile erscheinen, inhaltlich aehnlich den
|
||||
BTMT Be-/Entladestationen, und
|
||||
- wie Separator/AS/ES in die "TrackIds" eingebaut werden (auch auf Kreiseln,
|
||||
siehe test_export_kreisel_umlauf.py).
|
||||
Im Sivas-Export duerfen sie NICHT auftauchen.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "lib"))
|
||||
|
||||
import export_csv # noqa: E402
|
||||
import export_sivas # noqa: E402
|
||||
|
||||
|
||||
def _block(block_name, teileid, artinr="12345", x=0.0, y=0.0):
|
||||
return {
|
||||
"block_name": block_name,
|
||||
"x": x, "y": y, "z": 0.0,
|
||||
"rotation": 0.0,
|
||||
"attribs": {"ID": teileid, "ARTINR": artinr, "LAYER": "ILS_Flow",
|
||||
"ZUORDNUNG": ""},
|
||||
"_bbox": {"cx": x, "cy": y, "cz": 0.0, "dx": 200.0, "dy": 150.0},
|
||||
}
|
||||
|
||||
|
||||
class TestCsvKlassifikation:
|
||||
"""export_csv.process_blocks gibt Eingang/Ausgang je eine eigene
|
||||
TeileArt-Zeile ("Eingang"/"Ausgang") mit der Block-ID als TeileId."""
|
||||
|
||||
def test_eingang_und_ausgang_bekommen_eigene_zeile(self):
|
||||
blocks = [
|
||||
_block("Eingang_2D", "0050", x=0.0),
|
||||
_block("Ausgang_3D", "0051", x=1000.0),
|
||||
]
|
||||
items = export_csv.process_blocks(blocks, lookup={})
|
||||
nach_art = {it["teileart"]: it for it in items}
|
||||
|
||||
assert "Eingang" in nach_art, "Eingang-Zeile fehlt im CSV-Export"
|
||||
assert "Ausgang" in nach_art, "Ausgang-Zeile fehlt im CSV-Export"
|
||||
|
||||
ein = nach_art["Eingang"]
|
||||
aus = nach_art["Ausgang"]
|
||||
# TeileId kommt aus dem ID-Attribut (stabil ueber Exportlaeufe).
|
||||
assert ein["teileid"] == "0050"
|
||||
assert aus["teileid"] == "0051"
|
||||
# Merkmale wie BTMT: ARTINR als Merkmal gefuehrt.
|
||||
assert ein["merkmale"].get("ARTINR") == "12345"
|
||||
|
||||
def test_teileid_fallback_ohne_id_attribut(self):
|
||||
"""Ohne (noch) gefuelltes ID-Attribut greift der Fallback (EIN-/AUS-
|
||||
Praefix), damit die Zeile trotzdem eine TeileId traegt - wie bei BTMT."""
|
||||
blocks = [
|
||||
{"block_name": "Eingang_2D", "x": 0.0, "y": 0.0, "z": 0.0,
|
||||
"rotation": 0.0, "attribs": {},
|
||||
"_bbox": {"cx": 0.0, "cy": 0.0, "cz": 0.0, "dx": 200.0, "dy": 150.0}},
|
||||
]
|
||||
items = export_csv.process_blocks(blocks, lookup={})
|
||||
ein = next(it for it in items if it["teileart"] == "Eingang")
|
||||
assert ein["teileid"].startswith("EIN-")
|
||||
|
||||
|
||||
class TestSivasSchliesstAus:
|
||||
"""export_sivas.process_blocks fuehrt Eingang/Ausgang bewusst NICHT als
|
||||
eigene Zeile und zaehlt sie in keinem Summenzaehler mit."""
|
||||
|
||||
def test_keine_sivas_zeile_und_kein_zaehler(self):
|
||||
blocks = [
|
||||
_block("Eingang_2D", "0050"),
|
||||
_block("Ausgang_3D", "0051"),
|
||||
]
|
||||
items, counters = export_sivas.process_blocks(blocks, lookup={})
|
||||
|
||||
arten = {it.get("teileart", "") for it in items}
|
||||
assert "Eingang" not in arten
|
||||
assert "Ausgang" not in arten
|
||||
# Kein bestehender Zaehler darf durch die zwei Symbole hochgezaehlt
|
||||
# worden sein (alle Zaehler bleiben 0, da nur Eingang/Ausgang im Satz).
|
||||
assert all(v == 0 for v in counters.values()), (
|
||||
f"Eingang/Ausgang haben einen Sivas-Zaehler beeinflusst: "
|
||||
f"{{k: v for k, v in counters.items() if v}}")
|
||||
@@ -64,6 +64,17 @@ def _btmt(teileart, teileid, x, y):
|
||||
}
|
||||
|
||||
|
||||
def _flusssymbol(teileart, teileid, x, y):
|
||||
"""Eingangs-/Ausgangssymbol ("Eingang"/"Ausgang") - frei auf der Bahn
|
||||
platziert wie ein Separator/BTMT, siehe KREISEL_UMLAUF_TEILEARTEN. Die
|
||||
TeileArt-Strings sind bewusst OHNE "ILS 2.0"-Praefix (siehe export_csv.py)."""
|
||||
return {
|
||||
"teileart": teileart,
|
||||
"teileid": teileid,
|
||||
"_bbox": {"cx": x, "cy": y, "cz": 0.0, "dx": 200.0, "dy": 150.0},
|
||||
}
|
||||
|
||||
|
||||
def _zwei_beruehrende_kreisel():
|
||||
"""Zwei Kreisel, deren AN8-Enden sich exakt beruehren (End-an-End, wie im
|
||||
Mubea-Fall: 'Kreis/Kreis'-Beruehrung an der jeweiligen AN8-Kappe).
|
||||
@@ -422,3 +433,25 @@ class TestKreiselTrackidsSpalte:
|
||||
write_kreisel_separatorliste_merkmale(
|
||||
items, kreisel_umlauf, sep_kette_by_key={}, weiche_by_key={})
|
||||
assert k["trackids"] == "0031, 0020, 0030"
|
||||
|
||||
def test_eingang_und_ausgang_zaehlen_als_freie_punkte(self):
|
||||
"""Eingangs-/Ausgangssymbole ("Eingang"/"Ausgang") sind Fluss-
|
||||
Markierungen AUF der Bahn wie ein Separator/BTMT - sie muessen (auf
|
||||
Kundenwunsch) im Kreisel-Umlauf UND in der TrackIds-Spalte des
|
||||
Kreisels auftauchen, genau wie Separator/AS/ES."""
|
||||
k = _kreisel("0001", 0.0, 0.0, 0.0, abstand=1000.0)
|
||||
k["merkmale"] = {}
|
||||
sep = _separator("0020", 300.0, 300.0)
|
||||
ein = _flusssymbol("Eingang", "0040", 900.0, 400.0)
|
||||
aus = _flusssymbol("Ausgang", "0041", 1400.0, -50.0)
|
||||
items = [k, sep, ein, aus]
|
||||
|
||||
kreisel_umlauf = compute_kreisel_umlauf(
|
||||
items, sep_kette={}, tolerance_mm=200.0, durchmesser_mm=DURCHMESSER_MM)
|
||||
keys = [p[0] for p in kreisel_umlauf["0001"]]
|
||||
assert set(keys) == {"0020", "0040", "0041"}, (
|
||||
f"Eingang/Ausgang fehlen im Kreisel-Umlauf: {keys}")
|
||||
|
||||
write_kreisel_separatorliste_merkmale(
|
||||
items, kreisel_umlauf, sep_kette_by_key={}, weiche_by_key={})
|
||||
assert k["trackids"] == "0041, 0020, 0040"
|
||||
|
||||
Reference in New Issue
Block a user