17
17
18
18
// This code processes the Timetable definition and converts it into playable train information
19
19
//
20
- // #DEBUG_POOLINFO
20
+ // #define DEBUG_POOLINFO
21
21
//
22
22
23
23
using System ;
@@ -1000,8 +1000,17 @@ public int GetPoolExitIndex(TTTrain train)
1000
1000
1001
1001
#if DEBUG_POOLINFO
1002
1002
var sob = new StringBuilder ( ) ;
1003
- sob . AppendFormat ( "Pool {0} : error : train {1} ({2}) allready stored in pool \n " , PoolName , train . Number , train . Name ) ;
1004
- sob . AppendFormat ( " stored units : {0}" , thisStorage . StoredUnits . Count ) ;
1003
+ DateTime baseDT = new DateTime ( ) ;
1004
+ DateTime actTime = baseDT . AddSeconds ( train . AI . clockTime ) ;
1005
+
1006
+ sob . AppendFormat ( "{0} : Pool {1} : error : train {2} ({3}) allready stored in pool \n " , actTime . ToString ( "HH:mm:ss" ) , PoolName , train . Number , train . Name ) ;
1007
+
1008
+ int totalno = 0 ;
1009
+ foreach ( PoolDetails selStorage in StoragePool )
1010
+ {
1011
+ totalno += selStorage . StoredUnits . Count ;
1012
+ }
1013
+ sob . AppendFormat ( " stored units {0} : {1} (total {2})" , PoolName , thisStorage . StoredUnits . Count , totalno ) ;
1005
1014
File . AppendAllText ( @"C:\temp\PoolAnal.csv" , sob . ToString ( ) + "\n " ) ;
1006
1015
#endif
1007
1016
}
@@ -1083,8 +1092,18 @@ public void AddUnit(TTTrain train, bool claimOnly)
1083
1092
1084
1093
#if DEBUG_POOLINFO
1085
1094
var sob = new StringBuilder ( ) ;
1086
- sob . AppendFormat ( "Pool {0} : train {1} ({2}) added\n " , PoolName , train . Number , train . Name ) ;
1087
- sob . AppendFormat ( " stored units : {0}\n " , thisPool . StoredUnits . Count ) ;
1095
+ DateTime baseDT = new DateTime ( ) ;
1096
+ DateTime actTime = baseDT . AddSeconds ( train . AI . clockTime ) ;
1097
+
1098
+ sob . AppendFormat ( "{0} : Pool {1} : train {2} ({3}) added\n " , actTime . ToString ( "HH:mm:ss" ) , PoolName , train . Number , train . Name ) ;
1099
+
1100
+ int totalno = 0 ;
1101
+ foreach ( PoolDetails selStorage in StoragePool )
1102
+ {
1103
+ totalno += selStorage . StoredUnits . Count ;
1104
+ }
1105
+
1106
+ sob . AppendFormat ( " stored units {0} : {1} (total {2})" , PoolName , thisPool . StoredUnits . Count , totalno ) ;
1088
1107
File . AppendAllText ( @"C:\temp\PoolAnal.csv" , sob . ToString ( ) + "\n " ) ;
1089
1108
#endif
1090
1109
@@ -1184,7 +1203,10 @@ virtual public TrainFromPool ExtractTrain(ref TTTrain train, int presentTime)
1184
1203
{
1185
1204
#if DEBUG_POOLINFO
1186
1205
var sob = new StringBuilder ( ) ;
1187
- sob . AppendFormat ( "Pool {0} : request for train {1} ({2})" , PoolName , train . Number , train . Name ) ;
1206
+ DateTime baseDT = new DateTime ( ) ;
1207
+ DateTime actTime = baseDT . AddSeconds ( train . AI . clockTime ) ;
1208
+
1209
+ sob . AppendFormat ( "{0} : Pool {1} : request for train {2} ({3})" , actTime . ToString ( "HH:mm:ss" ) , PoolName , train . Number , train . Name ) ;
1188
1210
File . AppendAllText ( @"C:\temp\PoolAnal.csv" , sob . ToString ( ) + "\n " ) ;
1189
1211
#endif
1190
1212
// check if any engines available
@@ -1215,6 +1237,9 @@ virtual public TrainFromPool ExtractTrain(ref TTTrain train, int presentTime)
1215
1237
{
1216
1238
#if DEBUG_TRACEINFO
1217
1239
Trace . TraceInformation ( "Pool {0} : train {1} : delayed through claimed access\n " , PoolName , train . Name ) ;
1240
+ #endif
1241
+ #if DEBUG_POOLINFO
1242
+ Trace . TraceInformation ( "Pool {0} : train {1} : delayed through claimed access\n " , PoolName , train . Name ) ;
1218
1243
#endif
1219
1244
return ( TrainFromPool . Delayed ) ;
1220
1245
}
@@ -1319,7 +1344,13 @@ virtual public TrainFromPool ExtractTrain(ref TTTrain train, int presentTime)
1319
1344
#if DEBUG_POOLINFO
1320
1345
sob = new StringBuilder ( ) ;
1321
1346
sob . AppendFormat ( "Pool {0} : train {1} ({2}) waiting for incoming train {3} ({4})\n " , PoolName , train . Number , train . Name , otherTTTrain . Number , otherTTTrain . Name ) ;
1322
- sob . AppendFormat ( " stored units : {0}" , reqStorage . StoredUnits . Count ) ;
1347
+
1348
+ int totalno1 = 0 ;
1349
+ foreach ( PoolDetails selStorage in StoragePool )
1350
+ {
1351
+ totalno1 += selStorage . StoredUnits . Count ;
1352
+ }
1353
+ sob . AppendFormat ( " stored units {0} : {1} (total {2})" , PoolName , reqStorage . StoredUnits . Count , totalno1 ) ;
1323
1354
File . AppendAllText ( @"C:\temp\PoolAnal.csv" , sob . ToString ( ) + "\n " ) ;
1324
1355
#endif
1325
1356
break ;
@@ -1344,8 +1375,15 @@ virtual public TrainFromPool ExtractTrain(ref TTTrain train, int presentTime)
1344
1375
{
1345
1376
#if DEBUG_POOLINFO
1346
1377
sob = new StringBuilder ( ) ;
1347
- sob . AppendFormat ( "Pool {0} : cannot find train {1} for {2} ({3}) \n " , PoolName , selectedTrainNumber , train . Number , train . Name ) ;
1348
- sob . AppendFormat ( " stored units : {0}" , reqStorage . StoredUnits . Count ) ;
1378
+
1379
+ sob . AppendFormat ( "Pool {1} : cannot find train {2} for {3} ({4}) \n " , PoolName , selectedTrainNumber , train . Number , train . Name ) ;
1380
+
1381
+ int totalno2 = 0 ;
1382
+ foreach ( PoolDetails selStorage in StoragePool )
1383
+ {
1384
+ totalno2 += selStorage . StoredUnits . Count ;
1385
+ }
1386
+ sob . AppendFormat ( " stored units {0} : {1} (total {2})" , PoolName , reqStorage . StoredUnits . Count , totalno2 ) ;
1349
1387
File . AppendAllText ( @"C:\temp\PoolAnal.csv" , sob . ToString ( ) + "\n " ) ;
1350
1388
#endif
1351
1389
return ( TrainFromPool . Delayed ) ;
@@ -1361,8 +1399,15 @@ virtual public TrainFromPool ExtractTrain(ref TTTrain train, int presentTime)
1361
1399
1362
1400
#if DEBUG_POOLINFO
1363
1401
sob = new StringBuilder ( ) ;
1402
+
1364
1403
sob . AppendFormat ( "Pool {0} : train {1} ({2}) extracted as {3} ({4}) \n " , PoolName , selectedTrain . Number , selectedTrain . Name , train . Number , train . Name ) ;
1365
- sob . AppendFormat ( " stored units : {0}" , reqStorage . StoredUnits . Count ) ;
1404
+
1405
+ int totalno = 0 ;
1406
+ foreach ( PoolDetails selStorage in StoragePool )
1407
+ {
1408
+ totalno += selStorage . StoredUnits . Count ;
1409
+ }
1410
+ sob . AppendFormat ( " stored units {0} : {1} (total {2})" , PoolName , reqStorage . StoredUnits . Count , totalno ) ;
1366
1411
File . AppendAllText ( @"C:\temp\PoolAnal.csv" , sob . ToString ( ) + "\n " ) ;
1367
1412
#endif
1368
1413
@@ -1504,6 +1549,9 @@ virtual public TrainFromPool ExtractTrain(ref TTTrain train, int presentTime)
1504
1549
{
1505
1550
#if DEBUG_TRACEINFO
1506
1551
Trace . TraceWarning ( "Failed to extract required train " + train . Name + " from pool " + PoolName + "\n " ) ;
1552
+ #endif
1553
+ #if DEBUG_POOLINFO
1554
+ Trace . TraceWarning ( "Failed to extract required train " + train . Name + " from pool " + PoolName + "\n " ) ;
1507
1555
#endif
1508
1556
return ( TrainFromPool . Failed ) ;
1509
1557
}
0 commit comments