Varioförderer refactored mit Claude. Unittests dazu gebaut.

This commit is contained in:
2026-01-27 16:43:24 +01:00
parent ab415071c2
commit 829fe76d0f
3 changed files with 1733 additions and 1657 deletions
+315 -117
View File
@@ -11,48 +11,61 @@ class Gefaellestrecke(BaseModel):
teileid: str
x: float = Field(description="X-Koordinate des Foerder-Zentrums")
y: float = Field(description="Y-Koordinate des Foerder-Zentrums")
laenge:float = Field(description = "Länge des Förderers")
laenge: float = Field(description="Länge des Förderers")
h0: float = Field(description="Höhe Unten in Merkmale")
h1: float = Field(description="Höhe Oben in Merkmale")
drehung: float = Field(default=0.0, description="Drehung an z achse")
anzahl_scanner: int = Field(default=0, description="Anzahl der Scanner")
anzahl_separatoren: int = Field(default=0, description="Anzahl der Separatoren")
@property
def hight_zwischen(self):
return ((self.h0 + self.h1) /2)
return (self.h0 + self.h1) / 2
@classmethod
def from_merkmale(cls, teileid: str, x: float, y: float, merkmale: dict) -> 'Gefaellestrecke':
def from_merkmale(
cls, teileid: str, x: float, y: float, merkmale: dict
) -> "Gefaellestrecke":
h0 = float(merkmale.get("Höhe unten")) * 1000
h1 = float(merkmale.get("Höhe oben")) * 1000
laenge = float(merkmale.get("Länge in Meter")) * 1000
return cls(
teileid = teileid,
laenge = laenge,
x = x,
y = y,
h0 = h0,
h1 =h1,
drehung = float(merkmale.get("Drehung")),
anzahl_scanner = int(merkmale.get("Anzahl der Scanner")),
anzahl_separatoren = int(merkmale.get("Anzahl der Separatoren"))
teileid=teileid,
laenge=laenge,
x=x,
y=y,
h0=h0,
h1=h1,
drehung=float(merkmale.get("Drehung")),
anzahl_scanner=int(merkmale.get("Anzahl der Scanner")),
anzahl_separatoren=int(merkmale.get("Anzahl der Separatoren")),
)
def erstehlung_von_gefalle_ohne_aussnahmen(msp, x, y, upper_hoehe_gefaelle, lower_hoehe_gefaelle, halbe_laenge, winkel):
dx = halbe_laenge *math.sin(winkel * -1)
def erstehlung_von_gefalle_ohne_aussnahmen(
msp, x, y, upper_hoehe_gefaelle, lower_hoehe_gefaelle, halbe_laenge, winkel
):
dx = halbe_laenge * math.sin(winkel * -1)
dy = halbe_laenge * math.cos(winkel)
start = x +dx, y + dy,upper_hoehe_gefaelle
ende = x -dx, y - dy,lower_hoehe_gefaelle
line =msp.add_line(start,ende)
start = x + dx, y + dy, upper_hoehe_gefaelle
ende = x - dx, y - dy, lower_hoehe_gefaelle
line = msp.add_line(start, ende)
line.dxf.layer = "6-SP"
def rotation_mit_zwei_verbunden(gefaellestrecke_nachbarn,richtung2, richtung0, am_kreisel, kreisel_verbunden, hight_position):
drehung0 =gefaellestrecke_nachbarn.get("Drehung0")
def rotation_mit_zwei_verbunden(
gefaellestrecke_nachbarn,
richtung2,
richtung0,
am_kreisel,
kreisel_verbunden,
hight_position,
):
drehung0 = gefaellestrecke_nachbarn.get("Drehung0")
drehung1 = gefaellestrecke_nachbarn.get("Drehung1")
x0_kreisel = float(gefaellestrecke_nachbarn.get("x0"))
y0_kreisel = float(gefaellestrecke_nachbarn.get("y0"))
x1_kreisel = float(gefaellestrecke_nachbarn.get("x1"))
y1_kreisel = float(gefaellestrecke_nachbarn.get("y1"))
if richtung2 == "DEFAULT":
if richtung0 == "Vertikal":
if x0_kreisel < x1_kreisel:
@@ -71,26 +84,35 @@ class Gefaellestrecke(BaseModel):
else:
gefaelle = "rechts"
elif richtung0 == "Horizontal":
if position == "lower_lower" or position == "higher_higher":
gefaelle = "oben"
else:
gefaelle = "unten"
# vertausch der drehung und der höhe für die namens gebung des blockes
if (position == "higher_rechts" or position == "lower_rechts" or position=="higher_lower" or position== "lower_lower") and drehung0 != drehung1 and am_kreisel == 0:
if position == "lower_lower" or position == "higher_higher":
gefaelle = "oben"
else:
gefaelle = "unten"
# vertausch der drehung und der höhe für die namens gebung des blockes
if (
(
position == "higher_rechts"
or position == "lower_rechts"
or position == "higher_lower"
or position == "lower_lower"
)
and drehung0 != drehung1
and am_kreisel == 0
):
drehung_2 = drehung0
drehung0 = drehung1
drehung1= drehung_2
drehung1 = drehung_2
if hight_position == "higher":
hight_position = "lower"
else:
hight_position = "higher"
# austausch der werte damit immer davon ausgehen dass der 1 kreisel in unserer Liste am Kreisel verbuden ist
if kreisel_verbunden == 1 and am_kreisel ==2:
if kreisel_verbunden == 1 and am_kreisel == 2:
am_kreisel == 1
drehung_2 = drehung0
drehung0 = drehung1
drehung1= drehung_2
drehung1 = drehung_2
if hight_position == "higher":
hight_position = "lower"
else:
@@ -113,103 +135,249 @@ class Gefaellestrecke(BaseModel):
else:
gefaelle = "rechts"
elif richtung2 == "Horizontal":
if position == "lower_lower" or position == "higher_higher":
gefaelle = "oben"
else:
gefaelle = "unten"
# austausch der werte damit immer davon ausgehen dass der 1 kreisel in unserer Liste am Kreisel verbuden ist
if position == "lower_lower" or position == "higher_higher":
gefaelle = "oben"
else:
gefaelle = "unten"
# austausch der werte damit immer davon ausgehen dass der 1 kreisel in unserer Liste am Kreisel verbuden ist
if am_kreisel == 2:
am_kreisel = 1
drehung_2 = drehung0
drehung0 = drehung1
drehung1= drehung_2
drehung1 = drehung_2
if hight_position == "higher":
hight_position = "lower"
else:
hight_position = "higher"
# Erstellung der Rotation
# Erstellung der Rotation
if gefaelle == "oben":
rotation = 0
elif gefaelle == "unten" :
elif gefaelle == "unten":
rotation = 180
elif gefaelle == "links" :
elif gefaelle == "links":
rotation = 90
elif gefaelle == "rechts" :
elif gefaelle == "rechts":
rotation = 270
return rotation,drehung0,drehung1,hight_position
def ein_motor_oder_eine_umlenk(x, y,start,ende, doc, lib_doc, hoehe_gefaelle, block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links, hat_motor_0, hat_umlenk_0, tefkurve_0, block,umlenk_gerade,motor_gerade):
return rotation, drehung0, drehung1, hight_position
block_Vario_Bogen_auf = (f"Vario_Bogen_auf_3°")
block_Vario_Bogen_ab = (f"Vario_Bogen_ab_3°")
def ein_motor_oder_eine_umlenk(
x,
y,
start,
ende,
doc,
lib_doc,
hoehe_gefaelle,
block_Vario_Umlenkstation_500mm,
block_Vario_Motorstation_500mm,
blockname_motor_links,
blockname_umlenk_links,
hat_motor_0,
hat_umlenk_0,
tefkurve_0,
block,
umlenk_gerade,
motor_gerade,
):
block_Vario_Bogen_auf = f"Vario_Bogen_auf_3°"
block_Vario_Bogen_ab = f"Vario_Bogen_ab_3°"
block_Vario_Bogen_auf_links = (f"Vario_Bogen_auf_3°") + "_links"
block_Vario_Bogen_ab_links = (f"Vario_Bogen_ab_3°") + "_links"
auf_attrib = block_methoden.import_block(block_Vario_Bogen_auf,lib_doc,doc)
ab_attrib = block_methoden.import_block(block_Vario_Bogen_ab,lib_doc,doc)
Vario_Bogen_auf_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_attrib["DELTA_SP_0"]))
Vario_Bogen_auf_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_attrib["DELTA_SP_1"]))
Vario_Bogen_ab_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_SP_0"]))
Vario_Bogen_ab_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_SP_1"]))
for i, wert in enumerate(Vario_Bogen_auf_Delta_SP_0):
if wert < 0:
Vario_Bogen_auf_Delta_SP_0[i] = abs(wert)
auf_attrib = block_methoden.import_block(block_Vario_Bogen_auf, lib_doc, doc)
ab_attrib = block_methoden.import_block(block_Vario_Bogen_ab, lib_doc, doc)
Vario_Bogen_auf_Delta_SP_0 = list(
float(att) for att in re.split(r"[;,]", auf_attrib["DELTA_SP_0"])
)
Vario_Bogen_auf_Delta_SP_1 = list(
float(att) for att in re.split(r"[;,]", auf_attrib["DELTA_SP_1"])
)
Vario_Bogen_ab_Delta_SP_0 = list(
float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_SP_0"])
)
Vario_Bogen_ab_Delta_SP_1 = list(
float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_SP_1"])
)
for i, wert in enumerate(Vario_Bogen_auf_Delta_SP_0):
if wert < 0:
Vario_Bogen_auf_Delta_SP_0[i] = abs(wert)
for i, wert in enumerate(Vario_Bogen_auf_Delta_SP_1):
if wert< 0:
Vario_Bogen_auf_Delta_SP_1[i] = abs(wert)
if wert < 0:
Vario_Bogen_auf_Delta_SP_1[i] = abs(wert)
for i, wert in enumerate(Vario_Bogen_ab_Delta_SP_0):
if wert< 0:
if wert < 0:
Vario_Bogen_ab_Delta_SP_0[i] = abs(wert)
for i, wert in enumerate(Vario_Bogen_ab_Delta_SP_1):
if wert< 0:
if wert < 0:
Vario_Bogen_ab_Delta_SP_1[i] = abs(wert)
block_methoden.turn_two_blocks_left(doc, block_Vario_Bogen_auf, block_Vario_Bogen_ab, block_Vario_Bogen_ab_links, block_Vario_Bogen_auf_links)
block_methoden.turn_two_blocks_left(
doc,
block_Vario_Bogen_auf,
block_Vario_Bogen_ab,
block_Vario_Bogen_ab_links,
block_Vario_Bogen_auf_links,
)
if hat_motor_0 == True:
if tefkurve_0 == "links":
if motor_gerade == False:
block.add_blockref(block_Vario_Bogen_ab_links,(start[0]-x,start[1]-Vario_Bogen_ab_Delta_SP_0[0]-y,start[2]- Vario_Bogen_ab_Delta_SP_0[2]-hoehe_gefaelle),dxfattribs={"rotation": 270})
start = [start[0],start[1]-Vario_Bogen_ab_Delta_SP_0[0]- Vario_Bogen_ab_Delta_SP_1[0],start[2]-Vario_Bogen_ab_Delta_SP_0[2]- Vario_Bogen_ab_Delta_SP_1[2]]
block.add_blockref(blockname_motor_links, (start[0]-x,start[1] - 250* math.cos(math.radians(3))-y,start[2] - 250* math.sin(math.radians(3))-hoehe_gefaelle),dxfattribs={"rotation": 270})
start[1]= start[1] - 500* math.cos(math.radians(3))
start[2] = start[2] - 500* math.sin(math.radians(3))
if tefkurve_0 == "links":
if motor_gerade == False:
block.add_blockref(
block_Vario_Bogen_ab_links,
(
start[0] - x,
start[1] - Vario_Bogen_ab_Delta_SP_0[0] - y,
start[2] - Vario_Bogen_ab_Delta_SP_0[2] - hoehe_gefaelle,
),
dxfattribs={"rotation": 270},
)
start = [
start[0],
start[1]
- Vario_Bogen_ab_Delta_SP_0[0]
- Vario_Bogen_ab_Delta_SP_1[0],
start[2]
- Vario_Bogen_ab_Delta_SP_0[2]
- Vario_Bogen_ab_Delta_SP_1[2],
]
block.add_blockref(
blockname_motor_links,
(
start[0] - x,
start[1] - 250 * math.cos(math.radians(3)) - y,
start[2] - 250 * math.sin(math.radians(3)) - hoehe_gefaelle,
),
dxfattribs={"rotation": 270},
)
start[1] = start[1] - 500 * math.cos(math.radians(3))
start[2] = start[2] - 500 * math.sin(math.radians(3))
else:
block.add_blockref("Vario_Motorstation_500mm_links", (start[0]-x,start[1] -250 -y,start[2] -hoehe_gefaelle),dxfattribs={"rotation": 270})
start[1]= start[1] - 500
block.add_blockref(
"Vario_Motorstation_500mm_links",
(start[0] - x, start[1] - 250 - y, start[2] - hoehe_gefaelle),
dxfattribs={"rotation": 270},
)
start[1] = start[1] - 500
else:
if motor_gerade == False:
block.add_blockref(block_Vario_Bogen_ab,(start[0]-x,start[1]-Vario_Bogen_ab_Delta_SP_0[0]-y,start[2]- Vario_Bogen_ab_Delta_SP_0[2]-hoehe_gefaelle),dxfattribs={"rotation": 270})
start = [start[0],start[1]-Vario_Bogen_ab_Delta_SP_0[0]- Vario_Bogen_ab_Delta_SP_1[0],start[2]-Vario_Bogen_ab_Delta_SP_0[2]- Vario_Bogen_ab_Delta_SP_1[2]]
block.add_blockref(block_Vario_Motorstation_500mm, (start[0]-x,start[1] - 250* math.cos(math.radians(3))-y,start[2] - 250* math.sin(math.radians(3))-hoehe_gefaelle),dxfattribs={"rotation": 270})
start[1]= start[1] - 500* math.cos(math.radians(3))
start[2] = start[2] - 500* math.sin(math.radians(3))
if motor_gerade == False:
block.add_blockref(
block_Vario_Bogen_ab,
(
start[0] - x,
start[1] - Vario_Bogen_ab_Delta_SP_0[0] - y,
start[2] - Vario_Bogen_ab_Delta_SP_0[2] - hoehe_gefaelle,
),
dxfattribs={"rotation": 270},
)
start = [
start[0],
start[1]
- Vario_Bogen_ab_Delta_SP_0[0]
- Vario_Bogen_ab_Delta_SP_1[0],
start[2]
- Vario_Bogen_ab_Delta_SP_0[2]
- Vario_Bogen_ab_Delta_SP_1[2],
]
block.add_blockref(
block_Vario_Motorstation_500mm,
(
start[0] - x,
start[1] - 250 * math.cos(math.radians(3)) - y,
start[2] - 250 * math.sin(math.radians(3)) - hoehe_gefaelle,
),
dxfattribs={"rotation": 270},
)
start[1] = start[1] - 500 * math.cos(math.radians(3))
start[2] = start[2] - 500 * math.sin(math.radians(3))
else:
block.add_blockref("Vario_Motorstation_500mm", (start[0]-x,start[1]- 250 -y,start[2] -hoehe_gefaelle),dxfattribs={"rotation": 270})
start[1]= start[1] - 500
block.add_blockref(
"Vario_Motorstation_500mm",
(start[0] - x, start[1] - 250 - y, start[2] - hoehe_gefaelle),
dxfattribs={"rotation": 270},
)
start[1] = start[1] - 500
if hat_umlenk_0 == True:
if tefkurve_0 == "links":
if umlenk_gerade == False:
block.add_blockref(block_Vario_Bogen_auf,(ende[0]-x,ende[1]+Vario_Bogen_auf_Delta_SP_0[0]-y,ende[2] + Vario_Bogen_auf_Delta_SP_0[2]-hoehe_gefaelle),dxfattribs={"rotation": 90})
ende = [ende[0],ende[1]+ Vario_Bogen_auf_Delta_SP_0[0]+ Vario_Bogen_auf_Delta_SP_1[0],ende[2]+Vario_Bogen_auf_Delta_SP_0[2]+ Vario_Bogen_auf_Delta_SP_1[2]]
block.add_blockref(blockname_umlenk_links, (ende[0]-x,ende[1] + 250* math.cos(math.radians(3))-y,ende[2] + 250* math.sin(math.radians(3))-hoehe_gefaelle),dxfattribs={"rotation": 270})
block.add_blockref(
block_Vario_Bogen_auf,
(
ende[0] - x,
ende[1] + Vario_Bogen_auf_Delta_SP_0[0] - y,
ende[2] + Vario_Bogen_auf_Delta_SP_0[2] - hoehe_gefaelle,
),
dxfattribs={"rotation": 90},
)
ende = [
ende[0],
ende[1]
+ Vario_Bogen_auf_Delta_SP_0[0]
+ Vario_Bogen_auf_Delta_SP_1[0],
ende[2]
+ Vario_Bogen_auf_Delta_SP_0[2]
+ Vario_Bogen_auf_Delta_SP_1[2],
]
block.add_blockref(
blockname_umlenk_links,
(
ende[0] - x,
ende[1] + 250 * math.cos(math.radians(3)) - y,
ende[2] + 250 * math.sin(math.radians(3)) - hoehe_gefaelle,
),
dxfattribs={"rotation": 270},
)
ende [1]= ende[1] + 500* math.cos(math.radians(3))
ende[2] = ende[2] + 500* math.sin(math.radians(3))
ende[1] = ende[1] + 500 * math.cos(math.radians(3))
ende[2] = ende[2] + 500 * math.sin(math.radians(3))
else:
block.add_blockref("Vario_Umlenkstation_500mm_links", (ende[0]-x,ende[1] + 250-y,ende[2] -hoehe_gefaelle),dxfattribs={"rotation": 270})
ende [1]= ende[1] + 500
block.add_blockref(
"Vario_Umlenkstation_500mm_links",
(ende[0] - x, ende[1] + 250 - y, ende[2] - hoehe_gefaelle),
dxfattribs={"rotation": 270},
)
ende[1] = ende[1] + 500
else:
if umlenk_gerade == False:
block.add_blockref(block_Vario_Bogen_auf_links,(ende[0]-x,ende[1]+Vario_Bogen_auf_Delta_SP_0[0]-y,ende[2] + Vario_Bogen_auf_Delta_SP_0[2]-hoehe_gefaelle),dxfattribs={"rotation": 90})
ende = [ende[0],ende[1]+ Vario_Bogen_auf_Delta_SP_0[0]+ Vario_Bogen_auf_Delta_SP_1[0],ende[2]+Vario_Bogen_auf_Delta_SP_0[2]+ Vario_Bogen_auf_Delta_SP_1[2]]
block.add_blockref(block_Vario_Umlenkstation_500mm, (ende[0]-x,ende[1] + 250* math.cos(math.radians(3))-y,ende[2] + 250* math.sin(math.radians(3))-hoehe_gefaelle),dxfattribs={"rotation": 270})
ende [1]= ende[1] + 500* math.cos(math.radians(3))
ende[2] = ende[2] + 500* math.sin(math.radians(3))
block.add_blockref(
block_Vario_Bogen_auf_links,
(
ende[0] - x,
ende[1] + Vario_Bogen_auf_Delta_SP_0[0] - y,
ende[2] + Vario_Bogen_auf_Delta_SP_0[2] - hoehe_gefaelle,
),
dxfattribs={"rotation": 90},
)
ende = [
ende[0],
ende[1]
+ Vario_Bogen_auf_Delta_SP_0[0]
+ Vario_Bogen_auf_Delta_SP_1[0],
ende[2]
+ Vario_Bogen_auf_Delta_SP_0[2]
+ Vario_Bogen_auf_Delta_SP_1[2],
]
block.add_blockref(
block_Vario_Umlenkstation_500mm,
(
ende[0] - x,
ende[1] + 250 * math.cos(math.radians(3)) - y,
ende[2] + 250 * math.sin(math.radians(3)) - hoehe_gefaelle,
),
dxfattribs={"rotation": 270},
)
ende[1] = ende[1] + 500 * math.cos(math.radians(3))
ende[2] = ende[2] + 500 * math.sin(math.radians(3))
else:
block.add_blockref("Vario_Umlenkstation_500mm", (ende[0]-x,ende[1] + 250-y,ende[2] -hoehe_gefaelle),dxfattribs={"rotation": 270})
ende [1]= ende[1] + 500
return start,ende
def hat_motor_umlenk_station (gefaelle_objekt, gefaellestrecke_nachbarn):
block.add_blockref(
"Vario_Umlenkstation_500mm",
(ende[0] - x, ende[1] + 250 - y, ende[2] - hoehe_gefaelle),
dxfattribs={"rotation": 270},
)
ende[1] = ende[1] + 500
return start, ende
def hat_motor_umlenk_station(gefaelle_objekt, gefaellestrecke_nachbarn):
hat_motor_0 = None
hat_motor_1 = None
hat_umlenk_0 = None
@@ -223,28 +391,38 @@ class Gefaellestrecke(BaseModel):
rotation = gefaelle_objekt.drehung
x = gefaelle_objekt.x
y = gefaelle_objekt.y
if "Kurvenrichtung" in gefaellestrecke_nachbarn:
vario_hoehe_0 = float(gefaellestrecke_nachbarn.get("vario_hoehe_0"))
vario_hoehe_1 = float(gefaellestrecke_nachbarn.get("vario_hoehe_1"))
vario_hoehe_1 = float(gefaellestrecke_nachbarn.get("vario_hoehe_1"))
kurvenrichtung = gefaellestrecke_nachbarn.get("Kurvenrichtung")
tefkurve_0 = gefaellestrecke_nachbarn.get("Tefkurve")
tefkurve_0 = gefaellestrecke_nachbarn.get("Tefkurve")
x_angetrieben = gefaellestrecke_nachbarn.get("X_angetrieben")
y_angetrieben = gefaellestrecke_nachbarn.get("Y_angetrieben")
x_angetrieben_1 = gefaellestrecke_nachbarn.get("X_angetrieben_1")
y_angetrieben_1 = gefaellestrecke_nachbarn.get("Y_angetrieben_1")
if (kurvenrichtung == "links" and tefkurve_0 == "außen") or kurvenrichtung == "rechts" and tefkurve_0 == "innen":
if (
(kurvenrichtung == "links" and tefkurve_0 == "außen")
or kurvenrichtung == "rechts"
and tefkurve_0 == "innen"
):
tefkurve_0 = "rechts"
else:
tefkurve_0 = "links"
if upper_hoehe_gefaelle > lower_hoehe_gefaelle:
if vario_hoehe_0 == upper_hoehe_gefaelle or vario_hoehe_1 == upper_hoehe_gefaelle:
if upper_hoehe_gefaelle > lower_hoehe_gefaelle:
if (
vario_hoehe_0 == upper_hoehe_gefaelle
or vario_hoehe_1 == upper_hoehe_gefaelle
):
hat_motor_0 = True
else:
hat_umlenk_0 = True
elif upper_hoehe_gefaelle < lower_hoehe_gefaelle:
if vario_hoehe_0 == lower_hoehe_gefaelle or vario_hoehe_1 == lower_hoehe_gefaelle:
elif upper_hoehe_gefaelle < lower_hoehe_gefaelle:
if (
vario_hoehe_0 == lower_hoehe_gefaelle
or vario_hoehe_1 == lower_hoehe_gefaelle
):
hat_motor_0 = True
else:
hat_umlenk_0 = True
@@ -252,31 +430,45 @@ class Gefaellestrecke(BaseModel):
rotation_zwischen = rotation
if rotation_zwischen == 0.0:
rotation_zwischen = -360.0
if (((-360.0<= rotation_zwischen< -270.0)and y > y_angetrieben) or ((-90.0< rotation< 0.0)and y > y_angetrieben) or
((-270.0< rotation_zwischen< -90.0)and y < y_angetrieben) or
(rotation == -90.0 and x < x_angetrieben) or ((rotation == -270.0)and x<x_angetrieben)):
if (
((-360.0 <= rotation_zwischen < -270.0) and y > y_angetrieben)
or ((-90.0 < rotation < 0.0) and y > y_angetrieben)
or ((-270.0 < rotation_zwischen < -90.0) and y < y_angetrieben)
or (rotation == -90.0 and x < x_angetrieben)
or ((rotation == -270.0) and x < x_angetrieben)
):
hat_umlenk_0 = True
umlenk_gerade = True
else:
hat_motor_0 = True
motor_gerade = True
if "Kurvenrichtung_1" in gefaellestrecke_nachbarn:
vario_hoehe_0_1 = float(gefaellestrecke_nachbarn.get("vario_hoehe_0_1"))
vario_hoehe_1_1 = float(gefaellestrecke_nachbarn.get("vario_hoehe_1_1"))
vario_hoehe_1_1 = float(gefaellestrecke_nachbarn.get("vario_hoehe_1_1"))
kurvenrichtung_1 = gefaellestrecke_nachbarn.get("Kurvenrichtung_1")
tefkurve_1 = gefaellestrecke_nachbarn.get("Tefkurve_1")
if (kurvenrichtung_1 == "links" and tefkurve_1 == "außen") or kurvenrichtung_1 == "rechts" and tefkurve_1 == "innen":
tefkurve_1 = gefaellestrecke_nachbarn.get("Tefkurve_1")
if (
(kurvenrichtung_1 == "links" and tefkurve_1 == "außen")
or kurvenrichtung_1 == "rechts"
and tefkurve_1 == "innen"
):
tefkurve_1 = "rechts"
else:
tefkurve_1 = "links"
if upper_hoehe_gefaelle > lower_hoehe_gefaelle:
if vario_hoehe_0_1 == upper_hoehe_gefaelle or vario_hoehe_1_1 == upper_hoehe_gefaelle:
tefkurve_1 = "links"
if upper_hoehe_gefaelle > lower_hoehe_gefaelle:
if (
vario_hoehe_0_1 == upper_hoehe_gefaelle
or vario_hoehe_1_1 == upper_hoehe_gefaelle
):
hat_motor_1 = True
else:
hat_umlenk_1 = True
elif upper_hoehe_gefaelle < lower_hoehe_gefaelle:
if vario_hoehe_0_1 == lower_hoehe_gefaelle or vario_hoehe_1_1 == lower_hoehe_gefaelle:
elif upper_hoehe_gefaelle < lower_hoehe_gefaelle:
if (
vario_hoehe_0_1 == lower_hoehe_gefaelle
or vario_hoehe_1_1 == lower_hoehe_gefaelle
):
hat_motor_1 = True
else:
hat_umlenk_1 = True
@@ -284,15 +476,21 @@ class Gefaellestrecke(BaseModel):
rotation_zwischen = rotation
if rotation_zwischen == 0.0:
rotation_zwischen = -360.0
if (((-360.0<= rotation_zwischen< -270.0)and y > y_angetrieben_1) or ((-90.0< rotation< 0.0)and y > y_angetrieben_1) or
((-270.0< rotation_zwischen< -90.0)and y < y_angetrieben_1) or
(rotation == -90.0 and x < x_angetrieben_1) or ((rotation == -270.0)and x<x_angetrieben_1)):
if (
((-360.0 <= rotation_zwischen < -270.0) and y > y_angetrieben_1)
or ((-90.0 < rotation < 0.0) and y > y_angetrieben_1)
or (
(-270.0 < rotation_zwischen < -90.0) and y < y_angetrieben_1
)
or (rotation == -90.0 and x < x_angetrieben_1)
or ((rotation == -270.0) and x < x_angetrieben_1)
):
hat_umlenk_1 = True
umlenk_gerade = True
else:
hat_motor_1 = True
motor_gerade = True
hat_zusatz ={}
hat_zusatz = {}
hat_zusatz["hat_motor_0"] = hat_motor_0
hat_zusatz["hat_motor_1"] = hat_motor_1
hat_zusatz["hat_umlenk_0"] = hat_umlenk_0
@@ -301,4 +499,4 @@ class Gefaellestrecke(BaseModel):
hat_zusatz["tefkurve_1"] = tefkurve_1
hat_zusatz["umlenk_gerade"] = umlenk_gerade
hat_zusatz["motor_gerade"] = motor_gerade
return hat_zusatz
return hat_zusatz