Skip to content

Commit 1534bb4

Browse files
committed
Close #306
1 parent 0346681 commit 1534bb4

File tree

6 files changed

+58
-5
lines changed

6 files changed

+58
-5
lines changed

DaySim.Framework/Core/Configuration.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,6 +2200,12 @@ public sealed class Configuration {
22002200

22012201
[XmlAttribute]
22022202
public double COMPASS_AutoParkAndRideLotCapacitySizeWeight { get; set; } = 1;
2203+
public double COMPASS_BikeParkAndRideAccessCapacitySizeWeight { get; set; } = 1;
2204+
public double COMPASS_BikeParkAndRideEgressCapacitySizeWeight { get; set; } = 1;
2205+
public double COMPASS_BikeParkAndRideAccessAnnualCostDivisor { get; set; } = 200;
2206+
public double COMPASS_BikeParkAndRideEgressAnnualCostDivisor { get; set; } = 200;
2207+
public bool COMPASS_IncludeAutoParkAndRideLotCapacityEffectInModeChoice { get; set; } = false;
2208+
public bool COMPASS_IncludeBikeParkAndRideLotCapacityEffectInModeChoice { get; set; } = false;
22032209

22042210
[XmlAttribute]
22052211
public int COMPASS_MaximumTerminalsToSearchWalk { get; set; } = 10;

DaySim.Framework/Persistence/ExporterFactory.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ private static void GenerateMethodCode(ILGenerator il, Type type, char delimiter
7373
il.Emit(OpCodes.Callvirt, typeof(StreamWriter).GetMethod("Write", new[] { typeof(int) }));
7474
} else if (properties[i].PropertyType == typeof(bool)) {
7575
il.Emit(OpCodes.Callvirt, typeof(StreamWriter).GetMethod("Write", new[] { typeof(bool) }));
76+
} else if (properties[i].PropertyType == typeof(long)) {
77+
il.Emit(OpCodes.Callvirt, typeof(StreamWriter).GetMethod("Write", new[] { typeof(long) }));
7678
} else {
77-
throw new NotSupportedException("Unsupported type. Valid types are double, int, and bool.");
79+
throw new NotSupportedException("Unsupported type. Valid types are double, int, long and bool.");
7880
}
7981

8082
if (i == properties.Length - 1) {
@@ -90,4 +92,4 @@ private static void GenerateMethodCode(ILGenerator il, Type type, char delimiter
9092
il.Emit(OpCodes.Ret);
9193
}
9294
}
93-
}
95+
}

DaySim/DomainModels/Actum/Models/Interfaces/IActumTrip.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace DaySim.DomainModels.Actum.Models.Interfaces {
1111
public interface IActumTrip : ITrip {
1212
//JLB20160323
13+
long TripId { get; set; }
1314

1415
int TourMode { get; set; }
1516

@@ -52,6 +53,5 @@ public interface IActumTrip : ITrip {
5253
int AutoType { get; set; }
5354

5455
int AutoOccupancy { get; set; }
55-
5656
}
5757
}

DaySim/DomainModels/Actum/Models/Trip.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
77

88
using System.Runtime.InteropServices;
9+
using System.IO;
910
using DaySim.DomainModels.Actum.Models.Interfaces;
1011
using DaySim.Framework.Factories;
1112
using DaySim.Framework.Persistence;
@@ -15,6 +16,9 @@ namespace DaySim.DomainModels.Actum.Models {
1516
[Factory(Factory.PersistenceFactory, Category = Category.Model, DataType = DataType.Actum)]
1617
public sealed class Trip : DomainModels.Default.Models.Trip, IActumTrip {
1718

19+
[ColumnName("trip_id")]
20+
public long TripId { get; set; }
21+
1822
[ColumnName("tourmode")]
1923
public int TourMode { get; set; }
2024

DaySim/DomainModels/Actum/Wrappers/TripWrapper.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
using System;
99
using System.Collections.Generic;
10+
using System.IO;
1011
using DaySim.ChoiceModels.H;
1112
using DaySim.DomainModels.Actum.Models.Interfaces;
1213
using DaySim.DomainModels.Actum.Wrappers.Interfaces;
@@ -64,6 +65,11 @@ public int AutoOccupancy {
6465
set => _trip.AutoOccupancy = value;
6566
}
6667

68+
public long TripId {
69+
get => _trip.TripId;
70+
set => _trip.TripId = value;
71+
}
72+
6773
public int TourMode {
6874
get => _trip.TourMode;
6975
set => _trip.TourMode = value;
@@ -439,6 +445,8 @@ public override void HUpdateTripValues() {
439445
TravelDistance = modeImpedance.PathDistance;
440446
PathType = modeImpedance.PathType;
441447

448+
TripId = (long)Id;
449+
if (TripId < 0) { TripId += 4294967295L; };
442450
TourMode = Tour.Mode;
443451

444452
IActumHouseholdWrapper household = (IActumHouseholdWrapper) Household;
@@ -675,6 +683,8 @@ public void HPTBikeDriveTransitTourUpdateTripValues() {
675683
TravelDistance = Tour.TravelDistanceForPTBikeTour / 2.0;
676684
PathType = Tour.PathType;
677685

686+
TripId = (long)Id;
687+
if (TripId < 0) { TripId += 4294967295L; };
678688
TourMode = Tour.Mode;
679689
bool parkAndRide = (TourMode == Global.Settings.Modes.CarParkRideWalk || TourMode == Global.Settings.Modes.CarParkRideBike || TourMode == Global.Settings.Modes.CarParkRideShare);
680690

DaySim/PathTypeModels/PathTypeModel_Actum.cs

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,10 +1001,16 @@ private void RunStopAreaGeneralTransitModel(int skimMode, int accessMode, int eg
10011001
accessTerminalParcelID = parkAndRideParcel.Id;
10021002
accessTerminalZoneID = (int)parkAndRideParcel.ZoneKey;
10031003
WalkBikePath accessPath = GetWalkBikePath(accessMode, pathTypeAccEgr, votValue, useZones, _outboundTime, _returnTime, 0, 0, originParcelUsed, parkAndRideParcel);
1004-
double parkingCost = node.CostDaily;
1004+
double parkingCost = node.CostAnnual / Global.Configuration.COMPASS_BikeParkAndRideAccessAnnualCostDivisor;
1005+
parkCapacitySizeTerm = Math.Log(Math.Max(node.Capacity, 1.0E-30)) * Global.Configuration.COMPASS_BikeParkAndRideAccessCapacitySizeWeight;
10051006
accessTime = accessPath.Time * roundTripFactor;
10061007
accessCost = parkingCost;
1008+
accessPath.Utility += parkingCost * _tourCostCoefficient;
10071009
accessUtility = accessPath.Utility * roundTripFactor;
1010+
if (Global.Configuration.COMPASS_IncludeBikeParkAndRideLotCapacityEffectInModeChoice) {
1011+
accessUtility = accessUtility + parkCapacitySizeTerm;
1012+
parkCapacitySizeTerm = 0;
1013+
}
10081014
} else if (sovAccess) {
10091015
int nodeId = Global.ParcelToAutoParkAndRideNodeIds[indexAccess];
10101016
ParkAndRideNodeWrapper node = autoParkAndRideNodes.First(x => x.ZoneId == nodeId);
@@ -1045,7 +1051,12 @@ private void RunStopAreaGeneralTransitModel(int skimMode, int accessMode, int eg
10451051

10461052
accessTime = accessPath.Time * roundTripFactor;
10471053
accessCost = accessPath.Cost + parkingCost;
1054+
accessPath.Utility += parkingCost * _tourCostCoefficient;
10481055
accessUtility = accessPath.Utility * roundTripFactor;
1056+
if (Global.Configuration.COMPASS_IncludeAutoParkAndRideLotCapacityEffectInModeChoice) {
1057+
accessUtility = accessUtility + parkCapacitySizeTerm;
1058+
parkCapacitySizeTerm = 0;
1059+
}
10491060
} else if (hovAccess || shareAccess) {
10501061
accessTerminalKey = Global.ParcelToAutoKissAndRideTerminalKeys[indexAccess];
10511062
accessTerminalIndex = Global.ParcelToAutoKissAndRideTerminalIndices[indexAccess];
@@ -1109,9 +1120,16 @@ private void RunStopAreaGeneralTransitModel(int skimMode, int accessMode, int eg
11091120
egressTerminalParcelID = parkAndRideParcel.Id;
11101121
egressTerminalZoneID = (int)parkAndRideParcel.ZoneKey;
11111122
WalkBikePath egressPath = GetWalkBikePath(egressMode, pathTypeAccEgr, votValue, useZones, _outboundTime, _returnTime, 0, 0, parkAndRideParcel, destinationParcelUsed);
1123+
double parkingCost = node.CostAnnual / Global.Configuration.COMPASS_BikeParkAndRideEgressAnnualCostDivisor;
1124+
parkCapacitySizeTerm += Math.Log(Math.Max(node.Capacity, 1.0E-30)) * Global.Configuration.COMPASS_BikeParkAndRideEgressCapacitySizeWeight;
11121125
egressTime = egressPath.Time * roundTripFactor;
1113-
egressCost = 0;
1126+
egressCost = parkingCost;
1127+
egressPath.Utility += parkingCost * _tourCostCoefficient;
11141128
egressUtility = egressPath.Utility * roundTripFactor;
1129+
if (Global.Configuration.COMPASS_IncludeBikeParkAndRideLotCapacityEffectInModeChoice) {
1130+
accessUtility = accessUtility + parkCapacitySizeTerm;
1131+
parkCapacitySizeTerm = 0;
1132+
}
11151133
} else if (shareEgress) {
11161134
egressTerminalKey = Global.ParcelToAutoKissAndRideTerminalKeys[indexEgress];
11171135
egressTerminalIndex = Global.ParcelToAutoKissAndRideTerminalIndices[indexEgress];
@@ -1584,6 +1602,19 @@ private TransitPath GetTransitPath(int skimMode, int pathType, double votValue,
15841602
path.Cost += fare;
15851603
}
15861604
}
1605+
//mb code for bike on board fare
1606+
if (skimMode == Global.Settings.Modes.BikeOnTransit) {
1607+
varname = commuter ? "bikefare-co" : "bikefare";
1608+
skimValue =
1609+
ImpedanceRoster.GetValue(varname, skimMode, pathType, votValue, outboundTime, originZoneId, destinationZoneId);
1610+
path.Cost += skimValue.Variable;
1611+
1612+
if (_returnTime > 0) {
1613+
skimValue =
1614+
ImpedanceRoster.GetValue(varname, skimMode, pathType, votValue, returnTime, destinationZoneId, originZoneId);
1615+
path.Cost += skimValue.Variable;
1616+
}
1617+
}
15871618

15881619
path.Utility = path.GenTime * _tourTimeCoefficient
15891620
+ path.Cost * _tourCostCoefficient;

0 commit comments

Comments
 (0)