Track and Inertial Modelling

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • StevenSam
    New Member
    • Oct 2015
    • 10

    #16
    Thanks for info... So, I'll try to focus my efforts on a narrower scope. I would really like to understand the format / data structure of the track representations. Can someone help with this, or let me know where I could find help?

    I am completely new to the software here, but I am an experienced engineer and programmer. What is the file hierarchy? I have noticed there are Track files, track databases, etc. If I wanted to write a program that did nothing but load a model of a track into memory for me to manipulate somehow, what would I need to do? Which files would I need to open, and how is data stored within those files?

    Is there a binary data structure, or is the data stored as ASCII or what?

    Thanks again all, I appreciate the help.

    Regards,
    -Steve

    Comment

    • R. Steele
      3500 Post Veteran

      • Feb 2013
      • 3928
      • known universe
      • ORTS

      #17
      Originally posted by StevenSam
      Thanks for info... So, I'll try to focus my efforts on a narrower scope. I would really like to understand the format / data structure of the track representations. Can someone help with this, or let me know where I could find help?...
      -Steve
      This item below was suggested for reading (I'm in the learning stage about route and track editing) by Carlo Santucci (on the Open Rails development team) it may provide some information you are looking for. I'm really not sure, this whole thread is waaayyy beyond me, but interesting, nonetheless.

      I downloaded some time ago at UKtrainsim (uktrainsim.com) the file with ID 22427, "TDB Primer v1.2.pdf" by SDTrains, that is an excellent document that also has some precise suggestions about how to repair the .tdb file. I'd expect that parts of it apply also to the .rdb file.
      Cheers, Gerry
      "A mind is like a parachute. It doesn't work if it is not open." Frank Zappa
      It's my railroad and I'll do what I want! Historically accurate attitude of US Railroad Barons.
      Forever, ridin' drag in railroad knowledge.
      Audi, Vide, Tace, Si Vis Vivere In Pace​

      https://www.trainsim.com/forums/filedata/fetch?filedataid=79656&type=medium​ https://www.trainsim.com/forums/filedata/fetch?filedataid=79654&type=small

      Comment

      • muskokaandtahoe
        3000 Post Veteran

        • Apr 2003
        • 3003
        • Silicon Valley, CA, USA.
        • ORTS

        #18
        Originally posted by StevenSam
        Thanks for info... So, I'll try to focus my efforts on a narrower scope. I would really like to understand the format / data structure of the track representations. Can someone help with this, or let me know where I could find help?

        I am completely new to the software here, but I am an experienced engineer and programmer. What is the file hierarchy? I have noticed there are Track files, track databases, etc. If I wanted to write a program that did nothing but load a model of a track into memory for me to manipulate somehow, what would I need to do? Which files would I need to open, and how is data stored within those files?

        Is there a binary data structure, or is the data stored as ASCII or what?

        Thanks again all, I appreciate the help.

        Regards,
        -Steve

        This is the official home of Open Rails with news and links to content, vendors and the community. Open Rails is a totally free train simulator that supports the world’s largest range of rail content.


        That should help. They're also rather short on help right now so if you wanted to sign up I'll wager your offer would be quite welcomed.
        Dave Nelson
        sigpic
        Seldom visiting, posting less often that that.

        Comment

        • StevenSam
          New Member
          • Oct 2015
          • 10

          #19
          Thanks guys,

          @R. Steele, I have a feeling that I've read the TDB Primer document before, but I can't seem to find it again, do you have a link to where it lives?

          @ muskokaandtahoe, I have already downloaded the sourcecode, however the soltuion seems to be made up fo a lot of different projects, and as it alll seems to be broken down into quite discrete blocks of functionality, I am unable to find where in the code a track file (or database, or whatever) is opened, parsed and put into a data structure / class. If you do have any idea about which project, or file handles this that would be amazing.

          Thanks again guys,
          -Steve

          Comment

          • StevenSam
            New Member
            • Oct 2015
            • 10

            #20
            I'v had a look through some of the files, and I was hoping someone could explain some of the terms.

            Within the *.rdb file, the content seems to be along the lines of:
            TrackDB (
            Serial ( 1726 )
            TrackNodes ( 2643
            TrackNode ( 1
            TrEndNode ( 0 )
            UiD ( -6115 15145 1820 2 -6115 15145 850.105 51.2188 -799.334 -0.00521607 -2.19303 -0.000456356 )
            TrPins ( 1 0
            TrPin ( 1021 0 )
            )
            )
            TrackNode ( 2
            TrEndNode ( 0 )
            UiD ( -6115 15145 3026 0 -6115 15145 981.283 50.3211 -709.805 0 -0.360445 0 )
            TrPins ( 1 0
            TrPin ( 22 1 )
            )
            )
            TrackNode ( 3
            TrEndNode ( 0 )
            UiD ( -6115 15145 908 1 -6115 15145 575.434 50.7929 -54.5506 0.0182562 -0.475623 -0.00159736 )
            TrPins ( 1 0
            TrPin ( 81 0 )
            )
            )

            Can someone explain these structures. What are the UiD's and TrPins? What are the numbers within the brackets for each of these, co-ordiantes?

            What is the significance of TrEndNode ( 0 )?


            Some track nodes have a TrVecotNode, TrVecotrSections and TrItemRefs, what are these?


            TrackNode ( 461
            TrVectorNode (
            TrVectorSections ( 17 1 144 -6126 15147 465 1 0 00 -6126 15147 -76.0888 54.377 710.25 -0.0523598 1.28021 -1.26834e-007 209 151 -6126 15147 464 2 3 00 -6126 15147 -28.2506 56.9938 724.556 -0.0370156 1.28021 -0.0370408 1 144 -6126 15147 463 2 3 00 -6126 15147 -3.65134 58.5296 744.591 -0.0523598 0.494133 1.37526e-007 217 137 -6126 15147 462 2 3 00 -6126 15147 20.0299 61.1464 788.55 0 0.494137 0 2 127 -6126 15147 461 1 0 00 -6126 15147 29.5155 61.1464 806.158 -0.0523598 0.494141 -1.22171e-007 270 196 -6126 15147 460 2 3 00 -6126 15147 76.8781 66.3799 894.074 -0.0515637 0.494142 -0.00910015 2 127 -6126 15147 459 2 3 00 -6126 15147 94.1988 68.6656 934.282 0 0.319379 0 209 133 -6126 15148 316 2 3 00 -6126 15148 125.597 68.6656 -1018.78 0.0523599 0.31938 1.91506e-008 220 140 -6126 15148 317 2 3 00 -6126 15148 123.258 67.2409 -987.133 0.0523599 5.81648 -1.44231e-008 2 127 -6126 15148 318 1 0 00 -6126 15148 113.299 66.4699 -974.388 0.0523599 5.4233 -1.08182e-007 208 133 -6126 15148 319 1 0 00 -6126
            15148 37.6261 61.2363 -909.225 0.0523598 5.42329 7.46081e-009 1 126 -6126 15148 320 2 3 00 -6126 15148 24.3855 59.7004 -882.944 0.0523599 6.20937 -6.67033e-010 217 137 -6126 15148 321 2 3 00 -6126 15148 20.7034 57.0836 -833.148 0 6.20937 0 2 127 -6126 15148 324 2 3 00 -6126 15148 19.2285 57.0836 -813.202 0.0523599 6.20937 -6.67033e-010 2 127 -6126 15148 325 1 0 00 -6126 15148 11.8643 51.85 -713.611 0 6.20937 0 2 127 -6126 15148 326 2 3 00 -6126 15148 4.48974 51.85 -613.884 -0.0523599 6.20936 -4.98688e-010 3 128 -6126 15148 327 2 3 00 -6126 15148 -2.87497 57.0836 -514.293 0 6.20936 0 )
            TrItemRefs ( 2
            TrItemRef ( 359 )
            TrItemRef ( 358 )
            )
            )
            TrPins ( 1 1
            TrPin ( 459 1 )
            TrPin ( 458 1 )
            )
            )



            In the *.tdb file looks similar, what is the difference between these files, and how are they meant to be used together?


            TrackDB (
            Serial ( 1724 )
            TrackNodes ( 1101
            TrackNode ( 1
            TrJunctionNode ( 0 39000 0 )
            UiD ( -6130 15149 164 0 -6130 15149 -171.709 35.9139 -39.343 0.00167127 2.01677 0.000119041 )
            TrPins ( 1 2
            TrPin ( 1016 1 )
            TrPin ( 37 0 )
            TrPin ( 1017 0 )
            )
            )
            TrackNode ( 2
            TrVectorNode (
            TrVectorSections ( 11 38511 38521 -6130 15149 157 2 3 00 -6130 15149 738.886 34.5611 -234.158 0 4.91008 0 38512 38522 -6130 15149 158 2 3 00 -6130 15149 689.86 34.5611 -224.337 0 4.91008 0 38513 38523 -6130 15149 3 2 3 00 -6130 15149 591.806 34.5611 -204.696 -0.00167546 4.91008 -2.81741e-008 38513 38523 -6130 15149 4 2 3 00 -6130 15149 395.702 34.8962 -165.414 -0.00167555 4.91008 4.81364e-008 38512 38522 -6130 15149 5 2 3 00 -6130 15149 199.598 35.2312 -126.131 -0.00167559 4.91008 4.07441e-008 38512 38522 -6130 15149 135 2 3 00 -6130 15149 101.546 35.3988 -106.49 -0.00167551 4.91008 -3.20286e-009 38509 38520 -6130 15149 138 2 3 00 -6130 15149 3.49436 35.5662 -86.8485 -0.00167551 4.91008 2.44329e-009 40106 40045 -6130 15149 134 1 0 00 -6130 15149 -25.9076 35.6266 -80.958 -0.002484 4.90994 0.000121763 40105 40045 -6130 15149 134 1 0 00 -6130 15149 -32.9675 35.6444 -79.5449 -0.002484 4.90994 0.000121763 38785 39538 -6130 15149 132 1 0 00 -6130 15149 -108.909 35.838 -62.399 0 4.95894 0 36366
            39400 -6130 15149 130 2 0 00 -6130 15149 -129.808 35.838 -56.1584 -0.00167171 5.0462 0.0001148 )
            TrItemRefs ( 13
            TrItemRef ( 2037 )
            TrItemRef ( 2039 )
            TrItemRef ( 2041 )
            TrItemRef ( 2035 )
            TrItemRef ( 1054 )
            TrItemRef ( 1055 )
            TrItemRef ( 2042 )
            TrItemRef ( 2046 )
            TrItemRef ( 2048 )
            TrItemRef ( 2044 )
            TrItemRef ( 1042 )
            TrItemRef ( 1058 )
            TrItemRef ( 1057 )
            )
            )
            TrPins ( 1 1
            TrPin ( 3 1 )
            TrPin ( 4 0 )
            )
            )




            Thanks very much for your help.

            Regards,
            -Steve

            Comment

            • eolesen
              9500 Post Veteran and Administrator



              • Dec 2002
              • 9583
              • NS MP245.4 CNO&TP South District
              • English, SQL
              • General

              #21
              RDB is the road database, TDB is the track database.

              TrEndNode defines if the vector either ends or continues. When set to 1, travel doesn't go past the end of the node.

              TrVectorNode indicates the track pieces which comprise a continuous vector without any change in the second and fourth values defined in the quaternion.

              TrItemRef is a pointer reference to an interactive object as defined in either the RIT or TIT file (i.e. a signal, crossover junction, platform, speedpost).

              TrPin are where track pieces join other pieces, and in the case of points/turnouts, define the primary and alternate vectors available from that particular point/turnout when diverging or converging.
              If you like what you see here at Trainsim.com, be it the discussions and knowledge in the forums, or items available in our library, I hope you'll consider a paid membership to help support keeping the site operating.... Thanks!

              Comment

              • roeter
                Senior Member
                • Nov 1999
                • 171
                • Netherlands.

                #22
                Originally posted by eric

                TrItemRef is a pointer reference to an interactive object as defined in either the RIT or TIT file (i.e. a signal, crossover junction, platform, speedpost).
                The items are also defined in the .tdb and .rdb itself. OR does not use either TIT or RIT.

                Regards,
                Rob Roeterdink

                Comment

                • eolesen
                  9500 Post Veteran and Administrator



                  • Dec 2002
                  • 9583
                  • NS MP245.4 CNO&TP South District
                  • English, SQL
                  • General

                  #23
                  Duh... I knew that.... been spending too much time away from the guts & bytes....
                  If you like what you see here at Trainsim.com, be it the discussions and knowledge in the forums, or items available in our library, I hope you'll consider a paid membership to help support keeping the site operating.... Thanks!

                  Comment

                  • StevenSam
                    New Member
                    • Oct 2015
                    • 10

                    #24
                    Thanks again guys,

                    The UiD section seems to contain the most data, what are all of these values referring to?

                    Also, you mentioned that there are quaternions, where are these values defined?

                    Am I right in assuming that there should be a co-ordinate system of some sort, where in these files is the information that dictates the position of a node, it's length, or curvature or any other physical properties?

                    If I wanted to use this file to plot the route as a servies of lines, can I do that? If so, which data do I need to use, If not, what other files do I need?

                    I've also read somewhere that the TrPin refers to the number of inputs and outputs... So what is a TrPin (37 0), or a TrPin (1016 1)?

                    I would have expected TrPin(1 1) to be the most common?

                    Also, I have no idea what TIT and RIT stand for... There are way too many TLA's for me to deal with.

                    Regards,
                    -Steve

                    Comment

                    • OTTODAD
                      1
                      • Feb 2001
                      • 32344
                      • England
                      • General

                      #25
                      Hi Steve !

                      I wonder what Marc Nelson has to say in response to all your questions on the subject ?

                      As far as I am concerned he is the only one left who is still creating them for MSTS, working on a new version of his Scalerail tracks for MSTS and ORTS and qualified to answer them !

                      Comment

                      • eolesen
                        9500 Post Veteran and Administrator



                        • Dec 2002
                        • 9583
                        • NS MP245.4 CNO&TP South District
                        • English, SQL
                        • General

                        #26
                        Originally posted by StevenSam
                        Thanks again guys,

                        The UiD section seems to contain the most data, what are all of these values referring to?

                        Also, you mentioned that there are quaternions, where are these values defined?

                        Am I right in assuming that there should be a co-ordinate system of some sort, where in these files is the information that dictates the position of a node, it's length, or curvature or any other physical properties?

                        If I wanted to use this file to plot the route as a servies of lines, can I do that? If so, which data do I need to use, If not, what other files do I need?

                        I've also read somewhere that the TrPin refers to the number of inputs and outputs... So what is a TrPin (37 0), or a TrPin (1016 1)?

                        I would have expected TrPin(1 1) to be the most common?

                        Also, I have no idea what TIT and RIT stand for... There are way too many TLA's for me to deal with.

                        Regards,
                        -Steve
                        Three files that play together here...

                        The TDB/RDB builds chains of UID's into a TrackNode, which then uses the UID as a pointer back to the .W files (in the WORLD directory for the route). The W holds the geographic coordinates and quaternion values for each scenery object and track piece.

                        Within each track object in the W files, you'll see a reference to ShapeIdx, which is a pointer to the TSECTION.DAT files (the main file is located in the GLOBAL directory for the installation plus one in the primary directory for each route). The TSection defines the geometry for track shapes (length, curvature, and path offset from a X/Z axis where multiple tracks/lanes exist on a single track piece).

                        TrPin(37 0) means that the pin for the track section you're looking at is attached to TrackNode 37, and is the default path. TrPin(1016 1) is attached to TrackNode 1016, and is an alternate path.

                        If you want to see how a 2D plot is constructed, look for the ORTS source code for the Track Viewer or the Dispatcher Display. Both of these projects do just that.
                        Last edited by eric; 10-30-2015, 10:58.
                        If you like what you see here at Trainsim.com, be it the discussions and knowledge in the forums, or items available in our library, I hope you'll consider a paid membership to help support keeping the site operating.... Thanks!

                        Comment

                        • drelyea
                          Senior Member
                          • May 2010
                          • 661
                          • Big Johnson City, TN

                          #27
                          Hi,

                          Ummm, almost Eric, but not quite.

                          TrackNodes ( 32802
                          TrackNode ( 1
                          TrJunctionNode ( 0 38052 1 )
                          UiD ( -10999 14408 268 0 -10999 14408 567.714 174.329 771.099 0 -0.345033 0 )
                          TrPins ( 1 2
                          TrPin ( 14071 1 )
                          TrPin ( 10 0 )
                          TrPin ( 7 0 )
                          )
                          )

                          An example, the first number is the Track Node that leg of the Junction node is connected to. (14701 ) 1 is the entrance to the junction node, 0 is(are) the exits in this case. The Zero(s) and One(s) will swap if the T key was used while placing the turnout. In MSTS, the Junction Node has zero length, and is a simple point, defined by the second W file naming, the X,Y,Z numbers following that and the q(uarternion) numbers after those. Y in MSTS is above (or below) sea level for the world files.

                          Doug Relyea
                          Making stuff that works, using outdated Software on outdated Hardware.sigpic

                          Comment

                          • eolesen
                            9500 Post Veteran and Administrator



                            • Dec 2002
                            • 9583
                            • NS MP245.4 CNO&TP South District
                            • English, SQL
                            • General

                            #28
                            Edits made, Doug... Getting too old to remember all these little details...

                            I skipped over TrackNodes being a collection of TrackObj's...
                            If you like what you see here at Trainsim.com, be it the discussions and knowledge in the forums, or items available in our library, I hope you'll consider a paid membership to help support keeping the site operating.... Thanks!

                            Comment

                            • drelyea
                              Senior Member
                              • May 2010
                              • 661
                              • Big Johnson City, TN

                              #29
                              Hi Eric,

                              Yes, sometimes it amazes me that this even worked in Win98, given all the nitty little details that had to mesh perfectly in order for it to arrive in the Rendering Engine(s) without a CTD or a "MSTS has encountered a problem and needs to close" message.

                              Doug Relyea
                              Making stuff that works, using outdated Software on outdated Hardware.sigpic

                              Comment

                              • OTTODAD
                                1
                                • Feb 2001
                                • 32344
                                • England
                                • General

                                #30
                                https://www.trainsim.com/vbts/showthread.php?238541-3d-modeling-progs-and-making-tracks-for-MSTS&p=1141519#post1141519

                                Years ago I worked with Y-Tracks Romanovski, testing and releasing them from my web site, after editing all Y-Tracks shape files to use Acleantrack textures instead of his Ycleantrack ones so that my MSTS-Tracks changer can be used with them, adding my how-to-use Y-Tracks manual !

                                He showed me how to create his Y-Tracks using 3DCanvas.

                                Got it and had a go but had to give up, trying to create animated switches, turnouts, junctions, or whatever they are called being a nightmare, especially slips, MSTS signalling not being aware of them creating another problem !

                                His wife then divorced him, getting fed up with him spending most of his time working on creating them !

                                Later when working with Norbert Rieger on his DB-Tracks I used my workaround of creating MSTS Dynamic straight and curved tracks, have DYNATRAX convert them to DynaTrax track shape files and then rename them to their appropriate length / radius X-Tracks shapes, also listing them in the Global Tsection.dat !

                                Doing the latter is only necessary when using new X-Tracks tracks in the Route Editor, otherwise just adding them to the Global\Shapes folder will do !

                                All suggestions made so far are only a small part of what it takes to create them, covering just the tip of the Iceberg !

                                Don't waste anymore of your time as you will be getting nowhere !

                                Me having worked day and night for years creating my commercial accounting software, being physically inactive most of the time, not smoking but drinking lots of sugary Coke with some Brandy, got me Diabetes-2 and then a heart attack in 2003 and wonder whether Norbert doing similar was the cause of his untimely passing away ?

                                The heart attack was a warning and doing something to change my Austrian eating preferences and using Natural Supplements to add minerals and vitamins to what is lacking in my diet has so far kept the lid on my health problems, but can do nothing about getting older !


                                Comment

                                Working...