Class BasicSpeedMatcher
- java.lang.Object
-
- jmri.jmrix.bachrus.speedmatcher.SpeedMatcher
-
- jmri.jmrix.bachrus.speedmatcher.basic.BasicSpeedMatcher
-
- All Implemented Interfaces:
java.util.EventListener
,ProgListener
,ThrottleListener
- Direct Known Subclasses:
BasicESUTableSpeedMatcher
,BasicSimpleCVSpeedMatcher
,BasicSpeedTableSpeedMatcher
public abstract class BasicSpeedMatcher extends SpeedMatcher
Abstract class defining the basic operations of a Basic speed matcher (sets a minimum speed at speed step 1, a maximum at speed step 28, and some number of points in between). All basic speed matcher implementations must extend this class.
-
-
Nested Class Summary
-
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 Modifier and Type Field Description protected float
targetStartSpeedKPH
protected float
targetTopSpeedKPH
-
Fields inherited from class jmri.jmrix.bachrus.speedmatcher.SpeedMatcher
ALLOWED_SPEED_MATCH_ERROR, currentSpeedKPH, dccLocoAddress, INITIAL_MOMENTUM, Kd, Ki, Kp, lastSpeedMatchError, opsModeProgrammer, powerManager, programmerState, REVERSE_TRIM_MAX, REVERSE_TRIM_MIN, speedMatchDerivative, speedMatchError, speedMatchIntegral, startStopButton, statusLabel, stepDuration, Td, Ti, 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 BasicSpeedMatcher(BasicSpeedMatcherConfig config)
Constructs the abstract BasicSpeedMatcher at the core of any Basic Speed Matcher
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected float
getSpeedForSpeedStep(SpeedMatcher.SpeedTableStep speedStep, float minSpeed, float maxSpeed)
Gets the desired speed for a given speed stepprotected boolean
validate()
Validates the speed matcher's configuration-
Methods inherited from class jmri.jmrix.bachrus.speedmatcher.SpeedMatcher
cleanUpSpeedMatcher, getNextSpeedMatchValue, initializeAndStartSpeedMatcher, isSpeedMatcherIdle, notifyDecisionRequired, notifyFailedThrottleRequest, notifyThrottleFound, programmingOpReply, resetSpeedMatchError, setSpeedMatchError, setSpeedMatchStateTimerDuration, setThrottle, startSpeedMatcher, startSpeedMatchStateTimer, stopSpeedMatcher, stopSpeedMatchStateTimer, updateCurrentSpeed, writeForwardTrim, writeMomentumAccel, writeMomentumDecel, writeReverseTrim, writeSpeedTableStep, writeVHigh, writeVMid, writeVStart
-
-
-
-
Field Detail
-
targetStartSpeedKPH
protected float targetStartSpeedKPH
-
targetTopSpeedKPH
protected float targetTopSpeedKPH
-
-
Constructor Detail
-
BasicSpeedMatcher
public BasicSpeedMatcher(BasicSpeedMatcherConfig config)
Constructs the abstract BasicSpeedMatcher at the core of any Basic Speed Matcher- Parameters:
config
- BasicSpeedMatcherConfig
-
-
Method Detail
-
validate
protected boolean validate()
Validates the speed matcher's configuration- Specified by:
validate
in classSpeedMatcher
- Returns:
- true if the configuration is valid, false otherwise
-
getSpeedForSpeedStep
protected float getSpeedForSpeedStep(SpeedMatcher.SpeedTableStep speedStep, float minSpeed, float maxSpeed)
Gets the desired speed for a given speed step- Parameters:
speedStep
- the SpeedTableStep to get the speed forminSpeed
- minimum speed in KPH (at speed step 1)maxSpeed
- maximum speed in KPH (at speed step 28)- Returns:
- the speed for the given speed step in KPH
-
-