Here is the
script
Layout4.lua
(this may not be as
up to date as the zip file linked to below):
--[[ --------------------------------------------------------------------------- Remote Train Control Program for Windows
© Copyright 2022 by Mark DiVecchio
This file is part of Remote Train Control.
Remote Train Control is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Remote Train Control is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Remote Train Control. If not, see <http://www.gnu.org/licenses/>.
Home Page : http://www.silogic.com/trains/RTC_Running.html ---------------------------------------------------------------------------]] -- Semicolons are not required in Lua code --[=[--------------------------------------------------------------------------------------- This file contains all of the details about Instrumented Layout #4. The stopping and starting distances created by "Deceleration Test.lua" and "Acceleration Test.lua".
usage:
local Layout4 = require([[Layout4]]); StopDelay = (Struthers_Passenger_StoppingDistance - Layout4.STOPDistance(EngineNo,CurrentSpeed)) * (48 / (12 * 5280 * CurrentSpeed)) * 3600; SetSpeed(0, StopDelay, EngineNo, MyTIUNo); -----------------------------------------------------------------------------------------]=]
----------------------------------------------------------------------------- -- Declare module and import dependencies ----------------------------------------------------------------------------- local base = _G local Layout = {} Layout.__index = Layout Layout.MASTER_TIU = 1; -- Controlling TIU Number Layout.name = "P&LE Layout4"; -- Layout Name Layout.AccDecRate = 1; -- Acceleration and Deceleration Rate
----------------------------------------------------------------------------- -- Layout constants ----------------------------------------------------------------------------- -- These constants describe your layout --[[------------------------------- Stopping Distance for 1 Smph/Sec -----------------------------------------------]]
-- All tables in Lua are 1 based, that is, StoppingDistance[EngineNo][1] is the first item in the list -- Measured stopping distance in inches (from "Deceleration Test.lua") for scale speeds from 1 Smph to 40 Smph -- Table contains a table for each Engine Number -- Deceleration set to 1 Smph/sec. Unless specified, each engine is pulling two freight -- cars and a caboose. -- These table constructors were created using "Deceleration Test.lua" Layout.StoppingDistance1 = { [ 1] = {[1] = 0.19377162629764, [2] = 0.57024221453259, [3] = 1.0740484429061, [4] = 1.6830449826987, [5] = 2.3640138408305, [6] = 3.1612456747406, [7] = 4.1854671280276, [8] = 4.346020761246, [9] = 6.1397923875427, [10] = 7.4961937716262, [11] = 8.7584775086504, [12] = 10.125951557094, [13] = 11.620761245675, [14] = 13.248442906575, [15] = 14.770934256055, [16] = 16.525951557093, [17] = 18.674048442907, [18] = 18.192387543252, [19] = 22.123183391004, [20] = 24.387543252595, [21] = 26.41384083045, [22] = 29.010380622837, [23] = 31.020069204152, [24] = 34.120415224913, [25] = 36.268512110726, [26] = 39.003460207613, [27] = 41.649826989619, [28] = 44.478892733565, [29] = 47.031141868512, [30] = 50.297577854671, [31] = 53.923875432526, [32] = 57.240138408304, [33] = 60.01384083045, [34] = 60.119031141869, [35] = 67.056055363323, [36] = 66.685121107266, [37] = 74.253287197233, [38] = 78.040138408305, [39] = 82.613148788927, [40] = 86.200692041522} , [ 2] = {[1] = 0.28107746360966, [2] = 0.55211644637755, [3] = 1.0088673247447, [4] = 1.6513300987123, [5] = 2.3841392002677, [6] = 3.1621214656175, [7] = 3.9902961351844, [8] = 4.9891249790862, [9] = 5.9477998996149, [10] = 7.0319558306841, [11] = 8.4825163125316, [12] = 9.6469800903456, [13] = 11.197925380626, [14] = 12.593274217835, [15] = 14.18939267191, [16] = 16.187050359712, [17] = 17.617533879874, [18] = 19.580056884725, [19] = 21.758407227706, [20] = 23.625564664548, [21] = 25.959511460599, [22] = 28.062573197256, [23] = 30.612347331437, [24] = 33.051698176342, [25] = 35.726953321064, [26] = 38.266688974402, [27] = 41.102559812615, [28] = 43.888238246613, [29] = 46.889744018738, [30] = 49.610172327254, [31] = 53.219006190396, [32] = 56.220511962523, [33] = 59.583403045005, [34] = 63.232390831521, [35] = 65.847415091182, [36] = 69.531537560649, [37] = 73.44654508951, [38] = 77.231052367408, [39] = 81.201271540907, [40] = 84.870336289107} , [ 3] = {[1] = 0.22145328719723, [2] = 0.5923875432526, [3] = 0.99100346020761, [4] = 1.5889273356401, [5] = 2.2089965397924, [6] = 3.0062283737024, [7] = 3.8089965397924, [8] = 4.7058823529412, [9] = 5.7522491349481, [10] = 6.9259515570934, [11] = 8.1882352941176, [12] = 9.3674740484429, [13] = 10.961937716263, [14] = 12.440138408305, [15] = 13.857439446367, [16] = 15.761937716263, [17] = 17.63321799308, [18] = 19.426989619377, [19] = 21.392387543253, [20] = 23.496193771626, [21] = 25.694117647059, [22] = 27.886505190312, [23] = 30.006920415225, [24] = 32.653287197232, [25] = 35.310726643599, [26] = 37.857439446367, [27] = 40.503806228373, [28] = 43.244290657439, [29] = 46.256055363322, [30] = 49.649826989619, [31] = 52.163321799308, [32] = 55.800692041523, [33] = 59.582006920415, [34] = 62.577162629758, [35] = 65.356401384083, [36] = 69.021453287197, [37] = 72.719723183391, [38] = 76.689273356401, [39] = 80.531487889274, [40] = 84.650519031141} , [30] = {[1] = 0.21591695501736, [2] = 0.56470588235294, [3] = 0.83044982698961, [4] = 1.5335640138409, [5] = 2.319723183391, [6] = 2.5190311418686, [7] = 3.8034602076124, [8] = 4.7114186851211, [9] = 5.9017301038062, [10] = 6.9148788927336, [11] = 7.9889273356402, [12] = 9.4560553633217, [13] = 10.912110726644, [14] = 12.429065743945, [15] = 14.023529411765, [16] = 15.645674740484, [17] = 16.232525951557, [18] = 19.255363321799, [19] = 21.497577854671, [20] = 23.307958477509, [21] = 25.793771626298, [22] = 27.731487889273, [23] = 30.167474048443, [24] = 32.564705882353, [25] = 34.873356401384, [26] = 37.58062283737, [27] = 40.088581314879, [28] = 43.011764705883, [29] = 46.267128027681, [30] = 49.544636678201, [31] = 52.357093425605, [32] = 55.496193771627, [33] = 58.884429065743, [34] = 62.305882352941, [35] = 65.467128027682, [36] = 66.762629757786, [37] = 72.664359861592, [38] = 76.423529411764, [39] = 80.642214532872, [40] = 84.417993079585} , [ 4] = {[1] = 0.28788927335638, [2] = 0.60899653979245, [3] = 1.123875432526, [4] = 1.2456747404844, [5] = 2.3750865051903, [6] = 3.1501730103806, [7] = 3.2885813148789, [8] = 5.1377162629759, [9] = 5.0159169550175, [10] = 6.1397923875433, [11] = 8.4207612456749, [12] = 8.4373702422145, [13] = 11.111418685121, [14] = 11.305190311419, [15] = 14.42214532872, [16] = 16.00553633218, [17] = 17.898961937716, [18] = 19.593079584775, [19] = 21.802076124567, [20] = 23.97785467128, [21] = 26.319723183391, [22] = 28.395847750865, [23] = 30.842906574395, [24] = 33.179238754325, [25] = 33.162629757785, [26] = 38.793079584775, [27] = 41.251211072664, [28] = 44.384775086505, [29] = 46.920415224913, [30] = 49.821453287197, [31] = 49.699653979238, [32] = 56.525951557093, [33] = 59.582006920415, [34] = 62.953633217993, [35] = 66.491349480969, [36] = 69.635986159169, [37] = 69.480968858131, [38] = 77.840830449826, [39] = 81.588927335639, [40] = 85.287197231834} , -- Engine 7 P&LE GP7 #1501 is pulling three P&LE passenger cars [ 7] = {[1] = 0.32110726643599, [2] = 0.70865051903115, [3] = 1.3453287197232, [4] = 1.522491349481, [5] = 2.7903114186851, [6] = 3.604152249135, [7] = 4.6892733564014, [8] = 5.6193771626298, [9] = 6.9314878892734, [10] = 8.0664359861592, [11] = 9.5723183391003, [12] = 10.790311418685, [13] = 9.9820069204153, [14] = 13.110034602076, [15] = 12.921799307958, [16] = 17.699653979239, [17] = 19.548788927336, [18] = 20.982698961938, [19] = 23.363321799308, [20] = 25.771626297578, [21] = 27.681660899654, [22] = 29.840830449827, [23] = 33.107266435986, [24] = 35.510034602076, [25] = 37.757785467128, [26] = 40.669896193771, [27] = 43.825605536332, [28] = 46.815224913495, [29] = 49.478200692042, [30] = 52.927335640138, [31] = 55.800692041523, [32] = 59.21660899654, [33] = 62.898269896193, [34] = 66.491349480969, [35] = 68.860899653979, [36] = 73.201384083045, [37] = 77.038062283737, [38] = 80.946712802768, [39] = 81.062975778547, [40] = 86.244982698962} , [ 8] = {[1] = 0.25511854693349, [2] = 0.63779636733372, [3] = 1.114757128992, [4] = 1.6693626658039, [5] = 2.3016129777695, [6] = 3.1057910061469, [7] = 4.0652585848316, [8] = 4.9304432222582, [9] = 6.084022738827, [10] = 7.193233812451, [11] = 9.1898137449738, [12] = 9.4172020150668, [13] = 12.223506031335, [14] = 14.059250358183, [15] = 13.837408143458, [16] = 15.506770809262, [17] = 18.906502749919, [18] = 21.324582890419, [19] = 23.4154457642, [20] = 25.74478901881, [21] = 27.669270231548, [22] = 29.915422655636, [23] = 32.344594906873, [24] = 35.062162037251, [25] = 36.958912973148, [26] = 40.303184360124, [27] = 43.458889864584, [28] = 46.437121597264, [29] = 49.498544160466, [30] = 56.048435550215, [31] = 53.34750658594, [32] = 56.076165827056, [33] = 62.337662337662, [34] = 66.247631372187, [35] = 66.669131580164, [36] = 73.008272865924, [37] = 77.794518648611, [38] = 81.038961038961, [39] = 84.305587650783, [40] = 87.239450940518} , [ 9] = {[1] = 0.15501730103806, [2] = 0.83044982698962, [3] = 1.4062283737024, [4] = 1.2346020761246, [5] = 3.2166089965398, [6] = 4.3072664359862, [7] = 3.3439446366782, [8] = 4.2131487889273, [9] = 5.6525951557094, [10] = 6.2062283737024, [11] = 8.2269896193772, [12] = 9.444982698962, [13] = 10.856747404844, [14] = 12.534256055363, [15] = 13.896193771626, [16] = 14.527335640138, [17] = 17.444982698962, [18] = 18.978546712803, [19] = 21.397923875433, [20] = 23.18615916955, [21] = 25.59446366782, [22] = 27.404844290658, [23] = 29.813148788927, [24] = 30.710034602076, [25] = 35.321799307959, [26] = 37.647058823529, [27] = 42.945328719723, [28] = 46.206228373702, [29] = 47.346712802768, [30] = 52.866435986159, [31] = 55.773010380623, [32] = 58.729411764706, [33] = 62.42214532872, [34] = 65.788235294118, [35] = 69.730103806228, [36] = 73.002076124567, [37] = 77.170934256055, [38] = 81.500346020761, [39] = 85.248442906574, [40] = 89.112802768166} , [10] = {[1] = 0.14292913097242, [2] = 0.6486783636446, [3] = 1.0994548536349, [4] = 1.2258921618031, [5] = 1.8470841541071, [6] = 3.265380915296, [7] = 4.0349993128406, [8] = 4.1229557011311, [9] = 5.1509459892805, [10] = 6.1294608090154, [11] = 7.2728938567959, [12] = 9.7961427458886, [13] = 9.8840991341794, [14] = 11.225434055614, [15] = 12.753676302167, [16] = 14.479820422374, [17] = 16.079527234413, [18] = 17.838655000229, [19] = 23.572312061936, [20] = 21.664757890879, [21] = 27.750240505749, [22] = 28.327454303907, [23] = 32.620825507353, [24] = 34.929680699986, [25] = 37.678317834074, [26] = 40.135599431949, [27] = 42.779788354941, [28] = 40.94369874937, [29] = 46.825782216318, [30] = 49.98121764625, [31] = 52.790324797289, [32] = 53.032204865088, [33] = 60.035732282743, [34] = 63.004260387558, [35] = 66.291630399927, [36] = 69.661459526318, [37] = 69.370103990104, [38] = 77.901873654313, [39] = 81.711484722159, [40] = 85.839937697558} , [11] = {[1] = 0.12139605462821, [2] = 0.57663125948406, [3] = 0.95978755690441, [4] = 1.4681335356601, [5] = 2.0789074355084, [6] = 2.9135053110774, [7] = 3.6342943854325, [8] = 4.6168437025796, [9] = 5.5576631259484, [10] = 6.5857359635812, [11] = 7.6289833080425, [12] = 9.0364188163885, [13] = 11.733687405159, [14] = 11.820940819423, [15] = 13.482549317147, [16] = 15.056904400607, [17] = 16.919575113809, [18] = 18.63808801214, [19] = 20.641122913505, [20] = 22.670713201821, [21] = 25.064491654021, [22] = 27.086494688923, [23] = 29.385432473445, [24] = 31.62746585736, [25] = 32.272382397572, [26] = 36.672989377845, [27] = 39.650986342944, [28] = 42.264795144158, [29] = 44.878603945372, [30] = 46.077389984825, [31] = 51.054628224583, [32] = 54.389226100152, [33] = 57.799696509863, [34] = 60.864946889227, [35] = 61.562974203339, [36] = 67.697268588771, [37] = 71.198786039454, [38] = 74.795144157815, [39] = 78.793626707132, [40] = 79.981031866464} , [12] = {[1] = 0.21075010398854, [2] = 0.52132920460323, [3] = 1.0759347414152, [4] = 1.9910338771549, [5] = 2.2627905901927, [6] = 3.0836067846744, [7] = 4.4534824605999, [8] = 5.479502703702, [9] = 5.7734436382123, [10] = 7.0767666497204, [11] = 8.2913527753385, [12] = 9.428294125803, [13] = 11.042196237926, [14] = 14.031520081342, [15] = 14.103618801128, [16] = 14.824605998983, [17] = 17.725192956511, [18] = 19.749503165873, [19] = 23.054952165272, [20] = 25.179091371262, [21] = 27.785737394278, [22] = 27.8689282248, [23] = 30.508850580025, [24] = 32.97129916347, [25] = 35.372741137866, [26] = 39.987059204141, [27] = 42.676896057679, [28] = 45.904700281924, [29] = 46.847529694505, [30] = 47.696076165827, [31] = 52.737440495448, [32] = 55.876507833804, [33] = 61.916162129686, [34] = 65.387992790128, [35] = 69.21477099413, [36] = 72.559042381106, [37] = 76.258261311642, [38] = 76.801774737718, [39] = 78.099551693858, [40] = 84.571798308454} , -- Engine 13 P&LE GP7 #1500 is pulling three P&LE passenger cars [13] = {[1] = 0.16055363321799, [2] = 0.5038062283737, [3] = 1.0629757785467, [4] = 1.6166089965398, [5] = 1.8934256055363, [6] = 2.9674740484429, [7] = 3.8477508650519, [8] = 4.8941176470588, [9] = 5.8574394463668, [10] = 6.9647058823529, [11] = 8.0885813148789, [12] = 9.5391003460208, [13] = 10.928719723183, [14] = 12.561937716263, [15] = 14.195155709343, [16] = 15.856055363322, [17] = 17.57785467128, [18] = 19.415916955017, [19] = 21.331487889273, [20] = 23.147404844291, [21] = 23.889273356401, [22] = 27.543252595156, [23] = 30.200692041522, [24] = 32.680968858131, [25] = 35.593079584775, [26] = 38.062283737024, [27] = 40.321107266436, [28] = 43.98615916955, [29] = 46.184083044983, [30] = 47.263667820069, [31] = 52.196539792388, [32] = 55.507266435986, [33] = 58.884429065744, [34] = 59.836678200692, [35] = 66.120415224914, [36] = 69.408996539792, [37] = 73.212456747405, [38] = 76.456747404844, [39] = 80.586851211072, [40] = 83.847750865053} , [14] = {[1] = 0.23293432546102, [2] = 0.43259231871338, [3] = 0.99828996626149, [4] = 1.6249942228589, [5] = 2.2905208670333, [6] = 3.017054120257, [7] = 3.8378703147387, [8] = 4.1817257475621, [9] = 5.9010029116791, [10] = 7.0601284836161, [11] = 8.1360632250312, [12] = 8.6740305957389, [13] = 10.79262374636, [14] = 12.578453574895, [15] = 14.197901742386, [16] = 15.861718352821, [17] = 17.403521745159, [18] = 19.372371400841, [19] = 21.612977769561, [20] = 23.481998428618, [21] = 25.933354901327, [22] = 26.415861718353, [23] = 30.314738642141, [24] = 32.993483384943, [25] = 35.638951795535, [26] = 38.007117437722, [27] = 40.69695429126, [28] = 43.658547857836, [29] = 44.429449554005, [30] = 49.376530942367, [31] = 52.693072052503, [32] = 55.715672228128, [33] = 59.109858113417, [34] = 62.498497943338, [35] = 65.615381060221, [36] = 69.580810648426, [37] = 70.540278227111, [38] = 77.234367056431, [39] = 80.817118824235, [40] = 84.63835097287} , [15] = {[1] = 0.21629615935665, [2] = 0.53796737070759, [3] = 1.0149281323659, [4] = 1.669362665804, [5] = 2.2073300365115, [6] = 3.0447843970976, [7] = 3.9210611452604, [8] = 4.8250681702639, [9] = 5.8344502472616, [10] = 6.9935758191986, [11] = 8.1804316679761, [12] = 9.6057678975828, [13] = 11.025558071821, [14] = 12.461986412164, [15] = 13.992697693765, [16] = 15.878356518926, [17] = 17.558811295466, [18] = 19.372371400841, [19] = 21.418865831677, [20] = 23.481998428618, [21] = 25.617229745344, [22] = 27.785737394279, [23] = 30.392383417295, [24] = 32.721726671905, [25] = 35.356102971761, [26] = 38.012663493091, [27] = 40.66922401442, [28] = 43.46998197532, [29] = 46.315108379165, [30] = 49.39871516384, [31] = 52.510052225355, [32] = 55.82659333549, [33] = 58.993390950686, [34] = 62.287747839349, [35] = 65.981420714517, [36] = 69.56971853769, [37] = 73.119193973287, [38] = 76.890511623608, [39] = 81.271895364422, [40] = 84.654989138975} , [16] = {[1] = 0.022184221472248, [2] = 0.4714147062904, [3] = 1.014928132366, [4] = 1.5140731154966, [5] = 1.9300272681061, [6] = 2.5844618015441, [7] = 3.8434163701067, [8] = 4.170633636826, [9] = 5.8178120811572, [10] = 7.0323982067753, [11] = 8.1915237787124, [12] = 9.4393862365397, [13] = 11.064380459398, [14] = 12.323335027962, [15] = 14.048158247447, [16] = 15.789619633036, [17] = 17.66418634746, [18] = 19.450016175995, [19] = 20.026805934279, [20] = 23.232425937052, [21] = 24.042150020798, [22] = 27.885566390905, [23] = 30.115080648887, [24] = 33.736654804271, [25] = 34.823681656422, [26] = 38.228959652447, [27] = 40.552756851689, [28] = 41.417941489115, [29] = 46.320654434533, [30] = 49.099228173961, [31] = 52.193927069371, [32] = 53.280953921524, [33] = 59.154226556362, [34] = 62.415307112816, [35] = 63.563340574016, [36] = 66.691315801636, [37] = 73.058187364237, [38] = 76.690853630356, [39] = 77.644775153672, [40] = 81.649027129454} , -- P&LE MP15AD #1594 [17] = {[1] = 0.32167121135082, [2] = 0.57678975828431, [3] = 0.97055968942096, [4] = 1.6083560567547, [5] = 2.2461524240884, [6] = 3.0614225632019, [7] = 3.8212321486344, [8] = 4.7973378934233, [9] = 5.8566344687338, [10] = 6.8050099366825, [11] = 8.1527013911352, [12] = 9.7277811156818, [13] = 11.064380459398, [14] = 12.633914128576, [15] = 14.147987244073, [16] = 15.662060359569, [17] = 17.542173129362, [18] = 19.322456902528, [19] = 21.136017007903, [20] = 23.371077321255, [21] = 25.489670471877, [22] = 27.680362342285, [23] = 30.214909645515, [24] = 32.727272727273, [25] = 35.156444978509, [26] = 37.846281832048, [27] = 40.580487128531, [28] = 43.447797753847, [29] = 46.015621389287, [30] = 49.431991496048, [31] = 52.687525997134, [32] = 55.593659010029, [33] = 58.732726348385, [34] = 62.054813513888, [35] = 65.670841613903, [36] = 69.431067153488, [37] = 72.925082035402, [38] = 76.82395895919, [39] = 80.301335675001, [40] = 84.699357581919} , [170] = {[1] = 0.0, [2] = 0.022184221472248, [3] = 0.14974349493958, [4] = 0.51578314923489, [5] = 1.064842630679, [6] = 1.8634746036882, [7] = 2.5123630817577, [8] = 3.0558765078339, [9] = 4.00979803115, [10] = 5.1911078245593, [11] = 6.1283911817722, [12] = 6.9048389333085, [13] = 8.635208208162, [14] = 9.655682395896, [15] = 11.940657207562, [16] = 12.988861672136, [17] = 14.164625410177, [18] = 15.623237971992, [19] = 17.420159911264, [20] = 19.633036003143, [21] = 21.807089707447, [22] = 23.931228913435, [23] = 26.30494061099, [24] = 27.54725701345, [25] = 30.697416462542, [26] = 32.960207052734, [27] = 35.589037297222, [28] = 38.961038961038, [29] = 41.978093081296, [30] = 42.832185607986, [31] = 47.291214123955, [32] = 49.69265609835, [33] = 52.998105097749, [34] = 56.298008041781, [35] = 58.194758977676, [36] = 62.215649119564, [37] = 67.867079539677, [38] = 69.858113416831, [39] = 74.866201414243, [40] = 77.323103942321} , [18] = {[1] = 0.26785714285711, [2] = 0.38183890577508, [3] = 0.75797872340424, [4] = 1.265197568389, [5] = 2.3993161094225, [6] = 3.1629939209726, [7] = 4.0064589665653, [8] = 4.9582066869301, [9] = 5.1405775075987, [10] = 9.7169452887537, [11] = 9.4034954407296, [12] = 8.4973404255319, [13] = 10.651595744681, [14] = 12.338525835866, [15] = 15.746580547112, [16] = 17.450607902736, [17] = 17.410714285714, [18] = 17.781155015198, [19] = 21.867401215805, [20] = 25.759878419453, [21] = 28.039513677812, [22] = 30.353343465046, [23] = 32.547492401216, [24] = 33.242781155015, [25] = 35.858662613982, [26] = 38.189589665653, [27] = 41.198708206687, [28] = 44.025455927052, [29] = 47.245440729484, [30] = 50.174772036474, [31] = 52.910334346504, [32] = 56.18161094225, [33] = 59.293313069909, [34] = 63.066109422492, [35] = 66.987082066869, [36] = 70.115881458967, [37] = 73.723404255319, [38] = 77.422112462006, [39] = 81.48556231003, [40] = 81.474164133738} -- these engines have not been tested yet: -- P&LE 2-8-0 #9378 (can't run through balloon) -- NYC 2-8-4 Berk #9401 (can't run through balloon) } -- -- Average stopping distance is all of the individual engine stopping distances -- above, averaged by "Layout.AvgStopDist()" -- Deceleration set to 1 Smph/sec. -- Layout.AverageStoppingDistance1 = {}; -- --[[------------------------------- Stopping Distance for 4 Smph/Sec -----------------------------------------------]]
-- All tables in Lua are 1 based, that is, StoppingDistance[EngineNo][1] is the first item in the list -- Measured stopping distance in inches (from "Deceleration Test.lua") for scale speeds from 1 Smph to 40 Smph -- Table contains a table for each Engine Number -- Deceleration set to 4 Smph/sec. Unless specified, each engine is pulling two freight -- cars and a caboose. -- These table constructors were created using "Deceleration Test.lua" Layout.StoppingDistance4 = { [ 1] = {[1] = 0.21038062283738, [2] = 0.42076124567475, [3] = 0.70311418685122, [4] = 0.9134948096886, [5] = 1.4283737024222, [6] = 1.8934256055363, [7] = 2.319723183391, [8] = 2.801384083045, [9] = 3.1612456747405, [10] = 3.764705882353, [11] = 4.3017301038062, [12] = 4.8442906574394, [13] = 5.3259515570934, [14] = 5.9792387543252, [15] = 6.6269896193772, [16] = 7.4795847750866, [17] = 8.1107266435987, [18] = 8.4761245674739, [19] = 9.3951557093425, [20] = 9.9266435986159, [21] = 10.740484429066, [22] = 11.897577854672, [23] = 12.429065743945, [24] = 13.503114186851, [25] = 14.101038062284, [26] = 15.346712802768, [27] = 16.293425605536, [28] = 16.863667820069, [29] = 17.799307958478, [30] = 18.950865051903, [31] = 19.786851211073, [32] = 20.700346020761, [33] = 22.029065743945, [34] = 23.280276816609, [35] = 24.310034602076, [36] = 24.874740484429, [37] = 26.823529411765, [38] = 27.930795847751, [39] = 28.622837370242, [40] = 30.615916955018} , [ 2] = {[1] = 0.17567341475633, [2] = 0.41659695499419, [3] = 0.78802074619334, [4] = 1.0490212481183, [5] = 1.360214154258, [6] = 1.6613685795547, [7] = 2.1131002175004, [8] = 2.4995817299651, [9] = 3.1320060230886, [10] = 3.377948803748, [11] = 4.1358541074113, [12] = 4.5825665049355, [13] = 5.0844905470977, [14] = 5.6817801572691, [15] = 6.2288773632258, [16] = 6.5852434331605, [17] = 7.3431487368244, [18] = 8.2014388489208, [19] = 8.9041325079473, [20] = 9.6921532541406, [21] = 10.24928894094, [22] = 10.911828676594, [23] = 12.196754224528, [24] = 12.412581562657, [25] = 13.607160783002, [26] = 14.149238748536, [27] = 15.027605822319, [28] = 15.815626568512, [29] = 16.92487870169, [30] = 17.778149573364, [31] = 19.429479672076, [32] = 19.419441191234, [33] = 20.789693826334, [34] = 22.009369248787, [35] = 23.464948971056, [36] = 24.403546929899, [37] = 25.301990965367, [38] = 26.772628408901, [39] = 27.701187886899, [40] = 28.398862305504} , [ 3] = {[1] = 0.15501730103806, [2] = 0.36539792387543, [3] = 0.52595155709342, [4] = 0.81384083044983, [5] = 1.2235294117647, [6] = 1.5114186851211, [7] = 1.8934256055363, [8] = 2.2256055363322, [9] = 2.718339100346, [10] = 3.0892733564014, [11] = 3.6982698961938, [12] = 4.2519031141868, [13] = 4.7058823529411, [14] = 5.2705882352941, [15] = 5.840830449827, [16] = 6.3114186851211, [17] = 7.1916955017301, [18] = 7.7065743944637, [19] = 8.2546712802769, [20] = 9.2678200692041, [21] = 9.7882352941175, [22] = 10.779238754325, [23] = 11.698269896194, [24] = 12.213148788927, [25] = 13.060207612457, [26] = 13.403460207613, [27] = 15.20276816609, [28] = 15.512802768166, [29] = 16.304498269896, [30] = 17.212456747405, [31] = 18.923148096886, [32] = 19.620761245675, [33] = 20.406920415225, [34] = 21.901730103807, [35] = 22.798615916955, [36] = 23.579238754325, [37] = 24.564705882353, [38] = 25.882352941177, [39] = 26.723875432526, [40] = 28.307266435986} , -- Engine 7 P&LE GP7 #1501 is pulling three P&LE passenger cars [ 7] = {[1] = 0.16055363321799, [2] = 0.38754325259516, [3] = 0.55916955017301, [4] = 0.87474048442906, [5] = 1.2124567474048, [6] = 1.522491349481, [7] = 1.9875432525952, [8] = 2.2532871972318, [9] = 2.7515570934256, [10] = 3.2110726643598, [11] = 3.6871972318339, [12] = 4.2574394463668, [13] = 4.7833910034602, [14] = 5.3259515570934, [15] = 5.8740484429066, [16] = 6.4442906574395, [17] = 7.1474048442907, [18] = 7.8782006920416, [19] = 8.4207612456747, [20] = 9.0408304498271, [21] = 13.674740484429, [22] = 10.507958477509, [23] = 11.355017301038, [24] = 12.246366782007, [25] = 12.888581314879, [26] = 13.940484429066, [27] = 15.16955017301, [28] = 15.451903114187, [29] = 16.586851211073, [30] = 17.400692041523, [31] = 18.297577854671, [32] = 19.249826989619, [33] = 20.689273356402, [34] = 21.525259515571, [35] = 22.36678200692, [36] = 23.557093425605, [37] = 24.592387543253, [38] = 25.494809688581, [39] = 27.399307958477, [40] = 28.102422145328} , -- Engine 13 P&LE GP7 #1500 is pulling three P&LE passenger cars [13] = {[1] = 0.033217993079574, [2] = 0.36539792387542, [3] = 0.54809688581314, [4] = 0.8636678200692, [5] = 1.201384083045, [6] = 1.516955017301, [7] = 1.9487889273356, [8] = 2.2975778546712, [9] = 2.7847750865052, [10] = 3.2166089965398, [11] = 3.6650519031142, [12] = 4.3349480968858, [13] = 4.7723183391004, [14] = 5.364705882353, [15] = 5.9072664359863, [16] = 6.5771626297578, [17] = 7.2858131487888, [18] = 7.7840830449826, [19] = 8.3930795847751, [20] = 9.0131487889274, [21] = 9.9432525951558, [22] = 10.723875432526, [23] = 11.393771626298, [24] = 12.02491349481, [25] = 12.921799307958, [26] = 13.768858131488, [27] = 14.981314878893, [28] = 15.9723183391, [29] = 16.559169550173, [30] = 17.904498269896, [31] = 18.768166089966, [32] = 19.487889273357, [33] = 20.611764705882, [34] = 21.741176470588, [35] = 22.737716262976, [36] = 23.357785467128, [37] = 24.453979238754, [38] = 26.541176470589, [39] = 27.426989619377, [40] = 28.501038062283} , [15] = {[1] = 0.14419743957049, [2] = 0.34385543282365, [3] = 0.57678975828548, [4] = 0.85963858205854, [5] = 1.1979479595143, [6] = 1.5584415584417, [7] = 2.0021259878913, [8] = 2.3459814207138, [9] = 2.8340342931091, [10] = 3.1889818366686, [11] = 3.7935018717937, [12] = 4.3148310763965, [13] = 4.775153671951, [14] = 5.3630355409712, [15] = 5.9176410777838, [16] = 6.6552664417424, [17] = 6.9547534316215, [18] = 7.9530433978838, [19] = 8.3745436058594, [20] = 9.1953598003414, [21] = 9.666774506633, [22] = 10.376669593752, [23] = 11.313952950964, [24] = 12.217959975968, [25] = 13.033230115081, [26] = 13.865138420299, [27] = 14.669316448676, [28] = 15.517862919998, [29] = 16.771271433193, [30] = 17.686370568933, [31] = 18.923140916023, [32] = 19.289180570319, [33] = 20.792161575079, [34] = 21.485418496095, [35] = 22.189767527846, [36] = 23.548551093036, [37] = 24.35827517678, [38] = 25.988815455006, [39] = 27.336506909461, [40] = 28.456810093822} }
-- Average stopping distance is all of the individual engine stopping distances -- above, averaged by "Layout.AvgStopDist()" -- Deceleration set to 4 Smph/sec. Layout.AverageStoppingDistance4 = {};
--[[------------------------------- Starting Distance for 1 Smph/Sec -----------------------------------------------]]
-- Measured starting distance in inches (from "Acceleration Test.lua") for scale speeds from 1 Smph to 40 Smph -- Table contains a table for each Engine Number. -- Acceleration set to 1 Smph/sec. -- These table constructors were created using "Acceleration Test.lua"
Layout.StartingDistance1 = { [12] = {[1] = 0.0, [2] = 0.0055460553685016, [3] = 0.0055460553679154, [4] = 0.56015159217997, [5] = 1.0260202431025, [6] = 1.3865138420299, [7] = 2.1130470952537, [8] = 3.1723436705643, [9] = 3.8656005915789, [10] = 4.7307852290054, [11] = 6.1783056800852, [12] = 7.2764246429729, [13] = 8.0085039515641, [14] = 9.3062809077044, [15] = 10.964551462772, [16] = 12.728197069834, [17] = 13.815223921986, [18] = 16.150113231964, [19] = 18.008041780284, [20] = 19.982437491334, [21] = 22.311780745944, [22] = 23.787031473864, [23] = 25.123630817581, [24] = 27.386421407773, [25] = 30.564311133706, [26] = 34.163701067615, [27] = 35.827517678051, [28] = 38.068124046772, [29] = 41.595415260896, [30] = 45.139344641124, [31] = 51.977630910015, [32] = 50.829597448814, [33] = 53.38078291815, [34] = 55.00023108564, [35] = 60.551832509127, [36] = 64.273235661136, [37] = 65.842769330314, [38] = 70.262975458706, [39] = 73.302213800435, [40] = 76.713037851828} , [120] = {[1] = 0.0055460553681194, [2] = 0.0, [3] = 0.24402643619725, [4] = 0.53242131533946, [5] = 1.1757637380413, [6] = 1.6360863335952, [7] = 2.2461524240884, [8] = 2.9227711789989, [9] = 4.2593705227157, [10] = 4.7529694504783, [11] = 6.4056939501779, [12] = 7.3097009751814, [13] = 8.3024448860748, [14] = 10.271294541757, [15] = 11.108748902343, [16] = 13.332717104959, [17] = 13.732033091464, [18] = 15.650968248833, [19] = 17.869390396081, [20] = 20.720062855294, [21] = 22.417155797939, [22] = 24.563479225401, [23] = 25.317742755465, [24] = 28.467902204557, [25] = 31.690160373434, [26] = 33.315154596293, [27] = 36.149188889402, [28] = 38.72255858021, [29] = 41.706336368258, [30] = 45.3001802468, [31] = 45.993437167814, [32] = 50.335998521052, [33] = 52.177288903268, [34] = 56.525396311873, [35] = 59.536904376762, [36] = 63.247215418034, [37] = 67.173822618662, [38] = 69.209224938762, [39] = 72.841891204881, [40] = 77.38411055137} , [121] = {[1] = 0.0055460553681194, [2] = 0.011092110736238, [3] = 0.34940148819152, [4] = 0.56015159218006, [5] = 3.8267782040024, [6] = 1.8357443268475, [7] = 2.6121920783843, [8] = 3.2333502796136, [9] = 4.6365022877478, [10] = 4.736331284374, [11] = 6.1616675139807, [12] = 6.8771086564681, [13] = 8.8570504228868, [14] = 9.6556823958959, [15] = 11.114294957711, [16] = 12.855756343301, [17] = 14.342099181957, [18] = 15.623237971992, [19] = 17.93039700513, [20] = 19.389009566946, [21] = 21.213661783057, [22] = 24.574571336137, [23] = 26.903914590747, [24] = 29.227711789989, [25] = 31.712344594907, [26] = 34.385543282341, [27] = 36.099274391089, [28] = 38.694828303369, [29] = 41.517770485742, [30] = 43.392337200166, [31] = 47.435411563526, [32] = 50.380366963997, [33] = 52.249387623053, [34] = 58.094929981051, [35] = 59.503628044553, [36] = 64.212229052086, [37] = 66.402920922494, [38] = 70.412718953645, [39] = 73.213476914545, [40] = 78.803900725609} , [122] = {[1] = 0.0, [2] = 0.016638166103746, [3] = 0.87073069279437, [4] = 0.77090169616838, [5] = 1.1646716273056, [6] = 2.8173961270054, [7] = 2.4569025280768, [8] = 3.1279752276192, [9] = 4.4091140176557, [10] = 5.4129500392848, [11] = 6.0230161297777, [12] = 7.8032999029442, [13] = 9.0067939178252, [14] = 9.7998798354676, [15] = 11.546887276424, [16] = 12.994407727504, [17] = 13.676572537782, [18] = 16.638166104358, [19] = 17.580995516938, [20] = 19.283634514951, [21] = 21.513148772935, [22] = 24.141979017424, [23] = 25.794703517123, [24] = 28.967047187688, [25] = 31.196561445672, [26] = 33.453805980497, [27] = 36.182465221612, [28] = 37.879558164255, [29] = 41.478948098165, [30] = 43.819383463512, [31] = 48.766464851874, [32] = 52.931552433331, [33] = 69.597448814531, [34] = 55.676849840551, [35] = 58.388870915561, [36] = 61.988260849471, [37] = 67.573138605167, [38] = 69.614086980635, [39] = 74.294957711328, [40] = 78.570966400148} } -- Average starting distance is all of the individual engine starting distances -- above, averaged by "Layout.AvgStartDist()" -- Acceleration set to 1 Smph/sec. -- Layout.AverageStartingDistance1 = {};
--[[------------------------------- Starting Distance for 4 Smph/Sec -----------------------------------------------]]
-- All tables in Lua are 1 based, that is, StartingDistance[EngineNo][1] is the first item in the list -- Measured starting distance in inches (from "Acceleration Test.lua") for scale speeds from 1 Smph to 40 Smph -- Table contains a table for each Engine Number -- Acceleration set to 4 Smph/sec. Unless specified, each engine is pulling two freight -- cars and a caboose. -- These table constructors were created using "Acceleration Test.lua"
Layout.StartingDistance4 = { [12] = {[1] = 0.016638166103746, [2] = 0.0055460553679154, [3] = 0.077644775153161, [4] = 0.17747377177798, [5] = 0.27730276840515, [6] = 0.7986319730103, [7] = 0.78199380690421, [8] = 0.95392152331662, [9] = 1.6139021121244, [10] = 1.6749087211714, [11] = 1.6416323889639, [12] = 2.6787447428016, [13] = 2.8784027360536, [14] = 2.9116790682611, [15] = 3.8489624254763, [16] = 3.9155150898913, [17] = 4.1373573046173, [18] = 4.1872718029285, [19] = 5.5405093127515, [20] = 5.6458843647442, [21] = 5.8178120811566, [22] = 7.7367472385281, [23] = 7.6369182419009, [24] = 9.0511623607709, [25] = 9.2397282432871, [26] = 10.071636548505, [27] = 11.502518833481, [28] = 10.981189628876, [29] = 11.585709664002, [30] = 12.883486620141, [31] = 13.42145399085, [32] = 13.537921153579, [33] = 20.991819568334, [34] = 15.717520913251, [35] = 15.573323473681, [36] = 17.974765448075, [37] = 19.594213615565, [38] = 19.594213615565, [39] = 20.14327309701, [40] = 22.223043860053} , [17] = {[1] = 0.0, [2] = 0.0055460553681198, [3] = 0.011092110736238, [4] = 0.14974349493923, [5] = 0.14974349493923, [6] = 0.15528955030735, [7] = 0.78199380690485, [8] = 0.9982899662615, [9] = 1.5695336691778, [10] = 1.902296991265, [11] = 1.8412903822157, [12] = 2.0076720432592, [13] = 2.834034293109, [14] = 2.8118500716366, [15] = 3.8822387576836, [16] = 4.2316402458751, [17] = 4.2371863012432, [18] = 5.2798447104497, [19] = 5.6070619771687, [20] = 5.2077459906641, [21] = 7.1821417017147, [22] = 7.5315431899063, [23] = 7.6313721865323, [24] = 7.060128483616, [25] = 9.3395572399131, [26] = 9.6224060636873, [27] = 10.714978971207, [28] = 11.435966169062, [29] = 11.652262328419, [30] = 11.61898599621, [31] = 15.024263992235, [32] = 13.759763368304, [33] = 14.025974025974, [34] = 16.349771225216, [35] = 16.355317280584, [36] = 16.33867911448, [37] = 19.128344964644, [38] = 19.971345380598, [39] = 19.427831954522, [40] = 22.311780745944} }
-- Average starting distance is all of the individual engine starting distances -- above, averaged by "Layout.AvgStartDist()" -- Acceleration set to 4 Smph/sec. Layout.AverageStartingDistance4 = {};
--[[-------------------------------Stations-----------------------------------------------]] ALIQUIPPA = 101; COLLEGE = 102; STRUTHERS = 103; --J_L = 104; MCKEES_ROCKS = 105; WEST_ALIQUIPPA = 106; MCKEES_ROCKS_YARD1 = 107 MCKEES_ROCKS_YARD2 = 108 YOUNGSTOWN = 109 --J_LTHRU = 110 --MILL = 111 YOUNGSTOWN_YARD1 = 112 YOUNGSTOWN_YARD2 = 113 NEWCASTLE = 114
--[[-------------------------------Station Names-------------------------------------------]]
StationNames = { [ALIQUIPPA] = "Aliquippa", [COLLEGE] = "College", [STRUTHERS] = "Struthers", --[J_L] = "J&L", [MCKEES_ROCKS] = "McKees Rocks", [WEST_ALIQUIPPA] = "West Aliquippa", [MCKEES_ROCKS_YARD1] = "McKees Rocks Yard 1", [MCKEES_ROCKS_YARD2] = "McKees Rocks Yard 2", [YOUNGSTOWN] = "Youngstown", --[J_LTHRU] = "J&L Thru", --[MILL] = "Mill", [YOUNGSTOWN_YARD1] = "Youngstown Yard 1", [YOUNGSTOWN_YARD2] = "Youngstown Yard 2", [NEWCASTLE] = "New Castle", }; --[[------------------Layout Tag Detectors & Readers-----------------------------------]] -- ALIQUIPPA_WEST_DETECTOR = 1; ALIQUIPPA_WEST_READER = 0; ALIQUIPPA_EAST_DETECTOR = 5; ALIQUIPPA_EAST_READER = 1; COLLEGE_WEST_DETECTOR = 2; COLLEGE_WEST_READER = 1; COLLEGE_EAST_DETECTOR = 4; COLLEGE_EAST_READER = 1; STRUTHERS_WEST_DETECTOR = 4; STRUTHERS_WEST_READER = 0; STRUTHERS_EAST_DETECTOR = 2; STRUTHERS_EAST_READER = 0; YOUNGSTOWN_YARD_DETECTOR = 5; YOUNGSTOWN_YARD_READER = 0; MCKEES_ROCKS_YARD_DETECTOR = 3; MCKEES_ROCKS_YARD_READER = 0; MONACA_EAST_DETECTOR = 6; MONACA_EAST_READER = 0; MONACA_WEST_DETECTOR = 6; MONACA_WEST_READER = 1; LOWELLVILLE_DETECTOR = 9; LOWELLVILLE_READER = 0; -- Detector 7 not used -- Detector 8 not used WEST_ALIQUIPPA_DETECTOR = 10; WEST_ALIQUIPPA_READER = 0; FALLSTON_DETECTOR = 10; FALLSTON_READER = 1; --NEW_DETECTOR = 100; --NEW_READER = 0; -- Combined values using the Detector # and the Reader # ALIQUIPPA_WEST_TAG = ((ALIQUIPPA_WEST_DETECTOR * 10) + ALIQUIPPA_WEST_READER); ALIQUIPPA_EAST_TAG = ((ALIQUIPPA_EAST_DETECTOR * 10) + ALIQUIPPA_EAST_READER); COLLEGE_WEST_TAG = ((COLLEGE_WEST_DETECTOR * 10) + COLLEGE_WEST_READER); COLLEGE_EAST_TAG = ((COLLEGE_EAST_DETECTOR * 10) + COLLEGE_EAST_READER); STRUTHERS_WEST_TAG = ((STRUTHERS_WEST_DETECTOR * 10) + STRUTHERS_WEST_READER); STRUTHERS_EAST_TAG = ((STRUTHERS_EAST_DETECTOR * 10) + STRUTHERS_EAST_READER); YOUNGSTOWN_YARD_TAG = ((YOUNGSTOWN_YARD_DETECTOR * 10) + YOUNGSTOWN_YARD_READER); MCKEES_ROCKS_YARD_TAG = ((MCKEES_ROCKS_YARD_DETECTOR * 10) + MCKEES_ROCKS_YARD_READER); MONACA_EAST_TAG = ((MONACA_EAST_DETECTOR * 10) + MONACA_EAST_READER); MONACA_WEST_TAG = ((MONACA_WEST_DETECTOR * 10) + MONACA_WEST_READER); LOWELLVILLE_TAG = ((LOWELLVILLE_DETECTOR * 10) + LOWELLVILLE_READER); WEST_ALIQUIPPA_TAG = ((WEST_ALIQUIPPA_DETECTOR * 10) + WEST_ALIQUIPPA_READER); FALLSTON_TAG = ((FALLSTON_DETECTOR * 10) + FALLSTON_READER); --NEW_TAG = ((NEW_DETECTOR * 10) + NEW_READER);
--[[-------------------------------Switches AIU and Channel-----------------------------]]
COLLEGE_WEST = 1; COLLEGE_WEST_AIU = 1; COLLEGE_WEST_CHAN = 1; COLLEGE_EAST = 2; COLLEGE_EAST_AIU = 1; COLLEGE_EAST_CHAN = 2;
YOUNGSTOWN_YARD = 3; YOUNGSTOWN_YARD_AIU = 1; YOUNGSTOWN_YARD_CHAN = 3;
MCKEES_ROCKS_YARD = 4; MCKEES_ROCKS_YARD_AIU = 1; MCKEES_ROCKS_YARD_CHAN = 4;
ALIQUIPPA_EAST = 5; ALIQUIPPA_EAST_AIU = 1; ALIQUIPPA_EAST_CHAN = 5;
J_L_SLAG_TRACK = 6; J_L_SLAG_TRACK_AIU = 1; J_L_SLAG_TRACK_CHAN = 6;
HOLE_TRACK = 7; HOLE_TRACK_AIU = 1; HOLE_TRACK_CHAN = 7
J_L_MILL_TRACK = 8; J_L_MILL_TRACK_AIU = 1; J_L_MILL_TRACK_CHAN = 8;
ALIQUIPPA_WEST = 9; ALIQUIPPA_WEST_AIU = 1; ALIQUIPPA_WEST_CHAN = 9;
ALIQUIPPA_TEAM_TRACK = 10; ALIQUIPPA_TEAM_TRACK_AIU = 1; ALIQUIPPA_TEAM_TRACK_CHAN = 10;
BYPASS_WEST = 11; BYPASS_WEST_AIU = 2; BYPASS_WEST_CHAN = 1; BYPASS_EAST = 12; BYPASS_EAST_AIU = 2; BYPASS_EAST_CHAN = 2;
--AIU2 CHAN3 NC --AIU2 CHAN4 NC
STRUTHERS_WEST = 15; STRUTHERS_WEST_AIU = 2; STRUTHERS_WEST_CHAN = 5; STRUTHERS_EAST = 16; STRUTHERS_EAST_AIU = 2; STRUTHERS_EAST_CHAN = 6;
CAMPBELL_YARD = 17; CAMPBELL_YARD_AIU = 2; CAMPBELL_YARD_CHAN = 7;
MONACA_CUTOFF = 18; MONACA_CUTOFF_AIU = 2; MONACA_CUTOFF_CHAN = 8;
-- AIU2 CHAN9 - two switches connected to this channel BALLOON = 19; BALLOON_AIU = 2; BALLOON_CHAN = 9; PM_MOORE_TRESTLE = 20; PM_MOORE_TRESTLE_AIU = 2; PM_MOORE_TRESTLE_CHAN = 10;
--[[-------------------------------Switch Names-------------------------------------------]]
SwitchName = { [COLLEGE_WEST] = "College West", [COLLEGE_EAST] = "College East", [YOUNGSTOWN_YARD] = "Youngstown Yard", [MCKEES_ROCKS_YARD] = "McKees Rocks Yard", [ALIQUIPPA_EAST] = "Aliquippa East", [J_L_SLAG_TRACK] = "J&L Slag Track", [HOLE_TRACK] = "Hole", [J_L_MILL_TRACK] = "J&L Mill", [ALIQUIPPA_WEST] = "Aliquippa West", [ALIQUIPPA_TEAM_TRACK] = "Aliquippa Team", [BYPASS_WEST] = "Bypass West", [BYPASS_EAST] = "Bypass East", [STRUTHERS_WEST] = "Struthers West", [STRUTHERS_EAST] = "Struthers East", [CAMPBELL_YARD] = "Campbell Yard", [MONACA_CUTOFF] = "Monaca Cutoff", [PM_MOORE_TRESTLE] = "PM Moore Trestle", [BALLOON] = "Lionel-Ives Switch", };
--[[----------------------------------Superior Direction-----------------------------------]] SuperiorDirection = WB; --[[----------------------------------Blocks-------------------------------------------]] -- Real physical blocks are numbered from 1 to 100 but must be sequential starting at 1 FIRST_BLOCK = 1; -- FIRST_BLOCK is the lowest physical block number YOUNGSTOWN_YARD2_BLOCK = 1; YOUNGSTOWN_YARD1_BLOCK = 2; YOUNGSTOWN_BLOCK = 3; STRUTHERS_THRU_TRACK = 4 STRUTHERS_BLOCK = 4; STRUTHERS_STATION_TRACK = 5; NEW_CASTLE_BLOCK = 6; COLLEGE_THRU_TRACK = 7; COLLEGE_BLOCK = 7; COLLEGE_STATION_TRACK = 8; ALIQUIPPA_BLOCK = 9; J_L_PASSING_TRACK = 10; J_L_THRU_TRACK = 11; J_L_BLOCK = 11; MCKEES_ROCKS_BLOCK = 12; MCKEES_ROCKS_YARD2_BLOCK = 13; MCKEES_ROCKS_YARD1_BLOCK = 14; LIONEL_IVES_BLOCK = 15; -- AKA BALLOON_TRACK BALLOON_TRACK = 15; -- AKA LIONEL_IVES_BLOCK MONACA_BLOCK = 16; BEAVER_FALLS_BLOCK = 17; LOWELLVILLE_BLOCK = 18; WEST_ALIQUIPPA_BLOCK = 19; FALLSTON_BLOCK = 20; --NEW_BLOCK = 0; LAST_BLOCK = 20; -- LAST_BLOCK is the highest physical block number used
-- Simulated blocks can be numbered from 101 to 200 CLEVELAND_EL = 101; ASHTABULA_NYC = 103; CUMBERLAND_B_O = 102; POINTS_SOUTH_N_W = 104; --[[----------------------------------Block Names---------------------------------------]]
BlockName = { [YOUNGSTOWN_YARD2_BLOCK] = "Youngstown Yard 2 Block", [YOUNGSTOWN_YARD1_BLOCK] = "Youngstown Yard 1 Block", [YOUNGSTOWN_BLOCK] = "Youngstown Block", [STRUTHERS_THRU_TRACK] = "Struthers Thru Track", [STRUTHERS_STATION_TRACK] = "Struthers Station Track", [NEW_CASTLE_BLOCK] = "New Castle Block", [COLLEGE_THRU_TRACK] = "College Thru Track", [COLLEGE_STATION_TRACK] = "College Station Track", [ALIQUIPPA_BLOCK] = "Aliquippa Block", [J_L_PASSING_TRACK] = "J&L Passing Track", [J_L_THRU_TRACK] = "J&L Thru Track", [MCKEES_ROCKS_BLOCK] = "McKees Rocks Block", [MCKEES_ROCKS_YARD2_BLOCK] = "McKees Rocks Yard 2 Block", [MCKEES_ROCKS_YARD1_BLOCK] = "McKees Rocks Yard 1 Block", [LIONEL_IVES_BLOCK] = "Lionel-Ives Block", -- AKA Balloon Track [CLEVELAND_EL] = "Cleveland via Erie-Lackawanna (simulated)", [ASHTABULA_NYC] = "Ashtabula via New York Central (simulated)", [CUMBERLAND_B_O] = "Cumberland via Baltimore & Ohio (simulated)", [POINTS_SOUTH_N_W] = "South via Norfolk & Western (simulated)", [MONACA_BLOCK] = "Monaca Block", [BEAVER_FALLS_BLOCK] = "Beaver Falls Block", [LOWELLVILLE_BLOCK] = "Lowellville Block", [WEST_ALIQUIPPA_BLOCK] = "West Aliquippa Block", [FALLSTON_BLOCK] = "Fallston Block", --[NEW_BLOCK] = "New Block", };
--[[-------------------------Tags and which block is on each side of the tag -----------------------]] NextBlock = { [EB] = { [YOUNGSTOWN_YARD_TAG] = YOUNGSTOWN_BLOCK, [STRUTHERS_WEST_TAG] = STRUTHERS_STATION_TRACK, [STRUTHERS_EAST_TAG] = LOWELLVILLE_BLOCK, [LOWELLVILLE_TAG] = NEW_CASTLE_BLOCK, [COLLEGE_WEST_TAG] = COLLEGE_STATION_TRACK, [COLLEGE_EAST_TAG] = BEAVER_FALLS_BLOCK, [FALLSTON_TAG] = FALLSTON_BLOCK, [MONACA_WEST_TAG] = MONACA_BLOCK, [MONACA_EAST_TAG] = WEST_ALIQUIPPA_BLOCK; [WEST_ALIQUIPPA_TAG] = ALIQUIPPA_BLOCK, [ALIQUIPPA_WEST_TAG] = J_L_PASSING_TRACK, [ALIQUIPPA_EAST_TAG] = MCKEES_ROCKS_BLOCK, [MCKEES_ROCKS_YARD_TAG] = BALLOON_TRACK, --[NEW_TAG] = NEW_BLOCK, }, [WB] = { [YOUNGSTOWN_YARD_TAG] = BALLOON_TRACK, [STRUTHERS_WEST_TAG] = YOUNGSTOWN_BLOCK, [STRUTHERS_EAST_TAG] = STRUTHERS_THRU_TRACK, [LOWELLVILLE_TAG] = LOWELLVILLE_BLOCK, [COLLEGE_WEST_TAG] = NEW_CASTLE_BLOCK, [COLLEGE_EAST_TAG] = COLLEGE_THRU_TRACK, [FALLSTON_TAG] = BEAVER_FALLS_BLOCK, [MONACA_WEST_TAG] = FALLSTON_BLOCK, [MONACA_EAST_TAG] = MONACA_BLOCK, [WEST_ALIQUIPPA_TAG] = WEST_ALIQUIPPA_BLOCK, [ALIQUIPPA_WEST_TAG] = ALIQUIPPA_BLOCK, [ALIQUIPPA_EAST_TAG] = J_L_THRU_TRACK, [MCKEES_ROCKS_YARD_TAG] = MCKEES_ROCKS_BLOCK, --[NEW_TAG] = NEW_BLOCK, }, };
--[[---------------------------------Next Signals---------------------------------------]] SignalNames = { [1] = "LI", [2] = "YG", [5] = "YG", [6] = "ST", [9] = "ST", [10] = "LO", [11] = "LO", [12] = "NC"; [13] = "NC", [14] = "CO", [17] = "CO", [18] = "BF", [19] = "BF", [20] = "FS", [21] = "FS", [22] = "MO", [25] = "MO", [26] = "QA", [27] = "QA", [28] = "AL", [29] = "AL", [30] = "JL", [33] = "JL", [34] = "MK", [37] = "MK", [38] = "LI", } NextSignal = { [EB] = { [YOUNGSTOWN_BLOCK] = { [HOMESIGNAL] = 6, [DISTANTSIGNAL] = 10, }, [STRUTHERS_BLOCK] = { -- AKA STRUTHERS_THRU_TRACK [HOMESIGNAL] = 10, [DISTANTSIGNAL] = 12, }, [STRUTHERS_STATION_TRACK] = { [HOMESIGNAL] = 10, [DISTANTSIGNAL] = 12, }, [LOWELLVILLE_BLOCK] = { [HOMESIGNAL] = 12, [DISTANTSIGNAL] = 14, }; [NEW_CASTLE_BLOCK] = { [HOMESIGNAL] = 14, [DISTANTSIGNAL] = 18, }, [COLLEGE_BLOCK] = { -- AKA COLLEGE_THRU_TRACK [HOMESIGNAL] = 18, [DISTANTSIGNAL] = 22, }, [COLLEGE_STATION_TRACK] = { [HOMESIGNAL] = 18, [DISTANTSIGNAL] = 22, }, [BEAVER_FALLS_BLOCK] = { [HOMESIGNAL] = 20, [DISTANTSIGNAL] = 22, }, [FALLSTON_BLOCK] = { [HOMESIGNAL] = 22, [DISTANTSIGNAL] = 26, }, [MONACA_BLOCK] = { [HOMESIGNAL] = 26, [DISTANTSIGNAL] = 28, }, [WEST_ALIQUIPPA_BLOCK] = { [HOMESIGNAL] = 28, [DISTANTSIGNAL] = 30, }, [ALIQUIPPA_BLOCK] = { [HOMESIGNAL] = 30, [DISTANTSIGNAL] = 34, }, [J_L_BLOCK] = { -- AKA J_L_THRU_TRACK [HOMESIGNAL] = 34, [DISTANTSIGNAL] = 38, }, [J_L_PASSING_TRACK] = { [HOMESIGNAL] = 34, [DISTANTSIGNAL] = 38, }, [MCKEES_ROCKS_BLOCK] = { [HOMESIGNAL] = 38, [DISTANTSIGNAL] = 2, }, [LIONEL_IVES_BLOCK] = { [HOMESIGNAL] = 2, [DISTANTSIGNAL] = 6, }, [YOUNGSTOWN_YARD2_BLOCK] = { [HOMESIGNAL] = 2, [DISTANTSIGNAL] = 6, }, [YOUNGSTOWN_YARD1_BLOCK] = { [HOMESIGNAL] = 2, [DISTANTSIGNAL] = 6, }, [MCKEES_ROCKS_YARD2_BLOCK] = { [HOMESIGNAL] = 0, [DISTANTSIGNAL] = 0, }, [MCKEES_ROCKS_YARD1_BLOCK] = { [HOMESIGNAL] = 0, [DISTANTSIGNAL] = 0, }, --[NEW_BLOCK] = { -- [HOMESIGNAL] = 0, -- [DISTANTSIGNAL] = 0, -- }, }, [WB] = { [LIONEL_IVES_BLOCK] = { [HOMESIGNAL] = 37, [DISTANTSIGNAL] = 33, }, [MCKEES_ROCKS_BLOCK] = { [HOMESIGNAL] = 33, [DISTANTSIGNAL] = 29, }, [J_L_BLOCK] = { -- AKA J_L_THRU_TRACK [HOMESIGNAL] = 29, [DISTANTSIGNAL] = 27, }, [J_L_PASSING_TRACK] = { [HOMESIGNAL] = 29, [DISTANTSIGNAL] = 27, }, [ALIQUIPPA_BLOCK] = { [HOMESIGNAL] = 27, [DISTANTSIGNAL] = 25, }, [WEST_ALIQUIPPA_BLOCK] = { [HOMESIGNAL] = 25, [DISTANTSIGNAL] = 21, }, [MONACA_BLOCK] = { [HOMESIGNAL] = 21, [DISTANTSIGNAL] = 19, }, [FALLSTON_BLOCK] = { [HOMESIGNAL] = 19, [DISTANTSIGNAL] = 17, }, [BEAVER_FALLS_BLOCK] = { [HOMESIGNAL] = 17, [DISTANTSIGNAL] = 13, }, [COLLEGE_BLOCK] = { -- AKA COLLEGE_THRU_TRACK [HOMESIGNAL] = 13, [DISTANTSIGNAL] = 11, }, [COLLEGE_STATION_TRACK] = { [HOMESIGNAL] = 13, [DISTANTSIGNAL] = 11, }, [NEW_CASTLE_BLOCK] = { [HOMESIGNAL] = 11, [DISTANTSIGNAL] = 9, }, [LOWELLVILLE_BLOCK] = { [HOMESIGNAL] = 9, [DISTANTSIGNAL] = 5, }, [STRUTHERS_BLOCK] = { -- AKA STRUTHERS_THRU_TRACK [HOMESIGNAL] = 5, [DISTANTSIGNAL] = 1, }, [STRUTHERS_STATION_TRACK] = { [HOMESIGNAL] = 5, [DISTANTSIGNAL] = 1, }, [YOUNGSTOWN_BLOCK] = { [HOMESIGNAL] = 1, [DISTANTSIGNAL] = 37, }, [MCKEES_ROCKS_YARD2_BLOCK] = { [HOMESIGNAL] = 37, [DISTANTSIGNAL] = 33, }, [MCKEES_ROCKS_YARD1_BLOCK] = { [HOMESIGNAL] = 37, [DISTANTSIGNAL] = 33, }, [YOUNGSTOWN_YARD2_BLOCK] = { [HOMESIGNAL] = 0, [DISTANTSIGNAL] = 0, }, [YOUNGSTOWN_YARD1_BLOCK] = { [HOMESIGNAL] = 0, [DISTANTSIGNAL] = 0, }, --[NEW_BLOCK] = { -- [HOMESIGNAL] = 0, -- [DISTANTSIGNAL] = 0, -- }, } }
--[[---------------------------------Block Speeds---------------------------------------]] -- Speeds NORMAL_SPEED = 30; -- AsClear LIMITED_SPEED = 25; -- AsApproachLimited -- AsLimitedClear -- AsLimitedApproach MEDIUM_SPEED = 20; -- AsApproachMedium -- AsMediumClear -- AsApproach -- AsMediumApproach SLOW_SPEED = 15; -- AsApproachSlow -- AsSlowClear -- AsSlowApproach RESTRICTED_SPEED = 10; -- AsRestricting -- AsStopandProceed
RAMMING_SPEED = 15; -- speed in Smph that helps assure successful coupling --[[---------------------------------------------------------------------------------------]] BlockSpeed = { [EB] = { -- "Slow" Freight [YOUNGSTOWN_YARD2_BLOCK] = RESTRICTED_SPEED, [YOUNGSTOWN_YARD1_BLOCK] = RESTRICTED_SPEED, [YOUNGSTOWN_BLOCK] = MEDIUM_SPEED, [STRUTHERS_THRU_TRACK] = MEDIUM_SPEED, [STRUTHERS_STATION_TRACK] = SLOW_SPEED, [NEW_CASTLE_BLOCK] = LIMITED_SPEED, [COLLEGE_THRU_TRACK] = MEDIUM_SPEED, [COLLEGE_STATION_TRACK] = SLOW_SPEED, [ALIQUIPPA_BLOCK] = LIMITED_SPEED, [J_L_PASSING_TRACK] = SLOW_SPEED, [J_L_THRU_TRACK] = MEDIUM_SPEED, [MCKEES_ROCKS_BLOCK] = SLOW_SPEED, [MCKEES_ROCKS_YARD2_BLOCK] = RESTRICTED_SPEED, [MCKEES_ROCKS_YARD1_BLOCK] = RESTRICTED_SPEED, [CLEVELAND_EL] = 0, [ASHTABULA_NYC] = 0, [CUMBERLAND_B_O] = 0, [POINTS_SOUTH_N_W] = 0, [LIONEL_IVES_BLOCK] = SLOW_SPEED, -- very slow through here in case of stop [MONACA_BLOCK] = SLOW_SPEED, [BEAVER_FALLS_BLOCK] = LIMITED_SPEED, [LOWELLVILLE_BLOCK] = LIMITED_SPEED, [WEST_ALIQUIPPA_BLOCK] = LIMITED_SPEED, [FALLSTON_BLOCK] = LIMITED_SPEED, --[NEW_BLOCK] = LIMITED_SPEED, }, [WB] = { -- "Fast" Freight [YOUNGSTOWN_YARD2_BLOCK] = RESTRICTED_SPEED, [YOUNGSTOWN_YARD1_BLOCK] = RESTRICTED_SPEED, [YOUNGSTOWN_BLOCK] = LIMITED_SPEED, [STRUTHERS_THRU_TRACK] = MEDIUM_SPEED, [STRUTHERS_STATION_TRACK] = SLOW_SPEED, [NEW_CASTLE_BLOCK] = LIMITED_SPEED, [COLLEGE_THRU_TRACK] = MEDIUM_SPEED, [COLLEGE_STATION_TRACK] = SLOW_SPEED, [ALIQUIPPA_BLOCK] = NORMAL_SPEED, [J_L_PASSING_TRACK] = SLOW_SPEED, [J_L_THRU_TRACK] = MEDIUM_SPEED, [MCKEES_ROCKS_BLOCK] = SLOW_SPEED, [MCKEES_ROCKS_YARD2_BLOCK] = RESTRICTED_SPEED, [MCKEES_ROCKS_YARD1_BLOCK] = RESTRICTED_SPEED, [CLEVELAND_EL] = 0, [ASHTABULA_NYC] = 0, [CUMBERLAND_B_O] = 0, [POINTS_SOUTH_N_W] = 0, [LIONEL_IVES_BLOCK] = SLOW_SPEED, -- slow through here in case of stop [MONACA_BLOCK] = SLOW_SPEED, [BEAVER_FALLS_BLOCK] = NORMAL_SPEED, [LOWELLVILLE_BLOCK] = LIMITED_SPEED, [WEST_ALIQUIPPA_BLOCK] = LIMITED_SPEED, [FALLSTON_BLOCK] = LIMITED_SPEED, --[NEW_BLOCK] = LIMITED_SPEED, }, };
--[[--------------------------------Switch Structure----------------------------------]] -- fields in the Switches table AIU_NUMBER = 1; CHAN_NUMBER = 2; TIU_NUMBER = 3; NORMAL_SEGMENT = 4; REVERSE_SEGMENT = 5; COMMON_SEGMENT = 6; -- NORMAL and REVERSE defined in defines.lua Switches = { [COLLEGE_WEST] = { [TIU_NUMBER] = Layout.MASTER_TIU, [AIU_NUMBER] = COLLEGE_WEST_AIU, [CHAN_NUMBER] = COLLEGE_WEST_CHAN, [NORMAL_SEGMENT] = COLLEGE_THRU_TRACK, [REVERSE_SEGMENT] = COLLEGE_STATION_TRACK, [COMMON_SEGMENT] = NEW_CASTLE_BLOCK },
[COLLEGE_EAST] = { [TIU_NUMBER] = Layout.MASTER_TIU, [AIU_NUMBER] = COLLEGE_EAST_AIU, [CHAN_NUMBER] = COLLEGE_EAST_CHAN, [NORMAL_SEGMENT] = COLLEGE_THRU_TRACK, [REVERSE_SEGMENT] = COLLEGE_STATION_TRACK, [COMMON_SEGMENT] = BEAVER_FALLS_BLOCK },
[YOUNGSTOWN_YARD] = { [TIU_NUMBER] = Layout.MASTER_TIU, [AIU_NUMBER] = YOUNGSTOWN_YARD_AIU, [CHAN_NUMBER] = YOUNGSTOWN_YARD_CHAN, [NORMAL_SEGMENT] = YOUNGSTOWN_YARD2_BLOCK, [REVERSE_SEGMENT] = YOUNGSTOWN_YARD1_BLOCK, [COMMON_SEGMENT] = YOUNGSTOWN_BLOCK },
[MCKEES_ROCKS_YARD] = { [TIU_NUMBER] = Layout.MASTER_TIU, [AIU_NUMBER] = MCKEES_ROCKS_YARD_AIU, [CHAN_NUMBER] = MCKEES_ROCKS_YARD_CHAN, [NORMAL_SEGMENT] = MCKEES_ROCKS_YARD1_BLOCK, [REVERSE_SEGMENT] = MCKEES_ROCKS_YARD2_BLOCK, [COMMON_SEGMENT] = MCKEES_ROCKS_BLOCK },
[ALIQUIPPA_EAST] = { [TIU_NUMBER] = Layout.MASTER_TIU, [AIU_NUMBER] = ALIQUIPPA_EAST_AIU, [CHAN_NUMBER] = ALIQUIPPA_EAST_CHAN, [NORMAL_SEGMENT] = J_L_THRU_TRACK, [REVERSE_SEGMENT] = J_L_PASSING_TRACK, [COMMON_SEGMENT] = MCKEES_ROCKS_BLOCK },
[J_L_SLAG_TRACK] = { [TIU_NUMBER] = Layout.MASTER_TIU, [AIU_NUMBER] = J_L_SLAG_TRACK_AIU, [CHAN_NUMBER] = J_L_SLAG_TRACK_CHAN, [NORMAL_SEGMENT] = 0, [REVERSE_SEGMENT] = 0, [COMMON_SEGMENT] = 0 },
[HOLE_TRACK] = { [TIU_NUMBER] = Layout.MASTER_TIU, [AIU_NUMBER] = HOLE_TRACK_AIU, [CHAN_NUMBER] = HOLE_TRACK_CHAN, [NORMAL_SEGMENT] = 0, [REVERSE_SEGMENT] = 0, [COMMON_SEGMENT] = 0 },
[J_L_MILL_TRACK] = { [TIU_NUMBER] = Layout.MASTER_TIU, [AIU_NUMBER] = J_L_MILL_TRACK_AIU, [CHAN_NUMBER] = J_L_MILL_TRACK_CHAN, [NORMAL_SEGMENT] = 0, [REVERSE_SEGMENT] = 0, [COMMON_SEGMENT] = 0 },
[ALIQUIPPA_WEST] = { [TIU_NUMBER] = Layout.MASTER_TIU, [AIU_NUMBER] = ALIQUIPPA_WEST_AIU, [CHAN_NUMBER] = ALIQUIPPA_WEST_CHAN, [NORMAL_SEGMENT] = J_L_THRU_TRACK, [REVERSE_SEGMENT] = J_L_PASSING_TRACK, [COMMON_SEGMENT] = ALIQUIPPA_BLOCK },
[ALIQUIPPA_TEAM_TRACK] = { [TIU_NUMBER] = Layout.MASTER_TIU, [AIU_NUMBER] = ALIQUIPPA_TEAM_TRACK_AIU, [CHAN_NUMBER] = ALIQUIPPA_TEAM_TRACK_CHAN, [NORMAL_SEGMENT] = 0, [REVERSE_SEGMENT] = 0, [COMMON_SEGMENT] = 0 },
[BYPASS_WEST] = { [TIU_NUMBER] = Layout.MASTER_TIU, [AIU_NUMBER] = BYPASS_WEST_AIU, [CHAN_NUMBER] = BYPASS_WEST_CHAN, [NORMAL_SEGMENT] = 0, [REVERSE_SEGMENT] = 0, [COMMON_SEGMENT] = 0 },
[BYPASS_EAST] = { [TIU_NUMBER] = Layout.MASTER_TIU, [AIU_NUMBER] = BYPASS_EAST_AIU, [CHAN_NUMBER] = BYPASS_EAST_CHAN, [NORMAL_SEGMENT] = 0, [REVERSE_SEGMENT] = 0, [COMMON_SEGMENT] = 0 },
[STRUTHERS_WEST] = { [TIU_NUMBER] = Layout.MASTER_TIU, [AIU_NUMBER] = STRUTHERS_WEST_AIU, [CHAN_NUMBER] = STRUTHERS_WEST_CHAN, [NORMAL_SEGMENT] = STRUTHERS_THRU_TRACK, [REVERSE_SEGMENT] = STRUTHERS_STATION_TRACK, [COMMON_SEGMENT] = YOUNGSTOWN_BLOCK },
[STRUTHERS_EAST] = { [TIU_NUMBER] = Layout.MASTER_TIU, [AIU_NUMBER] = STRUTHERS_EAST_AIU, [CHAN_NUMBER] = STRUTHERS_EAST_CHAN, [NORMAL_SEGMENT] = STRUTHERS_THRU_TRACK, [REVERSE_SEGMENT] = STRUTHERS_STATION_TRACK, [COMMON_SEGMENT] = LOWELLVILLE_BLOCK },
[CAMPBELL_YARD] = { [TIU_NUMBER] = Layout.MASTER_TIU, [AIU_NUMBER] = CAMPBELL_YARD_AIU, [CHAN_NUMBER] = CAMPBELL_YARD_CHAN, [NORMAL_SEGMENT] = 0, [REVERSE_SEGMENT] = 0, [COMMON_SEGMENT] = 0 },
[MONACA_CUTOFF] = { [TIU_NUMBER] = Layout.MASTER_TIU, [AIU_NUMBER] = MONACA_CUTOFF_AIU, [CHAN_NUMBER] = MONACA_CUTOFF_CHAN, [NORMAL_SEGMENT] = 0, [REVERSE_SEGMENT] = 0, [COMMON_SEGMENT] = 0 },
[PM_MOORE_TRESTLE] = { [TIU_NUMBER] = Layout.MASTER_TIU, [AIU_NUMBER] = PM_MOORE_TRESTLE_AIU, [CHAN_NUMBER] = PM_MOORE_TRESTLE_CHAN, [NORMAL_SEGMENT] = 0, [REVERSE_SEGMENT] = 0, [COMMON_SEGMENT] = 0 }, [BALLOON] = { -- Lionel and Ives switches [TIU_NUMBER] = Layout.MASTER_TIU, [AIU_NUMBER] = BALLOON_AIU, [CHAN_NUMBER] = BALLOON_CHAN, [NORMAL_SEGMENT] = 0, [REVERSE_SEGMENT] = 0, [COMMON_SEGMENT] = 0 }, };
--[[-------Distance in inches from a tag detector to when nearby switches are cleared-----------]] -- Returns nil if no switch is associated with the tag detector -- This distance is used to time it takes for the caboose to hit -- the detector and then roll enough to have the caboose clear -- all switches in the direction of travel. SwitchClearingInches = { [MCKEES_ROCKS_YARD_TAG] = { [EB] = 24, -- this depends on the state of Ives Switch, otherwise 0 [WB] = 0, }, [ALIQUIPPA_EAST_TAG] = { [WB] = 30, [EB] = 0, }, [ALIQUIPPA_WEST_TAG] = { [EB] = 56, -- to clear two switches into J&L thru and passing tracks [WB] = 0, }, [COLLEGE_EAST_TAG] = { [WB] = 34, [EB] = 0, }, [COLLEGE_WEST_TAG] = { [EB] = 32, [WB] = 0, }, [STRUTHERS_EAST_TAG] = { [WB] = 32, [EB] = 0, }, [STRUTHERS_WEST_TAG] = { [EB] = 34, [WB] = 0, }, [YOUNGSTOWN_YARD_TAG] = { [WB] = 24, -- this depends on the state of Ives Switch, otherwise 0 [EB] = 0, }, [MONACA_EAST_TAG] = { -- no switches on either side of this detector [EB] = 0, [WB] = 0, }, [FALLSTON_TAG] = { -- no switches on either side of this detector [EB] = 0, [WB] = 0, }, [WEST_ALIQUIPPA_TAG] = { -- no switches on either side of this detector [EB] = 0, [WB] = 0, }, [MONACA_WEST_TAG] = { -- no switches on either side of this detector [EB] = 0, [WB] = 0, }, [LOWELLVILLE_TAG] = { -- no switches on either side of this detector [EB] = 0, [WB] = 0, }, --[NEW_TAG] = { -- [EB] = 0, -- [WB] = 0, -- }, };
--[[---------------------Station stopping distances in inches after tag detection-----------]] -- fields in the Distances table PASSENGER = 1; FREIGHT = 2; DETECTOR = 3; READER = 4; STATION = 5;
-- -- Stopping distances for stops at a station from a tag reader -- -- Stations at: -- Aliquippa -- McKees Rocks -- Youngstown -- Struthers -- New Castle -- College -- West Aliquippa -- -- TBD 2 McKees Rocks and 2 Youngstown Yard tracks for interchange -- -- This table has entries for every block that has a station. Includes both eastbound and westbound entries. -- local StDiStation = { [ALIQUIPPA_BLOCK] = { -- Stop at Station [WB] = { -- Passenger Station stop WB from J&L thru track [STATION] = ALIQUIPPA, [PASSENGER] = 88, [FREIGHT] = 88, [DETECTOR] = ALIQUIPPA_WEST_DETECTOR, [READER] = ALIQUIPPA_WEST_READER, }, [EB] = { -- Passenger Station stop EB from West Aliquippa [STATION] = ALIQUIPPA, [PASSENGER] = 163, [FREIGHT] = 163, [DETECTOR] = WEST_ALIQUIPPA_DETECTOR, [READER] = WEST_ALIQUIPPA_READER, }, }, [WEST_ALIQUIPPA_BLOCK] = { -- Stop at Station [WB] = { -- Passenger Station stop WB from Aliquippa [STATION] = WEST_ALIQUIPPA, [PASSENGER] = 90, [FREIGHT] = 90, [DETECTOR] = WEST_ALIQUIPPA_DETECTOR, [READER] = WEST_ALIQUIPPA_READER, }, [EB] = { -- Passenger Station stop EB from Monaca [STATION] = WEST_ALIQUIPPA, [PASSENGER] = 185, [FREIGHT] = 185, [DETECTOR] = MONACA_EAST_DETECTOR, [READER] = MONACA_EAST_READER, }, }, [STRUTHERS_STATION_TRACK] = { -- Stop at Station [WB] = { -- Passenger Station stop WB from Lowellville [STATION] = STRUTHERS, [PASSENGER] = 85, [FREIGHT] = 85, [DETECTOR] = STRUTHERS_EAST_DETECTOR, [READER] = STRUTHERS_EAST_READER, }, [EB] = { -- Passenger Station stop EB from Youngstown [STATION] = STRUTHERS, [PASSENGER] = 95, [FREIGHT] = 95, [DETECTOR] = STRUTHERS_WEST_DETECTOR, [READER] = STRUTHERS_WEST_READER, }, },
[STRUTHERS_THRU_TRACK] = { -- Stop at Station [WB] = { -- Passenger Station stop WB from Lowellville [STATION] = STRUTHERS, [PASSENGER] = 98, [FREIGHT] = 98, [DETECTOR] = STRUTHERS_EAST_DETECTOR, [READER] = STRUTHERS_EAST_READER, }, [EB] = { -- Passenger Station stop EB from Youngstown [STATION] = STRUTHERS, [PASSENGER] = 110, [FREIGHT] = 110, [DETECTOR] = STRUTHERS_WEST_DETECTOR, [READER] = STRUTHERS_WEST_READER, }, },
[COLLEGE_STATION_TRACK] = { -- Stop at Station [WB] = { -- Passenger Station stop WB from Beaver Falls [STATION] = COLLEGE, [PASSENGER] = 85, [FREIGHT] = 85, [DETECTOR] = COLLEGE_EAST_DETECTOR, [READER] = COLLEGE_EAST_READER, }, [EB] = { -- Passenger Station stop EB from New Castle [STATION] = COLLEGE, [PASSENGER] = 100, [FREIGHT] = 100, [DETECTOR] = COLLEGE_WEST_DETECTOR, [READER] = COLLEGE_WEST_READER, } }, [COLLEGE_THRU_TRACK] = { -- Stop at Station [WB] = { -- Passenger Station stop WB from Beaver Falls [STATION] = COLLEGE, [PASSENGER] = 105, [FREIGHT] = 105, [DETECTOR] = COLLEGE_EAST_DETECTOR, [READER] = COLLEGE_EAST_READER, }, [EB] = { -- Passenger Station stop EB from New Castle [STATION] = COLLEGE, [PASSENGER] = 103, [FREIGHT] = 103, [DETECTOR] = COLLEGE_WEST_DETECTOR, [READER] = COLLEGE_WEST_READER, } },
[MCKEES_ROCKS_BLOCK] = { -- Stop at Station [WB] = { -- Passenger Station stop WB from McKees Rocks Yard or Lionel-Ives Block [STATION] = MCKEES_ROCKS, [PASSENGER] = 65, [FREIGHT] = 65, [DETECTOR] = MCKEES_ROCKS_YARD_DETECTOR, [READER] = MCKEES_ROCKS_YARD_READER, }, [EB] = { -- Passenger Station stop EB from J&L Passing Track [STATION] = MCKEES_ROCKS, [PASSENGER] = 55, [FREIGHT] = 55, [DETECTOR] = ALIQUIPPA_EAST_DETECTOR, [READER] = ALIQUIPPA_EAST_READER, }, }, [NEW_CASTLE_BLOCK] = { -- Stop at Station [WB] = { -- Passenger Station stop WB from College Thru Track [STATION] = NEWCASTLE, [PASSENGER] = 85, [FREIGHT] = 85, [DETECTOR] = COLLEGE_WEST_DETECTOR, [READER] = COLLEGE_WEST_READER, }, [EB] = { -- Passenger Station stop EB from Lowellville [STATION] = NEWCASTLE, [PASSENGER] = 115, [FREIGHT] = 115, [DETECTOR] = LOWELLVILLE_DETECTOR, [READER] = LOWELLVILLE_READER, }, }, [YOUNGSTOWN_BLOCK] = { -- Stop at Station [WB] = { -- Passenger Station stop WB from Struthers [STATION] = YOUNGSTOWN, [PASSENGER] = 206, [FREIGHT] = 206, [DETECTOR] = STRUTHERS_WEST_DETECTOR, [READER] = STRUTHERS_WEST_READER, }, [EB] = { -- Passenger Station stop EB from Youngstown Yard or Lionel-Ives Block [STATION] = YOUNGSTOWN, [PASSENGER] = 84, [FREIGHT] = 84, [DETECTOR] = YOUNGSTOWN_YARD_DETECTOR, [READER] = YOUNGSTOWN_YARD_READER, }, }, [YOUNGSTOWN_YARD1_BLOCK] = { -- Stop at Station [WB] = { -- Youngstown Yard1 stop WB from Youngstown [STATION] = YOUNGSTOWN_YARD1, [PASSENGER] = 117, [FREIGHT] = 117, [DETECTOR] = YOUNGSTOWN_YARD_DETECTOR, [READER] = YOUNGSTOWN_YARD_READER, }, [EB] = {}, -- no EB traffic }, [YOUNGSTOWN_YARD2_BLOCK] = { -- Stop at Station [WB] = { -- Youngstown Yard2 stop WB from Youngstown [STATION] = YOUNGSTOWN_YARD2, [PASSENGER] = 118, [FREIGHT] = 118, [DETECTOR] = YOUNGSTOWN_YARD_DETECTOR, [READER] = YOUNGSTOWN_YARD_READER, }, [EB] = {}, -- no EB traffic }, [MCKEES_ROCKS_YARD1_BLOCK] = { -- Stop at Station [WB] = {}, -- no WB traffic [EB] = { -- McKees Rocks Yard1 Stop EB from McKees Rocks [STATION] = MCKEES_ROCKS_YARD1, [PASSENGER] = 101, [FREIGHT] = 101, [DETECTOR] = MCKEES_ROCKS_YARD_DETECTOR, [READER] = MCKEES_ROCKS_YARD_READER, }, }, [MCKEES_ROCKS_YARD2_BLOCK] = { -- Stop at Station [WB] = {}, -- no WB traffic [EB] = { -- McKees Rocks Yard2 Stop EB from McKees Rocks [STATION] = MCKEES_ROCKS_YARD1, [PASSENGER] = 102, [FREIGHT] = 102, [DETECTOR] = MCKEES_ROCKS_YARD_DETECTOR, [READER] = MCKEES_ROCKS_YARD_READER, }, }, --[[ [NEW_BLOCK] = { -- Stop at Station [WB] = { -- Passenger Station stop WB [STATION] = NEWSTATION, [PASSENGER] = 0, [FREIGHT] = 0, [DETECTOR] = NEW_DETECTOR, [READER] = NEW_READER, }, [EB] = { -- Passenger Station stop EB [STATION] = NEWSTATION, [PASSENGER] = 0, [FREIGHT] = 0, [DETECTOR] = NEW_DETECTOR, [READER] = NEW_READER, }, }, ]] }
-- --[[----Stopping distances for stops within a block in inches after tag detection------]] -- -- These are meant to be stopping distances in conjuction with "Stop and Proceed" Signal -- Note: Short trains are 50 inches long (Diesel engine, 2 cars and a caboose) -- -- This table also gives us the next detector by looking at the opposite direction (see RFID Sensor Test.lua). -- -- This table has entries for every block both eastbound and west bound -- local StDiBlock = { [ALIQUIPPA_BLOCK] = { -- Stop In Block [WB] = { [PASSENGER] = 170, [FREIGHT] = 170, [DETECTOR] = ALIQUIPPA_WEST_DETECTOR, [READER] = ALIQUIPPA_WEST_READER, }, [EB] = { [PASSENGER] = 170, [FREIGHT] = 170, [DETECTOR] = WEST_ALIQUIPPA_DETECTOR, [READER] = WEST_ALIQUIPPA_READER }, }, [WEST_ALIQUIPPA_BLOCK] = { -- Stop In Block [WB] = { [PASSENGER] = 195, [FREIGHT] = 195, [DETECTOR] = WEST_ALIQUIPPA_DETECTOR, [READER] = WEST_ALIQUIPPA_READER, }, [EB] = { [PASSENGER] = 195, [FREIGHT] = 195, [DETECTOR] = MONACA_EAST_DETECTOR, [READER] = MONACA_EAST_READER }, }, [STRUTHERS_THRU_TRACK] = { -- Stop In Block [WB] = { [PASSENGER] = 80, [FREIGHT] = 80, [DETECTOR] = STRUTHERS_EAST_DETECTOR, [READER] = STRUTHERS_EAST_READER, }, [EB] = { -- Eastbound normally does not take the thru track [PASSENGER] = 80, [FREIGHT] = 80, [DETECTOR] = STRUTHERS_WEST_DETECTOR, [READER] = STRUTHERS_WEST_READER, }, }, [STRUTHERS_STATION_TRACK] = { -- Stop In Block [WB] = { -- Westbound normally does not take the station track [PASSENGER] = 90, [FREIGHT] = 90, [DETECTOR] = STRUTHERS_EAST_DETECTOR, [READER] = STRUTHERS_EAST_READER, }, [EB] = { [PASSENGER] = 90, [FREIGHT] = 90, [DETECTOR] = STRUTHERS_WEST_DETECTOR, [READER] = STRUTHERS_WEST_READER, }, }, [COLLEGE_THRU_TRACK] = { -- Stop In Block [WB] = { [PASSENGER] = 100, [FREIGHT] = 100, [DETECTOR] = COLLEGE_EAST_DETECTOR, [READER] = COLLEGE_EAST_READER, }, [EB] = { -- Eastbound normally does not take the thru track [PASSENGER] = 100, [FREIGHT] = 100, [DETECTOR] = COLLEGE_WEST_DETECTOR, [READER] = COLLEGE_WEST_READER, } }, [COLLEGE_STATION_TRACK] = { -- Stop In Block [WB] = { -- Westbound normally does not take the station track [PASSENGER] = 95, [FREIGHT] = 95, [DETECTOR] = COLLEGE_EAST_DETECTOR, [READER] = COLLEGE_EAST_READER, }, [EB] = { [PASSENGER] = 95, [FREIGHT] = 95, [DETECTOR] = COLLEGE_WEST_DETECTOR, [READER] = COLLEGE_WEST_READER, } },
[MCKEES_ROCKS_BLOCK] = { -- Stop In Block [WB] = { [PASSENGER] = 52, [FREIGHT] = 52, [DETECTOR] = MCKEES_ROCKS_YARD_DETECTOR, [READER] = MCKEES_ROCKS_YARD_READER, }, [EB] = { [PASSENGER] = 50, [FREIGHT] = 50, [DETECTOR] = ALIQUIPPA_EAST_DETECTOR, [READER] = ALIQUIPPA_EAST_READER, }, }, [NEW_CASTLE_BLOCK] = { -- Stop In Block [WB] = { [PASSENGER] = 117, [FREIGHT] = 117, [DETECTOR] = COLLEGE_WEST_DETECTOR, [READER] = COLLEGE_WEST_READER, }, [EB] = { [PASSENGER] = 117, [FREIGHT] = 117, [DETECTOR] = LOWELLVILLE_DETECTOR, [READER] = LOWELLVILLE_READER, }, }, [LOWELLVILLE_BLOCK] = { -- Stop In Block [WB] = { [PASSENGER] = 115, [FREIGHT] = 115, [DETECTOR] = LOWELLVILLE_DETECTOR, [READER] = LOWELLVILLE_READER, }, [EB] = { [PASSENGER] = 115, [FREIGHT] = 115, [DETECTOR] = STRUTHERS_EAST_DETECTOR, [READER] = STRUTHERS_EAST_READER, }, }, [YOUNGSTOWN_BLOCK] = { -- Stop In Block [WB] = { [PASSENGER] = 215, [FREIGHT] = 215, [DETECTOR] = STRUTHERS_WEST_DETECTOR, [READER] = STRUTHERS_WEST_READER, }, [EB] = { [PASSENGER] = 215, [FREIGHT] = 215, [DETECTOR] = YOUNGSTOWN_YARD_DETECTOR, [READER] = YOUNGSTOWN_YARD_READER, }, },
[MONACA_BLOCK] = { -- Stop In Block [WB] = { [PASSENGER] = 120, [FREIGHT] = 120, [DETECTOR] = MONACA_EAST_DETECTOR, [READER] = MONACA_EAST_READER, }, [EB] = { [PASSENGER] = 120, [FREIGHT] = 120, [DETECTOR] = MONACA_WEST_DETECTOR, [READER] = MONACA_WEST_READER, }, }, [BEAVER_FALLS_BLOCK] = { -- Stop In Block [WB] = { [PASSENGER] = 120, [FREIGHT] = 120, [DETECTOR] = FALLSTON_DETECTOR, [READER] = FALLSTON_READER, }, [EB] = { [PASSENGER] = 120, [FREIGHT] = 120, [DETECTOR] = COLLEGE_EAST_DETECTOR, [READER] = COLLEGE_EAST_READER, }, }, [FALLSTON_BLOCK] = { -- Stop In Block [WB] = { [PASSENGER] = 185, [FREIGHT] = 185, [DETECTOR] = MONACA_WEST_DETECTOR, [READER] = MONACA_WEST_READER, }, [EB] = { [PASSENGER] = 185, [FREIGHT] = 185, [DETECTOR] = FALLSTON_DETECTOR, [READER] = FALLSTON_READER, }, }, [J_L_PASSING_TRACK] = { -- Stop In Block [WB] = { -- Westbound normally does not take the passing track [PASSENGER] = 150, [FREIGHT] = 150, [DETECTOR] = ALIQUIPPA_EAST_DETECTOR, [READER] = ALIQUIPPA_EAST_READER, }, [EB] = { [PASSENGER] = 130, [FREIGHT] = 130, [DETECTOR] = ALIQUIPPA_WEST_DETECTOR, [READER] = ALIQUIPPA_WEST_READER, }, },
[J_L_THRU_TRACK] = { -- Stop In Block [WB] = { [PASSENGER] = 120, [FREIGHT] = 120, [DETECTOR] = ALIQUIPPA_EAST_DETECTOR, [READER] = ALIQUIPPA_EAST_READER, }, [EB] = { -- Eastbound normally does not take the thru track [PASSENGER] = 120, [FREIGHT] = 120, [DETECTOR] = ALIQUIPPA_WEST_DETECTOR, [READER] = ALIQUIPPA_WEST_READER, }, }, [YOUNGSTOWN_YARD1_BLOCK] = { -- Stop In Block [WB] = { [PASSENGER] = 146, [FREIGHT] = 146, [DETECTOR] = YOUNGSTOWN_YARD_DETECTOR, [READER] = YOUNGSTOWN_YARD_READER, }, [EB] = {}, -- no EB traffic }, [YOUNGSTOWN_YARD2_BLOCK] = { -- Stop In Block [WB] = { [PASSENGER] = 145, [FREIGHT] = 145, [DETECTOR] = YOUNGSTOWN_YARD_DETECTOR, [READER] = YOUNGSTOWN_YARD_READER, }, [EB] = {}, -- no EB traffic }, [MCKEES_ROCKS_YARD1_BLOCK] = { -- Stop In Block [WB] = {}, -- no WB traffic [EB] = { [PASSENGER] = 100, [FREIGHT] = 100, [DETECTOR] = MCKEES_ROCKS_YARD_DETECTOR, [READER] = MCKEES_ROCKS_YARD_READER, }, }, [MCKEES_ROCKS_YARD2_BLOCK] = { -- Stop In Block [WB] = {}, -- no WB traffic [EB] = { [PASSENGER] = 100, [FREIGHT] = 100, [DETECTOR] = MCKEES_ROCKS_YARD_DETECTOR, [READER] = MCKEES_ROCKS_YARD_READER, }, }, [LIONEL_IVES_BLOCK] = { -- Stop In Block [WB] = { [PASSENGER] = 65, [FREIGHT] = 65, [DETECTOR] = YOUNGSTOWN_YARD_DETECTOR, [READER] = YOUNGSTOWN_YARD_READER, }, [EB] = { [PASSENGER] = 63, [FREIGHT] = 63, [DETECTOR] = MCKEES_ROCKS_YARD_DETECTOR, [READER] = MCKEES_ROCKS_YARD_READER, }, }, --[[ [NEW_BLOCK] = { -- Stop In Block [WB] = { [PASSENGER] = 0, [FREIGHT] = 0, [DETECTOR] = NEW_DETECTOR, [READER] = NEW_READER, }, [EB] = { [PASSENGER] = 0, [FREIGHT] = 0, [DETECTOR] = NEW_DETECTOR, [READER] = NEW_READER, }, }, ]] }
--[[-----------------------------------------------------------------------------]] -- high level API --[[-----------------------------------------------------------------------------]] function Layout.StationName(Num) return StationNames[Num]; end --[[-----------------------------------------------------------------------------]] function Layout.NEXTBlock(Direction, TagNumber) return NextBlock[Direction][TagNumber]; end --[[-----------------------------------------------------------------------------]] function Layout.STOPBlock(block, Direction, Parameter) if (StDiBlock[block] == nil) then return nil; end; if (StDiBlock[block][Direction] == nil) then return nil; end; if (StDiBlock[block][Direction][Parameter] == nil) then return nil; end; return StDiBlock[block][Direction][Parameter] end --[[-----------------------------------------------------------------------------]]
function Layout.STOPStation(block, Direction, Parameter) if (StDiStation[block] == nil) then return nil; end; if (StDiStation[block][Direction] == nil) then return nil; end; if (StDiStation[block][Direction][Parameter] == nil) then return nil; end; return StDiStation[block][Direction][Parameter] end --[[-----------------------------------------------------------------------------]]
function Layout.STOPDistance(Engine, Speed) --[[ This original code, returned the individual engine stopping distances -- as generated by "Deceleration Test.lua" -- if (Layout.AccDecRate == 1) then if (Layout.StoppingDistance1[Engine] ~= nil) then if (Layout.StoppingDistance1[Engine][Speed] ~= nil) then return Layout.StoppingDistance1[Engine][Speed]; else return 0 end else return 0 end end; if (Layout.AccDecRate == 4) then if (Layout.StoppingDistance4[Engine] ~= nil) then if (Layout.StoppingDistance4[Engine][Speed] ~= nil) then return Layout.StoppingDistance4[Engine][Speed]; else return 0 end else return 0 end end; --]] -- This new code returns the average stopping distance for a particular -- speed averaged over all engines -- The average is generated by code at the end of this file as -- it calls "Layout.AvgStopDist();" -- if (Layout.AccDecRate == 1) then --print("AverageStoppingDistance1[" .. Speed .. "] = " .. Layout.AverageStoppingDistance1[Speed]); if (Layout.AverageStoppingDistance1[Speed] ~= nil) then return Layout.AverageStoppingDistance1[Speed]; end end; if (Layout.AccDecRate == 4) then if (Layout.AverageStoppingDistance4[Speed] ~= nil) then return Layout.AverageStoppingDistance4[Speed]; end end; return 0; end --[[-----------------------------------------------------------------------------]]
function Layout.STARTDistance(Engine, Speed)
-- This code returns the average Starting distance for a particular -- speed averaged over all engines -- The average is generated by code at the end of this file as -- it calls "Layout.AvgStartDist();" -- if (Layout.AccDecRate == 1) then --print("AverageStartingDistance1[" .. Speed .. "] = " .. Layout.AverageStartingDistance1[Speed]); if (Layout.AverageStartingDistance1[Speed] ~= nil) then return Layout.AverageStartingDistance1[Speed]; end end; if (Layout.AccDecRate == 4) then if (Layout.AverageStartingDistance4[Speed] ~= nil) then return Layout.AverageStartingDistance4[Speed]; end end; return 0; end --[[-----------------------------------------------------------------------------]]
function Layout.StartingisEmpty(Engine) return (StartingDistance[Engine] == nil) end --[[-----------------------------------------------------------------------------]]
function Layout.Starting(Engine, Speed) if (StartingDistance[Engine] ~= nil) then if (StartingDistance[Engine][Speed] ~= nil) then return StartingDistance[Engine][Speed] else return 0 end else return 0 end end --[[-----------------------------------------------------------------------------]]
function Layout.AvgStopDist() -- This code generates the average stopping distances by speed over all -- engines. The resulting Table is available to the running script by -- calling Layout.STOPDistance(Engine, Speed) -- local SD; if (Layout.AccDecRate == 1) then SD = Layout.StoppingDistance1; end; if (Layout.AccDecRate == 4) then SD = Layout.StoppingDistance4; end; print("Creating Average Stopping Distances by Speed"); local AverageDistance = {}; local iCount = 0; local EngNumber = 0; --local TableConstructor = "Average Stopping Distance " .. Layout.AccDecRate .. " Smph = {"; for iEng, aDist in pairs (SD) do --print("Data Set " .. iEng .. " Distance ", aDist[1]); --print("Data Set " .. iEng); EngNumber = iEng; iCount = iCount + 1; for iSpd, iNches in pairs (aDist) do if (AverageDistance[iSpd] == nil) then AverageDistance[iSpd] = 0; end --print("Speed " .. iSpd .. " Stopping Distance " .. iNches); AverageDistance[iSpd] = AverageDistance[iSpd] + iNches; end; end; print("Averaging " .. iCount .. " Data Sets"); for iSpd, _ in pairs (SD[EngNumber]) do -- use one of the Data Set tables to iterate over speeds AverageDistance[iSpd] = AverageDistance[iSpd] / iCount; --TableConstructor = TableConstructor .. "[" .. iSpd .. "] = " .. AverageDistance[iSpd] .. ", "; end; --if (TableConstructor ~= nil) then -- TableConstructor = string.sub(TableConstructor, 1, -3) .. "}"; -- remove ending comma -- print (TableConstructor); -- end; -- if (Layout.AccDecRate == 1) then Layout.AverageStoppingDistance1 = AverageDistance; end; if (Layout.AccDecRate == 4) then Layout.AverageStoppingDistance4 = AverageDistance; end; end; --[[-----------------------------------------------------------------------------]]
function Layout.AvgStartDist() -- This code generates the average starting distances by speed over all -- engines. The resulting Table is available to the running script by -- calling Layout.STARTDistance(Engine, Speed) -- local SD; if (Layout.AccDecRate == 1) then SD = Layout.StartingDistance1; end; if (Layout.AccDecRate == 4) then SD = Layout.StartingDistance4; end; print("Creating Average Starting Distances by Speed"); local AverageDistance = {}; local iCount = 0; local EngNumber = 0; --local TableConstructor = "Average Starting Distance " .. Layout.AccDecRate .. " Smph = {"; for iEng, aDist in pairs (SD) do --print("Data Set " .. iEng .. " Distance ", aDist[1]); --print("Data Set " .. iEng); EngNumber = iEng; iCount = iCount + 1; for iSpd, iNches in pairs (aDist) do if (AverageDistance[iSpd] == nil) then AverageDistance[iSpd] = 0; end --print("Speed " .. iSpd .. " Starting Distance " .. iNches); AverageDistance[iSpd] = AverageDistance[iSpd] + iNches; end; end; print("Averaging " .. iCount .. " Data Sets"); for iSpd, _ in pairs (SD[EngNumber]) do -- use one of the Data Set tables to iterate over speeds AverageDistance[iSpd] = AverageDistance[iSpd] / iCount; --TableConstructor = TableConstructor .. "[" .. iSpd .. "] = " .. AverageDistance[iSpd] .. ", "; end; --if (TableConstructor ~= nil) then -- TableConstructor = string.sub(TableConstructor, 1, -3) .. "}"; -- remove ending comma -- print (TableConstructor); -- end; -- if (Layout.AccDecRate == 1) then Layout.AverageStartingDistance1 = AverageDistance; end; if (Layout.AccDecRate == 4) then Layout.AverageStartingDistance4 = AverageDistance; end; end; --[[------------------------------Create Layout Graph---------------------------------------]]
function Layout:CreateGraph(G) -- This function creates the track layout graph. -- This graph is for Instrumented Layout #4.1
-- Youngstown Yard -- Track 1 G:addDoubleVertex(0, 1) -- double vertex G:addUndirectedEdge(1, 2, 5, YOUNGSTOWN_YARD1_BLOCK) G:addDoubleVertex(2, 3) -- double vertex -- Track 2 G:addDoubleVertex(36, 37) -- double vertex G:addUndirectedEdge(37, 38, 5, YOUNGSTOWN_YARD2_BLOCK) G:addDoubleVertex(38, 39) -- double vertex -- switch track G:addSwitchTrack(4, 3, 39, YOUNGSTOWN_YARD); -- common vertex, normal vertex, reverse vertex, Switch Name G:addDoubleVertex(4, 5) -- double vertex --[[--------------Line between Youngstown Yard and Struthers------------------]] G:addUndirectedEdge(5, 6, 5, YOUNGSTOWN_BLOCK) --[[--------------Struthers------------------]] G:addDoubleVertex(6, 7) -- double vertex G:addSwitchTrack(7, 8, 40, STRUTHERS_WEST); -- common vertex, normal vertex, reverse vertex, Switch Name -- Struthers Thru Track with different costs depending on direction G:addDoubleVertex(8, 9) -- double vertex G:addDirectedEdge(9, 10, 15, STRUTHERS_THRU_TRACK) -- Struthers Through Track Eastward G:addDirectedEdge(10, 9, 5, STRUTHERS_THRU_TRACK) -- Struthers Through Track Westward
-- Struthers Station Track with different costs depending on direction G:addDoubleVertex(40, 41) -- double vertex G:addDirectedEdge(41, 42, 7, STRUTHERS_STATION_TRACK) -- Eastward G:addDirectedEdge(42, 41, 20, STRUTHERS_STATION_TRACK) -- Westward G:addDoubleVertex(42, 43) -- double vertex G:addDoubleVertex(10, 11) -- double vertex G:addSwitchTrack(12, 11, 43, STRUTHERS_EAST); -- common vertex, normal vertex, reverse vertex, Switch Name G:addDoubleVertex(12, 13) -- double vertex
--[[--------------Line between Struthers, Lowellville and College------------------]] G:addUndirectedEdge(13, 60, 5, NEW_CASTLE_BLOCK) G:addUndirectedEdge(60, 14, 5, LOWELLVILLE_BLOCK) --[[--------------College------------------]] G:addDoubleVertex(14, 15) -- double vertex G:addSwitchTrack(15, 16, 44, COLLEGE_WEST); -- common vertex, normal vertex, reverse vertex, Switch Name -- College Thru Track with different costs depending on direction G:addDoubleVertex(16, 17) -- double vertex G:addDirectedEdge(17, 18, 15, COLLEGE_THRU_TRACK) -- College Through Track Eastward G:addDirectedEdge(18, 17, 5, COLLEGE_THRU_TRACK) -- College Through Track Westward -- College Station Track with different costs depending on direction G:addDoubleVertex(44, 45) -- double vertex G:addDirectedEdge(45, 46, 7, COLLEGE_STATION_TRACK) -- Eastward G:addDirectedEdge(46, 45, 20, COLLEGE_STATION_TRACK) -- Westward G:addDoubleVertex(46, 47) -- double vertex G:addDoubleVertex(18, 19) -- double vertex G:addSwitchTrack(20, 19, 47, COLLEGE_EAST); -- common vertex, normal vertex, reverse vertex, Switch Name G:addDoubleVertex(20, 21) -- double vertex --[[--------------Line between College and Aliquippa------------------]] G:addUndirectedEdge(21, 22, 5, ALIQUIPPA_BLOCK) --[[--------------Aliquppa------------------]] G:addDoubleVertex(22, 23) -- double vertex
G:addSwitchTrack(23, 24, 48, ALIQUIPPA_WEST); -- common vertex, normal vertex, reverse vertex, Switch Name -- J&L Aliquippa Thru Track with different costs depending on direction G:addDoubleVertex(24, 25) -- double vertex G:addDirectedEdge(25, 26, 15, J_L_THRU_TRACK) -- J&L Aliquippa Through Track Eastward G:addDirectedEdge(26, 25, 5, J_L_THRU_TRACK) -- J&L Aliquippa Through Track Westward -- J&L Passing Track with different costs depending on direction G:addDoubleVertex(48, 49) -- double vertex G:addDirectedEdge(49, 50, 7, J_L_PASSING_TRACK) -- Eastward G:addDirectedEdge(50, 49, 20, J_L_PASSING_TRACK) -- Westward G:addDoubleVertex(50, 51) -- double vertex G:addDoubleVertex(26, 27) -- double vertex G:addSwitchTrack(28, 27, 51, ALIQUIPPA_EAST); -- common vertex, normal vertex, reverse vertex, Switch Name G:addDoubleVertex(28, 29) -- double vertex --[[--------------Line between Aliquippa and McKees Rocks Yard------------------]] G:addUndirectedEdge(29, 30, 5, MCKEES_ROCKS_BLOCK) --[[--------------McKees Rocks Yard------------------]] G:addDoubleVertex(30, 31) -- double vertex G:addSwitchTrack(31, 32, 52, MCKEES_ROCKS_YARD); -- common vertex, normal vertex, reverse vertex, Switch Name -- Track 2 G:addDoubleVertex(52, 53) -- double vertex G:addUndirectedEdge(53, 54, 5, MCKEES_ROCKS_YARD2_BLOCK) G:addDoubleVertex(54, 55) -- double vertex -- Track 1 G:addDoubleVertex(32, 33) -- double vertex G:addUndirectedEdge(33, 34, 5, MCKEES_ROCKS_YARD1_BLOCK) G:addDoubleVertex(34, 35) -- double vertex -- -- -- templates: -- G:adddirectedEdge(000, 000, 0) -- (vertex1, vertex2, weight) -- G:addUndirectedEdge(000, 000, 0) -- (vertex1, vertex2, weight) -- G:addDoubleVertex(000, 000) -- double vertex -- G:addSwitchTrack(000, 000, 000, 000, 000, 000); -- (common vertex, normal vertex, reverse vertex, TIU, AIU, Channel) -- local requiredVertices = 56; -- 0 to 55 return requiredVertices end
print("Layout : " .. Layout.name); print("Acc/Dec Rate = " .. Layout.AccDecRate); Layout.AvgStopDist(); -- one time use only Layout.AvgStartDist(); -- one time use only
return Layout
|