Aktuelle Version. Routing weiterhin nicht Fehlerfrei.
This commit is contained in:
+27
-4
@@ -401,13 +401,19 @@ class Anlage():
|
||||
|
||||
def get_tunnel_onpoints(self):
|
||||
return self._tunnel_onpoints.values()
|
||||
|
||||
|
||||
def add_tunnel(self, tname: str, pos:Point):
|
||||
self._tunnels[tname] = pos
|
||||
|
||||
def set_tunnel_length(self, tunlength):
|
||||
def set_tunnel_length(self, tunlength: dict):
|
||||
self._tunnel_lengths = tunlength
|
||||
|
||||
def get_tunnel_length(self, tname: str):
|
||||
if tname in self._tunnels:
|
||||
return self._tunnel_lengths[tname]
|
||||
raise Exception("Tunnel not found")
|
||||
|
||||
def add_tunnels(self, tunnels:dict):
|
||||
for tname,pos in tunnels.items():
|
||||
self.add_tunnel(tname, pos)
|
||||
@@ -418,13 +424,29 @@ class Anlage():
|
||||
raise Exception("Tunnel not found")
|
||||
|
||||
def connect_tunnels(self) -> list:
|
||||
'''verbindet die Anfangs und Endpunkte der Tunnel miteiandner als t-Rack
|
||||
Verbindet sowohl Tunnel anfang als auch Tunnel ende jeweils mit nahegelgenem Rack (standard Aufruf wie Sensoren / Distributoren)
|
||||
die Rückage enthält ein Tuple, welche Tunnel keinem Rack zugeordnet werden konnten
|
||||
'''
|
||||
for tname, pos in self._tunnels.items():
|
||||
tunbeg = pos[0]
|
||||
tunend = pos[1]
|
||||
trackname = f"t-Rack-{tname}"
|
||||
self._racks.add_rack(tunbeg, tunend, trackname)
|
||||
|
||||
return self.connect_equipment_to_racks(self._tunnels, self._tunnel_onpoints)
|
||||
|
||||
errors = list()
|
||||
for name, pos in self._tunnels.items():
|
||||
p1 = self._tunnels[name][0]
|
||||
p2 = self._tunnels[name][1]
|
||||
|
||||
ret = self.connect_equipment_to_racks({f"{name}-A": p1}, self._tunnel_onpoints)
|
||||
if ret:
|
||||
errors.append(ret)
|
||||
ret = self.connect_equipment_to_racks({f"{name}-E": p2}, self._tunnel_onpoints)
|
||||
if ret:
|
||||
errors.append(ret)
|
||||
|
||||
return errors
|
||||
|
||||
|
||||
|
||||
@@ -528,7 +550,8 @@ class Anlage():
|
||||
color = "blue"
|
||||
elif re.match("t-.*", rname):
|
||||
color = "orange"
|
||||
weight = 3500 # !!! Wert muss noch validiert werden !!!
|
||||
tname = rname.split("-")[2]
|
||||
weight = self.get_tunnel_length(tname)
|
||||
else:
|
||||
color = "black"
|
||||
|
||||
|
||||
+4
-3
@@ -92,6 +92,7 @@ def create_plant(racks:dict, sensors:dict, distributors:dict, mapping:dict, tunn
|
||||
|
||||
paths['errors_sensors'] = errors_sensors
|
||||
paths['errors_dists'] = errors_dists
|
||||
paths['errors_tunnels'] = errors_tunnels
|
||||
return paths
|
||||
|
||||
def draw_graph(G:nx.Graph, an:Anlage):
|
||||
@@ -125,9 +126,9 @@ def prepare_data(rawdata:dict):
|
||||
ltemp.append(Point(p))
|
||||
dracks[rname] = ltemp
|
||||
|
||||
mapping = rawdata["mapping"]
|
||||
mapping = rawdata["mappings"]
|
||||
|
||||
tunnels = rawdata["tunnel"]
|
||||
tunnels = rawdata["tunnels"]
|
||||
dtunnels = dict()
|
||||
for tname,lp in tunnels.items():
|
||||
if tname == "length":
|
||||
@@ -137,7 +138,7 @@ def prepare_data(rawdata:dict):
|
||||
ltemp.append(Point(p))
|
||||
dtunnels[tname] = ltemp
|
||||
|
||||
dtunlength = rawdata["tunnel"]["length"]
|
||||
dtunlength = rawdata["tunnels"]["length"]
|
||||
|
||||
|
||||
return (dracks, dsensors, dsubdists, mapping, dtunnels, dtunlength)
|
||||
|
||||
Reference in New Issue
Block a user