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 9352e78f authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

write driver actions into mod-data, only output if TRACE is set

parent c2e8f4d7
No related branches found
No related tags found
No related merge requests found
......@@ -143,6 +143,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public IResponse DrivingActionAccelerate(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient,
IResponse previousResponse = null)
{
CurrentAction = "ACCELERATE";
IterationStatistics.Increment(this, "Accelerate");
Log.Debug("DrivingAction Accelerate");
var operatingPoint = ComputeAcceleration(ds, targetVelocity);
......@@ -236,6 +237,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// <returns></returns>
public IResponse DrivingActionCoast(Second absTime, Meter ds, MeterPerSecond maxVelocity, Radian gradient)
{
CurrentAction = "COAST";
IterationStatistics.Increment(this, "Coast");
Log.Debug("DrivingAction Coast");
......@@ -252,6 +254,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// <returns></returns>
public IResponse DrivingActionRoll(Second absTime, Meter ds, MeterPerSecond maxVelocity, Radian gradient)
{
CurrentAction = "ROLL";
IterationStatistics.Increment(this, "Roll");
Log.Debug("DrivingAction Roll");
......@@ -358,6 +361,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public IResponse DrivingActionBrake(Second absTime, Meter ds, MeterPerSecond nextTargetSpeed, Radian gradient,
IResponse previousResponse = null, Meter targetDistance = null)
{
CurrentAction = "BRAKE";
IterationStatistics.Increment(this, "Brake");
Log.Debug("DrivingAction Brake");
......@@ -733,6 +737,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// <returns></returns>
public IResponse DrivingActionHalt(Second absTime, Second dt, MeterPerSecond targetVelocity, Radian gradient)
{
CurrentAction = "HALT";
if (!targetVelocity.IsEqual(0) || !DataBus.VehicleStopped) {
Log.Error("TargetVelocity ({0}) and VehicleVelocity ({1}) must be zero when vehicle is halting!", targetVelocity,
DataBus.VehicleSpeed);
......@@ -762,6 +767,25 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
protected override void DoWriteModalResults(IModalDataContainer container)
{
container[ModalResultField.acc] = CurrentState.Acceleration;
container.SetDataValue("DriverAction", ActionToNumber(CurrentAction));
}
private int ActionToNumber(string currentAction)
{
switch (currentAction.ToUpper()) {
case "HALT":
return 0;
case "ROLL":
return 2;
case "COAST":
return 4;
case "ACCELERATE":
return 6;
case "BRAKE":
return -5;
default:
return -10;
}
}
protected override void DoCommitSimulationStep()
......
......@@ -206,6 +206,7 @@ namespace TUGraz.VectoCore.OutputData
});
}
var strCols = dataColumns.Select(x => x.GetName())
.Concat(Auxiliaries.Values.Select(c => c.ColumnName))
.Concat(
......@@ -213,7 +214,9 @@ namespace TUGraz.VectoCore.OutputData
ModalResultField.FCMap, ModalResultField.FCAUXc, ModalResultField.FCWHTCc,
ModalResultField.FCAAUX, ModalResultField.FCFinal
}.Select(x => x.GetName()));
#if TRACE
strCols = strCols.Concat(_additionalColumns);
#endif
if (WriteModalResults) {
var filteredData = Data;
foreach (var filter in _filters) {
......
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