Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit b5396d08 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

if new lookahead parameters are not present in input files, use declaration defaults

parent 04d12384
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,7 @@ using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.InputData.Impl;
using TUGraz.VectoCore.Models.Declaration;
using TUGraz.VectoCore.Utils;
using DriverData = TUGraz.VectoCore.Models.SimulationComponent.Data.DriverData;
......@@ -443,18 +444,32 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
get
{
var lac = Body.GetEx(JsonKeys.DriverData_LookaheadCoasting);
var distanceScalingFactor = lac["PreviewDistanceFactor"] != null
? lac.GetEx<double>("PreviewDistanceFactor")
: DeclarationData.Driver.LookAhead.LookAheadDistanceFactor;
var lacDfOffset = lac["DF_offset"] != null
? lac.GetEx<double>("DF_offset")
: DeclarationData.Driver.LookAhead.DecisionFactorCoastingOffset;
var lacDfScaling = lac["DF_scaling"] != null
? lac.GetEx<double>("DF_scaling")
: DeclarationData.Driver.LookAhead.DecisionFactorCoastingScaling;
var speedDependentLookup = lac["DF_targetSpeedLookup"] != null
? ReadTableData(lac.GetEx<string>("DF_targetSpeedLookup"), "Lookahead Coasting Decisionfactor - Target speed",
false)
: null;
var velocityDropLookup = lac["Df_velocityDropLookup"] != null
? ReadTableData(lac.GetEx<string>("Df_velocityDropLookup"),
"Lookahead Coasting Decisionfactor - Velocity drop", false)
: null;
return new LookAheadCoastingInputData() {
Enabled = lac.GetEx<bool>(JsonKeys.DriverData_Lookahead_Enabled),
Deceleration = lac.GetEx<double>(JsonKeys.DriverData_Lookahead_Deceleration).SI<MeterPerSquareSecond>(),
MinSpeed = lac.GetEx<double>(JsonKeys.DriverData_Lookahead_MinSpeed).KMPHtoMeterPerSecond(),
LookaheadDistanceFactor = lac.GetEx<double>("PreviewDistanceFactor"),
CoastingDecisionFactorOffset = lac.GetEx<double>("DF_offset"),
CoastingDecisionFactorScaling = lac.GetEx<double>("DF_scaling"),
CoastingDecisionFactorTargetSpeedLookup =
ReadTableData(lac.GetEx<string>("DF_targetSpeedLookup"), "Lookahead Coasting Decisionfactor - Target speed", false),
CoastingDecisionFactorVelocityDropLookup = ReadTableData(lac.GetEx<string>("Df_velocityDropLookup"),
"Lookahead Coasting Decisionfactor - Velocity drop",
false)
LookaheadDistanceFactor = distanceScalingFactor,
CoastingDecisionFactorOffset = lacDfOffset,
CoastingDecisionFactorScaling = lacDfScaling,
CoastingDecisionFactorTargetSpeedLookup = speedDependentLookup,
CoastingDecisionFactorVelocityDropLookup = velocityDropLookup
};
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment