Class BasicSimpleCVSpeedMatcher
- java.lang.Object
-
- jmri.jmrix.bachrus.speedmatcher.SpeedMatcher
-
- jmri.jmrix.bachrus.speedmatcher.basic.BasicSpeedMatcher
-
- jmri.jmrix.bachrus.speedmatcher.basic.BasicSimpleCVSpeedMatcher
-
- All Implemented Interfaces:
java.util.EventListener,ProgListener,ThrottleListener
public class BasicSimpleCVSpeedMatcher extends BasicSpeedMatcher
This is a simple speed matcher which will speed match a locomotive to a given start and top speed using the VStart, VMid, and VHigh CVs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classBasicSimpleCVSpeedMatcher.SpeedMatcherState-
Nested classes/interfaces inherited from class jmri.jmrix.bachrus.speedmatcher.SpeedMatcher
SpeedMatcher.ProgrammerState, SpeedMatcher.SpeedMatcherCV, SpeedMatcher.SpeedTableStep
-
Nested classes/interfaces inherited from interface jmri.ThrottleListener
ThrottleListener.DecisionType
-
-
Field Summary
-
Fields inherited from class jmri.jmrix.bachrus.speedmatcher.basic.BasicSpeedMatcher
targetStartSpeedKPH, targetTopSpeedKPH
-
Fields inherited from class jmri.jmrix.bachrus.speedmatcher.SpeedMatcher
ALLOWED_SPEED_MATCH_ERROR, attempt, currentSpeedKPH, dccLocoAddress, INITIAL_MOMENTUM, opsModeProgrammer, powerManager, programmerState, REVERSE_TRIM_MAX, REVERSE_TRIM_MIN, speedMatchError, speedMatcherValueDelta, startStopButton, statusLabel, stepDuration, trimReverseSpeed, warmUpForwardSeconds, warmUpReverseSeconds
-
Fields inherited from interface jmri.ProgListener
CommError, ConfirmFailed, FailedTimeout, NoAck, NoLocoDetected, NotImplemented, OK, ProgrammerBusy, ProgrammingShort, SequenceError, UnknownError, UserAborted
-
-
Constructor Summary
Constructors Constructor Description BasicSimpleCVSpeedMatcher(BasicSpeedMatcherConfig config)Constructs the BasicSimpleCVSpeedMatcher from a BasicSpeedMatcherConfig
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcleanUpSpeedMatcher()Cleans up the speed matcher when speed matching is stopped or is finishedprotected voidinitNextSpeedMatcherState(BasicSimpleCVSpeedMatcher.SpeedMatcherState nextState)Sets up the speed match state by resetting the speed matcher with a value delta of 10, clearing the step duration, setting the timer duration, and setting the next stateprotected voidinitNextSpeedMatcherState(BasicSimpleCVSpeedMatcher.SpeedMatcherState nextState, int speedMatchValueDelta)Sets up the speed match state by resetting the speed matcher with the given value delta, clearing the step duration, setting the timer duration, and setting the next statebooleanisSpeedMatcherIdle()Indicates if the speed matcher is idle (not currently speed matching)voidnotifyThrottleFound(DccThrottle t)Called when a throttle is foundbooleanstartSpeedMatcher()Starts the speed matching processvoidstopSpeedMatcher()Stops the speed matching process-
Methods inherited from class jmri.jmrix.bachrus.speedmatcher.basic.BasicSpeedMatcher
getSpeedForSpeedStep, validate
-
Methods inherited from class jmri.jmrix.bachrus.speedmatcher.SpeedMatcher
getNextSpeedMatchValue, initializeAndStartSpeedMatcher, notifyDecisionRequired, notifyFailedThrottleRequest, programmingOpReply, resetSpeedMatcher, setSpeedMatchError, setSpeedMatchStateTimerDuration, setThrottle, startSpeedMatchStateTimer, stopSpeedMatchStateTimer, updateCurrentSpeed, writeForwardTrim, writeMomentumAccel, writeMomentumDecel, writeReverseTrim, writeSpeedTableStep, writeVHigh, writeVMid, writeVStart
-
-
-
-
Constructor Detail
-
BasicSimpleCVSpeedMatcher
public BasicSimpleCVSpeedMatcher(BasicSpeedMatcherConfig config)
Constructs the BasicSimpleCVSpeedMatcher from a BasicSpeedMatcherConfig- Parameters:
config- BasicSpeedMatcherConfig
-
-
Method Detail
-
startSpeedMatcher
public boolean startSpeedMatcher()
Starts the speed matching process- Specified by:
startSpeedMatcherin classSpeedMatcher- Returns:
- true if speed matching started successfully, false otherwise
-
stopSpeedMatcher
public void stopSpeedMatcher()
Stops the speed matching process- Specified by:
stopSpeedMatcherin classSpeedMatcher
-
isSpeedMatcherIdle
public boolean isSpeedMatcherIdle()
Indicates if the speed matcher is idle (not currently speed matching)- Specified by:
isSpeedMatcherIdlein classSpeedMatcher- Returns:
- true if idle, false otherwise
-
cleanUpSpeedMatcher
protected void cleanUpSpeedMatcher()
Cleans up the speed matcher when speed matching is stopped or is finished- Overrides:
cleanUpSpeedMatcherin classSpeedMatcher
-
notifyThrottleFound
public void notifyThrottleFound(DccThrottle t)
Called when a throttle is found- Specified by:
notifyThrottleFoundin interfaceThrottleListener- Overrides:
notifyThrottleFoundin classSpeedMatcher- Parameters:
t- the requested DccThrottle
-
initNextSpeedMatcherState
protected void initNextSpeedMatcherState(BasicSimpleCVSpeedMatcher.SpeedMatcherState nextState)
Sets up the speed match state by resetting the speed matcher with a value delta of 10, clearing the step duration, setting the timer duration, and setting the next state- Parameters:
nextState- next SpeedMatcherState to set
-
initNextSpeedMatcherState
protected void initNextSpeedMatcherState(BasicSimpleCVSpeedMatcher.SpeedMatcherState nextState, int speedMatchValueDelta)
Sets up the speed match state by resetting the speed matcher with the given value delta, clearing the step duration, setting the timer duration, and setting the next state- Parameters:
nextState- next SpeedMatcherState to setspeedMatchValueDelta- the value delta to use when resetting the speed matcher
-
-