Conversion from railML

Handwritten example/test file

<?xml version="1.0" encoding="utf-8"?>
<railml xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.railml.org/schemas/2013">
  <infrastructure>
    <tracks>
        <track name="SP1">
            <trackTopology>
                <trackBegin pos="0.0">
                    <openEnd id="b1" />
                </trackBegin>
                <trackEnd pos="1000.0">
                    <openEnd id="b2" />
                </trackEnd>
                <connections>
                </connections>
            </trackTopology>
            <ocsElements>
                <signals>
                    <signal id="sig1" name="Signal 1" pos="50.0" type="main"  dir="up"/>
                    <signal id="sig2" name="Signal 2" pos="250.0" type="main" dir="up"/>
                    <signal id="sig3" name="Signal 3" pos="350.0" type="main" dir="up"/>
                </signals>
                <trainDetectionElements>
                    <trainDetector id="d0" name="detector 1" pos="10.0" />
                    <trainDetector id="d1" name="detector 1" pos="50.0" />
                    <trainDetector id="d2" name="detector 2" pos="250.0" />
                    <trainDetector id="d3" name="detector 2" pos="350.0" />
                    <trainDetector id="d4" name="detector 2" pos="390.0" />
                </trainDetectionElements>
            </ocsElements>
        </track>
    </tracks>
  </infrastructure>
</railml>

Generated output

Infrastructure

node b1-n0b
node n1a-n1b(sight sig1 50)
node n2a(exit sec0)-n2b(enter sec0)
node n3a-n3b(signal sig1)
node n4a(enter sec0, exit sec1)-n4b(exit sec0, enter sec1)
node n5a-n5b(sight sig2 200)
node n6a-n6b(sight sig3 200)
node n7a-n7b(signal sig2)
node n8a(enter sec1, exit sec2)-n8b(exit sec1, enter sec2)
node n9a-n9b(signal sig3)
node n10a(enter sec2, exit sec3)-n10b(exit sec2, enter sec3)
node n11a(enter sec3)-n11b(exit sec3)
node n12a-b2
boundary b1
linear n0b-n1a 0
linear n1b-n2a 10
linear n2b-n3a 40
linear n3b-n4a 0
linear n4b-n5a 0
linear n5b-n6a 100
linear n6b-n7a 100
linear n7b-n8a 0
linear n8b-n9a 100
linear n9b-n10a 0
linear n10b-n11a 40
linear n11b-n12a 610
boundary b2

Routes

modelentry r1 from b1 {
  exit sig1
  length 50
  sections [sec0]
  switches []
  contains []
  release { length 50 trigger sec0 resources [sec0] }
}
route r2 {
  entry sig1
  exit sig2
  entrysection sec1
  length 200
  sections [sec1]
  switches []
  contains []
  release { length 200 trigger sec1 resources [sec1] }
}
route r3 {
  entry sig2
  exit sig3
  entrysection sec2
  length 100
  sections [sec2]
  switches []
  contains []
  release { length 100 trigger sec2 resources [sec2] }
}
modelexit r4 to b2 {
  entry sig3
  entrysection sec3
  length 1650
  sections [sec3]
  switches []
  contains []
}

View