Class TrainBuilderEngines
java.lang.Object
jmri.jmrit.operations.trains.trainbuilder.TrainCommon
jmri.jmrit.operations.trains.trainbuilder.TrainBuilderBase
jmri.jmrit.operations.trains.trainbuilder.TrainBuilderEngines
- Direct Known Subclasses:
TrainBuilderCars
Contains methods for engines when building a train.
-
Field Summary
Fields inherited from class jmri.jmrit.operations.trains.trainbuilder.TrainBuilderBase
_buildReport, _carIndex, _carList, _completedMoves, _departLocation, _departStageTrack, _engineList, _lastEngine, _modifiedLocations, _notRoutable, _numberCars, _numOfBlocks, _reqNumOfMoves, _routeList, _secondLeadEngine, _startTime, _terminateLocation, _terminateStageTrack, _thirdLeadEngine, _train, _warnings, carLoads, DISPLAY_CAR_LIMIT_100, DISPLAY_CAR_LIMIT_20, DISPLAY_CAR_LIMIT_50, FIVE, ONE, router, routeToTrackFound, SEVEN, THREE, TIMING, trainManager, trainScheduleManager, USE_BUNITFields inherited from class jmri.jmrit.operations.trains.trainbuilder.TrainCommon
_dropCars, _pickupCars, _printLocalMoveHeader, _printPickupHeader, _printSetoutHeader, BLANK_LINE, BUILD_REPORT_CHAR, carManager, doneCars, ENGINE, engineManager, HORIZONTAL_LINE_CHAR, HYPHEN, index, IS_MANIFEST, IS_TWO_COLUMN_TRACK, LOCAL, locationManager, NEW_LINE, PAPER_MARGINS, PICKUP, SPACE, TAB, TEXT_COLOR_DONE, TEXT_COLOR_END, TEXT_COLOR_START, utilityCarTypes, VERTICAL_LINE_CHAR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddEnginesBasedHPT(int hpAvailable, int extraHpNeeded, RouteLocation rlNeedHp, RouteLocation rl, RouteLocation rld) Adds engines to the train if needed based on HPT.protected voidAdds engines to the train starting at the first location in the train's route.protected voidChecks to see if the engine or consist assigned to the train has the appropriate HP.protected voidChecks to see if additional engines are needed for the train based on the train's calculated tonnage.protected voidBuilds a list of possible engines for this train.protected booleangetConsist(String reqNumEngines, String model, String road, RouteLocation rl, RouteLocation rld) protected booleangetEngines(String requestedEngines, String model, String road, RouteLocation rl, RouteLocation rld) protected booleangetEngines(String requestedEngines, String model, String road, RouteLocation rl, RouteLocation rld, boolean useBunit) Get the engines for this train at a route location.protected voidgetNewEngine(int hpNeeded, Engine leadEngine, String model, String road) Removes engine from train and attempts to replace it with engine or consist that meets the HP requirements of the train.protected voidremoveEngineFromTrain(Engine engine) protected booleansetEngineDestination(Engine engine, RouteLocation rl, RouteLocation rld) Sets the destination track for an engine and assigns it to the train.protected voidMethods inherited from class jmri.jmrit.operations.trains.trainbuilder.TrainBuilderBase
adjustCarsInStaging, checkBasicMoves, checkDepartureStagingTrack, checkDropTrainDirection, checkDropTrainDirection, checkForAlternate, checkForEarlierDrop, checkForLaterPickUp, checkPickupInterchangeDestinationRestrictions, checkPickupInterchangeOrSpur, checkPickUpTrainDirection, checkPickUpTrainDirection, checkQuickServiceDeparting, checkReserved, checkStuckCarsInStaging, checkTerminateStagingTrack, checkThroughCarsAllowed, checkTrainCanDrop, checkTrainLength, countRollingStockAt, createBuildReportFile, finishAddRsToTrain, generateLoadCarDepartingAndTerminatingIntoStaging, getCarList, getLargestBlock, getLocationWithMaximumMoves, getNumberEngines, getScheduleItem, getTracksAtDestination, isCarStuckStaging, makeAdjustmentsIfDepartingStaging, promptFromStagingDialog, promptToStagingDialog, removeCaboosesAndCarsWithFred, removeCarsFromStaging, removeRollingStockFromTrain, restoreCarsIfDepartingStaging, saveCarFinalDestinations, setDepartureTrack, setUpRoute, showAndInitializeTrainRoute, showBuildReportInfo, showCarsByLocation, showCarServiceOrder, showCarsNotMoved, showCarsNotRoutable, showIfLocalSwitcher, showLoadGenerationOptionsStaging, showSpecificTrainBuildOptions, showTrainBuildOptions, showTrainCabooseRoads, showTrainCarRoads, showTrainCarTypes, showTrainLoadNames, showTrainRequirements, showTrainServices, sortCarsOnFifoLifoTracks, tryStagingMethods inherited from class jmri.jmrit.operations.trains.trainbuilder.TrainCommon
addCarsLocationUnknown, addLine, addLine, blockCarsByTrack, blockCarsByTrackNameTwoColumn, blockCarsTwoColumn, blockLocosTwoColumn, clearUtilityCarTypes, convertStringTime, convertStringToDate, countPickupUtilityCars, countSetoutUtilityCars, countUtilityCars, createTabIfNeeded, dropCar, dropCar, dropEngine, dropEngines, formatColorString, formatStringToCommaSeparated, getDate, getDate, getDropCarHeader, getDropEngineHeader, getISO8601Date, getLineLength, getLocalMoveHeader, getManifestHeaderLineLength, getPageSize, getPickupCarHeader, getPickupEngineHeader, getSwitchListTrainStatus, getTextColor, getTextColorName, getTextColorString, getTrainMessage, isNextCar, isNextCar, isThereWorkAtLocation, isThereWorkAtLocation, localMoveCar, newLine, newLine, padAndTruncate, padAndTruncateIfNeeded, padString, pickupCar, pickUpCar, pickUpCarTruncated, pickupEngine, pickupEngines, pickupUtilityCars, pickupUtilityCars, printCarHeader, printDropCarHeader, printDropEngineHeader, printEngineHeader, printHorizontalLine, printHorizontalLine, printHorizontalLine1, printHorizontalLine2, printHorizontalLine3, printLocalCarMoveHeader, printPickupCarHeader, printPickupEngineHeader, printTrackComments, printTrackNameHeader, setoutUtilityCars, setoutUtilityCars, setoutUtilityCars, setPickupAndSetoutTimes, splitString, splitStringLeftParenthesis, tabString, truncatedDropCar
-
Constructor Details
-
TrainBuilderEngines
public TrainBuilderEngines()
-
-
Method Details
-
getAndRemoveEnginesFromList
Builds a list of possible engines for this train. -
getEngines
protected boolean getEngines(String requestedEngines, String model, String road, RouteLocation rl, RouteLocation rld) throws BuildFailedException - Throws:
BuildFailedException
-
getEngines
protected boolean getEngines(String requestedEngines, String model, String road, RouteLocation rl, RouteLocation rld, boolean useBunit) throws BuildFailedException Get the engines for this train at a route location. If departing from staging engines must come from that track. Finds the required number of engines in a consist, or if the option to build from single locos, builds a consist for the user. When true, engines successfully added to train for the leg requested.- Parameters:
requestedEngines- Requested number of Engines, can be number, AUTO or AUTO HPTmodel- Optional model name for the enginesroad- Optional road name for the enginesrl- Departure route location for the enginesrld- Destination route location for the enginesuseBunit- true if B unit engine is allowed- Returns:
- true if correct number of engines found.
- Throws:
BuildFailedException- if coding issue
-
addEnginesToTrain
Adds engines to the train starting at the first location in the train's route. Note that engines from staging are already part of the train. There can be up to two engine swaps in a train's route.- Throws:
BuildFailedException- if required engines can't be added to train.
-
getConsist
protected boolean getConsist(String reqNumEngines, String model, String road, RouteLocation rl, RouteLocation rld) throws BuildFailedException - Throws:
BuildFailedException
-
showEnginesByLocation
-
addEnginesBasedHPT
protected void addEnginesBasedHPT(int hpAvailable, int extraHpNeeded, RouteLocation rlNeedHp, RouteLocation rl, RouteLocation rld) throws BuildFailedException Adds engines to the train if needed based on HPT. Note that the engine additional weight isn't considered in this method so HP requirements can be lower compared to the original calculation which did include the weight of the engines.- Parameters:
hpAvailable- the engine hp already assigned to the train for this legextraHpNeeded- the additional hp neededrlNeedHp- where in the route the additional hp is neededrl- the start of the legrld- the end of the leg- Throws:
BuildFailedException- if unable to add engines to train
-
checkEngineHP
Checks to see if the engine or consist assigned to the train has the appropriate HP. If the train's HP requirements are significantly higher or lower than the engine that was assigned, the program will search for a more appropriate engine or consist, and assign that engine or consist to the train. The HP calculation is based on a minimum train speed of 36 MPH. The formula HPT x 12 / % Grade = Speed, is used to determine the horsepower required. Speed is fixed at 36 MPH. For example a 1% grade requires a minimum of 3 HPT. Disabled for trains departing staging.- Throws:
BuildFailedException- if coding error.
-
getNewEngine
protected void getNewEngine(int hpNeeded, Engine leadEngine, String model, String road) throws BuildFailedException Removes engine from train and attempts to replace it with engine or consist that meets the HP requirements of the train.- Parameters:
hpNeeded- How much hp is neededleadEngine- The lead engine for this legmodel- The engine's modelroad- The engine's road- Throws:
BuildFailedException- if new engine not found
-
setEngineDestination
Sets the destination track for an engine and assigns it to the train.- Parameters:
engine- The engine to be added to trainrl- Departure route locationrld- Destination route location- Returns:
- true if destination track found and set
-
checkNumnberOfEnginesNeededHPT
Checks to see if additional engines are needed for the train based on the train's calculated tonnage. Minimum speed for the train is fixed at 36 MPH. The formula HPT x 12 / % Grade = Speed, is used to determine the horsepower needed. For example a 1% grade requires a minimum of 3 HPT. Ignored when departing staging- Throws:
BuildFailedException- if build failure
-
removeEngineFromTrain
-