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

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.