From 998047125a7838502cd9e37fcfbc7e97004ae0c0 Mon Sep 17 00:00:00 2001
From: Michael Krisper <michael.krisper@tugraz.at>
Date: Tue, 19 Jul 2022 16:25:49 +0200
Subject: [PATCH] CopyFrom: Removed field which are set manually.

---
 .../SimulationComponent/Impl/ATGearbox.cs     | 15 ++-----------
 .../SimulationComponent/Impl/ElectricMotor.cs |  3 +--
 .../SimulationComponent/Impl/Gearbox.cs       | 22 -------------------
 3 files changed, 3 insertions(+), 37 deletions(-)

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs
index 4b7a0cc978..087876ce24 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs
@@ -40,6 +40,7 @@ using TUGraz.VectoCore.Models.Simulation;
 using TUGraz.VectoCore.Models.Simulation.Data;
 using TUGraz.VectoCore.Models.Simulation.DataBus;
 using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox;
+using TUGraz.VectoCore.Models.SimulationComponent.Strategies;
 using TUGraz.VectoCore.OutputData;
 using TUGraz.VectoCore.Utils;
 
@@ -50,7 +51,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 		protected internal readonly IShiftStrategy _strategy;
 		protected internal readonly TorqueConverter TorqueConverter;
 		private IIdleController _idleController;
-		protected internal bool RequestAfterGearshift;
 
 		internal WattSecond _powershiftLossEnergy;
 		protected internal KilogramSquareMeter EngineInertia;
@@ -595,21 +595,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 			if (other is ATGearbox g) {
 				PreviousState = g.PreviousState.Clone();
 				_powershiftLossEnergy = g._powershiftLossEnergy;
-				EngineInertia = g.EngineInertia;
-				Disengaged = g.Disengaged;
-				SwitchToNeutral = g.SwitchToNeutral;
-				RequestAfterGearshift = g.RequestAfterGearshift;
 				LastShift = g.LastShift;
 				return true;
 			}
-
-			if (other is GearshiftPosition p) {
-				Gear = p;
-				DisengageGearbox = !p.Engaged;
-				Disengaged = !p.Engaged;
-				return true;
-			}
-
+			
 			return false;
 		}
 
diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs
index 7e4527e1c2..39ea12f2c6 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs
@@ -9,6 +9,7 @@ using TUGraz.VectoCore.Models.Connector.Ports.Impl;
 using TUGraz.VectoCore.Models.Simulation;
 using TUGraz.VectoCore.Models.Simulation.Data;
 using TUGraz.VectoCore.Models.SimulationComponent.Data;
+using TUGraz.VectoCore.Models.SimulationComponent.Strategies;
 using TUGraz.VectoCore.OutputData;
 using TUGraz.VectoCore.Utils;
 
@@ -582,8 +583,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 
 		public bool UpdateFrom(object other) {
 			if (other is ElectricMotor e && Position == e.Position) {
-				PreviousState = e.PreviousState.Clone();
-				ElectricPower = e.ElectricPower;
 				ThermalBuffer = e.ThermalBuffer;
 				DeRatingActive = e.DeRatingActive;
 				return true;
diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs
index dcc2f7d071..86c5c945cb 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs
@@ -571,30 +571,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 		public bool UpdateFrom(object other) {
 			if (other is Gearbox g) {
 				PreviousState = g.PreviousState.Clone();
-				Disengaged = g.Disengaged;
-				DisengageGearbox = g.DisengageGearbox;
-				_nextGear = g.NextGear;
-				
-				if (DataBus.VehicleInfo.VehicleStopped) {
-					Gear = _nextGear;
-				} else {
-					Gear = g.Gear;
-				}
-				
-				return true;
-			}
-
-			if (other is GearshiftPosition p) {
-				_nextGear = p;
-				DisengageGearbox = !p.Engaged;
-				Disengaged = !p.Engaged;
 				return true;
 			}
-
-			if (other is GearboxState s) {
-				PreviousState = s.Clone();
-			}
-			
 			return false;
 		}
 
-- 
GitLab