|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrit.dispatcher.AutoActiveTrain
public class AutoActiveTrain
This class holds information and options for an ActiveTrain when it is running in AUTOMATIC mode. It ia an extension to Active Train for automatic running.
This class implements logic that follows a train around a layout. Train follows signals, provided the next Section is allocated to it, and its ActiveTrain's status is RUNNING.
This class is linked via it's parent ActiveTrain object.
This file is part of JMRI.
JMRI is open source software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI 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.
The AutoEngineer sub class is based in part on code by Pete Cressman contained in Warrants.java
| Field Summary | |
|---|---|
static int |
BEGINNING_RESET
|
static int |
END_REVERSAL
|
static int |
LIMITED_SPEED
|
static int |
MAXIMUM_SPEED
|
static int |
MEDIUM_SPEED
|
static int |
NO_TASK
|
static int |
NORMAL_SPEED
|
static int |
RAMP_FAST
|
static int |
RAMP_MED_SLOW
|
static int |
RAMP_MEDIUM
|
static int |
RAMP_NONE
|
static int |
RAMP_SLOW
|
static int |
RESTRICTED_SPEED
|
static int |
SLOW_SPEED
|
static int |
SPEED_MASK
|
static int |
STOP_SPEED
|
| Constructor Summary | |
|---|---|
AutoActiveTrain(ActiveTrain at)
Main constructor method |
|
| Method Summary | |
|---|---|
protected void |
decrementHornExecution()
|
void |
dispose()
|
protected void |
executeStopTasks(int task)
|
ActiveTrain |
getActiveTrain()
|
jmri.jmrit.dispatcher.AutoActiveTrain.AutoEngineer |
getAutoEngineer()
|
AutoTrainAction |
getAutoTrainAction()
|
protected AllocatedSection |
getCurrentAllocatedSection()
|
boolean |
getForward()
|
float |
getMaxSpeed()
|
float |
getMaxTrainLength()
|
int |
getRampRate()
|
boolean |
getResistanceWheels()
|
boolean |
getRunInReverse()
|
int |
getSavedStatus()
|
boolean |
getSoundDecoder()
|
float |
getSpeedFactor()
|
float |
getTargetSpeed()
|
protected void |
handleBlockStateChange(AllocatedSection as,
Block b)
|
protected void |
handleSectionOccupancyChange(AllocatedSection as)
|
protected void |
handleSectionStateChange(AllocatedSection as)
Notification methods Handle notification of change in state and occupancy of Sections and Blocks to track the train around the Transit |
protected void |
incrementHornExecution()
|
boolean |
initialize()
Initialize new Auto Active Train or get a new throttle after WORKING Sets up the DCC address and initiates creation of a throttle to run the train. |
protected void |
initiateWorking()
Initiates running in manual mode with external throttle This method is triggered by an action in the Transit The throttle in use for automatic operation is dispatched |
void |
notifyFailedThrottleRequest(DccLocoAddress address,
String reason)
Get notification that an attempt to request a throttle has failed |
void |
notifyThrottleFound(DccThrottle t)
Get notification that a throttle has been found as you requested. |
Thread |
pauseTrain(int fastMinutes)
Pauses the auto active train for a specified number of fast clock minutes Pausing operation is performed in a separate thread |
protected void |
removeAllocatedSection(AllocatedSection as)
|
protected void |
restoreSavedSpeed()
|
protected void |
resumeAutomaticRunning()
Resumes automatic running after a working session using an external throttle This method is triggered by the dispatcher hitting the "Resume Auto Running" button A new throttle is acquired to allow automatic running to resume |
protected void |
saveSpeed()
|
void |
setCurrentRampRate(int rate)
|
protected void |
setEngineDirection()
support methods |
void |
setForward(boolean set)
|
void |
setMaxSpeed(float speed)
|
void |
setMaxTrainLength(float length)
|
void |
setRampRate(int rate)
|
void |
setResistanceWheels(boolean set)
|
void |
setRunInReverse(boolean set)
|
void |
setSavedStatus(int status)
|
void |
setSoundDecoder(boolean set)
|
protected void |
setSpeedBySignal()
|
void |
setSpeedFactor(float factor)
|
void |
setTargetSpeed(float speed)
|
void |
terminate()
|
protected void |
waitUntilStopped()
Returns when train is stopped Note: Provides for _autoEngineer becoming null during wait Ties up the current autoActiveTrain thread |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int SPEED_MASK
public static final int STOP_SPEED
public static final int RESTRICTED_SPEED
public static final int SLOW_SPEED
public static final int MEDIUM_SPEED
public static final int LIMITED_SPEED
public static final int NORMAL_SPEED
public static final int MAXIMUM_SPEED
public static final int RAMP_NONE
public static final int RAMP_FAST
public static final int RAMP_MEDIUM
public static final int RAMP_MED_SLOW
public static final int RAMP_SLOW
public static final int NO_TASK
public static final int END_REVERSAL
public static final int BEGINNING_RESET
| Constructor Detail |
|---|
public AutoActiveTrain(ActiveTrain at)
| Method Detail |
|---|
public ActiveTrain getActiveTrain()
public jmri.jmrit.dispatcher.AutoActiveTrain.AutoEngineer getAutoEngineer()
public AutoTrainAction getAutoTrainAction()
public boolean getForward()
public void setForward(boolean set)
public float getTargetSpeed()
public void setTargetSpeed(float speed)
public int getSavedStatus()
public void setSavedStatus(int status)
public void setCurrentRampRate(int rate)
public int getRampRate()
public void setRampRate(int rate)
public float getSpeedFactor()
public void setSpeedFactor(float factor)
public float getMaxSpeed()
public void setMaxSpeed(float speed)
public boolean getResistanceWheels()
public void setResistanceWheels(boolean set)
public boolean getRunInReverse()
public void setRunInReverse(boolean set)
public boolean getSoundDecoder()
public void setSoundDecoder(boolean set)
public float getMaxTrainLength()
public void setMaxTrainLength(float length)
public boolean initialize()
public void notifyThrottleFound(DccThrottle t)
ThrottleListener
notifyThrottleFound in interface ThrottleListenert - An instantiation of the DccThrottle with the address requested.
public void notifyFailedThrottleRequest(DccLocoAddress address,
String reason)
ThrottleListener
notifyFailedThrottleRequest in interface ThrottleListeneraddress - DccLocoAddress of the failed loco request.reason - The reason why the throttle request failed.protected void saveSpeed()
protected void restoreSavedSpeed()
protected void decrementHornExecution()
protected void incrementHornExecution()
protected void handleSectionStateChange(AllocatedSection as)
protected void handleSectionOccupancyChange(AllocatedSection as)
protected void handleBlockStateChange(AllocatedSection as,
Block b)
protected void setEngineDirection()
protected AllocatedSection getCurrentAllocatedSection()
protected void removeAllocatedSection(AllocatedSection as)
protected void setSpeedBySignal()
protected void executeStopTasks(int task)
protected void initiateWorking()
protected void waitUntilStopped()
protected void resumeAutomaticRunning()
public Thread pauseTrain(int fastMinutes)
public void terminate()
public void dispose()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||