From 2f5f28b0e701fd76fda4188e129662f256d5052e Mon Sep 17 00:00:00 2001
From: "niehues.mark@gmail.com" <niehues.mark@gmail.com>
Date: Fri, 13 Mar 2020 18:21:35 +0100
Subject: [PATCH] wip

---
 evrouting/charge/T.py       | 13 +++++++++++++
 evrouting/charge/routing.py |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/evrouting/charge/T.py b/evrouting/charge/T.py
index 069c6cf..0528fd0 100644
--- a/evrouting/charge/T.py
+++ b/evrouting/charge/T.py
@@ -12,6 +12,19 @@ Label = namedtuple('Label', ['t_trip', 'beta_u', 'u', 'SoCProfile_u_v'])
 
 class ChargingFunction:
 
+    def __init__(self, G: nx.Graph, n: Node, U: SoC):
+        self.c_n = charging_cofficient(G, n)
+        self.U = U
+
+    def __call__(self, t: Time, beta: SoC = 0) -> SoC:
+        beta += self.c_n * t
+
+        if beta > self.U:
+            return self.U
+
+
+class SoCFunction:
+
     def __init__(self, G: nx.Graph, l: Label):
         self.t_trip: Time = l.t_trip
         self.beta_u: SoC = l.beta_u
diff --git a/evrouting/charge/routing.py b/evrouting/charge/routing.py
index c4809de..e6b0a9e 100644
--- a/evrouting/charge/routing.py
+++ b/evrouting/charge/routing.py
@@ -25,7 +25,7 @@ def shortest_path(G: nx.Graph, S: set, s: Node, t: Node, beta_s: SoC, beta_t: So
     l_uns = {v: PriorityQueue() for v in G}
 
     # Dummy vertex without incident edges that is (temporarily) added to G
-    v_0: Node = Node(len(G.nodes))
+    v_0: Node = len(G.nodes)
     G.add_node(v_0)
 
     S.add(v_0)
-- 
GitLab