From 23d3997500b7207cf3700844811a97c222418e0e Mon Sep 17 00:00:00 2001
From: "VKMTHD\\haraldmartini" <harald.martini@student.tugraz.at>
Date: Tue, 31 Jan 2023 13:44:22 +0100
Subject: [PATCH] use simple electric motor control instead of dummy electric
 motor control in test powertain

(cherry picked from commit 1072afa79a7899bf2a0215f1bca3da9f19574540)
---
 .../Models/Simulation/Impl/PowertrainBuilder.cs        | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs
index 31f5be7aae..8a7e9f344a 100644
--- a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs
+++ b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs
@@ -1820,7 +1820,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
 				.AddComponent(data.AngledriveData != null ? new Angledrive(container, data.AngledriveData) : null)
 				.AddComponent(data.GearboxData is null ? null : GetSimpleGearbox(container, data))
 				.AddComponent(GetElectricMachine(data.ElectricMachinesData.First(x => x.Item1 != PowertrainPosition.GEN).Item1,
-					data.ElectricMachinesData, container, es, new DummyElectricMotorControl()));
+					data.ElectricMachinesData, container, es, new SimpleElectricMotorControl()));
 			if (data.AxleGearData == null) {
 				new DummyAxleGearInfo(container); // necessary for certain IEPC configurations
 			}
@@ -2206,10 +2206,17 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
 
 	public class SimpleElectricMotorControl : IElectricMotorControl
 	{
+		public bool EmOff { get; set; }
+
 		public NewtonMeter MechanicalAssistPower(Second absTime, Second dt, NewtonMeter outTorque, PerSecond prevOutAngularVelocity,
 			PerSecond currOutAngularVelocity, NewtonMeter maxDriveTorque, NewtonMeter maxRecuperationTorque,
 			PowertrainPosition position, bool dryRun)
 		{
+			if (EmOff) {
+				return null;
+			}
+
+			
 			if (dryRun) {
 				return -outTorque;
 			}
@@ -2238,6 +2245,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
 		#endregion
 	}
 
+	[Obsolete("Replaced with SimpleElectricMotorControl")]
 	public class DummyElectricMotorControl : IElectricMotorControl
 	{
 		#region Implementation of IElectricMotorControl
-- 
GitLab