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
f2015074
Commit
f2015074
authored
4 years ago
by
markn92
Browse files
Options
Downloads
Patches
Plain Diff
works
parent
ac34daa9
No related branches found
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/osm/test_gasstation_osm.py
+10
-6
10 additions, 6 deletions
tests/osm/test_gasstation_osm.py
with
10 additions
and
6 deletions
tests/osm/test_gasstation_osm.py
+
10
−
6
View file @
f2015074
...
...
@@ -4,6 +4,7 @@ from evrouting import gasstation
from
evrouting.T
import
Result
from
evrouting.osm.profiles
import
car
from
evrouting.osm.routing
import
shortest_path
,
GasstationAccessFunctions
from
evrouting.graph_tools
import
DISTANCE_KEY
def
test_charge_shortest_route_dimensions
(
map_graph
):
...
...
@@ -47,9 +48,9 @@ def test_charge_shortest_route_stop(map_graph):
consumption
=
0.5
*
1000
# Wh/s
f
=
GasstationAccessFunctions
(
consumption
)
# Traveltime to first charging station is < 5 min = 300 sek := 150 kWh
# Travel
time to first charging station is < 5 min = 300 sek := 150 kWh
# => Initial soc of 150 000 is enough to charge but not to reach target.
initial_soc
=
150000
initial_soc
=
150000
# Wh
result
=
gasstation
.
shortest_path
(
G
=
map_graph
,
charging_stations
=
map_graph
.
charging_stations
,
s
=
_s
,
...
...
@@ -67,9 +68,12 @@ def test_charge_shortest_route_stop(map_graph):
assert
len
(
charge_nodes
)
==
1
charge_node
,
charge_time
=
charge_nodes
[
0
]
charging_station_c
=
f
.
charging_coefficient
(
map_graph
,
charge_node
)
charging_station_c
=
f
.
_
charging_coefficient
(
map_graph
,
charge_node
)
# Wh/s
# calc travel time to charge_node an
s_to_c
=
consumption
*
nx
.
shortest_path_length
(
map_graph
,
_s
,
charge_node
)
c_to_t
=
consumption
*
nx
.
shortest_path_length
(
map_graph
,
charge_node
,
_t
)
s_to_c
=
consumption
*
nx
.
shortest_path_length
(
map_graph
,
_s
,
charge_node
,
weight
=
DISTANCE_KEY
)
c_to_t
=
consumption
*
nx
.
shortest_path_length
(
map_graph
,
charge_node
,
_t
,
weight
=
DISTANCE_KEY
)
assert
initial_soc
+
charge_time
*
charging_station_c
==
s_to_c
+
c_to_t
used_energy
=
initial_soc
+
charge_time
*
charging_station_c
path_cost
=
s_to_c
+
c_to_t
assert
int
(
path_cost
)
==
int
(
used_energy
)
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