Refactor module MovingPhases

pull/1/head v0.3
Max Kannenberg 2021-12-08 18:12:30 +01:00
parent a57944b166
commit 5c9bb29aa6
5 changed files with 621 additions and 391 deletions

View File

@ -7,6 +7,7 @@ export calculateRecoveryTime, increaseCoastingSection, decreaseMaximumVelocity,
function calculateRecoveryTime(s_MS::AbstractFloat, t_MS::AbstractFloat, train::Train)
# function for calculating the recovery time that can be used for energy saving
# MS: Moving Section
if train.trainType=="motor coach train"
if s_MS<= 30000
c_s=0.0

File diff suppressed because it is too large Load Diff

View File

@ -35,7 +35,8 @@ function simulateMinimumRunningTime!(movingSection::MovingSection, settings::Set
movingSection.characteristicSections[csId].t_total=0.0
if s_cruisingBeforeAcceleration == movingSection.characteristicSections[csId].s_total
(movingSection.characteristicSections[csId], drivingCourse)=addCruisingPhase!(movingSection.characteristicSections[csId], drivingCourse, s_cruisingBeforeAcceleration, settings, train, movingSection.characteristicSections, "cruisingBeforeAcceleration")
(movingSection.characteristicSections[csId], drivingCourse)=addCruisingPhase!(movingSection.characteristicSections[csId], drivingCourse, s_cruisingBeforeAcceleration, settings, train, movingSection.characteristicSections, "cruising")
# 09/06 "cruising" is used in EnergySaving and not cruisingBeforeAcceleration (movingSection.characteristicSections[csId], drivingCourse)=addCruisingPhase!(movingSection.characteristicSections[csId], drivingCourse, s_cruisingBeforeAcceleration, settings, train, movingSection.characteristicSections, "cruisingBeforeAcceleration")
elseif s_cruising == movingSection.characteristicSections[csId].s_total
(movingSection.characteristicSections[csId], drivingCourse)=addCruisingPhase!(movingSection.characteristicSections[csId], drivingCourse, s_cruising, settings, train, movingSection.characteristicSections, "cruising")
elseif s_cruising > 0.01 # if the cruising section is longer than 1 cm (because of rounding issues not >0.0)
@ -91,6 +92,7 @@ function simulateMinimumEnergyConsumption(movingSectionMinimumRunningTime::Movin
doMethod1=true
doMethod2=true
doCombinationOfMethods=true
#doCombinationOfMethods=false
#create a new moving section for the minimum energy consumption
movingSectionOriginal=MovingSection(movingSectionMinimumRunningTime)

View File

@ -102,8 +102,9 @@ function secureAccelerationBehavior!(movingSection::MovingSection, settings::Set
if movingSection.characteristicSections[csId].v_entry<movingSection.characteristicSections[csId].v_reach
(movingSection.characteristicSections[csId], accelerationCourse)=addAccelerationPhase!(movingSection.characteristicSections[csId], accelerationCourse, settings, train, movingSection.characteristicSections) # this function changes the accelerationCourse
movingSection.characteristicSections[csId].v_reach=accelerationCourse[end].v
movingSection.characteristicSections[csId].v_exit=min(movingSection.characteristicSections[csId].v_exit, movingSection.characteristicSections[csId].v_reach)
movingSection.characteristicSections[csId].v_reach=max(movingSection.characteristicSections[csId].v_entry,accelerationCourse[end].v)
movingSection.characteristicSections[csId].v_exit=min(movingSection.characteristicSections[csId].v_exit, movingSection.characteristicSections[csId].v_reach, accelerationCourse[end].v)
else #movingSection.characteristicSections[csId].v_entry==movingSection.characteristicSections[csId].v_reach
# v_exit stays the same
end #if
@ -140,8 +141,6 @@ function secureCruisingBehavior!(movingSection::MovingSection, settings::Setting
return movingSection
end #function secureCruisingBehavior!
end #module Preparation

View File

@ -15,6 +15,9 @@ using .Output
export calculateDrivingDynamics
# approximationLevel = 6 # value for approximation to intersections
# TODO: define it here and give it to each function? (MovingPhases, EnergySaving)
"""
calculateDrivingDynamics(trainFilePath::String, pathFilePath::String, settingsFilePath::String)