From 548d46b6c45446a6ae4ac20cd2ea662edfc3c77d Mon Sep 17 00:00:00 2001 From: Max Kannenberg <95709892+MaxKannenberg@users.noreply.github.com> Date: Wed, 17 Aug 2022 15:22:10 +0200 Subject: [PATCH] Remove the key :v_entry from CharacteristicSection dictionary --- src/behavior.jl | 12 ++++++------ src/calc.jl | 8 -------- src/constructors.jl | 4 +--- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/behavior.jl b/src/behavior.jl index 65b923c..a692bc1 100644 --- a/src/behavior.jl +++ b/src/behavior.jl @@ -1003,20 +1003,20 @@ end #function recalculateLastBrakingPoint ## define the intersection velocities between the characterisitc sections to secure braking behavior function secureBrakingBehavior!(CSs::Vector{Dict}, a_braking::Real, approxLevel::Integer) - # limit the entry and exit velocity of the characteristic sections to secure that the train stops at the moving sections end + # limit the entry and exit velocities of the characteristic sections to secure that the train stops at the moving sections end csId = length(CSs) - followingCSv_entry = 0.0 # the exit velocity of the last characteristic section is 0.0 m/s + v_entryFollowing = 0.0 # the exit velocity of the last characteristic section is 0.0 m/s while csId >= 1 + # calculate the maximum possible entry velocity to define the previous section's maximum allowed exit velocity CS = CSs[csId] - CS[:v_exit] = min(CS[:v_limit], followingCSv_entry) + CS[:v_exit] = min(CS[:v_limit], v_entryFollowing) - v_entryMax = brakingStartVelocity(CS[:v_exit], a_braking, CS[:s_exit]-CS[:s_entry], approxLevel) + v_entry = brakingStartVelocity(CS[:v_exit], a_braking, CS[:s_exit]-CS[:s_entry], approxLevel) - CS[:v_entry] = min(CS[:v_limit], v_entryMax) + v_entryFollowing = min(CS[:v_limit], v_entry) - followingCSv_entry = CS[:v_entry] csId = csId - 1 end #while return CSs diff --git a/src/calc.jl b/src/calc.jl index d559658..474d5c0 100644 --- a/src/calc.jl +++ b/src/calc.jl @@ -21,14 +21,6 @@ function calculateMinimumRunningTime!(CSs::Vector{Dict}, settings::Settings, tra for csId in 1:length(CSs) CS = CSs[csId] - # for testing: # TODO - if drivingCourse[end][:s] != CS[:s_entry] - println("ERROR: In CS", csId," the train run starts at s=",drivingCourse[end][:s]," and not s_entry=",CS[:s_entry]) - end - if drivingCourse[end][:v] > CS[:v_entry] - println("ERROR: In CS", csId," the train run ends with v=",drivingCourse[end][:v]," and not with v_entry=",CS[:v_entry]) - end - # determine the different flags for switching between the states for creating moving phases s_braking = brakingDistance(drivingCourse[end][:v], CS[:v_exit], train.a_braking, settings.approxLevel) calculateForces!(drivingCourse[end], CSs, CS[:id], "default", train, settings.massModel) # tractive effort and resisting forces (in N) diff --git a/src/constructors.jl b/src/constructors.jl index c6ec5b9..f601efe 100644 --- a/src/constructors.jl +++ b/src/constructors.jl @@ -644,9 +644,7 @@ function CharacteristicSection(id::Integer, s_entry::Real, section::Dict, v_limi :s_exit => section[:s_end], # last position (in m) :r_path => section[:f_Rp], # path resistance (in ‰) :v_limit => v_limit, # speed limit (in m/s) - # initializing :v_entry and :v_exit with :v_limit - :v_entry => v_limit, # maximum entry speed (in m/s) - :v_exit => v_limit) # maximum exit speed (in m/s) + :v_exit => v_limit) # maximum exit speed (in m/s) initialized with v_limit # list of positions of every point of interest (POI) in this charateristic section for which support points should be calculated s_exit = characteristicSection[:s_exit]