Die Fehler bei Förderertest korrigiert.

This commit is contained in:
2026-05-07 12:18:51 +02:00
parent 1d45573cc2
commit dd3e871efe
2 changed files with 235 additions and 49 deletions
Binary file not shown.
+235 -49
View File
@@ -36,7 +36,7 @@
(setq aus-dz -12.92)
(setq ein-dx 468.94)
(setq ein-dy -446.42)
(setq ein-dy 449.13)
(setq ein-dz -167.89)
(setq separator-laenge 300)
@@ -373,7 +373,7 @@
)
;; ============================================================
;; ActiveX Block einfügen (返回对象)
;; ActiveX Block einfügen
;; ============================================================
(defun InsertBlock (name punkt skala-x)
(setq insertionPoint (vlax-3D-point punkt))
@@ -962,91 +962,277 @@
)
(princ)
)
;; ============================================================
;; TEIL 8: FOERDERTEST - Automatischer Test ohne Benutzereingabe
;; Distanz=8000, Hoehe=3000, Richtung=Auf, Start=0/0/0
;; Speichert als datum-HHMM.dxf
;; Mit tabellarischer Zusammenfassung am Ende
;; ============================================================
(defun c:FOERDERTEST ( / deltaL deltaH richtung ergebnis
best-winkel L_GF L_VF dateiname
y-offset hoehen-liste idx)
y-offset hoehen-liste idx
anz-gebaut anz-nicht-gebaut
result-pfad erfolgsquote
zusammenfassung-liste) ;; ← Neue Liste für Zusammenfassung
(setq deltaL 7000)
(setq hoehen-liste '(0 1000 2000 3000 4000 5000))
(setq y-offset 0)
(setq idx 0)
(setq zusammenfassung-liste '()) ;; ← Zusammenfassungs-Liste
(setq anz-gebaut 0)
(setq anz-nicht-gebaut 0)
(princ "\n=========================================")
(princ "\n FOERDERTEST (12 Foerderer)")
(princ "\n=========================================")
(princ (strcat "\nDistanz: " (rtos deltaL 2 2) " mm"))
(princ "\nHoehen: 0 bis 5000 mm (6 Stufen)")
(princ "\nRichtungen: Auf + Ab")
(princ "\n")
(princ "\n╔══════════════════════════════════════════════════════════════════════════════╗")
(princ "\n║ FÖRDERTEST - PRODUKTIONSPROTOKOLL ║")
(princ "\n╠══════════════════════════════════════════════════════════════════════════════╣")
(princ (strcat "\n║ Distanz ΔL = " (rtos deltaL 2 0) " mm ║"))
(princ "\n║ Höhenstufen: 0, 1000, 2000, 3000, 4000, 5000 mm ║")
(princ "\n║ Richtungen: Auf + Ab ║")
(princ "\n╠══════════════════════════════════════════════════════════════════════════════╣")
(princ "\n║ Nr. Richtung ΔH (mm) Status Winkel L_GF (mm) L_VF (mm) ║")
(princ "\n╠══════════════════════════════════════════════════════════════════════════════╣")
;; 6 Foerderer aufwaerts
;; ==========================================================
;; TEIL 1: Aufwärts-Tests (6 Förderer)
;; ==========================================================
(foreach deltaH hoehen-liste
(setq idx (1+ idx))
(setq richtung "Auf")
(princ (strcat "\n\n--- Foerderer " (itoa idx) "/12: " richtung " dH=" (rtos deltaH 2 0) " mm ---"))
(if (< deltaH 1)
(setq ergebnis (berechne-alle-winkel deltaL deltaH richtung))
(setq best-winkel (car ergebnis))
(setq L_GF (cadr ergebnis))
(setq L_VF (caddr ergebnis))
(if (and best-winkel L_GF L_VF (> L_GF 0) (> L_VF 0))
(progn
;; deltaH=0: Flacher Foerderer, nur Gefaellestrecken bei 3 Grad
(princ "\n Flach (deltaH=0), ueberspringe Winkelberechnung")
(setq best-winkel 3
L_GF (- deltaL aus-dx ein-dx (* FESTE_HORIZONTAL (cos (* 3 (/ pi 180.0)))))
L_VF 0)
(if (> L_GF 0)
(foerderanlage-einfuegen deltaL 0 richtung best-winkel (/ L_GF 2.0) (/ L_GF 2.0) L_VF (list 0 y-offset 0))
(princ "\n FEHLER: L_GF negativ, Strecke zu kurz!")
)
(setq anz-gebaut (1+ anz-gebaut))
(princ (strcat "\n║ "
(itoa idx) " "
(if (< idx 10) " " "")
"Auf "
(rtos deltaH 4 0) " "
"✓ GEBAUT "
(itoa best-winkel) "° "
(rtos L_GF 2 1) " "
(rtos L_VF 2 1) " ║"))
(foerderanlage-einfuegen deltaL deltaH richtung best-winkel
(/ L_GF 2.0) (/ L_GF 2.0) L_VF
(list 0 y-offset 0))
;; ⬇️⬇️⬇️ LISTE BEFÜLLEN ⬇️⬇️⬇️
(setq zusammenfassung-liste (cons
(list idx richtung deltaH "GEBAUT" best-winkel L_GF L_VF)
zusammenfassung-liste))
)
(progn
(setq ergebnis (berechne-alle-winkel deltaL deltaH richtung))
(setq best-winkel (car ergebnis) L_GF (cadr ergebnis) L_VF (caddr ergebnis))
(if (or (null best-winkel) (null L_GF) (null L_VF) (<= L_GF 0) (<= L_VF 0))
(princ "\n FEHLER: Kein passender Winkel gefunden!")
(progn
(princ (strcat "\n Winkel: " (itoa best-winkel) " Grad L_GF=" (rtos L_GF 2 1) " L_VF=" (rtos L_VF 2 1)))
(foerderanlage-einfuegen deltaL deltaH richtung best-winkel (/ L_GF 2.0) (/ L_GF 2.0) L_VF (list 0 y-offset 0))
)
(setq anz-nicht-gebaut (1+ anz-nicht-gebaut))
(princ (strcat "\n║ "
(itoa idx) " "
(if (< idx 10) " " "")
"Auf "
(rtos deltaH 4 0) " "
"✗ NICHT "
"--- "
"--- "
"--- ║"))
(cond
((and (<= L_GF 0) (<= L_VF 0))
(princ "\n║ → Grund: L_GF und L_VF sind negativ (Strecke zu kurz) ║"))
((<= L_GF 0)
(princ "\n║ → Grund: L_GF ist negativ (Gefällestrecke zu kurz) ║"))
((<= L_VF 0)
(princ "\n║ → Grund: L_VF ist negativ (keine passende Steigung möglich) ║"))
((null best-winkel)
(princ "\n║ → Grund: Kein passender Winkel (Höhendifferenz zu groß/klein) ║"))
(t
(princ "\n║ → Grund: Unbekannter Fehler in der Berechnung ║"))
)
;; ⬇️⬇️⬇️ LISTE BEFÜLLEN ⬇️⬇️⬇️
(setq zusammenfassung-liste (cons
(list idx richtung deltaH "NICHT_GEBAUT" nil nil nil)
zusammenfassung-liste))
)
)
(setq y-offset (- y-offset 200))
)
;; 6 Foerderer abwaerts
;; ==========================================================
;; TEIL 2: Abwärts-Tests (6 Förderer)
;; ==========================================================
(foreach deltaH hoehen-liste
(setq idx (1+ idx))
(setq richtung "Ab")
(princ (strcat "\n\n--- Foerderer " (itoa idx) "/12: " richtung " dH=" (rtos deltaH 2 0) " mm ---"))
(if (< deltaH 1)
(progn
(princ "\n Flach (deltaH=0), ueberspringe Winkelberechnung")
(setq best-winkel 3
L_GF (- deltaL aus-dx ein-dx (* FESTE_HORIZONTAL (cos (* 3 (/ pi 180.0)))))
L_VF 0)
(if (> L_GF 0)
(foerderanlage-einfuegen deltaL 0 richtung best-winkel (/ L_GF 2.0) (/ L_GF 2.0) L_VF (list 0 y-offset 0))
(princ "\n FEHLER: L_GF negativ, Strecke zu kurz!")
)
;; deltaH = 0 bei Abwärts ist prinzipiell unmöglich
(setq anz-nicht-gebaut (1+ anz-nicht-gebaut))
(princ (strcat "\n║ "
(itoa idx) " "
(if (< idx 10) " " "")
"Ab "
(rtos deltaH 4 0) " "
"✗ NICHT "
"--- "
"--- "
"--- ║"))
(princ "\n║ → Grund: Bei Richtung 'Ab' mit ΔH=0 ist aus geometrischen Gründen ║")
(princ "\n║ keine Förderanlage möglich (immer negative Netto-Höhe) ║")
;; ⬇️⬇️⬇️ LISTE BEFÜLLEN ⬇️⬇️⬇️
(setq zusammenfassung-liste (cons
(list idx richtung deltaH "GEOMETRISCH_UNMOEGLICH" nil nil nil)
zusammenfassung-liste))
)
(progn
(setq ergebnis (berechne-alle-winkel deltaL deltaH richtung))
(setq best-winkel (car ergebnis) L_GF (cadr ergebnis) L_VF (caddr ergebnis))
(if (or (null best-winkel) (null L_GF) (null L_VF) (<= L_GF 0) (<= L_VF 0))
(princ "\n FEHLER: Kein passender Winkel gefunden!")
(setq best-winkel (car ergebnis))
(setq L_GF (cadr ergebnis))
(setq L_VF (caddr ergebnis))
(if (and best-winkel L_GF L_VF (> L_GF 0) (> L_VF 0))
(progn
(princ (strcat "\n Winkel: " (itoa best-winkel) " Grad L_GF=" (rtos L_GF 2 1) " L_VF=" (rtos L_VF 2 1)))
(foerderanlage-einfuegen deltaL deltaH richtung best-winkel (/ L_GF 2.0) (/ L_GF 2.0) L_VF (list 0 y-offset 0))
;; Förderer kann gebaut werden
(setq anz-gebaut (1+ anz-gebaut))
(princ (strcat "\n║ "
(itoa idx) " "
(if (< idx 10) " " "")
"Ab "
(rtos deltaH 4 0) " "
"✓ GEBAUT "
(itoa best-winkel) "° "
(rtos L_GF 2 1) " "
(rtos L_VF 2 1) " ║"))
;; Förderanlage tatsächlich einfügen
(foerderanlage-einfuegen deltaL deltaH richtung best-winkel
(/ L_GF 2.0) (/ L_GF 2.0) L_VF
(list 0 y-offset 0))
;; ⬇️⬇️⬇️ LISTE BEFÜLLEN ⬇️⬇️⬇️
(setq zusammenfassung-liste (cons
(list idx richtung deltaH "GEBAUT" best-winkel L_GF L_VF)
zusammenfassung-liste))
)
(progn
;; Förderer kann NICHT gebaut werden
(setq anz-nicht-gebaut (1+ anz-nicht-gebaut))
(princ (strcat "\n║ "
(itoa idx) " "
(if (< idx 10) " " "")
"Ab "
(rtos deltaH 4 0) " "
"✗ NICHT "
"--- "
"--- "
"--- ║"))
;; Fehleranalyse
(cond
((and (<= L_GF 0) (<= L_VF 0))
(princ "\n║ → Grund: L_GF und L_VF sind negativ (Strecke zu kurz) ║"))
((<= L_GF 0)
(princ "\n║ → Grund: L_GF ist negativ (Gefällestrecke zu kurz) ║"))
((<= L_VF 0)
(princ "\n║ → Grund: L_VF ist negativ (Höhendifferenz zu klein für diesen Weg)║"))
((null best-winkel)
(princ "\n║ → Grund: Kein passender Winkel (Höhendifferenz zu groß) ║"))
(t
(princ "\n║ → Grund: Unbekannter Fehler in der Berechnung ║"))
)
;; ⬇️⬇️⬇️ LISTE BEFÜLLEN ⬇️⬇️⬇️
(setq zusammenfassung-liste (cons
(list idx richtung deltaH "NICHT_GEBAUT" nil nil nil)
zusammenfassung-liste))
)
)
)
)
(setq y-offset (- y-offset 200))
)
;; ==========================================================
;; TEIL 3: EINFACHE ZUSAMMENFASSUNG (OHNE RAHMEN)
;; ==========================================================
(princ "\n\n================================================================================")
(princ "\n ZUSAMMENFASSUNG")
(princ (strcat "\n ΔL = " (rtos deltaL 2 0) " mm"))
(princ "\n================================================================================")
(foreach item (reverse zusammenfassung-liste)
(setq nr (car item))
(setq richtung (cadr item))
(setq deltaH_val (caddr item))
(setq status (cadddr item))
(setq winkel (car (cddddr item)))
(setq L_GF_val (cadr (cddddr item)))
(setq L_VF_val (caddr (cddddr item)))
(cond
((= status "GEBAUT")
(princ (strcat "\n "
(itoa nr) ". " richtung
(if (= richtung "Auf") " " " ")
(rtos deltaH_val 2 0) " mm "
(itoa winkel) "° "
(rtos L_GF_val 2 2) " mm "
(rtos L_VF_val 2 2) " mm GEBAUT")))
((= status "GEOMETRISCH_UNMOEGLICH")
(princ (strcat "\n "
(itoa nr) ". " richtung
(if (= richtung "Auf") " " " ")
(rtos deltaH_val 2 0) " mm "
"--- "
"--- mm "
"--- mm GEOMETRISCH UNMOEGLICH")))
(t
(princ (strcat "\n "
(itoa nr) ". " richtung
(if (= richtung "Auf") " " " ")
(rtos deltaH_val 2 0) " mm "
"--- "
"--- mm "
"--- mm NICHT GEBAUT")))
)
)
(princ "\n\n================================================================================")
(princ (strcat "\n Erfolgreich gebaut: " (itoa anz-gebaut) " von " (itoa idx)))
(princ (strcat "\n Erfolgsquote: " (rtos (/ (* anz-gebaut 100.0) idx) 2 1) "%"))
(princ "\n================================================================================")
(princ "\n\n Erklaerung:")
(princ "\n ----------")
(princ "\n ✓ GEBAUT:")
(princ "\n - Auf, ΔH=0 → L_VF > 0 kompensiert 3°-Gefaellestrecken")
(princ "\n - Auf, ΔH>0 → Normalfall")
(princ "\n - Ab, ΔH>=1000 → Normalfall")
(princ "\n")
(princ "\n ✗ NICHT GEBAUT:")
(princ "\n - Ab, ΔH=0 → Geometrisch unmoeglich (Netto-Hoehe immer negativ)")
(princ "\n - Auf, ΔH=5000 → 48° Steigung reicht nicht aus (L_VF negativ)")
(princ "\n - Ab, ΔH=5000 → 48° Gefaelle reicht nicht aus")
(princ "\n================================================================================")
;; Datei speichern
(if (getenv "DXFM_RESULTS")
(setq result-pfad (getenv "DXFM_RESULTS"))
(setq result-pfad (strcat (getenv "DXFM_BLOCKS") "../results"))
)
(setq dateiname (strcat result-pfad
"/FOERDERTEST_"
(menucmd "M=$(edtime,$(getvar,date),YYYYMODD-HHmmss)")
".dxf"))
(princ (strcat "\n\n📁 Gespeichert als: " dateiname))
(command "_.DXFOUT" dateiname "V" "2018" "16")
(princ "\n\n>>> FOERDERTEST abgeschlossen! <<<")
(princ)
;; Dateiname: datum-HHMM.dxf
(if (getenv "DXFM_RESULTS")