From 2f8a1a24698a106933c68b1b6d43cdb5e807ea41 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Wed, 26 Feb 2020 16:54:44 +0100
Subject: [PATCH] bugfi eco-roll: calculation of accelerationPedalIdle - use
 P_fc-map (=totalTorqueDemand) and compare with drag power, not P_ice_out)

(cherry picked from commit 3db42eb2ce143f93d1e08fa091a818c181581df6)
---
 .../Models/SimulationComponent/Impl/DefaultDriverStrategy.cs   | 3 ++-
 .../SimulationComponent/Impl/StopStartCombustionEngine.cs      | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs
index 62c4a9c8fe..f949c2f23c 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs
@@ -133,7 +133,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 				EcoRollState.PreviousBrakePower = Driver.DataBus.BrakePower;
 				if (retVal.Source is ICombustionEngine) {
 					var success = retVal as ResponseSuccess;
-					EcoRollState.AcceleratorPedalIdle = success.DragPower.IsEqual(success.EnginePowerRequest, 10.SI<Watt>());
+					var avgEngineSpeed = (success.EngineSpeed + Driver.DataBus.EngineSpeed) / 2.0;
+					EcoRollState.AcceleratorPedalIdle = success.DragPower.IsEqual(success.EngineTorqueDemandTotal * avgEngineSpeed, 10.SI<Watt>());
 				} else {
 					EcoRollState.AcceleratorPedalIdle = false;
 				}
diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs
index 58c94ecb34..3d042f6bb0 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs
@@ -55,6 +55,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl {
 				return new ResponseDryRun {
 					DeltaFullLoad = 0.SI<Watt>(),
 					DeltaDragLoad = 0.SI<Watt>(),
+					EngineTorqueDemandTotal = 0.SI<NewtonMeter>(),
 					DeltaEngineSpeed = 0.RPMtoRad(),
 					EnginePowerRequest = 0.SI<Watt>(),
 					DynamicFullLoadPower = 0.SI<Watt>(),
@@ -68,6 +69,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl {
 			return new ResponseSuccess() {
 				EnginePowerRequest = 0.SI<Watt>(),
 				DynamicFullLoadPower = 0.SI<Watt>(),
+				EngineTorqueDemandTotal = 0.SI<NewtonMeter>(),
 				DragPower = 0.SI<Watt>(),
 				AuxiliariesPowerDemand = 0.SI<Watt>(),
 				EngineSpeed = 0.RPMtoRad(),
-- 
GitLab