diff --git a/evrouting/charge/T.py b/evrouting/charge/T.py index 0528fd07015a4565aac85249d4a9a53c29907889..8316c91b281ffae99274c19e21ecd17a413ac4c5 100644 --- a/evrouting/charge/T.py +++ b/evrouting/charge/T.py @@ -25,18 +25,18 @@ class ChargingFunction: class SoCFunction: - def __init__(self, G: nx.Graph, l: Label): + def __init__(self, G: nx.Graph, l: Label, U: SoC): self.t_trip: Time = l.t_trip self.beta_u: SoC = l.beta_u self.u: Node = l.u self.b_u_v: SoCProfile = l.SoCProfile_u_v - self.c_u: ChargingCoefficient = charging_cofficient(G, l.u) + self.cf: ChargingFunction = ChargingFunction(G, l.u, U) def __call__(self, t) -> SoC: if t < self.t_trip: return -inf - return self.beta_u(self.beta_u + self.c_u * (t - self.t_trip)) + return self.b_u_v(self.cf(t - self.t_trip, self.beta_u)) def get_minimum(self) -> Time: """TODO: Explain.""" diff --git a/evrouting/charge/routing.py b/evrouting/charge/routing.py index e6b0a9e750f2b5b5d775ecc2831f7e653c5dd285..2dd2beb2501f0f195842b363d5e88d2f3563d094 100644 --- a/evrouting/charge/routing.py +++ b/evrouting/charge/routing.py @@ -5,7 +5,7 @@ import networkx as nx from evrouting.T import Node, SoC, Time, ChargingCoefficient from evrouting.utils import PriorityQueue -from .T import SoCProfile, ChargingFunction, Label +from .T import SoCProfile, SoCFunction, Label def shortest_path(G: nx.Graph, S: set, s: Node, t: Node, beta_s: SoC, beta_t: SoC, U: SoC): @@ -50,7 +50,7 @@ def shortest_path(G: nx.Graph, S: set, s: Node, t: Node, beta_s: SoC, beta_t: So l_set[v].add(l) if v == t: - return ChargingFunction(G, l).get_minimum() + return SoCFunction(G, l, U).get_minimum() # handle charging stations t_trip, beta_u, u, b_u_v = l