From 01c1751001b57932eea513ac2fff6772aad90b28 Mon Sep 17 00:00:00 2001 From: Martin Scheidt Date: Thu, 21 Apr 2022 14:04:59 +0200 Subject: [PATCH 1/3] renamed DrivingDynamics.jl to Formulary.jl --- CHANGELOG.md | 2 +- src/Behavior.jl | 6 +++--- src/EnergySaving.jl | 2 +- src/{DrivingDynamics.jl => Formulary.jl} | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) rename src/{DrivingDynamics.jl => Formulary.jl} (99%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 529f8aa..02d2eb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,7 @@ Refactor the modular structure: * Extract the modules Export and AdditionalOutput from TrainRunCalc * Divide the module Operationsmodes and add its functions to TrainRunCalc and 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 diff --git a/src/Behavior.jl b/src/Behavior.jl index 91b7f90..8d65c09 100644 --- a/src/Behavior.jl +++ b/src/Behavior.jl @@ -7,14 +7,14 @@ module Behavior -include("./DrivingDynamics.jl") -using .DrivingDynamics +include("./Formulary.jl") +using .Formulary export addBreakFreeSection!, addClearingSection!, addAcceleratingSection!, addCruisingSection!, addDiminishingSection!, addCoastingSection!, addBrakingSection!, addStandstill!, # addBrakingSectionInOneStep! is not used in the current version of the tool calculateForces!, createDataPoint, -# export functions from DrivingDynamics +# export functions from Formulary calcBrakingDistance, calcBrakingStartVelocity, calc_Δs_with_Δt diff --git a/src/EnergySaving.jl b/src/EnergySaving.jl index 26c4d18..037f9af 100644 --- a/src/EnergySaving.jl +++ b/src/EnergySaving.jl @@ -10,7 +10,7 @@ # 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/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/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 diff --git a/src/DrivingDynamics.jl b/src/Formulary.jl similarity index 99% rename from src/DrivingDynamics.jl rename to src/Formulary.jl index 617d8e6..2f5f1f0 100644 --- a/src/DrivingDynamics.jl +++ b/src/Formulary.jl @@ -5,7 +5,7 @@ # __copyright__ = "2022" # __license__ = "ISC" -module DrivingDynamics +module Formulary ######################### ## 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 end #function calcBrakingAcceleration -end #module DrivingDynamics +end #module Formulary From 237729ce5b1efa5a1dadf5f77ae741daeec57919 Mon Sep 17 00:00:00 2001 From: Martin Scheidt Date: Thu, 21 Apr 2022 14:24:22 +0200 Subject: [PATCH 2/3] renamed calculateDrivingDynamics() in trainRun() --- README.md | 2 +- examples/ExtendedWorkingExample.jl | 2 +- examples/MinimalWorkingExample.jl | 2 +- src/TrainRun.jl | 2 +- src/TrainRunCalc.jl | 10 +++++----- test/runtests.jl | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f03917a..88d15dc 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ running_path_directory = "data/paths/path_1_10km_nConst_vConst.yaml" settings_directory = "data/settings.yaml" (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) ``` ------------ diff --git a/examples/ExtendedWorkingExample.jl b/examples/ExtendedWorkingExample.jl index 082249c..ebb68e3 100644 --- a/examples/ExtendedWorkingExample.jl +++ b/examples/ExtendedWorkingExample.jl @@ -28,7 +28,7 @@ for path in allPaths for train in allTrains # println("train: ", train[:name]) for settings in allSettings - resultsDict = calculateDrivingDynamics(train, path, settings) + resultsDict = trainRun(train, path, settings) if haskey(settings, :typeOfOutput) && settings[:typeOfOutput] == "CSV" exportToCsv(resultsDict, settings) sleep(2) diff --git a/examples/MinimalWorkingExample.jl b/examples/MinimalWorkingExample.jl index c197589..47382f5 100644 --- a/examples/MinimalWorkingExample.jl +++ b/examples/MinimalWorkingExample.jl @@ -13,7 +13,7 @@ running_path_directory = "data/paths/path_1_10km_nConst_vConst.yaml" setting_directory = "data/settings/settings_distanceStep_massPoint_runningTime.yaml" (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) println("The V 90 with 10 ore wagons needs $runtime seconds for 10 km with no gradient.") diff --git a/src/TrainRun.jl b/src/TrainRun.jl index c811985..aaf7f2f 100644 --- a/src/TrainRun.jl +++ b/src/TrainRun.jl @@ -30,7 +30,7 @@ using .AdditionalOutput using .EnergySaving # main function -export calculateDrivingDynamics, +export trainRun, # import functions importYamlFiles, importFromYaml, diff --git a/src/TrainRunCalc.jl b/src/TrainRunCalc.jl index 41fe7c4..6e980e8 100644 --- a/src/TrainRunCalc.jl +++ b/src/TrainRunCalc.jl @@ -21,7 +21,7 @@ using .Behavior using .Output # export main function -export calculateDrivingDynamics +export trainRun approximationLevel = 6 # value for approximation to intersections and precisely calculated digits # 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`. """ - 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`. # Examples ```julia-repl -julia> calculateDrivingDynamics(trainDict, pathDict, settingsDict) +julia> trainRun(trainDict, pathDict, settingsDict) todo !!! ``` """ -function calculateDrivingDynamics(trainInput::Dict, pathInput::Dict, settingsInput::Dict) +function trainRun(trainInput::Dict, pathInput::Dict, settingsInput::Dict) # 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) train = copy(trainInput) @@ -68,7 +68,7 @@ function calculateDrivingDynamics(trainInput::Dict, pathInput::Dict, settingsInp end #if return output -end # function calculateDrivingDynamics +end # function trainRun # calculate a train run focussing on using the minimum possible running time function calculateMinimumRunningTime!(movingSection::Dict, settings::Dict, train::Dict) diff --git a/test/runtests.jl b/test/runtests.jl index f0b6d63..5e98cc6 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -25,7 +25,7 @@ push!(allTrains, importYamlFile(:train, "data/trains/train_passenger_IC2.yaml")) for path in allPaths for train in allTrains for settings in allSettings - testDict=calculateDrivingDynamics(train, path, settings) + testDict=trainRun(train, path, settings) exportToCsv(testDict) sleep(2) From e86971b67d3f1273832d81e22000590dcec819ee Mon Sep 17 00:00:00 2001 From: Martin Scheidt Date: Fri, 22 Apr 2022 10:51:34 +0200 Subject: [PATCH 3/3] renamed Input.jl in Types.jl --- CHANGELOG.md | 2 +- src/TrainRunCalc.jl | 4 ++-- src/{Input.jl => Validate.jl} | 4 ++-- test/testEnums.jl | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) rename src/{Input.jl => Validate.jl} (99%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02d2eb6..9f17d0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 * 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 * Change the type of existing Dictionary keys from String to Symbol diff --git a/src/TrainRunCalc.jl b/src/TrainRunCalc.jl index 6e980e8..e41d5c8 100644 --- a/src/TrainRunCalc.jl +++ b/src/TrainRunCalc.jl @@ -8,14 +8,14 @@ module TrainRunCalc # include modules of TrainRunCalc -include("./Input.jl") +include("./Validate.jl") include("./Characteristics.jl") include("./Behavior.jl") include("./Output.jl") # use modules of TrainRunCalc -using .Input +using .Validate using .Characteristics using .Behavior using .Output diff --git a/src/Input.jl b/src/Validate.jl similarity index 99% rename from src/Input.jl rename to src/Validate.jl index a21e5cb..2c51531 100644 --- a/src/Input.jl +++ b/src/Validate.jl @@ -6,7 +6,7 @@ # __license__ = "ISC" # TODO: 2022-04-07: if EnergySaving should be used. The train type has do be defined and checked -module Input +module Validate export checkAndSetInput! @@ -754,4 +754,4 @@ function informAboutUnusedKeys(allKeys::AbstractVector, usedKeys::Vector{Symbol} end end #function informAboutUnusedKeys -end # module Input +end # module Validate diff --git a/test/testEnums.jl b/test/testEnums.jl index 5303301..9a0875c 100644 --- a/test/testEnums.jl +++ b/test/testEnums.jl @@ -6,7 +6,7 @@ # __license__ = "ISC" include("../src/types.jl") -include("../src/Input.jl") +include("../src/Validate.jl") using .Input using YAML, Test