From 2d9eb403428f82dd8a1dfffdbd2c081087b03a29 Mon Sep 17 00:00:00 2001
From: "niehues.mark@gmail.com" <niehues.mark@gmail.com>
Date: Fri, 1 May 2020 18:33:16 +0200
Subject: [PATCH] added conversion

---
 evaluation/configs/example.yaml               |  6 +++---
 .../results/example/queries/gasstation.csv    | 20 +++++++++----------
 evaluation/run.py                             | 12 ++++++++++-
 3 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/evaluation/configs/example.yaml b/evaluation/configs/example.yaml
index 6e0f93b..3262173 100644
--- a/evaluation/configs/example.yaml
+++ b/evaluation/configs/example.yaml
@@ -7,10 +7,10 @@ maps:
   - map.osm
 queries_per_setup: 10
 setups:
-  - mu_s: 85 # Start and Target Soc
+  - mu_s: 300 # Start and Target Soc
     mu_t: 0
     charging_stations: 10 # Max Number of charging Stations to be inserted.
-    capacity: 85 # kWh
+    capacity: 300 # kWh
     consumption:
       type: gasstation
-      consumption_coefficient: 100 # kWh/s
+      consumption_coefficient: 0.5 # kWh/s
diff --git a/evaluation/results/example/queries/gasstation.csv b/evaluation/results/example/queries/gasstation.csv
index f7b0681..7d84d4c 100644
--- a/evaluation/results/example/queries/gasstation.csv
+++ b/evaluation/results/example/queries/gasstation.csv
@@ -1,11 +1,11 @@
 start_node,target_node,query_time,trip_time,nodes,edges,charging_stations,time_contracted_graph,time_state_graph
-549931430,3273201464,0.02408712999749696,None,2827,5691,3,0.014958268002374098,3.0371003958862275e-05
-2729891690,6603016874,0.02328153499547625,None,2827,5691,3,0.01450053900043713,3.0627001251559705e-05
-34053773,408478843,0.03271863699774258,None,2827,5691,3,0.014691472999402322,1.9122999219689518e-05
-292981057,4955446070,0.029121861000021454,None,2827,5691,3,0.01552509299654048,2.008400042541325e-05
-1254599554,360747579,0.017258337000384927,None,2827,5691,3,0.014459179998084437,1.8801998521666974e-05
-6389441586,508824243,0.016824515005282592,None,2827,5691,3,0.015478776003874373,1.987600262509659e-05
-7042580410,1929118248,0.04107918299996527,None,2827,5691,3,0.01451436200295575,1.9384002371225506e-05
-7074500856,7140363786,0.03340997399936896,None,2827,5691,3,0.014721665997058153,1.9647995941340923e-05
-360747732,4955446065,0.026879377001023386,None,2827,5691,3,0.016268585000943858,1.9888000679202378e-05
-600866946,4016874580,0.02424645799328573,None,2827,5691,3,0.0144769019971136,2.0027000573463738e-05
+2612700813,2632841214,0.005009925000194926,383.4794987778951,2827,5691,3,0.016830534004839137,0.00015566699585178867
+563191193,317944965,0.007466991002729628,446.99022181478455,2827,5691,3,0.017327437999483664,0.00013550499716075137
+7286240208,2604687836,0.00499775999924168,406.2307557413689,2827,5691,3,0.015518132997385692,0.0002068149988190271
+2639898855,574457829,0.0028420240050763823,339.7265922483922,2827,5691,3,0.015539429994532838,0.00013767200289294124
+2612700817,7286181375,0.005542577993765008,372.43394892215343,2827,5691,3,0.015766301003168337,0.00013465899974107742
+2616462194,4955446076,0.006115891002991702,374.0087002891246,2827,5691,3,0.015495608000492211,0.00015103199984878302
+4955446025,1505052669,0.009748128002684098,535.7659858061888,2827,5691,3,0.01556892799999332,0.0001692669975454919
+2700412801,563194900,0.0009064859987120144,161.78412446050507,2827,5691,3,0.015535534999798983,0.00013569000293500721
+5113940072,1768859059,0.05034502399939811,22741.474067970452,2827,5691,3,0.015074203001859132,0.00013480500638252124
+1929118150,687139215,0.041247827000916004,16827.8805214423,2827,5691,3,0.014938869993784465,0.0001336659988737665
diff --git a/evaluation/run.py b/evaluation/run.py
index 828864c..522107a 100644
--- a/evaluation/run.py
+++ b/evaluation/run.py
@@ -47,6 +47,16 @@ def get_map(osm_path: Path, cs_path: Path):
     return graph
 
 
+def apply_conversions(conf):
+    """kWh to Wh"""
+    for setup in conf['setups']:
+        setup['capacity'] = 1000 * setup['capacity']
+        setup['consumption']['consumption_coefficient'] = 1000 * setup['consumption']['consumption_coefficient']
+        setup['mu_s'] = 1000 * setup['mu_s']
+        setup['mu_t'] = 1000 * setup['mu_t']
+    return conf
+
+
 if __name__ == '__main__':
     base = Path(__file__).parent
     results_dir = base.joinpath('results')
@@ -73,7 +83,7 @@ if __name__ == '__main__':
         path = path.with_suffix('.yaml')
 
         with base.joinpath('configs/', path).open() as f:
-            conf = yaml.load(f, Loader=yaml.Loader)
+            conf = apply_conversions(yaml.load(f, Loader=yaml.Loader))
 
         graphs = [get_map(maps_dir.joinpath(m), cs_path) for m in conf['maps']]
 
-- 
GitLab