From 4e891a8bd7191e2e8f450db6d19d8ed863290baa Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Thu, 3 May 2018 13:59:19 +0200
Subject: [PATCH] adding tq & wheel speed left/right to cycle data

---
 .../Reader/DrivingCycleDataReader.cs          | 11 ++++++--
 .../Data/DrivingCycleData.cs                  | 26 +++++++++++++------
 2 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/VectoCore/VectoCore/InputData/Reader/DrivingCycleDataReader.cs b/VectoCore/VectoCore/InputData/Reader/DrivingCycleDataReader.cs
index 16a67cc062..3add8aec12 100644
--- a/VectoCore/VectoCore/InputData/Reader/DrivingCycleDataReader.cs
+++ b/VectoCore/VectoCore/InputData/Reader/DrivingCycleDataReader.cs
@@ -725,8 +725,11 @@ namespace TUGraz.VectoCore.InputData.Reader
 				var entries = table.Rows.Cast<DataRow>().Select(row => {
 					var wheelSpeed =
 						((row.ParseDouble(Fields.WheelSpeedLeft) + row.ParseDouble(Fields.WheelSpeedRight)) / 2).RPMtoRad();
-					var wheelPower = row.ParseDouble(Fields.WheelTorqueLeft).SI<NewtonMeter>() * row.ParseDouble(Fields.WheelSpeedLeft).RPMtoRad() +
-						row.ParseDouble(Fields.WheelTorqueRight).SI<NewtonMeter>() * row.ParseDouble(Fields.WheelSpeedRight).RPMtoRad();
+					var tqLeft = row.ParseDouble(Fields.WheelTorqueLeft).SI<NewtonMeter>();
+					var tqRight = row.ParseDouble(Fields.WheelTorqueRight).SI<NewtonMeter>();
+					var speedLeft = row.ParseDouble(Fields.WheelSpeedLeft).RPMtoRad();
+					var speedRight = row.ParseDouble(Fields.WheelSpeedRight).RPMtoRad();
+					var wheelPower = tqLeft * speedLeft + tqRight * speedRight;
 					return new DrivingCycleData.DrivingCycleEntry {
 						Time = row.ParseDouble(Fields.Time).SI<Second>(),
 						VehicleTargetSpeed = row.ParseDouble(Fields.VehicleSpeed).KMPHtoMeterPerSecond(),
@@ -739,6 +742,10 @@ namespace TUGraz.VectoCore.InputData.Reader
 						FanSpeed = row.ParseDouble(Fields.FanSpeed).RPMtoRad(),
 						Gear = (uint)row.ParseDoubleOrGetDefault(Fields.Gear),
 						Fuelconsumption = row.ParseDoubleOrGetDefault(Fields.FuelConsumption).SI(Unit.SI.Gramm.Per.Hour).Cast<KilogramPerSecond>(),
+						TorqueWheelLeft = tqLeft,
+						TorqueWheelRight = tqRight,
+						WheelSpeedLeft = speedLeft,
+						WheelSpeedRight = speedRight
 					};
 				}).ToArray();
 
diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs
index 13e3415b60..b565df6044 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs
@@ -47,7 +47,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
 		MeasuredSpeed,
 		MeasuredSpeedGear,
 		PTO,
-        VTP
+		VTP
 	}
 
 	public static class CycleTypeHelper
@@ -138,9 +138,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
 				Drag = entry.Drag;
 				PTOActive = entry.PTOActive;
 				AuxiliarySupplyPower = new Dictionary<string, Watt>(entry.AuxiliarySupplyPower);
-                EngineSpeed = entry.EngineSpeed;
-                FanSpeed = entry.FanSpeed;
-            }
+				EngineSpeed = entry.EngineSpeed;
+				FanSpeed = entry.FanSpeed;
+			}
 
 			/// <summary>
 			/// Travelled distance used for distance-based cycles. If "t" is also defined this column will be ignored.
@@ -225,7 +225,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
 			/// </summary>
 			public Watt PWheel;
 
-            public bool? TorqueConverterActive;
+			public bool? TorqueConverterActive;
 
 			/// <summary>
 			/// The angular velocity at the wheel. only used in PWheelCycle.
@@ -237,9 +237,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
 			/// </summary>
 			public bool PTOActive;
 
-            public PerSecond EngineSpeed;
+			public PerSecond EngineSpeed;
+
+			public PerSecond FanSpeed;
+
+			// required for VTP Mode (validation of cycle data in declaration mode)
+			public NewtonMeter TorqueWheelLeft;
+
+			public NewtonMeter TorqueWheelRight;
 
-            public PerSecond FanSpeed;
-        }
+			public PerSecond WheelSpeedLeft;
+
+			public PerSecond WheelSpeedRight;
+
+		}
 	}
 }
\ No newline at end of file
-- 
GitLab