diff --git a/src/constructors.jl b/src/constructors.jl index 148eb5f..0cedf61 100644 --- a/src/constructors.jl +++ b/src/constructors.jl @@ -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", diff --git a/src/output.jl b/src/output.jl index ccfb981..d18fdb9 100644 --- a/src/output.jl +++ b/src/output.jl @@ -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 = [] diff --git a/src/types.jl b/src/types.jl index f74a9cc..da620e9 100644 --- a/src/types.jl +++ b/src/types.jl @@ -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". diff --git a/test/data/settings/driving_course.yaml b/test/data/settings/driving_course.yaml index 3b5bae5..6c2928f 100644 --- a/test/data/settings/driving_course.yaml +++ b/test/data/settings/driving_course.yaml @@ -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" diff --git a/test/data/settings/points_of_interest.yaml b/test/data/settings/points_of_interest.yaml index d5e9bed..74c1772 100644 --- a/test/data/settings/points_of_interest.yaml +++ b/test/data/settings/points_of_interest.yaml @@ -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"