|
28 | 28 | // #define DEBUG_TRACEINFO |
29 | 29 | // #define DEBUG_TTANALYSIS |
30 | 30 | // #define DEBUG_DELAYS |
| 31 | +#define DEBUG_RQS |
31 | 32 | // DEBUG flag for debug prints |
32 | 33 |
|
33 | 34 | using System; |
@@ -1328,7 +1329,7 @@ public override bool PostInit() |
1328 | 1329 | /// <summary> |
1329 | 1330 | /// Calculate actual station stop details |
1330 | 1331 | /// <\summary> |
1331 | | - public StationStop CalculateStationStop(int platformStartID, int arrivalTime, int departTime, DateTime arrivalDT, DateTime departureDT, float clearingDistanceM, |
| 1332 | + public StationStop CalculateStationStop(int platformStartID, int? arrivalTime, int? departTime, DateTime? arrivalDT, DateTime? departureDT, float clearingDistanceM, |
1332 | 1333 | float minStopDistance, bool terminal, int? actMinStopTime, float? keepClearFront, float? keepClearRear, bool forcePosition, bool closeupSignal, |
1333 | 1334 | bool closeup, bool restrictPlatformToSignal, bool extendPlatformToSignal, bool endStop, bool allowdepartearly) |
1334 | 1335 | { |
@@ -1409,11 +1410,13 @@ public StationStop CalculateStationStop(int platformStartID, int arrivalTime, in |
1409 | 1410 | extendPlatformToSignal, |
1410 | 1411 | endStop, |
1411 | 1412 | allowdepartearly, |
1412 | | - StationStop.STOPTYPE.STATION_STOP) |
| 1413 | + StationStop.STOPTYPE.STATION_STOP); |
| 1414 | + |
| 1415 | + if (arrivalDT.HasValue) |
1413 | 1416 | { |
1414 | | - arrivalDT = arrivalDT, |
1415 | | - departureDT = departureDT |
1416 | | - }; |
| 1417 | + thisStation.arrivalDT = arrivalDT.Value; |
| 1418 | + thisStation.departureDT = departureDT.Value; |
| 1419 | + } |
1417 | 1420 |
|
1418 | 1421 | return thisStation; |
1419 | 1422 | } |
@@ -2000,7 +2003,7 @@ public StationStop CalculateStationStopPosition(TCSubpathRoute thisRoute, int ro |
2000 | 2003 | /// <param name="forcePosition"></param> |
2001 | 2004 | /// <param name="endStop"></param> |
2002 | 2005 | /// <returns></returns> |
2003 | | - public bool CreateStationStop(int platformStartID, int arrivalTime, int departTime, DateTime arrivalDT, DateTime departureDT, float clearingDistanceM, |
| 2006 | + public bool CreateStationStop(int platformStartID, int? arrivalTime, int? departTime, DateTime? arrivalDT, DateTime? departureDT, float clearingDistanceM, |
2004 | 2007 | float minStopDistanceM, bool terminal, int? actMinStopTime, float? keepClearFront, float? keepClearRear, bool forcePosition, bool closeupSignal, |
2005 | 2008 | bool closeup, bool restrictPlatformToSignal, bool extendPlatformToSignal, bool endStop, bool allowdepartearly) |
2006 | 2009 | { |
@@ -2766,7 +2769,7 @@ public void UpdateMinimalDelay() |
2766 | 2769 |
|
2767 | 2770 | if (StationStops != null && StationStops.Count > 0 && !AtStation) |
2768 | 2771 | { |
2769 | | - if (presentTime > StationStops[0].ArrivalTime) |
| 2772 | + if (StationStops[0].ArrivalTime >= 0 && presentTime > StationStops[0].ArrivalTime) |
2770 | 2773 | { |
2771 | 2774 | TimeSpan tempDelay = TimeSpan.FromSeconds((presentTime - StationStops[0].ArrivalTime) % (24 * 3600)); |
2772 | 2775 | // Skip when delay exceeds 12 hours - that's due to passing midnight |
@@ -3976,7 +3979,7 @@ public override void UpdateStationState(float elapsedClockSeconds, int presentTi |
3976 | 3979 | } |
3977 | 3980 | } |
3978 | 3981 |
|
3979 | | - if (thisStation.ActualStopType == StationStop.STOPTYPE.STATION_STOP) |
| 3982 | + if (thisStation.ActualStopType == StationStop.STOPTYPE.STATION_STOP && thisStation.ArrivalTime >= 0) |
3980 | 3983 | { |
3981 | 3984 | Delay = TimeSpan.FromSeconds((presentTime - thisStation.DepartTime) % (24 * 3600)); |
3982 | 3985 | } |
@@ -10225,7 +10228,10 @@ public override void CheckStationTask() |
10225 | 10228 | AtStation = false; |
10226 | 10229 | MayDepart = false; |
10227 | 10230 | DisplayMessage = ""; |
10228 | | - Delay = TimeSpan.FromSeconds((presentTime - StationStops[0].DepartTime) % (24 * 3600)); |
| 10231 | + if (StationStops[0].ArrivalTime >= 0) |
| 10232 | + { |
| 10233 | + Delay = TimeSpan.FromSeconds((presentTime - StationStops[0].DepartTime) % (24 * 3600)); |
| 10234 | + } |
10229 | 10235 |
|
10230 | 10236 | // Check for activation of other train |
10231 | 10237 | ActivateTriggeredTrain(TriggerActivationType.StationDepart, StationStops[0].PlatformReference); |
@@ -12680,10 +12686,17 @@ public void TTAnalysisUpdateStationState1(int presentTime, StationStop thisStati |
12680 | 12686 | DateTime presentDTA = baseDTA.AddSeconds(AI.clockTime); |
12681 | 12687 | DateTime arrTimeA = baseDTA.AddSeconds(presentTime); |
12682 | 12688 | DateTime depTimeA = baseDTA.AddSeconds(thisStation.ActualDepart); |
| 12689 | + string arrstring = "--:--:--"; |
| 12690 | + string depstring = "--:--:--"; |
| 12691 | + if (thisStation.ArrivalTime >= 0) |
| 12692 | + { |
| 12693 | + arrstring = thisStation.arrivalDT.ToString("HH:mm:ss"); |
| 12694 | + depstring = thisStation.departureDT.ToString("HH:mm:ss"); |
| 12695 | + } |
12683 | 12696 |
|
12684 | 12697 | var sob = new StringBuilder(); |
12685 | 12698 | sob.AppendFormat("{0};{1};{2};{3};{4};{5};{6};{7};{8};{9};{10};{11};{12}", |
12686 | | - Number, presentDTA.ToString("HH:mm:ss"), Name, Delay, thisStation.PlatformItem.Name, thisStation.arrivalDT.ToString("HH:mm:ss"), thisStation.departureDT.ToString("HH:mm:ss"), |
| 12699 | + Number, presentDTA.ToString("HH:mm:ss"), Name, Delay, thisStation.PlatformItem.Name, arrstring, depstring, |
12687 | 12700 | arrTimeA.ToString("HH:mm:ss"), depTimeA.ToString("HH:mm:ss"), "", "", "", ""); |
12688 | 12701 | File.AppendAllText(@"C:\temp\TTAnalysis.csv", sob.ToString() + "\n"); |
12689 | 12702 | } |
@@ -15574,20 +15587,20 @@ public void SetStopDetails(string trainName, string stationName) |
15574 | 15587 | { |
15575 | 15588 | probvalue = Simulator.Random.Next(100); |
15576 | 15589 | pickupSet = probvalue <= probPickUp; |
15577 | | -#if DEBUG_REPORTS |
15578 | | - File.AppendAllText(@"C:\temp\printproc.txt", "Train " + trainName + |
| 15590 | +#if DEBUG_RQS |
| 15591 | + Trace.TraceInformation("Train " + trainName + |
15579 | 15592 | " : request stop at " + stationName + " : pickup : probability : " + probPickUp + " ; number : " + probvalue + |
15580 | | - " set : " + pickupSet + "\n"); |
| 15593 | + " set : " + pickupSet); |
15581 | 15594 | #endif |
15582 | 15595 | } |
15583 | 15596 | if (probSetDown > 0) |
15584 | 15597 | { |
15585 | 15598 | probvalue = Simulator.Random.Next(100); |
15586 | 15599 | setdownSet = probvalue <= probSetDown; |
15587 | | -#if DEBUG_REPORTS |
15588 | | - File.AppendAllText(@"C:\temp\printproc.txt", "Train " + trainName + |
| 15600 | +#if DEBUG_RQS |
| 15601 | + Trace.TraceInformation("Train " + trainName + |
15589 | 15602 | " : request stop at " + stationName + " : setdown : probability : " + probSetDown + " ; number : " + probvalue + |
15590 | | - " set : " + setdownSet + "\n"); |
| 15603 | + " set : " + setdownSet); |
15591 | 15604 | #endif |
15592 | 15605 | } |
15593 | 15606 | } |
|
0 commit comments