diff --git a/VectoCore/Configuration/Constants.cs b/VectoCore/Configuration/Constants.cs index 3f2d5e841f3016d73fc837cd1c57d70569b4c8af..3c590a6278045cfbd3abe8f2e9940411dbb2393e 100644 --- a/VectoCore/Configuration/Constants.cs +++ b/VectoCore/Configuration/Constants.cs @@ -23,7 +23,7 @@ namespace TUGraz.VectoCore.Configuration { public static class Constants { - public const double RPMToRad = 2 * Math.PI / 60; + public const double RPMToRad = 2 * Math.PI / 60; public const double Kilo = 1000; public const double MeterPerSecondToKMH = 3.6; public const double SecondsPerHour = 3600; @@ -88,7 +88,7 @@ namespace TUGraz.VectoCore.Configuration //VectoMath.InclinationToAngle(0.25 / 100.0).Value(); - public const int DriverSearchLoopThreshold = 100; + public const int DriverSearchLoopThreshold = 200; public static readonly Watt EnginePowerSearchTolerance = 0.50.SI<Watt>(); // Watt diff --git a/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs b/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs index 371825a372f230029342778247a140c6de0aecb9..aead525b04d8600965f9ee082020fde4f0e5e907 100644 --- a/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs +++ b/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs @@ -192,8 +192,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl }; } - if (deltaFull.IsGreater(0.SI<NewtonMeter>()) && - deltaDrag.IsSmaller(0.SI<NewtonMeter>())) { + if ( + (deltaFull * avgEngineSpeed).IsGreater(0.SI<Watt>(), Constants.SimulationSettings.EnginePowerSearchTolerance) && + (deltaDrag * avgEngineSpeed).IsSmaller(0.SI<Watt>(), Constants.SimulationSettings.EnginePowerSearchTolerance)) { throw new VectoSimulationException( "Unexpected condition: requested torque_out is above gearbox full-load and engine is below drag load! deltaFull: {0}, deltaDrag: {1}", deltaFull, deltaDrag);