aboutsummaryrefslogtreecommitdiff
path: root/atc_command.txt
blob: 5a1c8fff3b2b6b4f3cb317a0e6ecb90turnouts = { {1870,11,9122},-- Southern headshunt/Goods Shed {1863,11,9122},--Southern Roads {1857,11,9122}, {1851,11,9122}, {1845,11,9122}, {1782,11,9222},--NW Roads {1782,11,9216}, {1782,11,9210}, {1782,11,9204}, {1868,11,9157}, --Eastern Assembly Roads {1860,11,9161}, {1817,11,9237}, {1817,11,9231}, {1822,11,9251}, --Northern Wye {1817,11,9238}, {1806,11,9243}, } routes = { -- max# of routes = 32 (1-31 + R0) --southern headshunt {['matrix']={"1st"}, ['name']="Goods Shed Headshunt"}, --1 {['matrix']={"1cr"}, ['name']="West Assembly Yard"}, --2 --southern road access {['matrix']={"2cr"}, ['name']="East S1"}, --3 {['matrix']={"2st","3cr"}, ['name']="East S2"}, --4 {['matrix']={"2st","3st","4cr"}, ['name']="East S3"}, --5 {['matrix']={"2st","3st","4st","5cr"}, ['name']="East S4"}, --6 {['matrix']={"2st","3st","4st","5st"}, ['name']="East S5"}, --7 --NW road access {['matrix']={"6cr"}, ['name']="East N1"}, --8 {['matrix']={"6st","7cr"}, ['name']="East N2"}, --9 {['matrix']={"6st","7st","8cr"}, ['name']="East N3"}, --10 {['matrix']={"6st","7st","8st","9cr"}, ['name']="East N4"}, --11 {['matrix']={"6st","7st","8st","9st"}, ['name']="East N5"}, --12 --Eastern Assembly Roads {['matrix']={"10st","12cr"}, ['name']="Assembly East"}, --13 {['matrix']={"10cr","11cr","12st","13cr"}, ['name']="Assembly Central"}, --14 {['matrix']={"10cr","11st","12st","13st"}, ['name']="Assembly West"}, --15 --Norther Wye {['matrix']={"15st","14cr"}, ['name']="Assembly<->Station"}, --16 {['matrix']={"15cr","16cr"}, ['name']="Yard Loopback"}, --17 {['matrix']={"14st","16st"}, ['name']="Bypass Yard"}, --18 --testing routes {['matrix']={"1cr","2cr","3cr","4cr","5cr"}, ['name']="[TEST]Southern Cr"}, --19 {['matrix']={"1st","2st","3st","4st","5st"}, ['name']="[TEST]Southern St"}, --20 {['matrix']={"6st","7st","8st","9st"}, ['name']="[TEST]Northern St"}, --21 {['matrix']={"6cr","7cr","8cr","9cr"}, ['name']="[TEST]Northern Cr"}, --22 } local display = "tl1" local debug_screen = "tl2" function tableLength(T) local count = 0 for _ in pairs(T) do count = count + 1 end return count end if event.type=="digiline" then if event.channel=="track_control" then local r = event.msg if r > tableLength(routes) then digiline_send(display,"Input ["..r.."] exceeds #routes||"..tableLength(routes)) -- digiline_send(debug_screen,"Input ["..r.."] exceeds #routes ("..tableLength(routes)..")") return elseif r == 0 then digiline_send(display,"Input 0 is not defined") -- digiline_send(debug_screen,"Input 0 is not defined") return end route = routes[r] -- a = "" for _,v in pairs(route.matrix) do local tid = tonumber(v:match("%d+")) local tpos = turnouts[tid] local turnout = {} turnout.x = tpos[1] turnout.y = tpos[2] turnout.z = tpos[3] local cmd = v:match("%a+") -- a = a..string.format("%s %d,%d,%d\n",cmd,turnout.x,turnout.y,turnout.z) setstate(turnout,cmd) end local verbose = table.concat(route.matrix," ") digiline_send(display,"Route "..r.." set||"..verbose.."||"..route.name) -- digiline_send(debug_screen,a) return end if event.channel=="input" then --show debug info if event.msg=="rwt_get" then digiline_send("rwt_get",rwt.now()) elseif event.msg=="debug" then digiline_send(debug_screen,"#turnouts: "..tableLength(turnouts).."\n#routes: "..tableLength(routes)) elseif event.msg=="occupancy_refresh" then local m = "" for k,v in pairs(S.yards.WOA) do if type(v) == "table" then m = m..k..": "..tostring(v.car_count).."||" end end digiline_send(debug_screen,m) end end end
apos;s one more available command: A0 Disable ARS on the train. A1 Enable ARS on the train. When disabled, the train will not trigger automatic route setting on signals based on ARS. # Persistence ATC controllers that are configured as 'static' or 'mesecon' are persistent over mapblock unloads and will even command the train when the mapblock is unloaded. This is not possible with digilines since these do not work in unloaded mapchunks. # LUA ATC controller (in development) The LUA ATC Controller will operate by using LUA code. All operations shown above will have a function equivalent. Additionally all LUA ATC controllers share an environment and setting signal and switch status will be possible to allow for complicated railway systems/fully automated subways a.s.o. Also planned: - digicompute add-on to allow computer access to the ATC environment (railway maps... ... ... ... ...)