Change behavior section "standstill" to "halt"
parent
ae5cc07862
commit
4c7980bbe6
|
@ -1304,11 +1304,11 @@ function addBrakingSection!(CS::Dict, drivingCourse::Vector{Dict}, stateFlags::D
|
||||||
end #function addBrakingSection!
|
end #function addBrakingSection!
|
||||||
|
|
||||||
|
|
||||||
## This function calculates the data point of the standstill.
|
## This function calculates the data point of the halt.
|
||||||
# Therefore it gets its first data point and the characteristic section and returns the characteristic section including the standstill if needed.
|
# Therefore it gets its first data point and the characteristic section and returns the characteristic section including the halt if needed.
|
||||||
function addStandstill!(CS::Dict, drivingCourse::Vector{Dict}, settings::Settings, train::Train, CSs::Vector{Dict})
|
function addHalt!(CS::Dict, drivingCourse::Vector{Dict}, settings::Settings, train::Train, CSs::Vector{Dict})
|
||||||
if drivingCourse[end][:v] == 0.0
|
if drivingCourse[end][:v] == 0.0
|
||||||
BS = createBehaviorSection("standstill", drivingCourse[end][:s], drivingCourse[end][:v], drivingCourse[end][:i])
|
BS = createBehaviorSection("halt", drivingCourse[end][:s], drivingCourse[end][:v], drivingCourse[end][:i])
|
||||||
merge!(BS, Dict(:length => 0.0, # total length (in m)
|
merge!(BS, Dict(:length => 0.0, # total length (in m)
|
||||||
:t => 0.0, # total running time (in s)
|
:t => 0.0, # total running time (in s)
|
||||||
:E => 0.0, # total energy consumption (in Ws)
|
:E => 0.0, # total energy consumption (in Ws)
|
||||||
|
@ -1319,10 +1319,10 @@ function addStandstill!(CS::Dict, drivingCourse::Vector{Dict}, settings::Setting
|
||||||
# traction effort and resisting forces (in N)
|
# traction effort and resisting forces (in N)
|
||||||
calculateForces!(drivingCourse[end], CSs, CS[:id], BS[:type], train, settings.massModel)
|
calculateForces!(drivingCourse[end], CSs, CS[:id], BS[:type], train, settings.massModel)
|
||||||
|
|
||||||
merge!(CS[:behaviorSections], Dict(:standstill => BS))
|
merge!(CS[:behaviorSections], Dict(:halt => BS))
|
||||||
end # else: return the characteristic section without a standstillSection section
|
end # else: return the characteristic section without a halt section section
|
||||||
return (CS, drivingCourse)
|
return (CS, drivingCourse)
|
||||||
end #function addStandstill!
|
end #function addHalt!
|
||||||
|
|
||||||
function mergeBehaviorSection!(BSs::Dict, BS::Dict)
|
function mergeBehaviorSection!(BSs::Dict, BS::Dict)
|
||||||
if !haskey(BSs, Symbol(BS[:type]))
|
if !haskey(BSs, Symbol(BS[:type]))
|
||||||
|
|
|
@ -44,7 +44,7 @@ function calculateMinimumRunningTime!(movingSection::Dict, settings::Settings, t
|
||||||
:speedLimitReached => drivingCourse[end][:v] > CS[:v_limit],
|
:speedLimitReached => drivingCourse[end][:v] > CS[:v_limit],
|
||||||
:error => false)
|
:error => false)
|
||||||
|
|
||||||
# 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 "standstill")
|
# 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[:brakingStartReached] # s+s_braking < s_exit
|
if !stateFlags[:brakingStartReached] # s+s_braking < s_exit
|
||||||
if !stateFlags[:tractionDeficit]
|
if !stateFlags[:tractionDeficit]
|
||||||
|
@ -103,7 +103,7 @@ function calculateMinimumRunningTime!(movingSection::Dict, settings::Settings, t
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#if s == s_exit
|
#if s == s_exit
|
||||||
# standstill
|
# halt
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ function calculateMinimumRunningTime!(movingSection::Dict, settings::Settings, t
|
||||||
end
|
end
|
||||||
end #for
|
end #for
|
||||||
|
|
||||||
(CSs[end], drivingCourse) = addStandstill!(CSs[end], drivingCourse, settings, train, CSs)
|
(CSs[end], drivingCourse) = addHalt!(CSs[end], drivingCourse, settings, train, CSs)
|
||||||
|
|
||||||
movingSection[:t] = drivingCourse[end][:t] # total running time (in s)
|
movingSection[:t] = drivingCourse[end][:t] # total running time (in s)
|
||||||
movingSection[:E] = drivingCourse[end][:E] # total energy consumption (in Ws)
|
movingSection[:E] = drivingCourse[end][:E] # total energy consumption (in Ws)
|
||||||
|
|
|
@ -63,7 +63,7 @@ function Settings(file="DEFAULT")
|
||||||
}""")
|
}""")
|
||||||
|
|
||||||
settings = YAML.load(open(file))["settings"]
|
settings = YAML.load(open(file))["settings"]
|
||||||
|
|
||||||
## validate the loaded file
|
## validate the loaded file
|
||||||
try
|
try
|
||||||
validate(schema, settings)
|
validate(schema, settings)
|
||||||
|
@ -116,12 +116,12 @@ function Path(file, type = :YAML)
|
||||||
data = YAML.load(open(file))
|
data = YAML.load(open(file))
|
||||||
if data["schema"] != "https://railtoolkit.org/schema/running-path.json"
|
if data["schema"] != "https://railtoolkit.org/schema/running-path.json"
|
||||||
error("Could not load path file '$file'.\n
|
error("Could not load path file '$file'.\n
|
||||||
YAML format is not recognized.
|
YAML format is not recognized.
|
||||||
Currently supported: railtoolkit/schema/running-path (2022.05)")
|
Currently supported: railtoolkit/schema/running-path (2022.05)")
|
||||||
end
|
end
|
||||||
if data["schema_version"] != "2022.05"
|
if data["schema_version"] != "2022.05"
|
||||||
error("Could not load path file '$file'.\n
|
error("Could not load path file '$file'.\n
|
||||||
YAML format is not recognized.
|
YAML format is not recognized.
|
||||||
Currently supported: railtoolkit/schema/running-path (2022.05)")
|
Currently supported: railtoolkit/schema/running-path (2022.05)")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ function Path(file, type = :YAML)
|
||||||
validate(railtoolkit_schema, paths)
|
validate(railtoolkit_schema, paths)
|
||||||
catch err
|
catch err
|
||||||
error("Could not load path file '$file'.\n
|
error("Could not load path file '$file'.\n
|
||||||
YAML format is not recognized.
|
YAML format is not recognized.
|
||||||
Currently supported: railtoolkit/schema/running-path (2022.05)")
|
Currently supported: railtoolkit/schema/running-path (2022.05)")
|
||||||
end
|
end
|
||||||
if length(paths) > 1
|
if length(paths) > 1
|
||||||
|
@ -258,7 +258,7 @@ function Path(file, type = :YAML)
|
||||||
station = elem[1] # first point of the section (in m)
|
station = elem[1] # first point of the section (in m)
|
||||||
label = elem[2] # paths speed limt (in m/s)
|
label = elem[2] # paths speed limt (in m/s)
|
||||||
measure = elem[3] # specific path resistance of the section (in ‰)
|
measure = elem[3] # specific path resistance of the section (in ‰)
|
||||||
|
|
||||||
point = Dict(:station => station,
|
point = Dict(:station => station,
|
||||||
:label => label,
|
:label => label,
|
||||||
:measure => measure)
|
:measure => measure)
|
||||||
|
@ -315,14 +315,14 @@ function Train(file, type = :YAML)
|
||||||
if type == :YAML
|
if type == :YAML
|
||||||
|
|
||||||
data = YAML.load(open(file))
|
data = YAML.load(open(file))
|
||||||
if data["schema"] != "https://railtoolkit.org/schema/rolling-stock.json"
|
if data["schema"] != "https://railtoolkit.org/schema/rolling-stock.json"
|
||||||
error("Could not load path file '$file'.\n
|
error("Could not load path file '$file'.\n
|
||||||
YAML format is not recognized.
|
YAML format is not recognized.
|
||||||
Currently supported: railtoolkit/schema/rolling-stock (2022.05)")
|
Currently supported: railtoolkit/schema/rolling-stock (2022.05)")
|
||||||
end
|
end
|
||||||
if data["schema_version"] != "2022.05"
|
if data["schema_version"] != "2022.05"
|
||||||
error("Could not load path file '$file'.\n
|
error("Could not load path file '$file'.\n
|
||||||
YAML format is not recognized.
|
YAML format is not recognized.
|
||||||
Currently supported: railtoolkit/schema/rolling-stock (2022.05)")
|
Currently supported: railtoolkit/schema/rolling-stock (2022.05)")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -472,14 +472,14 @@ function Train(file, type = :YAML)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}""")
|
}""")
|
||||||
|
|
||||||
try
|
try
|
||||||
validate(railtoolkit_schema, data)
|
validate(railtoolkit_schema, data)
|
||||||
catch err
|
catch err
|
||||||
error("Could not load path file '$file'.\n
|
error("Could not load path file '$file'.\n
|
||||||
YAML format is not recognized.
|
YAML format is not recognized.
|
||||||
Currently supported: railtoolkit/schema/rolling-stock (2022.05)")
|
Currently supported: railtoolkit/schema/rolling-stock (2022.05)")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -514,7 +514,7 @@ function Train(file, type = :YAML)
|
||||||
push!(vehicles, (data=vehicle, n=n, propulsion=propulsion) )
|
push!(vehicles, (data=vehicle, n=n, propulsion=propulsion) )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
## set the variables in "train"
|
## set the variables in "train"
|
||||||
name = train["name"]
|
name = train["name"]
|
||||||
id = train["id"]
|
id = train["id"]
|
||||||
|
@ -529,8 +529,8 @@ function Train(file, type = :YAML)
|
||||||
haskey(vehicle.data, "load_limit") ?
|
haskey(vehicle.data, "load_limit") ?
|
||||||
m_train_full += vehicle.data["load_limit"] * vehicle.n * 1000 : # in kg
|
m_train_full += vehicle.data["load_limit"] * vehicle.n * 1000 : # in kg
|
||||||
nothing
|
nothing
|
||||||
haskey(vehicle.data, "speed_limit") ?
|
haskey(vehicle.data, "speed_limit") ?
|
||||||
v_limit > vehicle.data["speed_limit"]/3.6 ? v_limit = vehicle.data["speed_limit"]/3.6 : nothing :
|
v_limit > vehicle.data["speed_limit"]/3.6 ? v_limit = vehicle.data["speed_limit"]/3.6 : nothing :
|
||||||
nothing
|
nothing
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -569,17 +569,17 @@ function Train(file, type = :YAML)
|
||||||
resis_air = []
|
resis_air = []
|
||||||
rotMassFac = []
|
rotMassFac = []
|
||||||
for car in cars
|
for car in cars
|
||||||
haskey(car.data, "base_resistance") ?
|
haskey(car.data, "base_resistance") ?
|
||||||
append!(resis_base,repeat([car.data["base_resistance"]],car.n)) :
|
append!(resis_base,repeat([car.data["base_resistance"]],car.n)) :
|
||||||
append!(resis_base,repeat([f_Rw0],car.n))
|
append!(resis_base,repeat([f_Rw0],car.n))
|
||||||
haskey(car.data, "rolling_resistance") ?
|
haskey(car.data, "rolling_resistance") ?
|
||||||
append!(resis_roll,repeat([car.data["rolling_resistance"]],car.n)) :
|
append!(resis_roll,repeat([car.data["rolling_resistance"]],car.n)) :
|
||||||
append!(resis_roll,repeat([f_Rw1],car.n))
|
append!(resis_roll,repeat([f_Rw1],car.n))
|
||||||
haskey(car.data, "air_resistance") ?
|
haskey(car.data, "air_resistance") ?
|
||||||
append!(resis_air,repeat([car.data["air_resistance"]],car.n)) :
|
append!(resis_air,repeat([car.data["air_resistance"]],car.n)) :
|
||||||
append!(resis_air, repeat([f_Rw2],car.n))
|
append!(resis_air, repeat([f_Rw2],car.n))
|
||||||
haskey(car.data, "rotation_mass") ?
|
haskey(car.data, "rotation_mass") ?
|
||||||
append!(rotMassFac,repeat([(car.data["rotation_mass"],car.data["mass"])],car.n)) :
|
append!(rotMassFac,repeat([(car.data["rotation_mass"],car.data["mass"])],car.n)) :
|
||||||
append!(rotMassFac,repeat([(ξ_cars ,car.data["mass"])],car.n))
|
append!(rotMassFac,repeat([(ξ_cars ,car.data["mass"])],car.n))
|
||||||
m_car_empty += car.data["mass"] * car.n * 1000 # in kg
|
m_car_empty += car.data["mass"] * car.n * 1000 # in kg
|
||||||
m_car_full += car.data["mass"] * car.n * 1000 # in kg
|
m_car_full += car.data["mass"] * car.n * 1000 # in kg
|
||||||
|
@ -727,7 +727,7 @@ BehaviorSection() TODO!
|
||||||
"""
|
"""
|
||||||
function createBehaviorSection(type::String, s_entry::Real, v_entry::Real, startingPoint::Integer)
|
function createBehaviorSection(type::String, s_entry::Real, v_entry::Real, startingPoint::Integer)
|
||||||
BS= Dict(
|
BS= Dict(
|
||||||
:type => type, # type of behavior section: "breakFree", "clearing", "accelerating", "cruising", "downhillBraking", "diminishing", "coasting", "braking" or "standstill"
|
:type => type, # type of behavior section: "breakFree", "clearing", "accelerating", "cruising", "downhillBraking", "diminishing", "coasting", "braking" or "halt"
|
||||||
:length => 0.0, # total length (in m)
|
:length => 0.0, # total length (in m)
|
||||||
:s_entry => s_entry, # first position (in m)
|
:s_entry => s_entry, # first position (in m)
|
||||||
:s_exit => 0.0, # last position (in m)
|
:s_exit => 0.0, # last position (in m)
|
||||||
|
|
Loading…
Reference in New Issue