diff --git a/evrouting/charge/T.py b/evrouting/charge/T.py index 069c6cf6cf6f101f7fe62297f09b1d0eb61c9b3b..0528fd07015a4565aac85249d4a9a53c29907889 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 c4809decc5c98620a6ea217a1cc0b06ac7bf96b4..e6b0a9e750f2b5b5d775ecc2831f7e653c5dd285 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)