Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 7bf815c4 authored by Michael KRISPER's avatar Michael KRISPER
Browse files

moved distance check from vehicle to driving cycle (due to changed commit order)

parent c663dfb8
Branches
Tags
No related merge requests found
......@@ -298,6 +298,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
protected override void DoWriteModalResults(IModalDataContainer container)
{
// sanity check: is the vehicle in step with the cycle?
if (container[ModalResultField.dist] == DBNull.Value) {
Log.Warn("Distance field is not set!");
} else {
var distance = (SI)container[ModalResultField.dist];
if (!distance.IsEqual(CurrentState.Distance)) {
Log.Warn("Vehicle Distance diverges from Cycle by {0} [m]. Distance: {1}",
(distance - CurrentState.Distance).Value(), distance);
}
}
container[ModalResultField.dist] = CurrentState.Distance; // (CurrentState.Distance + PreviousState.Distance) / 2.0;
container[ModalResultField.simulationDistance] = CurrentState.SimulationDistance;
container[ModalResultField.v_targ] = CurrentState.VehicleTargetSpeed;
......
......@@ -173,16 +173,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
container[ModalResultField.P_air] = CurrentState.AirDragResistance * averageVelocity;
container[ModalResultField.P_slope] = CurrentState.SlopeResistance * averageVelocity;
container[ModalResultField.P_trac] = CurrentState.VehicleTractionForce * averageVelocity;
// sanity check: is the vehicle in step with the cycle?
if (container[ModalResultField.dist] == DBNull.Value) {
Log.Warn("Distance field is not set!");
} else {
var distance = (SI)container[ModalResultField.dist];
if (!distance.IsEqual(CurrentState.Distance)) {
Log.Warn("Vehicle Distance diverges from Cycle by {0} [m]. Distance: {1}",
(distance - CurrentState.Distance).Value(), distance);
}
}
container[ModalResultField.dist] = CurrentState.Distance;
}
protected override void DoCommitSimulationStep()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment