Class BasicESUTableSpeedMatcher
java.lang.Object
jmri.jmrix.bachrus.speedmatcher.SpeedMatcher
jmri.jmrix.bachrus.speedmatcher.basic.BasicSpeedMatcher
jmri.jmrix.bachrus.speedmatcher.basic.BasicESUTableSpeedMatcher
- All Implemented Interfaces:
EventListener,ProgListener,ThrottleListener
This is a simple speed matcher which will speed match a locomotive to a given
start and top speed using ESU's complex speed table. Speed steps 1, 10, 19,
and 28 will be set according to values interpolated linearly between the
given start and to speeds. Values for the remaining CVs will interpolated
between these 4 CVs. This is done to reduce the time the speed match takes
and to increase likelihood of success.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumNested classes/interfaces inherited from class jmri.jmrix.bachrus.speedmatcher.SpeedMatcher
SpeedMatcher.ProgrammerState, SpeedMatcher.SpeedMatcherCV, SpeedMatcher.SpeedTableStepNested classes/interfaces inherited from interface jmri.ThrottleListener
ThrottleListener.DecisionType -
Field Summary
Fields inherited from class jmri.jmrix.bachrus.speedmatcher.basic.BasicSpeedMatcher
targetStartSpeedKPH, targetTopSpeedKPHFields 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, warmUpReverseSecondsFields inherited from interface jmri.ProgListener
CommError, ConfirmFailed, FailedTimeout, NoAck, NoLocoDetected, NotImplemented, OK, ProgrammerBusy, ProgrammingShort, SequenceError, UnknownError, UserAborted -
Constructor Summary
ConstructorsConstructorDescriptionConstructs the BasicESUTableSpeedMatcher from a BasicSpeedMatcherConfig -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCleans up the speed matcher when speed matching is stopped or is finishedprotected voidSets 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(BasicESUTableSpeedMatcher.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 statebooleanIndicates if the speed matcher is idle (not currently speed matching)voidCalled when a throttle is foundbooleanStarts the speed matching processvoidStops the speed matching processMethods inherited from class jmri.jmrix.bachrus.speedmatcher.basic.BasicSpeedMatcher
getSpeedForSpeedStep, validateMethods 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 Details
-
BasicESUTableSpeedMatcher
Constructs the BasicESUTableSpeedMatcher from a BasicSpeedMatcherConfig- Parameters:
config- BasicSpeedMatcherConfig
-
-
Method Details
-
startSpeedMatcher
Starts the speed matching process- Specified by:
startSpeedMatcherin classSpeedMatcher- Returns:
- true if speed matching started successfully, false otherwise
-
stopSpeedMatcher
Stops the speed matching process- Specified by:
stopSpeedMatcherin classSpeedMatcher
-
isSpeedMatcherIdle
Indicates if the speed matcher is idle (not currently speed matching)- Specified by:
isSpeedMatcherIdlein classSpeedMatcher- Returns:
- true if idle, false otherwise
-
cleanUpSpeedMatcher
Cleans up the speed matcher when speed matching is stopped or is finished- Overrides:
cleanUpSpeedMatcherin classSpeedMatcher
-
notifyThrottleFound
Called when a throttle is found- Specified by:
notifyThrottleFoundin interfaceThrottleListener- Overrides:
notifyThrottleFoundin classSpeedMatcher- Parameters:
t- the requested DccThrottle
-
initNextSpeedMatcherState
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(BasicESUTableSpeedMatcher.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
-