# This Jython script created by MRRM software from MTS Associates # Copyright 2004 # no dispatcher; no autostart; no transponder # includes debug statements; continue at end of script; no Sound import jarray import jmri class LAyard_AnthEl(jmri.jmrit.automat.AbstractAutomaton) : def init(self): loco1 = 5574 loco2 = 0 print "LAyard_AnthEl: lead loco is "5574" has entered this automaton. loco2 is "0" If zero, there is no 2nd sound loco. Sound is in primary loco. " if loco1 > 127 : self.slong1 = 1 #Long address else : self.slong1 = 0 #Short address self.throttle = self.getThrottle(loco1, self.slong1) #get throttle for loco1 self.throttle.setF0(True) # turn on headlight self.throttle.setIsForward(True) # Forward direction def locoLeaving(self): self.waitMsec(10000) #continue on for 10 seconds #This code is invoked as handle script completes print "LAyard_AnthEl:Stop locos then dispatch" self.throttle.setSpeedSetting(0) # stop loco self.throttle.dispatch() # dispatch/release loco1 def handle(self): #Handle is main routine for this class #This code will run exactly one time, in an independent thread, when invoked print "LAyard_AnthEl: runs East to West from LA Yard West Throat to AnthonyvilleStation" print "LAyard_AnthEl: Shuttle from LA yard West to Anthonyville El station" print "LAyard_AnthEl: Set Speed 10%" self.throttle.setSpeedSetting(0.15) # 15% of throttle print "LAyard_AnthEl: wait for sensor LS269 to become Active" self.LS269 = sensors.provideSensor("269") print "LAyard_AnthEl: Waiting for Sensor LS269" self.waitSensorActive(self.LS269) print "LAyard_AnthEl: slow the lead loco" self.throttle.setSpeedSetting(0.10) print "LAyard_AnthEl: time slowing the lead loco" self.waitMsec(7000) print "LAyard_AnthEl: stop the lead loco and wait" self.throttle.setSpeedSetting(0) # stop the loco self.waitMsec(10000) print "LAyard_AnthEl: depart stop; start the lead loco" self.throttle.setSpeedSetting(0.10) print "Wait for Turnout LT4 to be THROWN" self.LT4 = turnouts.getTurnout("LT4") print "LAyard_AnthEl: command turnout = LT4 to THROWN" self.LT4.setCommandedState(THROWN) print "Wait for signal LH263 to be NOT RED" self.LH263 = signals.getBySystemName("LH263") if self.LH263.getAppearance() == RED : self.throttle.setSpeedSetting(0) print "LAyard_AnthEl: wait while East to West signal LH263 is RED!" while self.LH263.getAppearance() == RED : self.waitMsec(2500) self.throttle.setSpeedSetting(0.35) print "LAyard_AnthEl: slowly start the lead loco" self.throttle.setSpeedSetting(0.10) print "LAyard_AnthEl: time slowly starting the lead loco" self.waitMsec(5000) print "LAyard_AnthEl: wait for sensor LS269 to become Inactive" self.waitSensorInactive(self.LS269) self.throttle.setSpeedSetting(0.35) print "LAyard_AnthEl: wait for sensor LS270 to become Active" self.LS270 = sensors.provideSensor("270") print "LAyard_AnthEl: Waiting for Sensor LS270" self.waitSensorActive(self.LS270) print "Wait for Turnout LT5 to be CLOSED" self.LT5 = turnouts.getTurnout("LT5") print "LAyard_AnthEl: command turnout = LT5 to CLOSED" self.LT5.setCommandedState(CLOSED) print "LAyard_AnthEl: wait for sensor LS270 to become Inactive" self.waitSensorInactive(self.LS270) self.throttle.setSpeedSetting(0.35) print "LAyard_AnthEl: wait for sensor LS257 to become Active" self.LS257 = sensors.provideSensor("257") print "LAyard_AnthEl: Waiting for Sensor LS257" self.waitSensorActive(self.LS257) print "LAyard_AnthEl: slow the lead loco" self.throttle.setSpeedSetting(0.10) print "LAyard_AnthEl: time slowing the lead loco" self.waitMsec(7000) print "LAyard_AnthEl: stop the lead loco and wait" self.throttle.setSpeedSetting(0) # stop the loco self.waitMsec(10000) print "LAyard_AnthEl: depart stop; start the lead loco" self.throttle.setSpeedSetting(0.10) print "Wait for Turnout LT6 to be CLOSED" self.LT6 = turnouts.getTurnout("LT6") print "LAyard_AnthEl: command turnout = LT6 to CLOSED" self.LT6.setCommandedState(CLOSED) print "LAyard_AnthEl: slowly start the lead loco" self.throttle.setSpeedSetting(0.10) print "LAyard_AnthEl: time slowly starting the lead loco" self.waitMsec(5000) print "LAyard_AnthEl: wait for sensor LS257 to become Inactive" self.waitSensorInactive(self.LS257) self.throttle.setSpeedSetting(0.35) print "LAyard_AnthEl: wait for sensor LS260 to become Active" self.LS260 = sensors.provideSensor("260") print "LAyard_AnthEl: Waiting for Sensor LS260" self.waitSensorActive(self.LS260) print "Wait for Turnout LT8 to be CLOSED" self.LT8 = turnouts.getTurnout("LT8") print "LAyard_AnthEl: command turnout = LT8 to CLOSED" self.LT8.setCommandedState(CLOSED) print "LAyard_AnthEl: wait for sensor LS260 to become Inactive" self.waitSensorInactive(self.LS260) self.throttle.setSpeedSetting(0.35) print "LAyard_AnthEl: wait for sensor LS262 to become Active" self.LS262 = sensors.provideSensor("262") print "LAyard_AnthEl: Waiting for Sensor LS262" self.waitSensorActive(self.LS262) print "LAyard_AnthEl: slow the lead loco" self.throttle.setSpeedSetting(0.10) print "LAyard_AnthEl: time slowing the lead loco" self.waitMsec(7000) print "LAyard_AnthEl: stop the lead loco and wait" self.throttle.setSpeedSetting(0) # stop the loco self.waitMsec(10000) print "LAyard_AnthEl: depart stop; start the lead loco" self.throttle.setSpeedSetting(0.10) print "Wait for Turnout LT177 to be CLOSED" self.LT177 = turnouts.getTurnout("LT177") print "LAyard_AnthEl: command turnout = LT177 to CLOSED" self.LT177.setCommandedState(CLOSED) print "LAyard_AnthEl: slowly start the lead loco" self.throttle.setSpeedSetting(0.10) print "LAyard_AnthEl: time slowly starting the lead loco" self.waitMsec(5000) print "LAyard_AnthEl: wait for sensor LS262 to become Inactive" self.waitSensorInactive(self.LS262) self.throttle.setSpeedSetting(0.35) self.throttle.dispatch() # dispatch/release loco1 print "Ask autoMgr to run script = LAyard_AnthEl again!" self.LT2003= turnouts.provideTurnout("LT2003") self.LT2003.setCommandedState(THROWN) print "LAyard_AnthEl script has completed!" return 0 # to stop - causes routine to NOT be called again # end of class definition