Automatic and manual switches

Switches in Microsoft Train Simulator are either automatic or manual. Automatic switches are controlled by the dispatcher. Manual switches are controlled by the player. Automatic switches function as manual switches while in explore mode.

Activity Editor shows automatic and manual switches using the same graphic so they are not distinguishable. To determine whether a switch is automatic or manual create a short path that includes just that switch.

path reverse direction

The path file used is from C:\Program Files (x86)\Microsoft Games\Train Simulator\ROUTES\SoldierSummit\Paths and a short path with a start, junction, and end nodes will have three TrackPDP elements.

TrackPDPs (
 TrackPDP ( -12507 14303 -300.982 2425.48 430.157 1 1 )
 TrackPDP ( -12507 14303 -347.236 2425.51 377.545 2 0 )
 TrackPDP ( -12507 14303 -398.91 2425.93 317.468 1 1 )
)

The 2 identifies that TrackPDP element as a junction node. Search the track database file for this junction using the x-coordinate, -347.236.

  TrackNode ( 1081
   TrJunctionNode ( 0 216 1 )
   UiD ( -12507 14303 113 0 -12507 14303 -347.236 2425.51 377.545 0 -2.42041 0 )
   TrPins ( 1 2
    TrPin ( 620 0 )
    TrPin ( 1082 1 )
    TrPin ( 1256 1 )
   )
  )

The second attribute of TrJunctionNode, 216, identifies the track shape. The third attribute is 1 for manual junctions and 0 for automatic junctions.

TrackShape ( 216
 FileName ( A1tPnt10dRgtMnl.s )
 NumPaths ( 2 )
 MainRoute ( 0 )
 ClearanceDist ( 26 )
 SectionIdx ( 1 0 0 0 0 179 )
 SectionIdx ( 2 0 0 0 0 183 176 )
 ManualJunctionShape ( )
)

Repairing damaged track

When a track shape is missing from a world file but present in the track database then that track cannot be selected in Route Editor. This error is reported by ICHK as

—> ‘TrVectorNode(318-2)’: UiD-Number (-11609,14310,8) is NOT defined!
‘TrVectorNode(318-2)’: Connection between Shape-/Section-Id and UiD not available!

If the track is in a vector with an end node then it can be repaired by removing the damaged track section and those to the end node from the vector and moving the end node to the last undamaged track section.

Moving the end node to a different track section requires that some of the elements in the end node be adjusted to the new track section.

TrackNode ( 9
TrEndNode ( 0 )
UiD ( -11609 14310 73 1 -11609 14310 -156.549 182.484 -482.472 -0.00261801 1.59697 1.02446e-008 )
TrPins ( 1 0
TrPin ( 318 1 )
)
)

The picture below shows missing track covered by static objects 100ftTrackTies.s.

vector 318 before

TrackNode ( 9
TrEndNode ( 0 )
UiD ( -11609 14310 track_uid track_point -11609 14310 -156.549 182.484 -482.472 -0.00261801 1.59697 1.02446e-008 )
TrPins ( 1 0
TrPin ( 318 1 )
)
)

Two elements that need to be adjusted are track_uid and track_point. The track_uid identifies the section of track in the world file. The track_point identifies the point in the path through the track. The track_points for single track are 0 and 1, for junctions 0, 1, and 2, for double track 0, 1, 2, and 3, and so on.

The picture below shows the damaged track replaced with good track.

vector 318 after

Repairing can’t select adjacent track

Track is defined in both world files and track database. If these two definitions do not match errors can occur when selecting track in Route Editor. If the track shape is missing from the world file selecting the adjacent track return an error of

Adjacent track pieces not loaded. Can’t select this track piece.

Since the track shape is missing the track cannot be edited by Route Editor. A rebuild of the track database is possible but can have undesired side effects.

The ICHK function of TsUtils procedures error message of the form

—> ‘TrVectorNode(301-2)’: UiD-Number (-11609,14309,3589) is NOT defined!
‘TrVectorNode(301-2)’: Connection between Shape-/Section-Id and UiD not available!

The track vector can be repaired in a text editor by dividing one track vector into two and creating two end nodes.

vector 308 repair

After the track in the track database that does not have matching shapes in world files has been removed, using Route Editor to add the missing track.

vector 308 after

Validating track geometry

When creating a route the track geometry is read from the global tsection.dat file and incorporated into the track database. Currently when routes are run the geometry is read from the global tsection.dat file. But this is not necessary as this geometry is in the track database. When the global tsection.dat file does not have this geometry then Open Rails has an error, see https://bugs.launchpad.net/or/+bug/1397695

As an example of calculating the geometry from the track database the following track vector will be used.

183 218 -12781 14686 186 0 1 00 -12781 14686 457.969 324.245 10.8839 0.00431981 3.49037 -2.36043e-007
175 218 -12781 14686 186 0 1 00 -12781 14686 457.453 324.238 9.46428 0.00431981 3.49037 -2.36043e-007
32115 29061 -12781 14686 195 0 1 00 -12781 14686 450.058 324.115 -18.1616 0.00431964 3.31584 3.6129e-007
176 218 -12781 14686 192 1 0 00 -12781 14686 445.081 323.99 -46.4338 0.0043197 3.31584 -1.54252e-007
183 218 -12781 14686 192 1 0 00 -12781 14686 437.687 323.867 -74.0594 0.0042541 3.49037 0.000749961

P1 and P2 are the points for track section 183 218 and LC is the chord distance between these points.

P1 457.969 324.245 10.8839
P2 457.453 324.238 9.46428
LC 1.511

A1 and A2 are the angles for the points above. DA is the difference in angles showing this is a straight section.

A1 3.49037
A2 3.49037
DA 0

Below is the definition for this section showing a match between length of 1.511 and length of 1.51059.

TrackSection ( 183
SectionSize ( 1.5 1.51059 )
)

P1 and P2 are the points for track section 175 218 and LC is the chord distance between these points.

P1 457.453 324.238 9.46428
P2 450.058 324.115 -18.1616
LC 28.599

A1 and A2 are the angles for the points above. DA is the differnce in angles showing this is a 10 degree curve.

A1 3.49037
A2 3.31584
DA 0.17453 (10 deg)

Using formulaes from http://www.ctre.iastate.edu/educweb/ce353/lec05/lecture.htm to calculate radius of curve given angle and chord distance.

LC = 2 R sin (DA/2)
R=LC/(2 sin (DA/2)

R = 164.068

Below is the definition for this section showing a match between radius of 164.068 and radius of 164.0639.

TrackSection ( 175
SectionSize ( 1.5 0 )
SectionCurve ( 164.0639 -10 )
)

Calculating the geometry of the track from the track database can be used to validate a match between the track database and the global tsection.dat file. It could also be used to enable Open Rails to run when the definition of the track section is missing.

TrackShape ( 218
FileName ( A1tPnt10dLftMnl.s )
NumPaths ( 2 )
MainRoute ( 1 )
ClearanceDist ( 26 )
SectionIdx ( 2 0 0 0 0 183 175 )
SectionIdx ( 1 0 0 0 0 179 )
ManualJunctionShape ( )
)

Portions of the global tsection.dat file not encoded in the track database are tunnel, water scoop, and clearance distance for switches.

Repairing dynamic track

The GMO&SS route has a track vector where the same dynamic track is used twice. This error was reported by ICHK as

—> Invalid reference(s) to path 288 from track-database! (expected=3, found=6)

—> Number of references to Section 460 from track-database is invalid! (expected=1, found=2)
—> Sum of references to Section 462 AND 463 from track-database is invalid! (expected=1, found=2)
—> Number of references to Section 464 from track-database is invalid! (expected=1, found=2)

track node 64 before

The track vector could not be removed in Route Editor as an error of adjacent track could not be selected. Removing a section of dynamic track removed the track shape but not the track vector.

Sections of track around the bad track were deleted to isolate the bad track. A new 2t 10m straight was created with the definition in the world file and track database copied to a temporary file and then deleted from the route.

track node 64 repairs

The track nodes of the bad track were noted and then replaced with the definitions of the 2t 10 straight track. Then this temporary track reappeared in Route Editor which could then be deleted. This left behind the track shapes of the bad track and removed the damaged track vector.

With the bad track vector removed the track shapes were selected and the deleted track added back to complete the repair of the track vector.

track node 64 after

APK files

Activities for Microsoft Train Simulator are packaged as .apk files.

Expand an .apk file using ZIP decompression. If the folder name and route ID are not the same files from within the route are not included in the .apk file.

2 bytes string length
string with leading null of route name
2 bytes null
2 bytes string length
string with leading null of folder name
2 bytes null
2 bytes string length
string with leading null of route ID
2 bytes null
4 bytes serial of track database
4 bytes count of files
4 bytes length of file in bytes
2 bytes string length
string with leading null of file path
2 bytes null
content of file starting with Unicode BOM, FF FE

repeat for each file
4 bytes length of file in bytes
2 bytes string length
string with leading null of file path
2 bytes null
content of file starting with Unicode BOM, FF FE
Unicode BOM

http://en.wikipedia.org/wiki/Byte_order_mark

Navigating the Rail Simulator route editor

When in route editor of Rail Simulator you can navigate in 3D space using the arrow keys or the 2D map. Click the map icon in the compass window to toggle between 2D and 3D views.

tehachapi_1

Move about the 2D map by click and dragging. To center the map and enter the current coordinates press Ctrl and left click. When you switch back to 3D your view will be those in the compass coordinates.

tehachapi_2

To adjust camera to ground level press Ctrl+Shift+Home.

http://dpsimulation.blogspot.com/2012/09/train-simulator-2013-hot-keys.html

ClearanceDist for track

ClearanceDist is a track parameter that indicates how far along the diverging end of the switch must be clear on both tracks for the switch to be clear.

If this distance is too short then a signal will indicate clear even though both tracks are not clear. This can result in a collision with a traffic train that starts when the signal clears.

If this distance is too short and their is a signal closer to the point than the clearance distance this can result in a signal passed at danger (SPAD).

Since Route Editor does not indicate when a signal is within the clearance distance of a switch both problems are difficult to avoid.