Anpassung der Methoden auf Verwendung von Tunnels. launch.json angepasst, sodass easy_positions.json genommen wird.
This commit is contained in:
+42
-1
@@ -290,6 +290,10 @@ class Anlage():
|
||||
# Container für alle Unterverteiler
|
||||
self._distributors = dict()
|
||||
self._distributors_onpoints = dict()
|
||||
# Container für alle Tunnel
|
||||
self._tunnels = dict()
|
||||
self._tunnel_onpoints = dict()
|
||||
self._tunnel_lengths = dict()
|
||||
#Container für alle Wege
|
||||
self._sensor2dist = dict()
|
||||
# Toleranzen zur Rack anbindung aneinander (Rack Snap)
|
||||
@@ -395,6 +399,36 @@ class Anlage():
|
||||
'''
|
||||
return self.connect_equipment_to_racks(self._distributors, self._distributors_onpoints)
|
||||
|
||||
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):
|
||||
self._tunnel_lengths = tunlength
|
||||
|
||||
def add_tunnels(self, tunnels:dict):
|
||||
for tname,pos in tunnels.items():
|
||||
self.add_tunnel(tname, pos)
|
||||
|
||||
def get_tunnel_point(self, tname:str) -> Point:
|
||||
if tname in self._tunnels:
|
||||
return self._tunnels[tname]
|
||||
raise Exception("Tunnel not found")
|
||||
|
||||
def connect_tunnels(self) -> list:
|
||||
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)
|
||||
|
||||
|
||||
|
||||
|
||||
def join_racks(self):
|
||||
self._racks.join_racks_str()
|
||||
|
||||
@@ -481,17 +515,24 @@ class Anlage():
|
||||
|
||||
for rname in self.get_rack_names():
|
||||
plist = self.get_points_from_rack(rname)
|
||||
|
||||
for start, end in pairwise(plist):
|
||||
nid_start = self._nodeids.get_id(start)
|
||||
nid_end = self._nodeids.get_id(end)
|
||||
|
||||
weight=start.distance(end)
|
||||
|
||||
if re.match("v-.*", rname):
|
||||
color = "red"
|
||||
elif re.match("d-.*", rname):
|
||||
color = "blue"
|
||||
elif re.match("t-.*", rname):
|
||||
color = "orange"
|
||||
weight = 3500 # !!! Wert muss noch validiert werden !!!
|
||||
else:
|
||||
color = "black"
|
||||
G.add_edge(nid_start, nid_end, color=color, weight=start.distance(end))
|
||||
|
||||
G.add_edge(nid_start, nid_end, color=color, weight=weight)
|
||||
return self._node_positions
|
||||
|
||||
def map_distributor_to_sensors(self, dname:str, snamen:list[str]):
|
||||
|
||||
Reference in New Issue
Block a user