Add output detail 'data_points' with starting points of the driving modes

master
Max Kannenberg 2022-06-22 13:04:54 +02:00
parent 892b84251a
commit a3a68e5553
5 changed files with 17 additions and 5 deletions

View File

@ -51,7 +51,7 @@ function Settings(
"outputDetail": {
"description": "Selecting the detail of the result",
"type": "string",
"enum": [ "running_time", "points_of_interest", "driving_course" ]
"enum": [ "running_time", "points_of_interest", "data_points", "driving_course" ]
},
"outputFormat": {
"description": "Output format",

View File

@ -22,6 +22,18 @@ function createOutput(settings::Settings, drivingCourse::Vector{Dict}, pointsOfI
end
end
elseif settings.outputDetail == :data_points
# get the driving course's support points where a new behavior section starts and the driving mode changes
output = Dict[]
# the first support point is the first data point
push!(output, drivingCourse[1])
for supportPoint in 2:length(drivingCourse)
if drivingCourse[supportPoint-1][:behavior] != drivingCourse[supportPoint][:behavior]
push!(output, drivingCourse[supportPoint])
end
end
else #if settings.outputDetail == :driving_course || (settings.outputDetail == :points_of_interest && !isempty(path.poi))
output = drivingCourse
end
@ -38,7 +50,7 @@ function createDataFrame(output_vector::Vector{Dict}, outputDetail)
if outputDetail == :running_time
# create a DataFrame with running time information
dataFrame = DataFrame(t=[output_vector[end][:t]])
else # :points_of_interest or :driving_course
else # :points_of_interest, :data_points or :driving_course
columnSymbols = [:label, :behavior, :s, :v, :t, :a, :F_T, :F_R, :R_path, :R_traction, :R_wagons]
allColumns = []

View File

@ -10,7 +10,7 @@ struct Settings
stepVariable::Symbol # variable of the linear multistep method: ":distance", ":time" or ":velocity".
stepSize::Real # step size, unit depends on stepVariable - :distance in meter, time in seconds and velocity in meter/second.
approxLevel::Int # value for approximation; used when rounding or iterating.
outputDetail::Symbol # single Float() ":running_time", Vector() of ":points_of_interest",
outputDetail::Symbol # single Float() ":running_time", Vector() of ":points_of_interest", Vector() of ":data_points"
# or complete Vector() ":driving_course"
outputFormat::Symbol # output as ":dataframe" or as ":vector".

View File

@ -1,4 +1,4 @@
%YAML 1.2
---
settings:
outputDetail: "driving_course" # single value "running_time", list of "points_of_interest", complete "driving_course"
outputDetail: "driving_course" # single value "running_time", list of "points_of_interest", list of "data_points", complete "driving_course"

View File

@ -1,4 +1,4 @@
%YAML 1.2
---
settings:
outputDetail: "points_of_interest" # single value "running_time", list of "points_of_interest", complete "driving_course"
outputDetail: "points_of_interest" # single value "running_time", list of "points_of_interest", list of "data_points", complete "driving_course"