Remove key :i from SupportPoint dictionary

master
Max Kannenberg 2022-08-18 13:44:57 +02:00
parent 4a047f4cf2
commit 94839a28c0
3 changed files with 3 additions and 8 deletions

View File

@ -17,7 +17,7 @@ function addBreakFreeSection!(drivingCourse::Vector{Dict}, stateFlags::Dict, CSs
if trainIsHalting && !endOfCSReached if trainIsHalting && !endOfCSReached
drivingMode = "breakFree" drivingMode = "breakFree"
drivingCourse[end][:behavior] = drivingMode drivingCourse[end][:behavior] = drivingMode
startingPoint = drivingCourse[end][:i] startingPoint = length(drivingCourse)
# traction effort and resisting forces (in N) # traction effort and resisting forces (in N)
calculateForces!(drivingCourse[end], CSs, csId, "accelerating", train, settings.massModel) # currently the tractive effort is calculated like in the accelerating section calculateForces!(drivingCourse[end], CSs, csId, "accelerating", train, settings.massModel) # currently the tractive effort is calculated like in the accelerating section
@ -30,7 +30,7 @@ function addBreakFreeSection!(drivingCourse::Vector{Dict}, stateFlags::Dict, CSs
end end
# delete every supportPoint except the first two # delete every supportPoint except the first two
while drivingCourse[end][:i] > startingPoint +1 while length(drivingCourse) > startingPoint +1
pop!(drivingCourse) pop!(drivingCourse)
end end
@ -851,7 +851,6 @@ function addBrakingSection!(drivingCourse::Vector{Dict}, stateFlags::Dict, CSs::
if settings.stepVariable == :distance && ((drivingCourse[end][:v]/drivingCourse[end][:a])^2+2*currentStepSize/drivingCourse[end][:a])<0.0 || (drivingCourse[end][:v]^2+2*currentStepSize*drivingCourse[end][:a])<0.0 if settings.stepVariable == :distance && ((drivingCourse[end][:v]/drivingCourse[end][:a])^2+2*currentStepSize/drivingCourse[end][:a])<0.0 || (drivingCourse[end][:v]^2+2*currentStepSize*drivingCourse[end][:a])<0.0
# create empty support point and set it for the values of s_exit and v_exit # create empty support point and set it for the values of s_exit and v_exit
push!(drivingCourse, SupportPoint()) push!(drivingCourse, SupportPoint())
drivingCourse[end][:i] = drivingCourse[end-1][:i]+1
drivingCourse[end][:behavior] = drivingMode drivingCourse[end][:behavior] = drivingMode
recalculateLastBrakingPoint!(drivingCourse, CS[:s_exit], CS[:v_exit]) recalculateLastBrakingPoint!(drivingCourse, CS[:s_exit], CS[:v_exit])
else else
@ -859,7 +858,6 @@ function addBrakingSection!(drivingCourse::Vector{Dict}, stateFlags::Dict, CSs::
push!(drivingCourse, moveAStep(drivingCourse[end], settings.stepVariable, currentStepSize, csId)) push!(drivingCourse, moveAStep(drivingCourse[end], settings.stepVariable, currentStepSize, csId))
drivingCourse[end][:behavior] = drivingMode drivingCourse[end][:behavior] = drivingMode
end end
#println(drivingCourse[end][:i],". s=",drivingCourse[end][:s]," s_exit=", CS[:s_exit]," v_exit=", CS[:v_exit]," v=",drivingCourse[end][:v])
# conditions for the next while cycle # conditions for the next while cycle
pointOfInterestReached = drivingCourse[end][:s] >= nextPointOfInterest[1] pointOfInterestReached = drivingCourse[end][:s] >= nextPointOfInterest[1]

View File

@ -9,7 +9,6 @@
# calculate a train run focussing on using the minimum possible running time # calculate a train run focussing on using the minimum possible running time
function calculateMinimumRunningTime(CSs::Vector{Dict}, settings::Settings, train::Train) function calculateMinimumRunningTime(CSs::Vector{Dict}, settings::Settings, train::Train)
startingPoint = SupportPoint() startingPoint = SupportPoint()
startingPoint[:i] = 1
startingPoint[:s] = CSs[1][:s_entry] startingPoint[:s] = CSs[1][:s_entry]
calculateForces!(startingPoint, CSs, 1, "default", train, settings.massModel) # traction effort and resisting forces (in N) calculateForces!(startingPoint, CSs, 1, "default", train, settings.massModel) # traction effort and resisting forces (in N)
drivingCourse::Vector{Dict} = [startingPoint] # List of support points drivingCourse::Vector{Dict} = [startingPoint] # List of support points
@ -223,7 +222,6 @@ function moveAStep(previousPoint::Dict, stepVariable::Symbol, stepSize::Real, cs
# create the next support point # create the next support point
newPoint = SupportPoint() newPoint = SupportPoint()
newPoint[:i] = previousPoint[:i]+1 # identifier
# calculate s, t, v, E # calculate s, t, v, E
if stepVariable == :distance # distance step method if stepVariable == :distance # distance step method

View File

@ -671,7 +671,6 @@ a SupportPoint is the smallest element of the driving course. One step of the st
""" """
function SupportPoint() function SupportPoint()
supportPoint = Dict( supportPoint = Dict(
:i => 0, # identifier and counter variable of the driving course
:behavior => "", # type of behavior section the support point is part of - see BehaviorSection() :behavior => "", # type of behavior section the support point is part of - see BehaviorSection()
# a support point which is the last point of one behavior section and the first point of the next behavior section will be attached to the latter # a support point which is the last point of one behavior section and the first point of the next behavior section will be attached to the latter
:s => 0.0, # position (in m) :s => 0.0, # position (in m)