Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/Implement function of GenerateChargeSolutions for station_graph #215

Merged
merged 15 commits into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions integration/oasis/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
generateResponse4SingleChargeStation(w, oasisReq, overlap, h.osrmConnector)
return
}
pickChargeStationsWithEarlistArrival(oasisReq, route, h.osrmConnector, h.tnSearchConnector)

generateFakeOASISResponse(w, oasisReq)
}
Expand Down
10 changes: 6 additions & 4 deletions integration/oasis/reachable_by_multiple_charge.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ import (
)

func pickChargeStationsWithEarlistArrival(oasisReq *oasis.Request, routeResp *route.Response, oc *osrmconnector.OSRMConnector, sc *searchconnector.TNSearchConnector) {
// chargeLocations := chargeLocationSelection(oasisReq, routeResp)
// for _, locations := range chargeLocations {
// c := stationfinder.CalculateWeightBetweenNeighbors(locations, oc, sc)
// }
// chargeLocations := chargeLocationSelection(oasisReq, routeResp)
// for _, locations := range chargeLocations {
// c := stationfinder.CalculateWeightBetweenNeighbors(locations, oc, sc)
// sol := stationgraph.NewStationGraph(c, oasisReq.CurrRange, oasisReq.MaxRange,
// chargingstrategy.NewFakeChargingStrategyCreator(oasisReq.MaxRange)).GenerateChargeSolutions()
// }
}

// For each route response, will generate an array of *stationfinder.StationCoordinate
Expand Down
1 change: 1 addition & 0 deletions integration/oasis/reachable_by_single_charge.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func generateResponse4SingleChargeStation(w http.ResponseWriter, req *oasis.Requ

station := new(oasis.ChargeStation)
station.WaitTime = 0.0
// @todo ChargeTime and ChargeRange need to be adjusted according to chargingstrategy
station.ChargeTime = 7200.0
station.ChargeRange = req.MaxRange
station.DetailURL = "url"
Expand Down
5 changes: 3 additions & 2 deletions integration/oasis/stationgraph/graph.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package stationgraph

import (
"github.com/Telenav/osrm-backend/integration/oasis/chargingstrategy"
"github.com/golang/glog"
)

type graph struct {
nodes []*node
startNodeID nodeID
endNodeID nodeID
strategy chargingstrategy.ChargingStrategyCreator
}

func (g *graph) dijkstra() []nodeID {
Expand All @@ -32,8 +34,7 @@ func (g *graph) dijkstra() []nodeID {
node := g.nodes[n]
for _, neighbor := range node.neighbors {
if g.nodes[n].isLocationReachable(neighbor.distance) {
// chargeTime := g.nodes[neighbor.targetNodeID].calcChargeTime(node, neighbor.distance, g.strategy)
chargeTime := 0.0
chargeTime := g.nodes[neighbor.targetNodeID].calcChargeTime(node, neighbor.distance, g.strategy)
if m.add(neighbor.targetNodeID, n, neighbor.distance, neighbor.duration+chargeTime) {
g.nodes[neighbor.targetNodeID].updateArrivalEnergy(node, neighbor.distance)
g.nodes[neighbor.targetNodeID].updateChargingTime(chargeTime)
Expand Down
Loading