Code development platform for open source projects from the European Union institutions

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

vehicle speed halt tolerance check only in vehicle

parent 39396f2e
No related branches found
No related tags found
No related merge requests found
......@@ -72,7 +72,7 @@ namespace TUGraz.VectoCore.Configuration
public static Meter DriverActionDistanceTolerance = 0.25.SI<Meter>();
public static double VehicleSpeedTolerance = 1e-3;
public static MeterPerSecond VehicleSpeedHaltTolerance = 1e-3.SI<MeterPerSecond>();
/// <summary>
/// The initial search interval for the operating point search in the driver.
......
......@@ -17,7 +17,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
protected override IResponse DoSimulationStep()
{
// estimate distance to be traveled within the next TargetTimeInterval
var ds = Container.VehicleSpeed.IsEqual(0, Constants.SimulationSettings.VehicleSpeedTolerance)
var ds = Container.VehicleSpeed.IsEqual(0)
? Constants.SimulationSettings.DriveOffDistance
: Constants.SimulationSettings.TargetTimeInterval * Container.VehicleSpeed;
......
......@@ -492,7 +492,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
// braking power is in the range of the exceeding delta. set searching range to 2/3 so that
// the target point is approximately in the center of the second interval
var searchInterval = origDelta.Abs() * 2 / 3;
debug.Add(new { brakePower = 0.SI<Watt>(), searchInterval, delta = origDelta, operatingPoint });
var brakePower = searchInterval * -origDelta.Sign();
......@@ -776,10 +776,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// <returns></returns>
public IResponse DrivingActionHalt(Second absTime, Second dt, MeterPerSecond targetVelocity, Radian gradient)
{
if (!targetVelocity.IsEqual(0) || !DataBus.VehicleSpeed.IsEqual(0, 1e-3)) {
if (!targetVelocity.IsEqual(0) || !DataBus.VehicleSpeed.IsEqual(0)) {
throw new NotImplementedException("TargetVelocity or VehicleVelocity is not zero!");
}
DataBus.BreakPower = Double.PositiveInfinity.SI<Watt>();
DataBus.BreakPower = double.PositiveInfinity.SI<Watt>();
var retVal = NextComponent.Request(absTime, dt, 0.SI<MeterPerSquareSecond>(), gradient);
retVal.Switch().
Case<ResponseGearShift>(r => {
......
......@@ -125,7 +125,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
_currentState.dt = dt;
_currentState.Acceleration = acceleration;
_currentState.Velocity = _previousState.Velocity + acceleration * dt;
if (_currentState.Velocity.IsEqual(0, 1e-4)) {
if (_currentState.Velocity.IsEqual(0.SI<MeterPerSecond>(), Constants.SimulationSettings.VehicleSpeedHaltTolerance)) {
_currentState.Velocity = 0.SI<MeterPerSecond>();
}
_currentState.Distance = _previousState.Distance + dt * (_previousState.Velocity + _currentState.Velocity) / 2;
......
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