Rename 'current speed limit' to 'lowest speed limit'
parent
f11e64b8b8
commit
6af0912359
|
@ -52,7 +52,7 @@ function addBreakFreeSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFlags:
|
||||||
stateFlags[:resistingForceNegative] = drivingCourse[end][:F_R] < 0
|
stateFlags[:resistingForceNegative] = drivingCourse[end][:F_R] < 0
|
||||||
stateFlags[:previousSpeedLimitReached] = false
|
stateFlags[:previousSpeedLimitReached] = false
|
||||||
stateFlags[:speedLimitReached] = drivingCourse[end][:v] >= CS[:v_limit]
|
stateFlags[:speedLimitReached] = drivingCourse[end][:v] >= CS[:v_limit]
|
||||||
stateFlags[:error] = !(stateFlags[:endOfCSReached] || stateFlags[:brakingStartReached] || stateFlags[:tractionDeficit] || stateFlags[:previousSpeedLimitReached] || stateFlags[:speedLimitReached])
|
stateFlags[:error] = drivingCourse[end][:v] > CS[:v_limit] || drivingCourse[end][:s] > CS[:s_exit]
|
||||||
|
|
||||||
return (CS, drivingCourse, stateFlags)
|
return (CS, drivingCourse, stateFlags)
|
||||||
end #function addBreakFreeSection!
|
end #function addBreakFreeSection!
|
||||||
|
@ -61,7 +61,7 @@ end #function addBreakFreeSection!
|
||||||
# Therefore it gets its previous driving course and the characteristic section and returns the characteristic section and driving course including the clearing section.
|
# Therefore it gets its previous driving course and the characteristic section and returns the characteristic section and driving course including the clearing section.
|
||||||
function addClearingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFlags::Dict, settings::Settings, train::Train, CSs::Vector{Dict})
|
function addClearingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFlags::Dict, settings::Settings, train::Train, CSs::Vector{Dict})
|
||||||
if stateFlags[:previousSpeedLimitReached]
|
if stateFlags[:previousSpeedLimitReached]
|
||||||
currentSpeedLimit = getCurrentSpeedLimit(CSs, CS[:id], drivingCourse[end][:s], train.length)
|
lowestSpeedLimit = getLowestSpeedLimit(CSs, CS[:id], drivingCourse[end][:s], train.length)
|
||||||
|
|
||||||
if haskey(stateFlags, :usedForDefiningCharacteristics) && stateFlags[:usedForDefiningCharacteristics]
|
if haskey(stateFlags, :usedForDefiningCharacteristics) && stateFlags[:usedForDefiningCharacteristics]
|
||||||
ignoreBraking = true
|
ignoreBraking = true
|
||||||
|
@ -71,7 +71,7 @@ function addClearingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFlags::
|
||||||
s_braking = brakingDistance(drivingCourse[end][:v], CS[:v_exit], train.a_braking, settings.approxLevel)
|
s_braking = brakingDistance(drivingCourse[end][:v], CS[:v_exit], train.a_braking, settings.approxLevel)
|
||||||
end
|
end
|
||||||
|
|
||||||
s_clearing = min(CS[:s_exit]-drivingCourse[end][:s]-s_braking, currentSpeedLimit[:s_end] - drivingCourse[end][:s])
|
s_clearing = min(CS[:s_exit]-drivingCourse[end][:s]-s_braking, lowestSpeedLimit[:s_end] - drivingCourse[end][:s])
|
||||||
if s_clearing > 0.0
|
if s_clearing > 0.0
|
||||||
(CS, drivingCourse, stateFlags) = addCruisingSection!(CS, drivingCourse, stateFlags, s_clearing, settings, train, CSs, "clearing")
|
(CS, drivingCourse, stateFlags) = addCruisingSection!(CS, drivingCourse, stateFlags, s_clearing, settings, train, CSs, "clearing")
|
||||||
calculateForces!(drivingCourse[end], CSs, CS[:id], "accelerating", train, settings.massModel)
|
calculateForces!(drivingCourse[end], CSs, CS[:id], "accelerating", train, settings.massModel)
|
||||||
|
@ -81,8 +81,8 @@ function addClearingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFlags::
|
||||||
error("ERROR: clearing <=0.0 although it has to be >0.0 in CS ",CS[:id])
|
error("ERROR: clearing <=0.0 although it has to be >0.0 in CS ",CS[:id])
|
||||||
end
|
end
|
||||||
#stateFlags[:previousSpeedLimitReached] = false
|
#stateFlags[:previousSpeedLimitReached] = false
|
||||||
currentSpeedLimit = getCurrentSpeedLimit(CSs, CS[:id], drivingCourse[end][:s], train.length)
|
lowestSpeedLimit = getLowestSpeedLimit(CSs, CS[:id], drivingCourse[end][:s], train.length)
|
||||||
stateFlags[:previousSpeedLimitReached] = currentSpeedLimit[:v] != CS[:v_limit] && drivingCourse[end][:v] >= currentSpeedLimit[:v]
|
stateFlags[:previousSpeedLimitReached] = lowestSpeedLimit[:v] != CS[:v_limit] && drivingCourse[end][:v] >= lowestSpeedLimit[:v]
|
||||||
else
|
else
|
||||||
stateFlags[:error] = true
|
stateFlags[:error] = true
|
||||||
end
|
end
|
||||||
|
@ -118,8 +118,8 @@ function addAcceleratingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFla
|
||||||
drivingMode = "accelerating"
|
drivingMode = "accelerating"
|
||||||
drivingCourse[end][:behavior] = drivingMode
|
drivingCourse[end][:behavior] = drivingMode
|
||||||
|
|
||||||
currentSpeedLimit = getCurrentSpeedLimit(CSs, CS[:id], drivingCourse[end][:s], train.length)
|
lowestSpeedLimit = getLowestSpeedLimit(CSs, CS[:id], drivingCourse[end][:s], train.length)
|
||||||
previousSpeedLimitReached = currentSpeedLimit[:v] != CS[:v_limit] && drivingCourse[end][:v] >= currentSpeedLimit[:v]
|
previousSpeedLimitReached = lowestSpeedLimit[:v] != CS[:v_limit] && drivingCourse[end][:v] >= lowestSpeedLimit[:v]
|
||||||
|
|
||||||
while !speedLimitReached && !endOfCSReached && tractionSurplus && !brakingStartReached && !previousSpeedLimitReached
|
while !speedLimitReached && !endOfCSReached && tractionSurplus && !brakingStartReached && !previousSpeedLimitReached
|
||||||
currentStepSize = settings.stepSize # initialize the step size that can be reduced near intersections
|
currentStepSize = settings.stepSize # initialize the step size that can be reduced near intersections
|
||||||
|
@ -132,9 +132,9 @@ function addAcceleratingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFla
|
||||||
end
|
end
|
||||||
|
|
||||||
while !speedLimitReached && !brakingStartReached && !pointOfInterestReached && tractionSurplus && !previousSpeedLimitReached
|
while !speedLimitReached && !brakingStartReached && !pointOfInterestReached && tractionSurplus && !previousSpeedLimitReached
|
||||||
if drivingCourse[end][:s] >= currentSpeedLimit[:s_end]
|
if drivingCourse[end][:s] >= lowestSpeedLimit[:s_end]
|
||||||
# could be asked after creating an support point. This way here prevents even a minimal exceedance of speed limit. On the other hand the train cruises possibly a little to long
|
# could be asked after creating an support point. This way here prevents even a minimal exceedance of speed limit. On the other hand the train cruises possibly a little to long
|
||||||
currentSpeedLimit = getCurrentSpeedLimit(CSs, CS[:id], drivingCourse[end][:s], train.length)
|
lowestSpeedLimit = getLowestSpeedLimit(CSs, CS[:id], drivingCourse[end][:s], train.length)
|
||||||
end
|
end
|
||||||
|
|
||||||
# acceleration (in m/s^2):
|
# acceleration (in m/s^2):
|
||||||
|
@ -152,7 +152,7 @@ function addAcceleratingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFla
|
||||||
end
|
end
|
||||||
brakingStartReached = drivingCourse[end][:s] +s_braking >= CS[:s_exit]
|
brakingStartReached = drivingCourse[end][:s] +s_braking >= CS[:s_exit]
|
||||||
speedLimitReached = drivingCourse[end][:v] >= CS[:v_limit]
|
speedLimitReached = drivingCourse[end][:v] >= CS[:v_limit]
|
||||||
previousSpeedLimitReached = currentSpeedLimit[:v] < CS[:v_limit] && (drivingCourse[end][:v] > currentSpeedLimit[:v] || (drivingCourse[end][:v] == currentSpeedLimit[:v] && drivingCourse[end][:s] < currentSpeedLimit[:s_end]))
|
previousSpeedLimitReached = lowestSpeedLimit[:v] < CS[:v_limit] && (drivingCourse[end][:v] > lowestSpeedLimit[:v] || (drivingCourse[end][:v] == lowestSpeedLimit[:v] && drivingCourse[end][:s] < lowestSpeedLimit[:s_end]))
|
||||||
pointOfInterestReached = drivingCourse[end][:s] >= nextPointOfInterest[1] # POIs include s_exit as well
|
pointOfInterestReached = drivingCourse[end][:s] >= nextPointOfInterest[1] # POIs include s_exit as well
|
||||||
tractionSurplus = drivingCourse[end][:F_T] > drivingCourse[end][:F_R]
|
tractionSurplus = drivingCourse[end][:F_T] > drivingCourse[end][:F_R]
|
||||||
end #while
|
end #while
|
||||||
|
@ -181,10 +181,10 @@ function addAcceleratingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFla
|
||||||
currentStepSize = settings.stepSize / 10.0^cycle
|
currentStepSize = settings.stepSize / 10.0^cycle
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif drivingCourse[end][:v] > currentSpeedLimit[:v]
|
elseif drivingCourse[end][:v] > lowestSpeedLimit[:v]
|
||||||
testFlag && println("in CS",CS[:id]," accelerating cycle",cycle," case: v=", drivingCourse[end][:v]," > v_limitCurrent=",currentSpeedLimit[:v]) # for testing
|
testFlag && println("in CS",CS[:id]," accelerating cycle",cycle," case: v=", drivingCourse[end][:v]," > v_lowestLimit=", lowestSpeedLimit[:v]) # for testing
|
||||||
if settings.stepVariable == :velocity
|
if settings.stepVariable == :velocity
|
||||||
currentStepSize = currentSpeedLimit[:v] - drivingCourse[end-1][:v]
|
currentStepSize = lowestSpeedLimit[:v] - drivingCourse[end-1][:v]
|
||||||
else
|
else
|
||||||
currentStepSize = settings.stepSize / 10.0^cycle
|
currentStepSize = settings.stepSize / 10.0^cycle
|
||||||
end
|
end
|
||||||
|
@ -196,8 +196,8 @@ function addAcceleratingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFla
|
||||||
end
|
end
|
||||||
break
|
break
|
||||||
|
|
||||||
elseif drivingCourse[end][:v] == currentSpeedLimit[:v]
|
elseif drivingCourse[end][:v] == lowestSpeedLimit[:v]
|
||||||
testFlag && println("in CS",CS[:id]," accelerating cycle",cycle," case: v=", drivingCourse[end][:v]," == v_limitCurrent=",currentSpeedLimit[:v]) # for testing
|
testFlag && println("in CS",CS[:id]," accelerating cycle",cycle," case: v=", drivingCourse[end][:v]," == v_lowestLimit=", lowestSpeedLimit[:v]) # for testing
|
||||||
break
|
break
|
||||||
|
|
||||||
elseif drivingCourse[end][:s] == nextPointOfInterest[1]
|
elseif drivingCourse[end][:s] == nextPointOfInterest[1]
|
||||||
|
@ -208,7 +208,7 @@ function addAcceleratingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFla
|
||||||
break
|
break
|
||||||
|
|
||||||
else
|
else
|
||||||
println("v=",drivingCourse[end][:v]," v_limit= ", CS[:v_limit] , " v_currentLimit=", currentSpeedLimit[:v])
|
println("v=",drivingCourse[end][:v]," v_limit= ", CS[:v_limit] , " v_lowestLimit=", lowestSpeedLimit[:v])
|
||||||
println("s=" ,drivingCourse[end][:s]," s_exit=", CS[:s_exit], " s+s_braking=", drivingCourse[end][:s] +s_braking," nextPOI=",nextPointOfInterest[1])
|
println("s=" ,drivingCourse[end][:s]," s_exit=", CS[:s_exit], " s+s_braking=", drivingCourse[end][:s] +s_braking," nextPOI=",nextPointOfInterest[1])
|
||||||
println("F_T=",drivingCourse[end][:F_T] ," F_R=", drivingCourse[end][:F_R])
|
println("F_T=",drivingCourse[end][:F_T] ," F_R=", drivingCourse[end][:F_R])
|
||||||
|
|
||||||
|
@ -226,8 +226,8 @@ function addAcceleratingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFla
|
||||||
tractionSurplus = true
|
tractionSurplus = true
|
||||||
|
|
||||||
else # if the level of approximation is reached
|
else # if the level of approximation is reached
|
||||||
if drivingCourse[end][:v] > currentSpeedLimit[:v]
|
if drivingCourse[end][:v] > lowestSpeedLimit[:v]
|
||||||
testFlag && println("in CS",CS[:id]," accelerating cycle",cycle," case: v=", drivingCourse[end][:v]," > v_limitCurrent=",currentSpeedLimit[:v], "with v_limit=",CS[:v_limit]) # for testing
|
testFlag && println("in CS",CS[:id]," accelerating cycle",cycle," case: v=", drivingCourse[end][:v]," > v_lowestLimit=", lowestSpeedLimit[:v], "with v_limit=",CS[:v_limit]) # for testing
|
||||||
pop!(drivingCourse)
|
pop!(drivingCourse)
|
||||||
|
|
||||||
# conditions for the next section
|
# conditions for the next section
|
||||||
|
@ -252,8 +252,8 @@ function addAcceleratingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFla
|
||||||
else
|
else
|
||||||
if drivingCourse[end][:s] + s_braking == CS[:s_exit]
|
if drivingCourse[end][:s] + s_braking == CS[:s_exit]
|
||||||
testFlag && println("in CS",CS[:id]," accelerating cycle",cycle," else case and there: s +s_braking=", drivingCourse[end][:s],",+",s_braking," = ",drivingCourse[end][:s] +s_braking," > s_exit=",CS[:s_exit]) # for testing
|
testFlag && println("in CS",CS[:id]," accelerating cycle",cycle," else case and there: s +s_braking=", drivingCourse[end][:s],",+",s_braking," = ",drivingCourse[end][:s] +s_braking," > s_exit=",CS[:s_exit]) # for testing
|
||||||
elseif drivingCourse[end][:v] == currentSpeedLimit[:v]
|
elseif drivingCourse[end][:v] == lowestSpeedLimit[:v]
|
||||||
testFlag && println("in CS",CS[:id]," accelerating cycle",cycle," case: v=", drivingCourse[end][:v]," == v_limitCurrent=",currentSpeedLimit[:v]) # for testing
|
testFlag && println("in CS",CS[:id]," accelerating cycle",cycle," case: v=", drivingCourse[end][:v]," == v_lowestLimit=", lowestSpeedLimit[:v]) # for testing
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -526,8 +526,8 @@ function addCruisingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFlags::
|
||||||
stateFlags[:brakingStartReached] = brakingStartReached || drivingCourse[end][:s] + s_braking >= CS[:s_exit]
|
stateFlags[:brakingStartReached] = brakingStartReached || drivingCourse[end][:s] + s_braking >= CS[:s_exit]
|
||||||
stateFlags[:tractionDeficit] = tractionDeficit
|
stateFlags[:tractionDeficit] = tractionDeficit
|
||||||
stateFlags[:resistingForceNegative] = drivingCourse[end][:F_R] < 0.0
|
stateFlags[:resistingForceNegative] = drivingCourse[end][:F_R] < 0.0
|
||||||
currentSpeedLimit = getCurrentSpeedLimit(CSs, CS[:id], drivingCourse[end][:s], train.length)
|
lowestSpeedLimit = getLowestSpeedLimit(CSs, CS[:id], drivingCourse[end][:s], train.length)
|
||||||
stateFlags[:previousSpeedLimitReached] = currentSpeedLimit[:v] != CS[:v_limit] && drivingCourse[end][:v] >= currentSpeedLimit[:v]
|
stateFlags[:previousSpeedLimitReached] = lowestSpeedLimit[:v] != CS[:v_limit] && drivingCourse[end][:v] >= lowestSpeedLimit[:v]
|
||||||
stateFlags[:error] = !(targetPositionReached || tractionDeficit || !(cruisingType == "clearing" || ((cruisingType == "downhillBraking") == resistingForceNegative)))
|
stateFlags[:error] = !(targetPositionReached || tractionDeficit || !(cruisingType == "clearing" || ((cruisingType == "downhillBraking") == resistingForceNegative)))
|
||||||
|
|
||||||
return (CS, drivingCourse, stateFlags)
|
return (CS, drivingCourse, stateFlags)
|
||||||
|
@ -710,8 +710,8 @@ end #function addDiminishingSection!
|
||||||
function addCoastingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFlags::Dict, settings::Settings, train::Train, CSs::Vector{Dict})
|
function addCoastingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFlags::Dict, settings::Settings, train::Train, CSs::Vector{Dict})
|
||||||
|
|
||||||
# conditions for coasting section
|
# conditions for coasting section
|
||||||
currentSpeedLimit = getCurrentSpeedLimit(CSs, CS[:id], drivingCourse[end][:s], train.length)
|
lowestSpeedLimit = getLowestSpeedLimit(CSs, CS[:id], drivingCourse[end][:s], train.length)
|
||||||
previousSpeedLimitReached = currentSpeedLimit[:v] != CS[:v_limit] && drivingCourse[end][:v] > currentSpeedLimit[:v]
|
previousSpeedLimitReached = lowestSpeedLimit[:v] != CS[:v_limit] && drivingCourse[end][:v] > lowestSpeedLimit[:v]
|
||||||
speedLimitReached = drivingCourse[end][:v] > CS[:v_limit]
|
speedLimitReached = drivingCourse[end][:v] > CS[:v_limit]
|
||||||
targetSpeedReached = drivingCourse[end][:v] <= CS[:v_exit] || previousSpeedLimitReached || speedLimitReached
|
targetSpeedReached = drivingCourse[end][:v] <= CS[:v_exit] || previousSpeedLimitReached || speedLimitReached
|
||||||
endOfCSReached = drivingCourse[end][:s] >= CS[:s_exit] || stateFlags[:endOfCSReached]
|
endOfCSReached = drivingCourse[end][:s] >= CS[:s_exit] || stateFlags[:endOfCSReached]
|
||||||
|
@ -731,9 +731,9 @@ function addCoastingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFlags::
|
||||||
|
|
||||||
for cycle in 1:settings.approxLevel+1 # first cycle with normal step size followed by cycles with reduced step size depending on the level of approximation
|
for cycle in 1:settings.approxLevel+1 # first cycle with normal step size followed by cycles with reduced step size depending on the level of approximation
|
||||||
while !targetSpeedReached && !brakingStartReached && !pointOfInterestReached
|
while !targetSpeedReached && !brakingStartReached && !pointOfInterestReached
|
||||||
if drivingCourse[end][:s] >= currentSpeedLimit[:s_end]
|
if drivingCourse[end][:s] >= lowestSpeedLimit[:s_end]
|
||||||
# could be asked after creating an support point. This way here prevents even a minimal exceedance of speed limit.
|
# could be asked after creating an support point. This way here prevents even a minimal exceedance of speed limit.
|
||||||
currentSpeedLimit = getCurrentSpeedLimit(CSs, CS[:id], drivingCourse[end][:s], train.length)
|
lowestSpeedLimit = getLowestSpeedLimit(CSs, CS[:id], drivingCourse[end][:s], train.length)
|
||||||
end
|
end
|
||||||
|
|
||||||
# traction effort and resisting forces (in N):
|
# traction effort and resisting forces (in N):
|
||||||
|
@ -750,7 +750,7 @@ function addCoastingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFlags::
|
||||||
s_braking = brakingDistance(drivingCourse[end][:v], CS[:v_exit], train.a_braking, settings.approxLevel)
|
s_braking = brakingDistance(drivingCourse[end][:v], CS[:v_exit], train.a_braking, settings.approxLevel)
|
||||||
brakingStartReached = drivingCourse[end][:s] + s_braking >= CS[:s_exit]
|
brakingStartReached = drivingCourse[end][:s] + s_braking >= CS[:s_exit]
|
||||||
pointOfInterestReached = drivingCourse[end][:s] >= nextPointOfInterest[1]
|
pointOfInterestReached = drivingCourse[end][:s] >= nextPointOfInterest[1]
|
||||||
targetSpeedReached = drivingCourse[end][:v] <= CS[:v_exit] || drivingCourse[end][:v] > CS[:v_limit] || currentSpeedLimit[:v] < CS[:v_limit] && (drivingCourse[end][:v] > currentSpeedLimit[:v] || (drivingCourse[end][:v] == currentSpeedLimit[:v] && drivingCourse[end][:s] < currentSpeedLimit[:s_end]))
|
targetSpeedReached = drivingCourse[end][:v] <= CS[:v_exit] || drivingCourse[end][:v] > CS[:v_limit] || lowestSpeedLimit[:v] < CS[:v_limit] && (drivingCourse[end][:v] > lowestSpeedLimit[:v] || (drivingCourse[end][:v] == lowestSpeedLimit[:v] && drivingCourse[end][:s] < lowestSpeedLimit[:s_end]))
|
||||||
end # while
|
end # while
|
||||||
|
|
||||||
testFlag = false
|
testFlag = false
|
||||||
|
@ -777,10 +777,10 @@ function addCoastingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFlags::
|
||||||
currentStepSize = settings.stepSize / 10.0^cycle
|
currentStepSize = settings.stepSize / 10.0^cycle
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif drivingCourse[end][:v] > currentSpeedLimit[:v]
|
elseif drivingCourse[end][:v] > lowestSpeedLimit[:v]
|
||||||
testFlag && println("in CS",CS[:id]," coasting cycle",cycle," case: v=", drivingCourse[end][:v]," > v_limitCurrent=", currentSpeedLimit[:v]) # for testing
|
testFlag && println("in CS",CS[:id]," coasting cycle",cycle," case: v=", drivingCourse[end][:v]," > v_lowestLimit=", lowestSpeedLimit[:v]) # for testing
|
||||||
if settings.stepVariable == :velocity
|
if settings.stepVariable == :velocity
|
||||||
currentStepSize = currentSpeedLimit[:v] - drivingCourse[end-1][:v]
|
currentStepSize = lowestSpeedLimit[:v] - drivingCourse[end-1][:v]
|
||||||
else
|
else
|
||||||
currentStepSize = settings.stepSize / 10.0^cycle
|
currentStepSize = settings.stepSize / 10.0^cycle
|
||||||
end
|
end
|
||||||
|
@ -825,14 +825,14 @@ function addCoastingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFlags::
|
||||||
pointOfInterestReached = false
|
pointOfInterestReached = false
|
||||||
targetSpeedReached = false
|
targetSpeedReached = false
|
||||||
|
|
||||||
elseif drivingCourse[end][:v] > currentSpeedLimit[:v] # if the train gets to fast it has to brake to hold the velocity limit
|
elseif drivingCourse[end][:v] > lowestSpeedLimit[:v] # if the train gets to fast it has to brake to hold the velocity limit
|
||||||
# delete last support point because it went to far
|
# delete last support point because it went to far
|
||||||
pop!(drivingCourse)
|
pop!(drivingCourse)
|
||||||
|
|
||||||
# conditions for the next for cycle
|
# conditions for the next for cycle
|
||||||
brakingStartReached = false
|
brakingStartReached = false
|
||||||
pointOfInterestReached = false
|
pointOfInterestReached = false
|
||||||
if currentSpeedLimit[:v] != CS[:v_limit]
|
if lowestSpeedLimit[:v] != CS[:v_limit]
|
||||||
previousSpeedLimitReached = true
|
previousSpeedLimitReached = true
|
||||||
else
|
else
|
||||||
speedLimitReached = true
|
speedLimitReached = true
|
||||||
|
@ -1000,8 +1000,8 @@ function addBrakingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFlags::D
|
||||||
end # else: return the characteristic section without a braking section
|
end # else: return the characteristic section without a braking section
|
||||||
|
|
||||||
# set state flags
|
# set state flags
|
||||||
currentSpeedLimit = getCurrentSpeedLimit(CSs, CS[:id], drivingCourse[end][:s], train.length)
|
lowestSpeedLimit = getLowestSpeedLimit(CSs, CS[:id], drivingCourse[end][:s], train.length)
|
||||||
stateFlags[:previousSpeedLimitReached] = currentSpeedLimit[:v] != CS[:v_limit] && drivingCourse[end][:v] >= currentSpeedLimit[:v]
|
stateFlags[:previousSpeedLimitReached] = lowestSpeedLimit[:v] != CS[:v_limit] && drivingCourse[end][:v] >= lowestSpeedLimit[:v]
|
||||||
stateFlags[:speedLimitReached] = drivingCourse[end][:v] >= CS[:v_exit]
|
stateFlags[:speedLimitReached] = drivingCourse[end][:v] >= CS[:v_exit]
|
||||||
stateFlags[:endOfCSReached] = endOfCSReached
|
stateFlags[:endOfCSReached] = endOfCSReached
|
||||||
stateFlags[:error] = !(endOfCSReached)
|
stateFlags[:error] = !(endOfCSReached)
|
||||||
|
|
12
src/calc.jl
12
src/calc.jl
|
@ -44,6 +44,10 @@ function calculateMinimumRunningTime!(CSs::Vector{Dict}, settings::Settings, tra
|
||||||
|
|
||||||
# determine the behavior sections for this characteristic section. It has to be at least one of those BS: "breakFree", "clearing", "accelerating", "cruising", "diminishing", "coasting", "braking" or "halt")
|
# determine the behavior sections for this characteristic section. It has to be at least one of those BS: "breakFree", "clearing", "accelerating", "cruising", "diminishing", "coasting", "braking" or "halt")
|
||||||
while !stateFlags[:endOfCSReached] # s < s_exit
|
while !stateFlags[:endOfCSReached] # s < s_exit
|
||||||
|
if stateFlags[:error]
|
||||||
|
error("ERROR in calc in CS",CS[:id],": BS=",drivingCourse[end][:behavior]," s=",drivingCourse[end][:s]," s_braking=",s_braking," v_limit=",CS[:v_limit]," v=",drivingCourse[end][:v]," v_exit=",CS[:v_exit]," with the flags: endOfCS: ",stateFlags[:endOfCSReached]," brakingStart: ",stateFlags[:brakingStartReached]," F_T<F_R: ",stateFlags[:tractionDeficit]," F_R<0: ",stateFlags[:resistingForceNegative]," v_previousLimit: ",stateFlags[:previousSpeedLimitReached]," v_limit: ",stateFlags[:speedLimitReached]," error: ",stateFlags[:error])
|
||||||
|
end
|
||||||
|
|
||||||
if !stateFlags[:brakingStartReached] # s+s_braking < s_exit
|
if !stateFlags[:brakingStartReached] # s+s_braking < s_exit
|
||||||
if !stateFlags[:tractionDeficit]
|
if !stateFlags[:tractionDeficit]
|
||||||
if drivingCourse[end][:F_T] > drivingCourse[end][:F_R] && drivingCourse[end][:v] == 0.0
|
if drivingCourse[end][:F_T] > drivingCourse[end][:F_R] && drivingCourse[end][:v] == 0.0
|
||||||
|
@ -287,7 +291,7 @@ end #function moveAStep
|
||||||
"""
|
"""
|
||||||
# if the rear of the train is still located in a former characteristic section it has to be checked if its speed limit can be kept
|
# if the rear of the train is still located in a former characteristic section it has to be checked if its speed limit can be kept
|
||||||
"""
|
"""
|
||||||
function getCurrentSpeedLimit(CSs::Vector{Dict}, csWithTrainHeadId::Integer, s::Real, trainLength::Real)
|
function getLowestSpeedLimit(CSs::Vector{Dict}, csWithTrainHeadId::Integer, s::Real, trainLength::Real)
|
||||||
v_limit = CSs[csWithTrainHeadId][:v_limit]
|
v_limit = CSs[csWithTrainHeadId][:v_limit]
|
||||||
s_exit = CSs[csWithTrainHeadId][:s_exit]
|
s_exit = CSs[csWithTrainHeadId][:s_exit]
|
||||||
if csWithTrainHeadId > 1 && s -trainLength < CSs[csWithTrainHeadId][:s_entry]
|
if csWithTrainHeadId > 1 && s -trainLength < CSs[csWithTrainHeadId][:s_entry]
|
||||||
|
@ -300,9 +304,9 @@ function getCurrentSpeedLimit(CSs::Vector{Dict}, csWithTrainHeadId::Integer, s::
|
||||||
formerCsId = formerCsId -1
|
formerCsId = formerCsId -1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
currentSpeedLimit = Dict(:v => v_limit, :s_end => s_exit + trainLength)
|
lowestSpeedLimit = Dict(:v => v_limit, :s_end => s_exit + trainLength)
|
||||||
return currentSpeedLimit
|
return lowestSpeedLimit
|
||||||
end #function getCurrentSpeedLimit
|
end #function getLowestSpeedLimit
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue