Skip to content

Commit

Permalink
Pass person and vehicle to travel time query in FISS
Browse files Browse the repository at this point in the history
  • Loading branch information
marecabo committed Mar 13, 2024
1 parent a1e8d51 commit d7bd8fe
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.matsim.api.core.v01.network.Link;
import org.matsim.api.core.v01.network.Network;
import org.matsim.api.core.v01.population.Leg;
import org.matsim.api.core.v01.population.Person;
import org.matsim.contrib.dynagent.DynAgent;
import org.matsim.core.api.experimental.events.EventsManager;
import org.matsim.core.controler.MatsimServices;
Expand Down Expand Up @@ -94,13 +95,16 @@ public boolean handleDeparture(double now, MobsimAgent agent, Id<Link> linkId) {
Leg currentLeg = (Leg) planAgent.getCurrentPlanElement();
Gbl.assertIf(this.fissConfigGroup.sampledModes.contains(currentLeg.getMode()));
NetworkRoute networkRoute = (NetworkRoute) currentLeg.getRoute();
Person person = planAgent.getCurrentPlan().getPerson();
Vehicle vehicle = this.matsimServices.getScenario().getVehicles().getVehicles()
.get(networkRoute.getVehicleId());

// update travel time with travel times of last iteration
double newTravelTime = 0.0;
// start and end link are not consideres in NetworkRoutingModule for travel time
for (Id<Link> routeLinkId : networkRoute.getLinkIds()) {
newTravelTime += this.travelTime.getLinkTravelTime(network.getLinks().get(routeLinkId),
now + newTravelTime, null, null);
now + newTravelTime, person, vehicle);
}
LOG.debug("New travelTime: {}, was {}", newTravelTime,
networkRoute.getTravelTime().orElseGet(() -> Double.NaN));
Expand Down

0 comments on commit d7bd8fe

Please sign in to comment.