public class BlockScheduler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
SimulationInstance |
simulationInstance |
Constructor and Description |
---|
BlockScheduler(Block block,
Train Train,
SimulationInstance simulationInstance)
blockSchedulingParameters
|
Modifier and Type | Method and Description |
---|---|
double |
calculateFinalVelocity(Link link,
int signal)
Get the final velocity for the scheduling of the train.
|
double |
calculateMaxSpeedOfTrain(Block block)
Get the maximum speed of the train for the block it would overlap into
while just exiting the currentBlock.
|
double |
calculateTotalTimeTillEnd(RunTimeReturn runTimeReturn,
Block nextBlock,
double arrivalTime,
Link nextLink,
double profileStartingMilePost,
OverlapParameters overlapParameters,
boolean enteredOnYellow)
Calculate the time since the head of the train leaves the currentBlock
till the tail of the train leaves currentBlock.
|
double |
calDepTimeForSchedTrainHalt(double arrivalTime)
Determine the time when a scheduled train should leave a station of halt.
|
StatusTraverseBlock |
computeEarliestFreeTimeSTP(Link previousLink,
Link nextLink,
int nFreeBlocksToBeTraversed,
double arrivalTime,
double departureTime,
double totalTimeTillEnd,
double startVelocity,
boolean linkPriorityIsNotOne,
double profileStartingMilePost,
int nextReferenceLoopNumber) |
simulator.scheduler.BlockScheduler.BlockSchedulingParameters |
determineBlockSchedulingParameters(Link previousLink,
Link nextLink,
double arrivalTime,
double startVelocity,
boolean linkPriorityIsNotOne,
double departureTime,
double profileStartingMilePost,
int maxSignalAspectsToBeConsidered) |
boolean |
determineEnteredOnYellow(Block block,
Train train,
double arrivalTime) |
simulator.scheduler.BlockScheduler.LastOverlapBlock |
getLastOverlapBlock(Block blockIter,
OverlapParameters overlapParameters) |
RunTimeReturn |
getRunTimeReturnConsideringWarner(Link link,
int signal,
double arrivalTime,
boolean linkPriorityIsNotOne,
RunTimeReturn runTimeReturn,
double warnerDistance,
int maxSignalAspectsToBeConsidered)
If there is a need to consider the warner distance, get the new
RunTimeReturn for the modified block considering the warner
distance |
StatusTraverseBlock |
handleDepTimeGreaterThanArrTime(double departureTime,
double arrivalTime,
double startVelocity,
Link previousLink,
Link nextFastestLink2,
double profileStartingMilePost,
int nextReferenceLoopNumber)
Handle the cases in which departure time is greater than the arrival time
|
StatusTraverseBlock |
handleRedSignal(double arrivalTime) |
StatusTraverseBlock |
handleSignalFailure(Link link,
double departureTime) |
boolean |
hasNoNextBlockToTraverse() |
boolean |
hasReachedDestinationStation()
Determine if currenTrain has reached its destination station
|
boolean |
hasReachedOverlapEndDistance(Block block,
OverlapParameters overlapParameters)
Determine if the block depending upon the train's direction covers the
Global.overlapEndDistance
|
boolean |
isNextBlockLastBlock() |
void |
reserveBlocks(Link nextLink,
Link previousLink,
int nFreeBlocksToBeReserved,
double arrivalTime,
double departureTime,
double totalTimeTillEnd,
VelocityProfileArray blockVelocityProfileArray,
VelocityProfileArray previousLinkVelocityProfileArray,
int signal) |
StatusTraverseBlock |
reserveBlocksAndGetCurrentSTP(Link nextLink,
Link previousLink,
double tempDepartureTime,
RunTimeReturn runtimereturn,
int nFreeBlocksToBeTraversed,
double arrivalTime,
double totalTimeTillEnd,
int signal,
double profileStartingMilePost,
int nextReferenceLoopNumber)
Get the
StatusTraverseBlock for the current block if the
scheduling for the next block is successful. |
boolean |
sawRedSignal(double arrivalTime) |
OverlapParameters |
setOverlapParameters(Link nextLink,
double profileStartingMilePost)
Set the overlapStartDistance, overlapEndDistance and overlap boolean
depending upon the block and the train.
|
StatusTraverseBlock |
traverseBlock(double arrivalTime,
double departureTime,
double startVelocity,
Link previousLink,
Link nextFastestLink2,
double profileStartingMilePost,
int nextReferenceLoopNumber)
BlockScheduler: StatusTraverseBlock traverseBlock(arrivalTime, deptTime,
startVelocity) 1) if there is no next block it traverses the last block:
traverseLastBlock(arrivalTime, startVelocity) 2) if got a redSignal it
handles that with : handleRedSignal(arrivalTime); Then it calls the
getSortedLinks.
|
StatusTraverseBlock |
traverseLastBlock(double arrivalTime,
double startVelocity,
Link previousLink,
double profileStartingMilePost) |
StatusTraverseBlock |
traversePath(Link previousLink,
Link nextLink,
double arrivalTime,
double departureTime,
double startVelocity,
boolean linkPriorityIsNotOne,
int maxSignalAspectsToBeConsidered,
double profileStartingMilePost,
int nextReferenceLoopNumber)
1) It first finds what is the signal of the block for the train and the
arrival time by calling currentBlock.getSignal(currentTrain, noOfColor,
arrivalTime,currentTrain.direction); 2) It first tries to find the
running time required to traverse the path, by going to
currentBlock.getRunTimeSignal(currentTrain, j, arrivalTime,
startVelocity, !linkPriorityIsOne ? link.nextBlock.maximumPossibleSpeed :
0.0D); and setting that value in runTimeReturn 3) If the simulation is in
the signalFailureMode or if the linkPriority is one it resets the
runTimeReturn to a block whose starting milePost is the same but the
endMilePost is the actual endMilePost minus the warnerDistance.
|
public SimulationInstance simulationInstance
public BlockScheduler(Block block, Train Train, SimulationInstance simulationInstance)
public boolean hasReachedDestinationStation()
public boolean hasNoNextBlockToTraverse()
public boolean sawRedSignal(double arrivalTime)
arrivalTime
- public StatusTraverseBlock handleDepTimeGreaterThanArrTime(double departureTime, double arrivalTime, double startVelocity, Link previousLink, Link nextFastestLink2, double profileStartingMilePost, int nextReferenceLoopNumber)
departureTime
- arrivalTime
- startVelocity
- previousLink
- nextFastestLink2
- nextReferenceLoopNumber
- public double calDepTimeForSchedTrainHalt(double arrivalTime)
arrivalTime
- public StatusTraverseBlock traverseBlock(double arrivalTime, double departureTime, double startVelocity, Link previousLink, Link nextFastestLink2, double profileStartingMilePost, int nextReferenceLoopNumber)
arrivalTime
- departureTime
- startVelocity
- nextFastestLink2
- nextReferenceLoopNumber
- j
- link2
- StatusTraverseBlock
public StatusTraverseBlock traverseLastBlock(double arrivalTime, double startVelocity, Link previousLink, double profileStartingMilePost)
arrivalTime
- startVelocity
- Train
- previousLink
- profileStartingMilePost
- StatusTraverseBlock
public boolean determineEnteredOnYellow(Block block, Train train, double arrivalTime)
public StatusTraverseBlock handleRedSignal(double arrivalTime)
arrivalTime
- StatusTraverseBlock
with a false status and arrival and
departureTimes to be the earliestArrivalTime possible for the
currentBlockpublic RunTimeReturn getRunTimeReturnConsideringWarner(Link link, int signal, double arrivalTime, boolean linkPriorityIsNotOne, RunTimeReturn runTimeReturn, double warnerDistance, int maxSignalAspectsToBeConsidered)
RunTimeReturn
for the modified block considering the warner
distancelink
- signal
- arrivalTime
- linkPriorityIsNotOne
- runTimeReturn
- RunTimeReturn
if the warner distance is considered. Else
returns null.public double calculateFinalVelocity(Link link, int signal)
link
- public simulator.scheduler.BlockScheduler.BlockSchedulingParameters determineBlockSchedulingParameters(Link previousLink, Link nextLink, double arrivalTime, double startVelocity, boolean linkPriorityIsNotOne, double departureTime, double profileStartingMilePost, int maxSignalAspectsToBeConsidered)
public StatusTraverseBlock traversePath(Link previousLink, Link nextLink, double arrivalTime, double departureTime, double startVelocity, boolean linkPriorityIsNotOne, int maxSignalAspectsToBeConsidered, double profileStartingMilePost, int nextReferenceLoopNumber)
link
- tempLink
- arrivalTime
- departureTime
- startVelocity
- linkPriorityIsNotOne
- numberOfColour
- profileStartingMilePost
- nextReferenceLoopNumber
- StatusTraverseBlock
public double calculateTotalTimeTillEnd(RunTimeReturn runTimeReturn, Block nextBlock, double arrivalTime, Link nextLink, double profileStartingMilePost, OverlapParameters overlapParameters, boolean enteredOnYellow)
runTimeReturn
- nextBlock
- arrivalTime
- profileStartingMilePost
- enteredOnYellow
- public boolean isNextBlockLastBlock()
public StatusTraverseBlock reserveBlocksAndGetCurrentSTP(Link nextLink, Link previousLink, double tempDepartureTime, RunTimeReturn runtimereturn, int nFreeBlocksToBeTraversed, double arrivalTime, double totalTimeTillEnd, int signal, double profileStartingMilePost, int nextReferenceLoopNumber)
StatusTraverseBlock
for the current block if the
scheduling for the next block is successful. In that case, the
corresponding blocks should also be reserved. If the scheduling for next
block is unsuccessful, it should return a StatusTraverseBlock
with false status.link
- previousLink
- tempDepartureTime
- runtimereturn
- nFreeBlocksToBeTraversed
- arrivalTime
- totalTimeTillEnd
- signal
- profileStartingMilePost
- nextReferenceLoopNumber
- StatusTraverseBlock
with true or false status depending
upon the successful scheduling of train on next block.public StatusTraverseBlock handleSignalFailure(Link link, double departureTime)
link
- departureTime
- StatusTraverseBlock
with signal -2, suggesting signal
failure. returns null if there is no signal failure.public StatusTraverseBlock computeEarliestFreeTimeSTP(Link previousLink, Link nextLink, int nFreeBlocksToBeTraversed, double arrivalTime, double departureTime, double totalTimeTillEnd, double startVelocity, boolean linkPriorityIsNotOne, double profileStartingMilePost, int nextReferenceLoopNumber)
link
- nFreeBlocksToBeTraversed
- arrivalTime
- departureTime
- totalTimeTillEnd
- startVelocity
- linkPriorityIsNotOne
- profileStartingMilePost
- nextReferenceLoopNumber
- public simulator.scheduler.BlockScheduler.LastOverlapBlock getLastOverlapBlock(Block blockIter, OverlapParameters overlapParameters)
blockIter
- overlapParameters
- LastOverlapBlock
such that the last block from the
currentBlock which the currentTrain will overlap while just
exiting the currentBlockpublic double calculateMaxSpeedOfTrain(Block block)
block
- public boolean hasReachedOverlapEndDistance(Block block, OverlapParameters overlapParameters)
block
- public OverlapParameters setOverlapParameters(Link nextLink, double profileStartingMilePost)
nextLink
- profileStartingMilePost
- public void reserveBlocks(Link nextLink, Link previousLink, int nFreeBlocksToBeReserved, double arrivalTime, double departureTime, double totalTimeTillEnd, VelocityProfileArray blockVelocityProfileArray, VelocityProfileArray previousLinkVelocityProfileArray, int signal)
link
- i
- arrivalTime
- departureTime
- totalTimeForRestOfPath
- velocityProfileArray
- velocityProfileArray2
- signal
-