Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ba
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
markn92
ba
Commits
745b397e
Commit
745b397e
authored
5 years ago
by
markn92
Browse files
Options
Downloads
Patches
Plain Diff
prevent exception
parent
56e13140
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
evrouting/charge/routing.py
+14
-17
14 additions, 17 deletions
evrouting/charge/routing.py
evrouting/charge/utils.py
+0
-6
0 additions, 6 deletions
evrouting/charge/utils.py
with
14 additions
and
23 deletions
evrouting/charge/routing.py
+
14
−
17
View file @
745b397e
...
...
@@ -78,8 +78,7 @@ def shortest_path(G: nx.Graph, charging_stations: set, s: Node, t: Node,
return
f_soc_factory
(
label_node_min
).
minimum
# Handle charging stations
if
node_min
in
charging_stations
and
\
not
node_min
==
label_node_min
.
last_cs
:
if
node_min
in
charging_stations
and
node_min
!=
label_node_min
.
last_cs
:
f_soc
:
SoCFunction
=
f_soc_factory
(
label_node_min
)
t_charge
=
f_soc
.
calc_optimal_t_charge
(
cf_map
[
node_min
])
...
...
@@ -112,29 +111,27 @@ def shortest_path(G: nx.Graph, charging_stations: set, s: Node, t: Node,
soc_profile_factory
(
node_min
,
n
)
if
soc_profile
(
capacity
)
!=
-
inf
:
l_new
=
Label
(
if
cf_map
[
label_node_min
.
last_cs
].
is_dummy
\
and
soc_profile
.
path_cost
>
label_node_min
.
soc_last_cs
:
# Dummy charging stations cannot increase SoC.
# Therefore paths that consume more energy than the SoC
# when arriving at the (dummy) station are unfeasible.
continue
label_neighbour
:
Label
=
Label
(
t_trip
=
label_node_min
.
t_trip
+
distance
(
G
,
node_min
,
n
),
soc_last_cs
=
label_node_min
.
soc_last_cs
,
last_cs
=
label_node_min
.
last_cs
,
soc_profile_cs_v
=
soc_profile
)
try
:
l_uns
[
n
].
insert
(
l_new
)
except
ValueError
:
# Infeasible because last_cs might be an
# dummy charging station. Therefore, the path might
# be infeasible even though one could reach it with a full
# battery, because charging is not possible at dummy
# stations.
#
# That means, the SoC and thereby the range is restricted
# to the SoC at the last cs (soc_last_cs).
continue
l_uns
[
n
].
insert
(
label_neighbour
)
# Update queue if entered label is the new minimum label
# of the neighbour.
try
:
is_new_min_label
:
bool
=
l
_new
==
l_uns
[
n
].
peak_min
()
is_new_min_label
:
bool
=
l
abel_neighbour
==
l_uns
[
n
].
peak_min
()
except
KeyError
:
continue
if
is_new_min_label
:
prio_queue
.
insert
(
n
,
**
keys
(
f_soc_factory
(
l
_new
)))
prio_queue
.
insert
(
n
,
**
keys
(
f_soc_factory
(
l
abel_neighbour
)))
This diff is collapsed.
Click to expand it.
evrouting/charge/utils.py
+
0
−
6
View file @
745b397e
...
...
@@ -41,11 +41,5 @@ class LabelPriorityQueue(PriorityQueue):
def
keys
(
f_soc
:
SoCFunction
)
->
Dict
:
t_min
:
Time
=
f_soc
.
minimum
# Might happen because of dummy charge stations
if
t_min
==
-
inf
:
raise
ValueError
(
'
Infeasible label.
'
)
soc_min
:
SoC
=
f_soc
(
t_min
)
return
{
'
priority
'
:
t_min
,
'
count
'
:
soc_min
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment