Skip to content

Commit 2c009f8

Browse files
committed
Close #177 Close #178 Close #179
1 parent f3fe400 commit 2c009f8

File tree

6 files changed

+53
-47
lines changed

6 files changed

+53
-47
lines changed

DaySim.Framework/Core/Configuration.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,8 +1000,8 @@ public sealed class Configuration {
10001000
[XmlAttribute]
10011001
public int RandomSeed { get; set; }
10021002

1003-
[XmlAttribute]
1004-
public bool ShouldLoadAggregateLogsumsFromFile { get; set; }
1003+
//[XmlAttribute]
1004+
//public bool ShouldLoadAggregateLogsumsFromFile { get; set; }
10051005

10061006
[XmlAttribute]
10071007
public bool ShouldOutputAggregateLogsums { get; set; }
@@ -1010,8 +1010,8 @@ public sealed class Configuration {
10101010
public string OutputAggregateLogsumsPath { get; set; }
10111011

10121012

1013-
[XmlAttribute]
1014-
public bool ShouldLoadSamplingWeightsFromFile { get; set; }
1013+
//[XmlAttribute]
1014+
//public bool ShouldLoadSamplingWeightsFromFile { get; set; }
10151015

10161016
[XmlAttribute]
10171017
public bool ShouldOutputSamplingWeights { get; set; }

DaySim/AggregateLogsums/AggregateLogsumsCalculator.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,9 @@ public sealed class AggregateLogsumsCalculator : IAggregateLogsumsCalculator {
281281
public AggregateLogsumsCalculator() {
282282
FileInfo file = Global.AggregateLogsumsPath.ToFile();
283283

284-
if (Global.Configuration.ShouldLoadAggregateLogsumsFromFile && file.Exists) {
285-
return;
286-
}
284+
//if (Global.Configuration.ShouldLoadAggregateLogsumsFromFile && file.Exists) {
285+
// return;
286+
//}
287287

288288
Framework.DomainModels.Persisters.IPersisterReader<IZone> zoneReader =
289289
Global
@@ -299,11 +299,11 @@ public AggregateLogsumsCalculator() {
299299
public void Calculate(IRandomUtility randomUtility) {
300300
FileInfo file = Global.AggregateLogsumsPath.ToFile();
301301

302-
if (Global.Configuration.ShouldLoadAggregateLogsumsFromFile && file.Exists) {
303-
Global.AggregateLogsums = LoadAggregateLogsumsFromFile(file);
302+
//if (Global.Configuration.ShouldLoadAggregateLogsumsFromFile && file.Exists) {
303+
// Global.AggregateLogsums = LoadAggregateLogsumsFromFile(file);
304304

305-
return;
306-
}
305+
// return;
306+
// }
307307

308308
Global.AggregateLogsums = new double[_zoneCount][][][][];
309309

@@ -329,9 +329,9 @@ public void Calculate(IRandomUtility randomUtility) {
329329
}
330330
}
331331

332-
if (Global.Configuration.ShouldLoadAggregateLogsumsFromFile && !file.Exists) {
333-
SaveAggregateLogsumsToFile(file);
334-
}
332+
//if (Global.Configuration.ShouldLoadAggregateLogsumsFromFile && !file.Exists) {
333+
// SaveAggregateLogsumsToFile(file);
334+
//}
335335
}
336336

337337
private void CalculateZone(IRandomUtility randomUtility, int id) {

DaySim/AggregateLogsums/AggregateLogsumsCalculator_Actum.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2005-2008 Mark A. Bradley and John L. Bowman
1+
// Copyright 2005-2008 Mark A. Bradley and John L. Bowman
22
// Copyright 2011-2013 John Bowman, Mark Bradley, and RSG, Inc.
33
// You may not possess or use this file without a License for its use.
44
// Unless required by applicable law or agreed to in writing, software
@@ -280,9 +280,9 @@ public sealed class AggregateLogsumsCalculator_Actum : IAggregateLogsumsCalculat
280280
public AggregateLogsumsCalculator_Actum() {
281281
FileInfo file = Global.AggregateLogsumsPath.ToFile();
282282

283-
if (Global.Configuration.ShouldLoadAggregateLogsumsFromFile && file.Exists) {
284-
return;
285-
}
283+
//if (Global.Configuration.ShouldLoadAggregateLogsumsFromFile && file.Exists) {
284+
// return;
285+
//}
286286

287287
Framework.DomainModels.Persisters.IPersisterReader<IZone> zoneReader =
288288
Global
@@ -298,11 +298,11 @@ public AggregateLogsumsCalculator_Actum() {
298298
public void Calculate(IRandomUtility randomUtility) {
299299
FileInfo file = Global.AggregateLogsumsPath.ToFile();
300300

301-
if (Global.Configuration.ShouldLoadAggregateLogsumsFromFile && file.Exists) {
302-
Global.AggregateLogsums = LoadAggregateLogsumsFromFile(file);
301+
//if (Global.Configuration.ShouldLoadAggregateLogsumsFromFile && file.Exists) {
302+
// Global.AggregateLogsums = LoadAggregateLogsumsFromFile(file);
303303

304-
return;
305-
}
304+
// return;
305+
// }
306306

307307
Global.AggregateLogsums = new double[_zoneCount][][][][];
308308

@@ -329,22 +329,22 @@ public void Calculate(IRandomUtility randomUtility) {
329329
}
330330
}
331331

332-
if (Global.Configuration.ShouldLoadAggregateLogsumsFromFile && !file.Exists) {
333-
SaveAggregateLogsumsToFile(file);
334-
}
332+
//if (Global.Configuration.ShouldLoadAggregateLogsumsFromFile && !file.Exists) {
333+
// SaveAggregateLogsumsToFile(file);
334+
//}
335335
}
336336

337337
private void CalculateZone(IRandomUtility randomUtility, int id) {
338338
Global.AggregateLogsums[id] = ComputeZone(randomUtility, id);
339339
}
340340

341-
private double[][][][][] LoadAggregateLogsumsFromFile(FileInfo file) {
342-
using (FileStream stream = file.Open(FileMode.Open, FileAccess.Read, FileShare.Read)) {
343-
BinaryFormatter formatter = new BinaryFormatter();
341+
//private double[][][][][] LoadAggregateLogsumsFromFile(FileInfo file) {
342+
// using (FileStream stream = file.Open(FileMode.Open, FileAccess.Read, FileShare.Read)) {
343+
// BinaryFormatter formatter = new BinaryFormatter();
344344

345-
return (double[][][][][])formatter.Deserialize(stream);
346-
}
347-
}
345+
// return (double[][][][][])formatter.Deserialize(stream);
346+
// }
347+
//}
348348

349349
private void SaveAggregateLogsumsToFile(FileInfo file) {
350350
using (FileStream stream = file.Open(FileMode.Create, FileAccess.Write, FileShare.Read)) {

DaySim/AggregateLogsums/AggregateLogsumsExporter.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ private static void RunExport(string path) {
4545
FileInfo file = new FileInfo(Path.Combine(directory, string.Format("{0}.{1}{2}", filename, purpose, extension)));
4646

4747
using (StreamWriter writer = new StreamWriter(file.Open(FileMode.Create, FileAccess.Write, FileShare.Read))) {
48-
writer.WriteLine("ZONE\tCHILD/SHO\tCHILD/LON\tCHILD/NAV\tNOCAR/SHO\tNOCAR/LON\tNOCAR/NAV\tCCOMP/SHO\tCCOMP/LON\tCCOMP/NAV\tCFULL/SHO\tCFULL/LON\tCFULL/NAV");
48+
writer.Write("ZONE\t");
49+
writer.Write("CHILD/LVOT/CLOSE\tCHILD/LVOT/FAR\tCHILD/LVOT/NAV\tCHILD/MVOT/CLOSE\tCHILD/MVOT/FAR\tCHILD/MVOT/NAV\tCHILD/HVOT/CLOSE\tCHILD/HVOT/FAR\tCHILD/HVOT/NAV\t");
50+
writer.Write("NOCAR/LVOT/CLOSE\tNOCAR/LVOT/FAR\tNOCAR/LVOT/NAV\tNOCAR/MVOT/CLOSE\tNOCAR/MVOT/FAR\tNOCAR/MVOT/NAV\tNOCAR/HVOT/CLOSE\tNOCAR/HVOT/FAR\tNOCAR/HVOT/NAV\t");
51+
writer.Write("CCOMP/LVOT/CLOSE\tCCOMP/LVOT/FAR\tCCOMP/LVOT/NAV\tCCOMP/MVOT/CLOSE\tCCOMP/MVOT/FAR\tCCOMP/MVOT/NAV\tCCOMP/HVOT/CLOSE\tCCOMP/HVOT/FAR\tCCOMP/HVOT/NAV\t");
52+
writer.WriteLine("FULLCO/LVOT/CLOSE\tFULLCO/LVOT/FAR\tFULLCO/LVOT/NAV\tFULLCO/MVOT/CLOSE\tFULLCO/MVOT/FAR\tFULLCO/MVOT/NAV\tFULLCO/HVOT/CLOSE\tFULLCO/HVOT/FAR\tFULLCO/HVOT/NAV");
4953

5054
for (int id = 0; id < zoneCount; id++) {
5155
IZone zone = zoneReader.Seek(id);
@@ -64,7 +68,9 @@ private static void RunExport(string path) {
6468
for (int transitAccess = Global.Settings.TransitAccesses.Gt0AndLteQtrMi; transitAccess < Global.Settings.TransitAccesses.TotalTransitAccesses; transitAccess++) {
6569
writer.Write(string.Format("{0,9:f5}", transitAccesses[transitAccess]));
6670

67-
if ((carOwnership + 1) * (transitAccess + 1) != Global.Settings.CarOwnerships.TotalCarOwnerships * Global.Settings.TransitAccesses.TotalTransitAccesses) {
71+
if (carOwnership + 1 != Global.Settings.CarOwnerships.TotalCarOwnerships ||
72+
votALSegment + 1 != Global.Settings.VotALSegments.TotalVotALSegments ||
73+
transitAccess + 1 != Global.Settings.TransitAccesses.TotalTransitAccesses) {
6874
writer.Write("\t");
6975
}
7076
}
@@ -79,4 +85,4 @@ private static void RunExport(string path) {
7985
}
8086
}
8187
}
82-
}
88+
}

DaySim/Engine.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,7 @@ public static void InitializeParcelStopAreaIndex(TextReader reader) {
11151115
}
11161116

11171117
private static void BeginLoadMicrozoneToBikeCarParkAndRideNodeDistances() {
1118-
if (!Global.StopAreaIsEnabled) {
1118+
if (!Global.StopAreaIsEnabled|| Global.Configuration.DataType != "Actum") {
11191119
return;
11201120
}
11211121
if (string.IsNullOrEmpty(Global.Configuration.MicrozoneToParkAndRideNodeIndexPath)) {

DaySim/Sampling/SamplingWeightsCalculator.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,24 +90,24 @@ public static void Calculate(string variableName, int mode, int pathType, double
9090
private static void CalculateSegment(SamplingWeightsCalculator samplingWeightsCalculator, int segment) {
9191
FileInfo file = new FileInfo(string.Format(Global.SamplingWeightsPath, segment));
9292

93-
if (Global.Configuration.ShouldLoadSamplingWeightsFromFile && file.Exists) {
94-
Global.SegmentZones[segment] = LoadSamplingWeightsFromFile(file);
93+
//if (Global.Configuration.ShouldLoadSamplingWeightsFromFile && file.Exists) {
94+
// Global.SegmentZones[segment] = LoadSamplingWeightsFromFile(file);
9595

96-
return;
97-
}
96+
// return;
97+
//}
9898

9999
Global.SegmentZones[segment] = samplingWeightsCalculator.ComputeSegment(segment);
100100

101-
if (Global.Configuration.ShouldLoadSamplingWeightsFromFile && !file.Exists) {
102-
SaveSamplingWeightsToFile(file, segment);
103-
}
101+
//if (Global.Configuration.ShouldLoadSamplingWeightsFromFile && !file.Exists) {
102+
// SaveSamplingWeightsToFile(file, segment);
103+
//}
104104
}
105105

106-
private static SegmentZone[] LoadSamplingWeightsFromFile(FileInfo file) {
107-
using (FileStream stream = file.Open(FileMode.Open, FileAccess.Read, FileShare.Read)) {
108-
return SegmentZoneFormatter.Deserialize(stream);
109-
}
110-
}
106+
//private static SegmentZone[] LoadSamplingWeightsFromFile(FileInfo file) {
107+
// using (FileStream stream = file.Open(FileMode.Open, FileAccess.Read, FileShare.Read)) {
108+
// return SegmentZoneFormatter.Deserialize(stream);
109+
// }
110+
//}
111111

112112
private static void SaveSamplingWeightsToFile(FileInfo file, int segment) {
113113
using (FileStream stream = file.Open(FileMode.Create, FileAccess.Write, FileShare.Read)) {

0 commit comments

Comments
 (0)