示例#1
0
文件: GoEgress.cs 项目: lunaxi7/XTMF
        /// <summary>
        /// Calculate the V for Go Egress
        /// Assumes that there is an access before this egress.
        /// </summary>
        /// <param name="trip">The trip</param>
        /// <returns>The V for this trip</returns>
        public double CalculateV(ITrip trip)
        {
            int egressStation = LatestAccessStation(trip.TripChain, trip, out ITrip accessTrip);
            int accessStation = GOData.GetClosestStations(trip.DestinationZone.ZoneNumber)[0];

            trip.Attach("go-egress-station", accessStation);

            double v = CDriveEgress;

            if (trip["Walking"] != null)
            {
                ITrip intermediateTrip = (ITrip)trip["Walking"];
                v += Walking.CalculateV(intermediateTrip);
            }
            else
            {
                v += TransitTime * GOData.GetTransitAccessTime(trip.OriginalZone.ZoneNumber, accessStation);
                v += WalkTime * GOData.GetEgressWalkTime(trip.OriginalZone.ZoneNumber, accessStation);
                v += WaitTime * GOData.GetEgressWaitTime(trip.OriginalZone.ZoneNumber, accessStation);
            }
            v += AutoTime * GOData.GetAutoTime(trip.DestinationZone.ZoneNumber, egressStation);
            v += AutoCost * GOData.GetAutoCost(trip.DestinationZone.ZoneNumber, egressStation);
            v += TransitRailTime * GOData.GetLineHaulTime(accessStation, egressStation);
            v += FareCost * (GOData.GetGoFair(accessStation, egressStation)
                             + GOData.GetTransitFair(trip.DestinationZone.ZoneNumber, egressStation));

            if ((Common.GetTimePeriod(trip.ActivityStartTime) == TravelTimePeriod.Morning) ||
                (Common.GetTimePeriod(trip.ActivityStartTime) == TravelTimePeriod.Afternoon))
            {
                v += PeakTrip;
            }

            if (trip.TripChain.Person.Occupation == Occupation.Retail)
            {
                v += OccSalesTransit;
            }

            if (trip.TripChain.Person.Occupation == Occupation.Office)
            {
                v += OccGeneralTransit;
            }

            return(v);
        }