Merge pull request #3 from railtoolkit/dev-martin

Dev martin
development
Max Kannenberg 2022-04-26 16:56:55 +02:00 committed by GitHub
commit 25959f7302
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 23 additions and 23 deletions

View File

@ -19,7 +19,7 @@ Refactor the modular structure:
* Extract the modules Export and AdditionalOutput from TrainRunCalc * Extract the modules Export and AdditionalOutput from TrainRunCalc
* Divide the module Operationsmodes and add its functions to TrainRunCalc and EnergySaving * Divide the module Operationsmodes and add its functions to TrainRunCalc and EnergySaving
* Add the remaining functions of the module types to EnergySaving * Add the remaining functions of the module types to EnergySaving
* Divide the module MovingPhases into Behavior and DrivingDynamics * Divide the module MovingPhases into Behavior and Formulary
* Rename the module Preparation to Characteristics * Rename the module Preparation to Characteristics
@ -70,7 +70,7 @@ Add an attribute to DataPoint to record the corresponding driving behavior
Refactor some of the mutable structs from types.jl as Dictionaries Refactor some of the mutable structs from types.jl as Dictionaries
* Remove the mutable structs Train, Path, PathSection, Settings and MovingSection * Remove the mutable structs Train, Path, PathSection, Settings and MovingSection
* Create Dictionaries for train, path an settings in Input.jl * Create Dictionaries for train, path an settings in Validate.jl
* Create a Dictionary for the whole moving section in Preperation.jl and a function for copying the moving section in OperationModes.jl * Create a Dictionary for the whole moving section in Preperation.jl and a function for copying the moving section in OperationModes.jl
* Change the type of existing Dictionary keys from String to Symbol * Change the type of existing Dictionary keys from String to Symbol

View File

@ -34,7 +34,7 @@ running_path_directory = "data/paths/path_1_10km_nConst_vConst.yaml"
settings_directory = "data/settings.yaml" settings_directory = "data/settings.yaml"
(train, running_path, settings) = importYamlFiles(train_directory, running_path_directory, setting_directory) (train, running_path, settings) = importYamlFiles(train_directory, running_path_directory, setting_directory)
train_run = calculateDrivingDynamics(train, running_path, settings) train_run = trainRun(train, running_path, settings)
``` ```
------------ ------------

View File

@ -28,7 +28,7 @@ for path in allPaths
for train in allTrains for train in allTrains
# println("train: ", train[:name]) # println("train: ", train[:name])
for settings in allSettings for settings in allSettings
resultsDict = calculateDrivingDynamics(train, path, settings) resultsDict = trainRun(train, path, settings)
if haskey(settings, :typeOfOutput) && settings[:typeOfOutput] == "CSV" if haskey(settings, :typeOfOutput) && settings[:typeOfOutput] == "CSV"
exportToCsv(resultsDict, settings) exportToCsv(resultsDict, settings)
sleep(2) sleep(2)

View File

@ -13,7 +13,7 @@ running_path_directory = "data/paths/path_1_10km_nConst_vConst.yaml"
setting_directory = "data/settings/settings_distanceStep_massPoint_runningTime.yaml" setting_directory = "data/settings/settings_distanceStep_massPoint_runningTime.yaml"
(train, running_path, settings) = importYamlFiles(train_directory, running_path_directory, setting_directory) (train, running_path, settings) = importYamlFiles(train_directory, running_path_directory, setting_directory)
runtime = calculateDrivingDynamics(train, running_path, settings) runtime = trainRun(train, running_path, settings)
exportToCsv(runtime, settings) exportToCsv(runtime, settings)
println("The V 90 with 10 ore wagons needs $runtime seconds for 10 km with no gradient.") println("The V 90 with 10 ore wagons needs $runtime seconds for 10 km with no gradient.")

View File

@ -7,14 +7,14 @@
module Behavior module Behavior
include("./DrivingDynamics.jl") include("./Formulary.jl")
using .DrivingDynamics using .Formulary
export addBreakFreeSection!, addClearingSection!, addAcceleratingSection!, addCruisingSection!, addDiminishingSection!, addCoastingSection!, addBrakingSection!, addStandstill!, export addBreakFreeSection!, addClearingSection!, addAcceleratingSection!, addCruisingSection!, addDiminishingSection!, addCoastingSection!, addBrakingSection!, addStandstill!,
# addBrakingSectionInOneStep! is not used in the current version of the tool # addBrakingSectionInOneStep! is not used in the current version of the tool
calculateForces!, createDataPoint, calculateForces!, createDataPoint,
# export functions from DrivingDynamics # export functions from Formulary
calcBrakingDistance, calcBrakingStartVelocity, calc_Δs_with_Δt calcBrakingDistance, calcBrakingStartVelocity, calc_Δs_with_Δt

View File

@ -10,7 +10,7 @@
# TODO: calculation time for passenger trains on path1 is very long and should be reduced # TODO: calculation time for passenger trains on path1 is very long and should be reduced
# TODO from 2022/01/18: Test if enum trainType is working correctly in function calculateRecoveryTime or if only the else-pathis taken # TODO from 2022/01/18: Test if enum trainType is working correctly in function calculateRecoveryTime or if only the else-pathis taken
# TODO from 2022/01/19: Are here calculations that should be transferred to DrivingDynamics.jl? # TODO from 2022/01/19: Are here calculations that should be transferred to Formulary.jl?
# TODO from 2022/01/22: use always copyCharacteristicSection and don't do it manually like "csModified=Dict(:id => csOriginal[:id], ..." three times # TODO from 2022/01/22: use always copyCharacteristicSection and don't do it manually like "csModified=Dict(:id => csOriginal[:id], ..." three times
# TODO from 2022/03/18: stateFlags need to be added to functions that add behavior sections # TODO from 2022/03/18: stateFlags need to be added to functions that add behavior sections
# TODO from 2022/03/21: consider previous speed limits during the coasting section in case F_R < 0.0 and the train is getting faster # TODO from 2022/03/21: consider previous speed limits during the coasting section in case F_R < 0.0 and the train is getting faster

View File

@ -5,7 +5,7 @@
# __copyright__ = "2022" # __copyright__ = "2022"
# __license__ = "ISC" # __license__ = "ISC"
module DrivingDynamics module Formulary
######################### #########################
## literature the driving dynamics equations are based on: ## literature the driving dynamics equations are based on:
@ -253,4 +253,4 @@ function calcBrakingAcceleration(v_start::Real, v_end::Real, s_braking::Real)
return a_braking return a_braking
end #function calcBrakingAcceleration end #function calcBrakingAcceleration
end #module DrivingDynamics end #module Formulary

View File

@ -30,7 +30,7 @@ using .AdditionalOutput
using .EnergySaving using .EnergySaving
# main function # main function
export calculateDrivingDynamics, export trainRun,
# import functions # import functions
importYamlFiles, importFromYaml, importYamlFiles, importFromYaml,

View File

@ -8,20 +8,20 @@
module TrainRunCalc module TrainRunCalc
# include modules of TrainRunCalc # include modules of TrainRunCalc
include("./Input.jl") include("./Validate.jl")
include("./Characteristics.jl") include("./Characteristics.jl")
include("./Behavior.jl") include("./Behavior.jl")
include("./Output.jl") include("./Output.jl")
# use modules of TrainRunCalc # use modules of TrainRunCalc
using .Input using .Validate
using .Characteristics using .Characteristics
using .Behavior using .Behavior
using .Output using .Output
# export main function # export main function
export calculateDrivingDynamics export trainRun
approximationLevel = 6 # value for approximation to intersections and precisely calculated digits approximationLevel = 6 # value for approximation to intersections and precisely calculated digits
# TODO: define it here and give it to each function? (Behavior, ...) # TODO: define it here and give it to each function? (Behavior, ...)
@ -29,17 +29,17 @@ approximationLevel = 6 # value for approximation to intersections and precisely
# Calculate the driving dynamics of a train run on a path with special settings with information from the corresponding YAML files with the file paths `trainDirectory`, `pathDirectory`, `settingsDirectory`. # Calculate the driving dynamics of a train run on a path with special settings with information from the corresponding YAML files with the file paths `trainDirectory`, `pathDirectory`, `settingsDirectory`.
""" """
calculateDrivingDynamics(train::Dict, path::Dict, settings::Dict) trainRun(train::Dict, path::Dict, settings::Dict)
Calculate the driving dynamics of a train run on a path with special settings with information from the corresponding dictionaries `train`, `path`, `settings`. Calculate the driving dynamics of a train run on a path with special settings with information from the corresponding dictionaries `train`, `path`, `settings`.
# Examples # Examples
```julia-repl ```julia-repl
julia> calculateDrivingDynamics(trainDict, pathDict, settingsDict) julia> trainRun(trainDict, pathDict, settingsDict)
todo !!! todo !!!
``` ```
""" """
function calculateDrivingDynamics(trainInput::Dict, pathInput::Dict, settingsInput::Dict) function trainRun(trainInput::Dict, pathInput::Dict, settingsInput::Dict)
# copy Input data for not changing them # copy Input data for not changing them
# TODO: or should they be changed? normally it would only make it "better" except for settings[:detailOfOutput] == "points of interest" && !haskey(path, :pointsOfInterest) # TODO: or should they be changed? normally it would only make it "better" except for settings[:detailOfOutput] == "points of interest" && !haskey(path, :pointsOfInterest)
train = copy(trainInput) train = copy(trainInput)
@ -68,7 +68,7 @@ function calculateDrivingDynamics(trainInput::Dict, pathInput::Dict, settingsInp
end #if end #if
return output return output
end # function calculateDrivingDynamics end # function trainRun
# 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!(movingSection::Dict, settings::Dict, train::Dict) function calculateMinimumRunningTime!(movingSection::Dict, settings::Dict, train::Dict)

View File

@ -6,7 +6,7 @@
# __license__ = "ISC" # __license__ = "ISC"
# TODO: 2022-04-07: if EnergySaving should be used. The train type has do be defined and checked # TODO: 2022-04-07: if EnergySaving should be used. The train type has do be defined and checked
module Input module Validate
export checkAndSetInput! export checkAndSetInput!
@ -754,4 +754,4 @@ function informAboutUnusedKeys(allKeys::AbstractVector, usedKeys::Vector{Symbol}
end end
end #function informAboutUnusedKeys end #function informAboutUnusedKeys
end # module Input end # module Validate

View File

@ -25,7 +25,7 @@ push!(allTrains, importYamlFile(:train, "data/trains/train_passenger_IC2.yaml"))
for path in allPaths for path in allPaths
for train in allTrains for train in allTrains
for settings in allSettings for settings in allSettings
testDict=calculateDrivingDynamics(train, path, settings) testDict=trainRun(train, path, settings)
exportToCsv(testDict) exportToCsv(testDict)
sleep(2) sleep(2)

View File

@ -6,7 +6,7 @@
# __license__ = "ISC" # __license__ = "ISC"
include("../src/types.jl") include("../src/types.jl")
include("../src/Input.jl") include("../src/Validate.jl")
using .Input using .Input
using YAML, Test using YAML, Test