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
e35c8ca6
Commit
e35c8ca6
authored
5 years ago
by
markn92
Browse files
Options
Downloads
Patches
Plain Diff
further test case
parent
9392932e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
evrouting/charge/routing.py
+8
-0
8 additions, 0 deletions
evrouting/charge/routing.py
tests/charge/test_charge_routing.py
+9
-1
9 additions, 1 deletion
tests/charge/test_charge_routing.py
tests/config.py
+23
-1
23 additions, 1 deletion
tests/config.py
with
40 additions
and
2 deletions
evrouting/charge/routing.py
+
8
−
0
View file @
e35c8ca6
...
@@ -142,6 +142,14 @@ def shortest_path(G: nx.Graph, charging_stations: set, s: Node, t: Node,
...
@@ -142,6 +142,14 @@ def shortest_path(G: nx.Graph, charging_stations: set, s: Node, t: Node,
)
)
)
)
except
ValueError
:
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).
pass
pass
else
:
else
:
if
l_new
==
l_uns
[
n
].
peak_min
():
if
l_new
==
l_uns
[
n
].
peak_min
():
...
...
This diff is collapsed.
Click to expand it.
tests/charge/test_charge_routing.py
+
9
−
1
View file @
e35c8ca6
...
@@ -3,17 +3,25 @@ from evrouting.charge import shortest_path
...
@@ -3,17 +3,25 @@ from evrouting.charge import shortest_path
from
..config
import
(
from
..config
import
(
edge_case
,
edge_case
,
edge_case_start_node_no_cs
,
edge_case_start_node_no_cs
,
edge_case_a_slow
,
init_config
init_config
)
)
def
test_shortest_path_charge_at_s
():
def
test_shortest_path_charge_at_s
_and_a
():
"""
Charging at s.
"""
"""
Charging at s.
"""
path
=
shortest_path
(
**
init_config
(
edge_case
))
path
=
shortest_path
(
**
init_config
(
edge_case
))
assert
path
==
3.5
assert
path
==
3.5
def
test_shortest_path_charge_at_s_only
():
"""
Charging at s.
"""
path
=
shortest_path
(
**
init_config
(
edge_case_a_slow
))
assert
path
==
3
def
test_shortest_path_no_charge_s_path_t
():
def
test_shortest_path_no_charge_s_path_t
():
"""
No charging at s but enough initial SoC to go to t directly.
"""
"""
No charging at s but enough initial SoC to go to t directly.
"""
conf
=
init_config
(
edge_case_start_node_no_cs
)
conf
=
init_config
(
edge_case_start_node_no_cs
)
...
...
This diff is collapsed.
Click to expand it.
tests/config.py
+
23
−
1
View file @
e35c8ca6
...
@@ -8,7 +8,11 @@ from evrouting.graph_tools import (
...
@@ -8,7 +8,11 @@ from evrouting.graph_tools import (
)
)
# List of configs
# List of configs
config_list
=
[
'
edge_case
'
,
'
edge_case_start_node_no_cs
'
]
config_list
=
[
'
edge_case
'
,
'
edge_case_start_node_no_cs
'
,
'
edge_case_a_slow
'
]
edge_case
=
{
edge_case
=
{
'
beta_s
'
:
0
,
'
beta_s
'
:
0
,
...
@@ -28,6 +32,24 @@ edge_case = {
...
@@ -28,6 +32,24 @@ edge_case = {
]
]
}
}
edge_case_a_slow
=
{
'
beta_s
'
:
0
,
'
beta_t
'
:
0
,
'
U
'
:
4
,
'
s
'
:
0
,
'
t
'
:
2
,
'
nodes
'
:
[
TemplateNode
(
'
s
'
,
charging_coeff
=
2
),
TemplateNode
(
'
a
'
,
charging_coeff
=
1
),
TemplateNode
(
'
t
'
),
],
'
edges
'
:
[
TemplateEdge
(
0
,
1
,
distance
=
1
,
consumption
=
1
),
TemplateEdge
(
0
,
2
,
distance
=
1
,
consumption
=
4
),
TemplateEdge
(
1
,
2
,
distance
=
1
,
consumption
=
1
),
]
}
edge_case_start_node_no_cs
=
{
edge_case_start_node_no_cs
=
{
'
beta_s
'
:
0
,
'
beta_s
'
:
0
,
'
beta_t
'
:
0
,
'
beta_t
'
:
0
,
...
...
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