diff --git a/src/behavior.jl b/src/behavior.jl index 046ba7c..10d3c88 100644 --- a/src/behavior.jl +++ b/src/behavior.jl @@ -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] diff --git a/src/calc.jl b/src/calc.jl index 0018e9b..21ff56a 100644 --- a/src/calc.jl +++ b/src/calc.jl @@ -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 diff --git a/src/constructors.jl b/src/constructors.jl index 2dc30cc..bbe6289 100644 --- a/src/constructors.jl +++ b/src/constructors.jl @@ -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)