From 0c63afb87105677b6d2450596405e966efbf9c84 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Fri, 12 Nov 2021 13:56:01 +0100
Subject: [PATCH] fix calculation of E_<x>_off_loss

---
 VectoCore/VectoCore/OutputData/ModalDataContainer.cs | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/VectoCore/VectoCore/OutputData/ModalDataContainer.cs b/VectoCore/VectoCore/OutputData/ModalDataContainer.cs
index 302eedaf19..0313282db1 100644
--- a/VectoCore/VectoCore/OutputData/ModalDataContainer.cs
+++ b/VectoCore/VectoCore/OutputData/ModalDataContainer.cs
@@ -407,13 +407,14 @@ namespace TUGraz.VectoCore.OutputData
 			var selected = Data.AsEnumerable().Select(r => {
 				var dt = r.Field<Second>(ModalResultField.simulationInterval.GetName());
 				return new {
-					P_em = r.Field<Watt>(string.Format(ModalResultField.P_EM_electricMotor_el_.GetCaption(),
-						emPos.GetName())),
-					E_mech = r.Field<Watt>(string.Format(ModalResultField.P_EM_electricMotorLoss_.GetCaption(),
+					EM_off = r.Field<Scalar>(string.Format(ModalResultField.EM_Off_.GetCaption(), emPos.GetName())),
+					//P_em = r.Field<Watt>(string.Format(ModalResultField.P_EM_electricMotor_el_.GetCaption(),
+					//	emPos.GetName())),
+					E_mech = r.Field<Watt>(string.Format(ModalResultField.P_EM_mech_.GetCaption(),
 						emPos.GetName())) * dt,
 				};
 			});
-			return selected.Where(x => x.P_em.IsEqual(0)).Sum(x => x.E_mech) ?? 0.SI<WattSecond>();
+			return selected.Where(x => !x.EM_off.IsEqual(0)).Sum(x => x.E_mech) ?? 0.SI<WattSecond>();
 		}
 
 		public WattSecond ElectricMotorLosses(PowertrainPosition emPos)
-- 
GitLab