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
drivingMode = "breakFree"
drivingCourse[end][:behavior] = drivingMode
startingPoint = drivingCourse[end][:i]
startingPoint = length(drivingCourse)
# 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
@ -30,7 +30,7 @@ function addBreakFreeSection!(drivingCourse::Vector{Dict}, stateFlags::Dict, CSs
end
# delete every supportPoint except the first two
while drivingCourse[end][:i] > startingPoint +1
while length(drivingCourse) > startingPoint +1
pop!(drivingCourse)
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
# create empty support point and set it for the values of s_exit and v_exit
push!(drivingCourse, SupportPoint())
drivingCourse[end][:i] = drivingCourse[end-1][:i]+1
drivingCourse[end][:behavior] = drivingMode
recalculateLastBrakingPoint!(drivingCourse, CS[:s_exit], CS[:v_exit])
else
@ -859,7 +858,6 @@ function addBrakingSection!(drivingCourse::Vector{Dict}, stateFlags::Dict, CSs::
push!(drivingCourse, moveAStep(drivingCourse[end], settings.stepVariable, currentStepSize, csId))
drivingCourse[end][:behavior] = drivingMode
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
pointOfInterestReached = drivingCourse[end][:s] >= nextPointOfInterest[1]

View File

@ -9,7 +9,6 @@
# calculate a train run focussing on using the minimum possible running time
function calculateMinimumRunningTime(CSs::Vector{Dict}, settings::Settings, train::Train)
startingPoint = SupportPoint()
startingPoint[:i] = 1
startingPoint[:s] = CSs[1][:s_entry]
calculateForces!(startingPoint, CSs, 1, "default", train, settings.massModel) # traction effort and resisting forces (in N)
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
newPoint = SupportPoint()
newPoint[:i] = previousPoint[:i]+1 # identifier
# calculate s, t, v, E
if stepVariable == :distance # distance step method

View File

@ -671,9 +671,8 @@ a SupportPoint is the smallest element of the driving course. One step of the st
"""
function SupportPoint()
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()
# 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)
:t => 0.0, # point in time (in s)
:v => 0.0, # velocity (in m/s)