if (((TransitRouterNetworkLink) link).getRoute() == null) {
public double getVehArrivalTime(final Link link, final double now){ if ((link == this.previousWaitLink) && (now == this.previousWaitTime)) { return this.cachedVehArrivalTime; } this.previousWaitLink = link; this.previousWaitTime = now; //first find out vehicle arrival time to fromStop according to transit schedule TransitRouterNetworkLink wrapped = (TransitRouterNetworkLink) link; if (wrapped.getRoute() == null) { throw new RuntimeException("should not happen") ; } TransitRouteStop fromStop = wrapped.fromNode.stop; double nextDepartureTime = preparedTransitSchedule.getNextDepartureTime(wrapped.getRoute(), fromStop, now); double fromStopArrivalOffset = (fromStop.getArrivalOffset() != Time.UNDEFINED_TIME) ? fromStop.getArrivalOffset() : fromStop.getDepartureOffset(); double vehWaitAtStopTime = fromStop.getDepartureOffset() - fromStopArrivalOffset; //time in which the veh stops at station double vehArrivalTime = nextDepartureTime - vehWaitAtStopTime; cachedVehArrivalTime = vehArrivalTime ; return vehArrivalTime ; }
@Override public double getLinkTravelDisutility(final Link link, final double time, final Person person, final Vehicle vehicle, final CustomDataManager dataManager) { double cost; if (((TransitRouterNetworkLink) link).getRoute() == null) { // "route" here means "pt route". If no pt route is attached, it means that it is a transfer link. cost = defaultTransferCost(link, time, person, vehicle); } else { double offVehWaitTime = offVehicleWaitTime(link, time); double inVehTime = getLinkTravelTime(link,time, person, vehicle) - offVehWaitTime; cost = - inVehTime * this.config.getMarginalUtilityOfTravelTimePt_utl_s() -offVehWaitTime * this.config.getMarginalUtilityOfWaitingPt_utl_s() -link.getLength() * this.config.getMarginalUtilityOfTravelDistancePt_utl_m(); } return cost; }