getpositions schreibt nur noch eine json Ergebnisdatei raus. Config launch.json und routing.py angepasst; in Requirements networkx aufgenommen.

This commit is contained in:
2025-05-09 20:49:47 +02:00
parent 9b1f3bef80
commit ae86dbcafa
6 changed files with 91 additions and 11 deletions
+8 -6
View File
@@ -122,6 +122,7 @@ def node_to_coords(node_name, racks):
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Berechne Wege von Sensoren zu Verteilern über Kabeltrassen')
parser.add_argument('-i', '--inputfile', action='store', required=True, default="easy_position.json", help='file with all informations about positions gathered from getpositions', metavar='my_positions.json')
parser.add_argument('-c', '--console', action='store_true', help='Ausgabe auf Konsole')
args = parser.parse_args()
@@ -131,14 +132,15 @@ if __name__ == "__main__":
config_dir = os.environ.get("PROJECT_CFG")
# Pfade zu JSON-Dateien
sensors_path = os.path.join(work_dir, "sensors.json")
subdist_path = os.path.join(work_dir, "subdistributors.json")
racks_path = os.path.join(work_dir, "racks.json")
jsonfilename = args.inputfile
sensors_path = os.path.join(work_dir, jsonfilename)
# Einlesen
sensors = load_json(sensors_path)
subdists = load_json(subdist_path)
racks = load_json(racks_path)
data = load_json(sensors_path)
sensors = data["sensors"]
subdists = data["distributors"]
racks = data["racks"]
# Graph erstellen
graph = {}