From b41cee159b14187cf1c471a3430ac0eda04b93a6 Mon Sep 17 00:00:00 2001 From: "niehues.mark@gmail.com" <niehues.mark@gmail.com> Date: Fri, 13 Mar 2020 18:26:19 +0100 Subject: [PATCH] wip --- evrouting/charge/T.py | 6 +++--- evrouting/charge/routing.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/evrouting/charge/T.py b/evrouting/charge/T.py index 0528fd0..8316c91 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 e6b0a9e..2dd2beb 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 -- GitLab