From 2aad36ae02676e28fdeacffb3b3e7f6b6d35683d Mon Sep 17 00:00:00 2001
From: Michael Krisper <michael.krisper@tugraz.at>
Date: Fri, 13 Aug 2021 18:12:44 +0200
Subject: [PATCH] updated test files to use the correct components and
 filenames

---
 .../Integration/ADAS/ADASTestsConventional.cs | 170 ++++++---
 .../Integration/ADAS/ADASTestsHEV.cs          | 346 ++++++++++++++++--
 .../Group5PCCEng/AMT_12.vgbx                  |  47 ++-
 .../Group5PCCEng/Class5_Tractor_NoADAS.vecto  |   2 +-
 .../Group5PCCEng/Engine_325kW_12.7l.veng      |  31 +-
 .../ADAS-HEV/Group5PCCEng/AMT_12.vgbx         |   4 +-
 .../Group5PCCEng/Class5_Tractor_PCC12.vveh    |   2 +-
 .../Group5PCCEng/Class5_Tractor_PCC123.vveh   |   2 +-
 8 files changed, 488 insertions(+), 116 deletions(-)

diff --git a/VectoCore/VectoCoreTest/Integration/ADAS/ADASTestsConventional.cs b/VectoCore/VectoCoreTest/Integration/ADAS/ADASTestsConventional.cs
index 955ac5cd02..6cd4fded84 100644
--- a/VectoCore/VectoCoreTest/Integration/ADAS/ADASTestsConventional.cs
+++ b/VectoCore/VectoCoreTest/Integration/ADAS/ADASTestsConventional.cs
@@ -3,20 +3,20 @@ using System.Linq;
 using Ninject;
 using NUnit.Framework;
 using System;
+using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.Data;
-using System.Threading;
 using System.Threading.Tasks;
 using TUGraz.VectoCommon.Models;
 using TUGraz.VectoCommon.Utils;
 using TUGraz.VectoCore.InputData.FileIO.JSON;
 using TUGraz.VectoCore.InputData.FileIO.XML;
-using TUGraz.VectoCore.Models.Simulation;
 using TUGraz.VectoCore.Models.Simulation.Data;
 using TUGraz.VectoCore.Models.Simulation.Impl;
 using TUGraz.VectoCore.OutputData;
 using TUGraz.VectoCore.OutputData.FileIO;
 using TUGraz.VectoCore.Tests.Utils;
+using TUGraz.VectoCore.Utils;
 
 namespace TUGraz.VectoCore.Tests.Integration.ADAS
 {
@@ -220,8 +220,6 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 		}
 
 
-		// FC: Group5NoPCC <= Group5PCC12 <= Group5PCC123 <= Group5PCC123EcoEngineStop
-		// FC for Group5PCC123EcoNoEngineStop can sometimes be bigger than all others.
 		[TestCase(Group5EcoRollWithoutEngineStop, 0, TestName = "G5Eng EcoRoll Without Engine Stop CrestCoast 1"),
 		TestCase(Group5EcoRollWithoutEngineStop, 1, TestName = "G5Eng EcoRoll Without Engine Stop CrestCoast 2"),
 		TestCase(Group5EcoRollWithoutEngineStop, 2, TestName = "G5Eng EcoRoll Without Engine Stop Case A"), // Case A
@@ -261,7 +259,6 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 		TestCase(Group5NoADAS, 10, TestName = "G5Eng NoPCC Case I"), // Case I
 		TestCase(Group5NoADAS, 11, TestName = "G5Eng NoPCC Case J"), // Case J
 
-		// FuelConsumption should always be <= Group5NoPCC
 		TestCase(Group5PCC12, 0, TestName = "G5Eng PCC12 CrestCoast 1"),
 		TestCase(Group5PCC12, 1, TestName = "G5Eng PCC12 CrestCoast 2"),
 		TestCase(Group5PCC12, 2, TestName = "G5Eng PCC12 Case A"), // Case A
@@ -275,7 +272,6 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 		TestCase(Group5PCC12, 10, TestName = "G5Eng PCC12 Case I"), // Case I
 		TestCase(Group5PCC12, 11, TestName = "G5Eng PCC12 Case J"), // Case J
 
-		// FuelConsumption should always be <= Group5PCC12
 		TestCase(Group5PCC123, 2, TestName = "G5Eng PCC123 Case A"), // Case A
 		TestCase(Group5PCC123, 3, TestName = "G5Eng PCC123 Case B"), // Case B
 		TestCase(Group5PCC123, 4, TestName = "G5Eng PCC123 Case C"), // Case C
@@ -287,7 +283,6 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 		TestCase(Group5PCC123, 10, TestName = "G5Eng PCC123 Case I"), // Case I
 		TestCase(Group5PCC123, 11, TestName = "G5Eng PCC123 Case J"), // Case J
 
-		// FuelConsumption can sometimes be greater than Group5PCC123 (because of engine idling)
 		TestCase(Group5PCC123EcoRollWithoutEngineStop, 2, TestName = "G5Eng PCC123-Eco WithoutEngineStop Case A"), // Case A
 		TestCase(Group5PCC123EcoRollWithoutEngineStop, 3, TestName = "G5Eng PCC123-Eco WithoutEngineStop Case B"), // Case B
 		TestCase(Group5PCC123EcoRollWithoutEngineStop, 4, TestName = "G5Eng PCC123-Eco WithoutEngineStop Case C"), // Case C
@@ -299,7 +294,6 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 		TestCase(Group5PCC123EcoRollWithoutEngineStop, 10, TestName = "G5Eng PCC123-Eco WithoutEngineStop Case I"), // Case I
 		TestCase(Group5PCC123EcoRollWithoutEngineStop, 11, TestName = "G5Eng PCC123-Eco WithoutEngineStop Case J"), // Case J
 
-		// FuelConsumption should always be <= Group5PCC123
 		TestCase(Group5PCC123EcoRollEngineStop, 0, TestName = "G5Eng PCC123-Eco-EngineStop CrestCoast 1"),
 		TestCase(Group5PCC123EcoRollEngineStop, 1, TestName = "G5Eng PCC123-Eco-EngineStop CrestCoast 2"),
 		TestCase(Group5PCC123EcoRollEngineStop, 2, TestName = "G5Eng PCC123-Eco-EngineStop Case A"), // Case A
@@ -421,10 +415,10 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 		}
 
 		[TestCase]
-		public void CompareAllEngineeringJobs()
+		public void CompareADASConventionalEngineeringJobs()
 		{
 			var jobName = Group5NoADAS;
-			var writer = new FileOutputWriter(Path.Combine(Path.GetDirectoryName(jobName), Path.GetFileName(jobName)));
+			var writer = new FileOutputWriter(Path.Combine(Path.GetDirectoryName(jobName), "Group5_Conventional_Compare"));
 			var sumContainer = new SummaryDataContainer(writer);
 			var jobContainer = new JobContainer(sumContainer);
 
@@ -438,14 +432,15 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 				Group5PCC123EcoRollEngineStop,
 			};
 
-			var tasks = jobNames.Select(job => Task.Factory.StartNew(j =>
-				new SimulatorFactory(ExecutionMode.Engineering,
-					JSONInputDataFactory.ReadJsonJob((string)j), writer, validate: false, writeModalResults: true),
-				job, TaskCreationOptions.LongRunning)).ToArray();
+			var modData = new ConcurrentDictionary<(string, string), ModalResults>();
 
-			foreach (var task in tasks) {
-				jobContainer.AddRuns(task.Result);
-			}
+			Parallel.ForEach(jobNames, j => {
+				var factory = new SimulatorFactory(ExecutionMode.Engineering,
+					JSONInputDataFactory.ReadJsonJob(j), writer, validate: false, writeModalResults: true);
+				foreach (var run in jobContainer.AddRuns(factory)) {
+					modData.TryAdd((j, run.CycleName), (run.GetContainer().ModalData as ModalDataContainer).Data);
+				}
+			});
 
 			jobContainer.Execute();
 			jobContainer.WaitFinished();
@@ -453,7 +448,8 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 
 			Assert.IsTrue(progress.All(r => r.Value.Success), string.Concat(progress.Select(r => r.Value.Error)));
 
-			var c = "CrestCoast1.vdri"; var result = CheckCycle(c);
+			var c = "CrestCoast1.vdri";
+			var result = CheckCycle(c, sumContainer);
 			Assert.AreEqual(203, result.NoADAS, 5);
 			Assert.AreEqual(result.PCC12, result.NoADAS, $"{c}: since there is no pcc event, pcc should consume the same.");
 			Assert.AreEqual(result.PCC123, result.NoADAS, $"{c}: since there is no pcc event, pcc should consume the same.");
@@ -461,8 +457,15 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 			Assert.AreEqual(result.EcoRollEngineStop, result.PCC123EngineStop, $"{c}: since there is no pcc event, pcc should consume the same.");
 			Assert.GreaterOrEqual(result.EcoRollNoStop, result.NoADAS, $"{c}: Enabling EcoRoll increases fuel consumption.");
 			Assert.GreaterOrEqual(result.EcoRollEngineStop, result.NoADAS, $"{c}: Enabling EcoRoll increases fuel consumption.");
+			TestPCCSections(modData, c);
+
+			var m = modData[(Group5PCC123, c.Slice(0, -5))];
+			var pccStates = m.SelectData(x => Convert.ToInt32(x["PCCState"]));
+			foreach (var (p, i) in pccStates.Select()) {
+				Assert.AreEqual(0, p, $"PCCStates Index[{i}] should be zero.");
+			}
 
-			c = "CrestCoast2.vdri"; result = CheckCycle(c);
+			c = "CrestCoast2.vdri"; result = CheckCycle(c, sumContainer);
 			Assert.AreEqual(250, result.NoADAS, 5);
 			Assert.AreEqual(result.PCC12, result.NoADAS, $"{c}: since there is no pcc event, pcc should consume the same.");
 			Assert.AreEqual(result.PCC123, result.NoADAS, $"{c}: since there is no pcc event, pcc should consume the same.");
@@ -470,8 +473,10 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 			Assert.AreEqual(result.EcoRollEngineStop, result.PCC123EngineStop, $"{c}: since there is no pcc event, pcc should consume the same.");
 			Assert.GreaterOrEqual(result.EcoRollNoStop, result.NoADAS, $"{c}: Enabling EcoRoll increases fuel consumption.");
 			Assert.GreaterOrEqual(result.EcoRollEngineStop, result.NoADAS, $"{c}: Enabling EcoRoll increases fuel consumption.");
-			
-			c = "Group5Eng_CaseA.vdri"; result = CheckCycle(c);
+			TestPCCSections(modData, c);
+
+			c = "Group5Eng_CaseA.vdri";
+			result = CheckCycle(c, sumContainer);
 			Assert.AreEqual(264, result.NoADAS, 5);
 			Assert.Less(result.PCC12, result.NoADAS, $"{c}: pcc should be less.");
 			Assert.Less(result.PCC123, result.NoADAS, $"{c}: pcc should be less.");
@@ -481,8 +486,10 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 			Assert.Less(result.PCC123EngineStop, result.EcoRollEngineStop);
 			Assert.Less(result.PCC123NoEngineStop, result.EcoRollNoStop);
 			Assert.Less(result.PCC123NoEngineStop, result.EcoRollEngineStop);
-			
-			c = "Group5Eng_CaseB.vdri"; result = CheckCycle(c);
+			TestPCCSections(modData, c, (4119d, 0, 1), (5426d, 1, 2), (5830d, 2, 0));
+
+			c = "Group5Eng_CaseB.vdri";
+			result = CheckCycle(c, sumContainer);
 			Assert.AreEqual(224, result.NoADAS, 5);
 			Assert.AreEqual(result.PCC12, result.PCC123);
 			Assert.Less(result.PCC12, result.NoADAS);
@@ -490,8 +497,10 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 			Assert.Less(result.NoADAS, result.EcoRollNoStop);
 			Assert.Less(result.PCC123NoEngineStop, result.PCC123);
 			Assert.Less(result.PCC123EngineStop, result.PCC123NoEngineStop);
+			TestPCCSections(modData, c, (4609, 0, 1), (5414, 1, 2), (7291, 2, 0));
 
-			c = "Group5Eng_CaseC.vdri"; result = CheckCycle(c);
+			c = "Group5Eng_CaseC.vdri";
+			result = CheckCycle(c, sumContainer);
 			Assert.AreEqual(197, result.NoADAS, 5);
 			Assert.Greater(result.EcoRollNoStop, result.NoADAS);
 			Assert.Less(result.EcoRollEngineStop, result.EcoRollNoStop);
@@ -499,8 +508,10 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 			Assert.Less(result.PCC123, result.PCC12);
 			Assert.Greater(result.PCC123NoEngineStop, result.PCC123);
 			Assert.Less(result.PCC123EngineStop, result.PCC123NoEngineStop);
-			
-			c = "Group5Eng_CaseD.vdri"; result = CheckCycle(c);
+			TestPCCSections(modData, c, (3967, 0, 1), (4912, 1, 2), (6089, 2, 1), (7173, 1, 0));
+
+			c = "Group5Eng_CaseD.vdri";
+			result = CheckCycle(c, sumContainer);
 			Assert.AreEqual(248, result.NoADAS, 5);
 			Assert.Greater(result.EcoRollNoStop, result.NoADAS);
 			Assert.Less(result.EcoRollEngineStop, result.EcoRollNoStop);
@@ -508,8 +519,10 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 			Assert.Less(result.PCC123, result.PCC12);
 			Assert.Less(result.PCC123NoEngineStop, result.PCC123);
 			Assert.Less(result.PCC123EngineStop, result.PCC123NoEngineStop);
-			
-			c = "Group5Eng_CaseE.vdri"; result = CheckCycle(c);
+			TestPCCSections(modData, c, (654, 0, 1), (1867, 1, 2), (2481, 2, 0), (4021, 0, 1), (4919, 1, 2), (6217, 2, 1), (6704, 1, 0));
+
+			c = "Group5Eng_CaseE.vdri";
+			result = CheckCycle(c, sumContainer);
 			Assert.AreEqual(230, result.NoADAS, 5);
 			Assert.Less(result.EcoRollNoStop, result.NoADAS);
 			Assert.Less(result.EcoRollEngineStop, result.EcoRollNoStop);
@@ -517,8 +530,10 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 			Assert.AreEqual(result.PCC123, result.PCC12);
 			Assert.Less(result.PCC123NoEngineStop, result.PCC123);
 			Assert.Less(result.PCC123EngineStop, result.PCC123NoEngineStop);
+			TestPCCSections(modData, c, (689, 0, 1), (2066, 1, 2), (2377, 2, 1), (2984, 1, 2), (3871, 2, 1), (3978, 1, 0));
 
-			c = "Group5Eng_CaseF.vdri"; result = CheckCycle(c);
+			c = "Group5Eng_CaseF.vdri";
+			result = CheckCycle(c, sumContainer);
 			Assert.AreEqual(220, result.NoADAS, 5);
 			Assert.Less(result.EcoRollNoStop, result.NoADAS);
 			Assert.Less(result.EcoRollEngineStop, result.EcoRollNoStop);
@@ -526,8 +541,10 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 			Assert.AreEqual(result.PCC123, result.PCC12);
 			Assert.Less(result.PCC123NoEngineStop, result.PCC123);
 			Assert.Less(result.PCC123EngineStop, result.PCC123NoEngineStop);
+			TestPCCSections(modData, c, (701, 0, 1), (2066, 1, 2), (2400, 2, 1), (2587, 1, 2), (3283, 2, 0));
 
-			c = "Group5Eng_CaseG.vdri"; result = CheckCycle(c);
+			c = "Group5Eng_CaseG.vdri";
+			result = CheckCycle(c, sumContainer);
 			Assert.AreEqual(236, result.NoADAS, 5);
 			Assert.AreEqual(result.EcoRollNoStop, result.NoADAS);
 			Assert.AreEqual(result.EcoRollEngineStop, result.EcoRollNoStop);
@@ -535,8 +552,10 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 			Assert.Less(result.PCC123, result.PCC12);
 			Assert.Greater(result.PCC123NoEngineStop, result.PCC123);
 			Assert.Less(result.PCC123EngineStop, result.PCC123);
+			TestPCCSections(modData, c, (3944, 0, 1), (5076, 1, 2), (5899, 2, 1), (6596, 1, 0));
 
-			c = "Group5Eng_CaseH.vdri"; result = CheckCycle(c);
+			c = "Group5Eng_CaseH.vdri";
+			result = CheckCycle(c, sumContainer);
 			Assert.AreEqual(204, result.NoADAS, 5);
 			Assert.Greater(result.EcoRollNoStop, result.NoADAS);
 			Assert.Less(result.EcoRollEngineStop, result.EcoRollNoStop);
@@ -544,8 +563,10 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 			Assert.AreEqual(result.PCC123, result.PCC12);
 			Assert.Less(result.PCC123NoEngineStop, result.PCC123);
 			Assert.Less(result.PCC123EngineStop, result.PCC123NoEngineStop);
+			TestPCCSections(modData, c, (3804, 0, 1), (4772, 1, 2), (6003, 2, 0));
 
-			c = "Group5Eng_CaseI.vdri"; result = CheckCycle(c);
+			c = "Group5Eng_CaseI.vdri";
+			result = CheckCycle(c, sumContainer);
 			Assert.AreEqual(214, result.NoADAS, 5);
 			Assert.AreEqual(result.EcoRollNoStop, result.NoADAS);
 			Assert.AreEqual(result.EcoRollEngineStop, result.EcoRollNoStop);
@@ -553,8 +574,10 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 			Assert.AreEqual(result.PCC123, result.PCC12);
 			Assert.AreEqual(result.PCC123NoEngineStop, result.PCC123);
 			Assert.AreEqual(result.PCC123EngineStop, result.PCC123NoEngineStop);
-			
-			c = "Group5Eng_CaseJ.vdri"; result = CheckCycle(c);
+			TestPCCSections(modData, c);
+
+			c = "Group5Eng_CaseJ.vdri";
+			result = CheckCycle(c, sumContainer);
 			Assert.AreEqual(303, result.NoADAS, 5);
 			Assert.AreEqual(result.EcoRollNoStop, result.NoADAS);
 			Assert.AreEqual(result.EcoRollEngineStop, result.EcoRollNoStop);
@@ -562,27 +585,66 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 			Assert.Less(result.PCC123, result.PCC12);
 			Assert.Greater(result.PCC123NoEngineStop, result.PCC123);
 			Assert.Less(result.PCC123EngineStop, result.PCC123NoEngineStop);
+			TestPCCSections(modData, c, (3559, 0, 1), (5364, 1, 3), (5692, 3, 1), (6132, 1, 0));
+		}
+
+		private (ConvertedSI NoADAS, ConvertedSI EcoRollNoStop, ConvertedSI EcoRollEngineStop,
+			ConvertedSI PCC12, ConvertedSI PCC123, ConvertedSI PCC123NoEngineStop, ConvertedSI PCC123EngineStop)
+			CheckCycle(string s, SummaryDataContainer summaryDataContainer)
+		{
 
-			(ConvertedSI NoADAS, ConvertedSI EcoRollNoStop, ConvertedSI EcoRollEngineStop,
-				ConvertedSI PCC12, ConvertedSI PCC123, ConvertedSI PCC123NoEngineStop, ConvertedSI PCC123EngineStop)
-				CheckCycle(string s)
-			{
-				var sumResults = sumContainer.Table.Select($@"[Cycle [-\]] = '{s}'", "Job [-]");
-				var values = sumResults.Select(row => row.Field<ConvertedSI>("FC-Final [g/km]")).ToArray();
-				var (NoADAS, EcoRollNoStop, EcoRollEngineStop, PCC12, PCC123, PCC123NoEngineStop, PCC123EngineStop) = values;
-
-				Assert.LessOrEqual(PCC12, NoADAS, $"{s}: Enabling ADAS should always reduce fuel consumption.");
-				Assert.LessOrEqual(PCC123, NoADAS, $"{s}: Enabling ADAS should always reduce fuel consumption.");
-
-				Assert.LessOrEqual(PCC123EngineStop, PCC123NoEngineStop, $"{s}: with engine stop should always consume less then without engine stop");
-				Assert.LessOrEqual(EcoRollEngineStop, EcoRollNoStop, $"{s}: with engine stop should always consume less then without engine stop");
-
-				Assert.LessOrEqual(PCC123NoEngineStop, EcoRollNoStop, $"{s}: PCC EcoRoll should always be lower as EcoRoll.");
-				Assert.LessOrEqual(PCC123EngineStop, EcoRollEngineStop, $"{s}: PCC EcoRoll should always be lower as EcoRoll.");
-		
-				Assert.LessOrEqual(PCC123, PCC12, $"{s}: better pcc options should consume less");
-				
-				return (NoADAS, EcoRollNoStop, EcoRollEngineStop, PCC12, PCC123, PCC123NoEngineStop, PCC123EngineStop);
+			var sumResults = summaryDataContainer.Table.Select($@"[Cycle [-\]] = '{s}'", "Input File [-]");
+			Assert.AreEqual(7, sumResults.Length, $"{s}: Not enough result rows in sum file");
+			var values = sumResults.Select(row => row.Field<ConvertedSI>("FC-Final [g/km]")).ToArray();
+			var (EcoRollEngineStop, EcoRollNoStop, NoADAS, PCC12, PCC123, PCC123EngineStop, PCC123NoEngineStop) = values;
+
+			Assert.LessOrEqual(PCC12, NoADAS, $"{s}: Enabling ADAS should always reduce fuel consumption.");
+			Assert.LessOrEqual(PCC123, NoADAS, $"{s}: Enabling ADAS should always reduce fuel consumption.");
+
+			Assert.LessOrEqual(PCC123EngineStop, PCC123NoEngineStop, $"{s}: with engine stop should always consume less then without engine stop");
+			Assert.LessOrEqual(EcoRollEngineStop, EcoRollNoStop, $"{s}: with engine stop should always consume less then without engine stop");
+
+			Assert.LessOrEqual(PCC123NoEngineStop, EcoRollNoStop, $"{s}: PCC EcoRoll should always be lower as EcoRoll.");
+			Assert.LessOrEqual(PCC123EngineStop, EcoRollEngineStop, $"{s}: PCC EcoRoll should always be lower as EcoRoll.");
+
+			Assert.LessOrEqual(PCC123, PCC12, $"{s}: better pcc options should consume less");
+
+			return (NoADAS, EcoRollNoStop, EcoRollEngineStop, PCC12, PCC123, PCC123NoEngineStop, PCC123EngineStop);
+		}
+
+		private void TestPCCSections(ConcurrentDictionary<(string, string), ModalResults> modData, string c,
+			params (double Distance, int Before, int After)[] expectedSections)
+		{
+			var m = modData[(Group5PCC123, c.Slice(0, -5))];
+			var pccStates = m.SelectData(x => Convert.ToInt32(x["PCCState"]));
+			var distances = m.SelectData(x => x.Field<Meter>(ModalResultField.dist.GetName()).Value());
+			var sections = GetDistancesOfStateChanges(pccStates, distances);
+			if (expectedSections.Length == 0) {
+				Assert.IsFalse(sections.Any());
+			} else {
+				foreach (var (exp, actual) in expectedSections.Zip(sections)) {
+					Assert.AreEqual(exp.Before, actual.Before, $"Cycle {c}: Expected change from {exp.Before} --> {exp.After} at distance {exp.Distance}");
+					Assert.AreEqual(exp.After, actual.After, $"Cycle {c}: Expected change from {exp.Before} --> {exp.After} at distance {exp.Distance}");
+					Assert.AreEqual(exp.Distance, actual.Distance, 10, $"Cycle {c}: Expected change from {exp.Before} --> {exp.After} at distance {exp.Distance}");
+				}
+			}
+		}
+
+		IEnumerable<(T2 Distance, T1 Before, T1 After)> GetDistancesOfStateChanges<T1, T2>(IEnumerable<T1> states, IEnumerable<T2> locations)
+		{
+			using (var values = states.GetEnumerator()) {
+				using (var locs = locations.GetEnumerator()) {
+					locs.MoveNext();
+					values.MoveNext();
+					var value = values.Current;
+					while (values.MoveNext()) {
+						locs.MoveNext();
+						if (!value.Equals(values.Current)) {
+							yield return (locs.Current, value, values.Current);
+							value = values.Current;
+						}
+					}
+				}
 			}
 		}
 	}
diff --git a/VectoCore/VectoCoreTest/Integration/ADAS/ADASTestsHEV.cs b/VectoCore/VectoCoreTest/Integration/ADAS/ADASTestsHEV.cs
index a663236ca2..15a818b13e 100644
--- a/VectoCore/VectoCoreTest/Integration/ADAS/ADASTestsHEV.cs
+++ b/VectoCore/VectoCoreTest/Integration/ADAS/ADASTestsHEV.cs
@@ -1,13 +1,20 @@
 using System.IO;
 using System.Linq;
 using NUnit.Framework;
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Data;
+using System.Threading.Tasks;
 using TUGraz.VectoCommon.Models;
+using TUGraz.VectoCommon.Utils;
 using TUGraz.VectoCore.InputData.FileIO.JSON;
 using TUGraz.VectoCore.Models.Simulation.Data;
 using TUGraz.VectoCore.Models.Simulation.Impl;
 using TUGraz.VectoCore.OutputData;
 using TUGraz.VectoCore.OutputData.FileIO;
 using TUGraz.VectoCore.Tests.Utils;
+using TUGraz.VectoCore.Utils;
 
 namespace TUGraz.VectoCore.Tests.Integration.ADAS
 {
@@ -15,11 +22,14 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 	[Parallelizable(ParallelScope.All)]
 	public class ADASTestsHEV
 	{
-		const string Group5NoPCC = @"TestData\Integration\ADAS-HEV\Group5PCCEng\Class5_Tractor_ENG.vecto";
-		const string Group5PCC12 = @"TestData\Integration\ADAS-HEV\Group5PCCEng\Class5_Tractor_ENG_PCC12.vecto";
-		const string Group5PCC123 = @"TestData\Integration\ADAS-HEV\Group5PCCEng\Class5_Tractor_ENG_PCC123.vecto";
-		const string Group5PCC123EcoSS = @"TestData\Integration\ADAS-HEV\Group5PCCEng\Class5_Tractor_ENG_PCC123EcoSS.vecto";
-
+		private const string Group5NoADAS = @"TestData\Integration\ADAS-HEV\Group5PCCEng\Class5_Tractor_NoADAS.vecto";
+		private const string Group5EcoRollWithoutEngineStop = @"TestData\Integration\ADAS-HEV\Group5PCCEng\Class5_Tractor_EcoRollWithoutEngineStop.vecto";
+		private const string Group5EcoRollEngineStop = @"TestData\Integration\ADAS-HEV\Group5PCCEng\Class5_Tractor_EcoRollEngineStop.vecto";
+		private const string Group5PCC12 = @"TestData\Integration\ADAS-HEV\Group5PCCEng\Class5_Tractor_PCC12.vecto";
+		private const string Group5PCC123 = @"TestData\Integration\ADAS-HEV\Group5PCCEng\Class5_Tractor_PCC123.vecto";
+		private const string Group5PCC123EcoRollWithoutEngineStop = @"TestData\Integration\ADAS-HEV\Group5PCCEng\Class5_Tractor_PCC123EcoRollWithoutEngineStop.vecto";
+		private const string Group5PCC123EcoRollEngineStop = @"TestData\Integration\ADAS-HEV\Group5PCCEng\Class5_Tractor_PCC123EcoRollEngineStop.vecto";
+		
 		[OneTimeSetUp]
 		public void RunBeforeAnyTests() => Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory);
 
@@ -165,18 +175,44 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 			GetGraphWriter().Write(modFilename);
 		}
 
-		[TestCase(Group5NoPCC, 0, TestName = "G5Eng NoPCC CrestCoast 1"),
-		TestCase(Group5NoPCC, 1, TestName = "G5Eng NoPCC CrestCoast 2"),
-		TestCase(Group5NoPCC, 2, TestName = "G5Eng NoPCC Case A"), // Case A
-		TestCase(Group5NoPCC, 3, TestName = "G5Eng NoPCC Case B"), // Case B
-		TestCase(Group5NoPCC, 4, TestName = "G5Eng NoPCC Case C"), // Case C
-		TestCase(Group5NoPCC, 5, TestName = "G5Eng NoPCC Case D"), // Case D
-		TestCase(Group5NoPCC, 6, TestName = "G5Eng NoPCC Case E"), // Case E
-		TestCase(Group5NoPCC, 7, TestName = "G5Eng NoPCC Case F"), // Case F
-		TestCase(Group5NoPCC, 8, TestName = "G5Eng NoPCC Case G"), // Case G
-		TestCase(Group5NoPCC, 9, TestName = "G5Eng NoPCC Case H"), // Case H
-		TestCase(Group5NoPCC, 10, TestName = "G5Eng NoPCC Case I"), // Case I
-		TestCase(Group5NoPCC, 11, TestName = "G5Eng NoPCC Case J"), // Case J
+		[TestCase(Group5EcoRollWithoutEngineStop, 0, TestName = "G5Eng EcoRoll Without Engine Stop CrestCoast 1"),
+		TestCase(Group5EcoRollWithoutEngineStop, 1, TestName = "G5Eng EcoRoll Without Engine Stop CrestCoast 2"),
+		TestCase(Group5EcoRollWithoutEngineStop, 2, TestName = "G5Eng EcoRoll Without Engine Stop Case A"), // Case A
+		TestCase(Group5EcoRollWithoutEngineStop, 3, TestName = "G5Eng EcoRoll Without Engine Stop Case B"), // Case B
+		TestCase(Group5EcoRollWithoutEngineStop, 4, TestName = "G5Eng EcoRoll Without Engine Stop Case C"), // Case C
+		TestCase(Group5EcoRollWithoutEngineStop, 5, TestName = "G5Eng EcoRoll Without Engine Stop Case D"), // Case D
+		TestCase(Group5EcoRollWithoutEngineStop, 6, TestName = "G5Eng EcoRoll Without Engine Stop Case E"), // Case E
+		TestCase(Group5EcoRollWithoutEngineStop, 7, TestName = "G5Eng EcoRoll Without Engine Stop Case F"), // Case F
+		TestCase(Group5EcoRollWithoutEngineStop, 8, TestName = "G5Eng EcoRoll Without Engine Stop Case G"), // Case G
+		TestCase(Group5EcoRollWithoutEngineStop, 9, TestName = "G5Eng EcoRoll Without Engine Stop Case H"), // Case H
+		TestCase(Group5EcoRollWithoutEngineStop, 10, TestName = "G5Eng EcoRoll Without Engine Stop Case I"), // Case I
+		TestCase(Group5EcoRollWithoutEngineStop, 11, TestName = "G5Eng EcoRoll Without Engine Stop Case J"), // Case J
+
+		TestCase(Group5EcoRollEngineStop, 0, TestName = "G5Eng EcoRoll With Engine Stop CrestCoast 1"),
+		TestCase(Group5EcoRollEngineStop, 1, TestName = "G5Eng EcoRoll With Engine Stop CrestCoast 2"),
+		TestCase(Group5EcoRollEngineStop, 2, TestName = "G5Eng EcoRoll With Engine Stop Case A"), // Case A
+		TestCase(Group5EcoRollEngineStop, 3, TestName = "G5Eng EcoRoll With Engine Stop Case B"), // Case B
+		TestCase(Group5EcoRollEngineStop, 4, TestName = "G5Eng EcoRoll With Engine Stop Case C"), // Case C
+		TestCase(Group5EcoRollEngineStop, 5, TestName = "G5Eng EcoRoll With Engine Stop Case D"), // Case D
+		TestCase(Group5EcoRollEngineStop, 6, TestName = "G5Eng EcoRoll With Engine Stop Case E"), // Case E
+		TestCase(Group5EcoRollEngineStop, 7, TestName = "G5Eng EcoRoll With Engine Stop Case F"), // Case F
+		TestCase(Group5EcoRollEngineStop, 8, TestName = "G5Eng EcoRoll With Engine Stop Case G"), // Case G
+		TestCase(Group5EcoRollEngineStop, 9, TestName = "G5Eng EcoRoll With Engine Stop Case H"), // Case H
+		TestCase(Group5EcoRollEngineStop, 10, TestName = "G5Eng EcoRoll With Engine Stop Case I"), // Case I
+		TestCase(Group5EcoRollEngineStop, 11, TestName = "G5Eng EcoRoll With Engine Stop Case J"), // Case J
+
+		TestCase(Group5NoADAS, 0, TestName = "G5Eng NoPCC CrestCoast 1"),
+		TestCase(Group5NoADAS, 1, TestName = "G5Eng NoPCC CrestCoast 2"),
+		TestCase(Group5NoADAS, 2, TestName = "G5Eng NoPCC Case A"), // Case A
+		TestCase(Group5NoADAS, 3, TestName = "G5Eng NoPCC Case B"), // Case B
+		TestCase(Group5NoADAS, 4, TestName = "G5Eng NoPCC Case C"), // Case C
+		TestCase(Group5NoADAS, 5, TestName = "G5Eng NoPCC Case D"), // Case D
+		TestCase(Group5NoADAS, 6, TestName = "G5Eng NoPCC Case E"), // Case E
+		TestCase(Group5NoADAS, 7, TestName = "G5Eng NoPCC Case F"), // Case F
+		TestCase(Group5NoADAS, 8, TestName = "G5Eng NoPCC Case G"), // Case G
+		TestCase(Group5NoADAS, 9, TestName = "G5Eng NoPCC Case H"), // Case H
+		TestCase(Group5NoADAS, 10, TestName = "G5Eng NoPCC Case I"), // Case I
+		TestCase(Group5NoADAS, 11, TestName = "G5Eng NoPCC Case J"), // Case J
 
 		TestCase(Group5PCC12, 0, TestName = "G5Eng PCC12 CrestCoast 1"),
 		TestCase(Group5PCC12, 1, TestName = "G5Eng PCC12 CrestCoast 2"),
@@ -191,8 +227,6 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 		TestCase(Group5PCC12, 10, TestName = "G5Eng PCC12 Case I"), // Case I
 		TestCase(Group5PCC12, 11, TestName = "G5Eng PCC12 Case J"), // Case J
 
-		TestCase(Group5PCC123, 0, TestName = "G5Eng PCC123 CrestCoast 1"),
-		TestCase(Group5PCC123, 1, TestName = "G5Eng PCC123 CrestCoast 2"),
 		TestCase(Group5PCC123, 2, TestName = "G5Eng PCC123 Case A"), // Case A
 		TestCase(Group5PCC123, 3, TestName = "G5Eng PCC123 Case B"), // Case B
 		TestCase(Group5PCC123, 4, TestName = "G5Eng PCC123 Case C"), // Case C
@@ -204,18 +238,29 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 		TestCase(Group5PCC123, 10, TestName = "G5Eng PCC123 Case I"), // Case I
 		TestCase(Group5PCC123, 11, TestName = "G5Eng PCC123 Case J"), // Case J
 
-		TestCase(Group5PCC123EcoSS, 0, TestName = "G5Eng PCC123-EcoSS CrestCoast 1"),
-		TestCase(Group5PCC123EcoSS, 1, TestName = "G5Eng PCC123-EcoSS CrestCoast 2"),
-		TestCase(Group5PCC123EcoSS, 2, TestName = "G5Eng PCC123-EcoSS Case A"), // Case A
-		TestCase(Group5PCC123EcoSS, 3, TestName = "G5Eng PCC123-EcoSS Case B"), // Case B
-		TestCase(Group5PCC123EcoSS, 4, TestName = "G5Eng PCC123-EcoSS Case C"), // Case C
-		TestCase(Group5PCC123EcoSS, 5, TestName = "G5Eng PCC123-EcoSS Case D"), // Case D
-		TestCase(Group5PCC123EcoSS, 6, TestName = "G5Eng PCC123-EcoSS Case E"), // Case E
-		TestCase(Group5PCC123EcoSS, 7, TestName = "G5Eng PCC123-EcoSS Case F"), // Case F
-		TestCase(Group5PCC123EcoSS, 8, TestName = "G5Eng PCC123-EcoSS Case G"), // Case G
-		TestCase(Group5PCC123EcoSS, 9, TestName = "G5Eng PCC123-EcoSS Case H"), // Case H
-		TestCase(Group5PCC123EcoSS, 10, TestName = "G5Eng PCC123-EcoSS Case I"), // Case I
-		TestCase(Group5PCC123EcoSS, 11, TestName = "G5Eng PCC123-EcoSS Case J"), // Case J
+		TestCase(Group5PCC123EcoRollWithoutEngineStop, 2, TestName = "G5Eng PCC123-Eco WithoutEngineStop Case A"), // Case A
+		TestCase(Group5PCC123EcoRollWithoutEngineStop, 3, TestName = "G5Eng PCC123-Eco WithoutEngineStop Case B"), // Case B
+		TestCase(Group5PCC123EcoRollWithoutEngineStop, 4, TestName = "G5Eng PCC123-Eco WithoutEngineStop Case C"), // Case C
+		TestCase(Group5PCC123EcoRollWithoutEngineStop, 5, TestName = "G5Eng PCC123-Eco WithoutEngineStop Case D"), // Case D
+		TestCase(Group5PCC123EcoRollWithoutEngineStop, 6, TestName = "G5Eng PCC123-Eco WithoutEngineStop Case E"), // Case E
+		TestCase(Group5PCC123EcoRollWithoutEngineStop, 7, TestName = "G5Eng PCC123-Eco WithoutEngineStop Case F"), // Case F
+		TestCase(Group5PCC123EcoRollWithoutEngineStop, 8, TestName = "G5Eng PCC123-Eco WithoutEngineStop Case G"), // Case G
+		TestCase(Group5PCC123EcoRollWithoutEngineStop, 9, TestName = "G5Eng PCC123-Eco WithoutEngineStop Case H"), // Case H
+		TestCase(Group5PCC123EcoRollWithoutEngineStop, 10, TestName = "G5Eng PCC123-Eco WithoutEngineStop Case I"), // Case I
+		TestCase(Group5PCC123EcoRollWithoutEngineStop, 11, TestName = "G5Eng PCC123-Eco WithoutEngineStop Case J"), // Case J
+
+		TestCase(Group5PCC123EcoRollEngineStop, 0, TestName = "G5Eng PCC123-Eco-EngineStop CrestCoast 1"),
+		TestCase(Group5PCC123EcoRollEngineStop, 1, TestName = "G5Eng PCC123-Eco-EngineStop CrestCoast 2"),
+		TestCase(Group5PCC123EcoRollEngineStop, 2, TestName = "G5Eng PCC123-Eco-EngineStop Case A"), // Case A
+		TestCase(Group5PCC123EcoRollEngineStop, 3, TestName = "G5Eng PCC123-Eco-EngineStop Case B"), // Case B
+		TestCase(Group5PCC123EcoRollEngineStop, 4, TestName = "G5Eng PCC123-Eco-EngineStop Case C"), // Case C
+		TestCase(Group5PCC123EcoRollEngineStop, 5, TestName = "G5Eng PCC123-Eco-EngineStop Case D"), // Case D
+		TestCase(Group5PCC123EcoRollEngineStop, 6, TestName = "G5Eng PCC123-Eco-EngineStop Case E"), // Case E
+		TestCase(Group5PCC123EcoRollEngineStop, 7, TestName = "G5Eng PCC123-Eco-EngineStop Case F"), // Case F
+		TestCase(Group5PCC123EcoRollEngineStop, 8, TestName = "G5Eng PCC123-Eco-EngineStop Case G"), // Case G
+		TestCase(Group5PCC123EcoRollEngineStop, 9, TestName = "G5Eng PCC123-Eco-EngineStop Case H"), // Case H
+		TestCase(Group5PCC123EcoRollEngineStop, 10, TestName = "G5Eng PCC123-Eco-EngineStop Case I"), // Case I
+		TestCase(Group5PCC123EcoRollEngineStop, 11, TestName = "G5Eng PCC123-Eco-EngineStop  Case J"), // Case J
 		]
 		public void TestPCCEngineeringSampleCases(string jobName, int cycleIdx)
 		{
@@ -249,5 +294,244 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
 			var modFilename = writer.GetModDataFileName(run.RunName, run.CycleName, run.RunSuffix);
 			GetGraphWriter().Write(modFilename);
 		}
+
+
+
+		[TestCase]
+		public void CompareADASHEVEngineeringJobs()
+		{
+			var jobName = Group5NoADAS;
+			var writer = new FileOutputWriter(Path.Combine(Path.GetDirectoryName(jobName), "Group5_HEV_Compare"));
+			var sumContainer = new SummaryDataContainer(writer);
+			var jobContainer = new JobContainer(sumContainer);
+
+			var jobNames = new[] {
+				Group5NoADAS,
+				Group5EcoRollWithoutEngineStop,
+				Group5EcoRollEngineStop,
+				Group5PCC12,
+				Group5PCC123,
+				Group5PCC123EcoRollWithoutEngineStop,
+				Group5PCC123EcoRollEngineStop,
+			};
+
+			var modData = new ConcurrentDictionary<(string, string), ModalResults>();
+
+			Parallel.ForEach(jobNames, j => {
+				var factory = new SimulatorFactory(ExecutionMode.Engineering,
+					JSONInputDataFactory.ReadJsonJob(j), writer, validate: false, writeModalResults: true);
+				foreach (var run in jobContainer.AddRuns(factory)) {
+					modData.TryAdd((j, run.CycleName), (run.GetContainer().ModalData as ModalDataContainer).Data);
+				}
+			});
+
+			jobContainer.Execute();
+			jobContainer.WaitFinished();
+			var progress = jobContainer.GetProgress();
+
+			Assert.IsTrue(progress.All(r => r.Value.Success), string.Concat(progress.Select(r => r.Value.Error)));
+
+			var c = "CrestCoast1.vdri";
+			var result = CheckCycle(c, sumContainer);
+			Assert.AreEqual(203, result.NoADAS, 5);
+			Assert.AreEqual(result.PCC12, result.NoADAS, $"{c}: since there is no pcc event, pcc should consume the same.");
+			Assert.AreEqual(result.PCC123, result.NoADAS, $"{c}: since there is no pcc event, pcc should consume the same.");
+			Assert.AreEqual(result.EcoRollEngineStop, result.PCC123EngineStop, $"{c}: since there is no pcc event, pcc should consume the same.");
+			Assert.AreEqual(result.EcoRollEngineStop, result.PCC123EngineStop, $"{c}: since there is no pcc event, pcc should consume the same.");
+			Assert.GreaterOrEqual(result.EcoRollNoStop, result.NoADAS, $"{c}: Enabling EcoRoll increases fuel consumption.");
+			Assert.GreaterOrEqual(result.EcoRollEngineStop, result.NoADAS, $"{c}: Enabling EcoRoll increases fuel consumption.");
+			TestPCCSections(modData, c);
+
+			var m = modData[(Group5PCC123, c.Slice(0, -5))];
+			var pccStates = m.SelectData(x => Convert.ToInt32(x["PCCState"]));
+			foreach (var (p, i) in pccStates.Select()) {
+				Assert.AreEqual(0, p, $"PCCStates Index[{i}] should be zero.");
+			}
+
+			c = "CrestCoast2.vdri"; result = CheckCycle(c, sumContainer);
+			Assert.AreEqual(250, result.NoADAS, 5);
+			Assert.AreEqual(result.PCC12, result.NoADAS, $"{c}: since there is no pcc event, pcc should consume the same.");
+			Assert.AreEqual(result.PCC123, result.NoADAS, $"{c}: since there is no pcc event, pcc should consume the same.");
+			Assert.AreEqual(result.EcoRollEngineStop, result.PCC123EngineStop, $"{c}: since there is no pcc event, pcc should consume the same.");
+			Assert.AreEqual(result.EcoRollEngineStop, result.PCC123EngineStop, $"{c}: since there is no pcc event, pcc should consume the same.");
+			Assert.GreaterOrEqual(result.EcoRollNoStop, result.NoADAS, $"{c}: Enabling EcoRoll increases fuel consumption.");
+			Assert.GreaterOrEqual(result.EcoRollEngineStop, result.NoADAS, $"{c}: Enabling EcoRoll increases fuel consumption.");
+			TestPCCSections(modData, c);
+
+			c = "Group5Eng_CaseA.vdri";
+			result = CheckCycle(c, sumContainer);
+			Assert.AreEqual(264, result.NoADAS, 5);
+			Assert.Less(result.PCC12, result.NoADAS, $"{c}: pcc should be less.");
+			Assert.Less(result.PCC123, result.NoADAS, $"{c}: pcc should be less.");
+			Assert.AreEqual(result.PCC12, result.PCC123, $"{c}: pcc 12 and 123 should be equal.");
+			Assert.Less(result.EcoRollNoStop, result.NoADAS);
+			Assert.Less(result.EcoRollEngineStop, result.EcoRollNoStop);
+			Assert.Less(result.PCC123EngineStop, result.EcoRollEngineStop);
+			Assert.Less(result.PCC123NoEngineStop, result.EcoRollNoStop);
+			Assert.Less(result.PCC123NoEngineStop, result.EcoRollEngineStop);
+			TestPCCSections(modData, c, (4119d, 0, 1), (5426d, 1, 2), (5830d, 2, 0));
+
+			c = "Group5Eng_CaseB.vdri";
+			result = CheckCycle(c, sumContainer);
+			Assert.AreEqual(224, result.NoADAS, 5);
+			Assert.AreEqual(result.PCC12, result.PCC123);
+			Assert.Less(result.PCC12, result.NoADAS);
+			Assert.Less(result.NoADAS, result.EcoRollEngineStop);
+			Assert.Less(result.NoADAS, result.EcoRollNoStop);
+			Assert.Less(result.PCC123NoEngineStop, result.PCC123);
+			Assert.Less(result.PCC123EngineStop, result.PCC123NoEngineStop);
+			TestPCCSections(modData, c, (4609, 0, 1), (5414, 1, 2), (7291, 2, 0));
+
+			c = "Group5Eng_CaseC.vdri";
+			result = CheckCycle(c, sumContainer);
+			Assert.AreEqual(197, result.NoADAS, 5);
+			Assert.Greater(result.EcoRollNoStop, result.NoADAS);
+			Assert.Less(result.EcoRollEngineStop, result.EcoRollNoStop);
+			Assert.Less(result.PCC12, result.NoADAS);
+			Assert.Less(result.PCC123, result.PCC12);
+			Assert.Greater(result.PCC123NoEngineStop, result.PCC123);
+			Assert.Less(result.PCC123EngineStop, result.PCC123NoEngineStop);
+			TestPCCSections(modData, c, (3967, 0, 1), (4912, 1, 2), (6089, 2, 1), (7173, 1, 0));
+
+			c = "Group5Eng_CaseD.vdri";
+			result = CheckCycle(c, sumContainer);
+			Assert.AreEqual(248, result.NoADAS, 5);
+			Assert.Greater(result.EcoRollNoStop, result.NoADAS);
+			Assert.Less(result.EcoRollEngineStop, result.EcoRollNoStop);
+			Assert.Less(result.PCC12, result.NoADAS);
+			Assert.Less(result.PCC123, result.PCC12);
+			Assert.Less(result.PCC123NoEngineStop, result.PCC123);
+			Assert.Less(result.PCC123EngineStop, result.PCC123NoEngineStop);
+			TestPCCSections(modData, c, (654, 0, 1), (1867, 1, 2), (2481, 2, 0), (4021, 0, 1), (4919, 1, 2), (6217, 2, 1), (6704, 1, 0));
+
+			c = "Group5Eng_CaseE.vdri";
+			result = CheckCycle(c, sumContainer);
+			Assert.AreEqual(230, result.NoADAS, 5);
+			Assert.Less(result.EcoRollNoStop, result.NoADAS);
+			Assert.Less(result.EcoRollEngineStop, result.EcoRollNoStop);
+			Assert.Less(result.PCC12, result.NoADAS);
+			Assert.AreEqual(result.PCC123, result.PCC12);
+			Assert.Less(result.PCC123NoEngineStop, result.PCC123);
+			Assert.Less(result.PCC123EngineStop, result.PCC123NoEngineStop);
+			TestPCCSections(modData, c, (689, 0, 1), (2066, 1, 2), (2377, 2, 1), (2984, 1, 2), (3871, 2, 1), (3978, 1, 0));
+
+			c = "Group5Eng_CaseF.vdri";
+			result = CheckCycle(c, sumContainer);
+			Assert.AreEqual(220, result.NoADAS, 5);
+			Assert.Less(result.EcoRollNoStop, result.NoADAS);
+			Assert.Less(result.EcoRollEngineStop, result.EcoRollNoStop);
+			Assert.Less(result.PCC12, result.NoADAS);
+			Assert.AreEqual(result.PCC123, result.PCC12);
+			Assert.Less(result.PCC123NoEngineStop, result.PCC123);
+			Assert.Less(result.PCC123EngineStop, result.PCC123NoEngineStop);
+			TestPCCSections(modData, c, (701, 0, 1), (2066, 1, 2), (2400, 2, 1), (2587, 1, 2), (3283, 2, 0));
+
+			c = "Group5Eng_CaseG.vdri";
+			result = CheckCycle(c, sumContainer);
+			Assert.AreEqual(236, result.NoADAS, 5);
+			Assert.AreEqual(result.EcoRollNoStop, result.NoADAS);
+			Assert.AreEqual(result.EcoRollEngineStop, result.EcoRollNoStop);
+			Assert.Less(result.PCC12, result.NoADAS);
+			Assert.Less(result.PCC123, result.PCC12);
+			Assert.Greater(result.PCC123NoEngineStop, result.PCC123);
+			Assert.Less(result.PCC123EngineStop, result.PCC123);
+			TestPCCSections(modData, c, (3944, 0, 1), (5076, 1, 2), (5899, 2, 1), (6596, 1, 0));
+
+			c = "Group5Eng_CaseH.vdri";
+			result = CheckCycle(c, sumContainer);
+			Assert.AreEqual(204, result.NoADAS, 5);
+			Assert.Greater(result.EcoRollNoStop, result.NoADAS);
+			Assert.Less(result.EcoRollEngineStop, result.EcoRollNoStop);
+			Assert.Less(result.PCC12, result.NoADAS);
+			Assert.AreEqual(result.PCC123, result.PCC12);
+			Assert.Less(result.PCC123NoEngineStop, result.PCC123);
+			Assert.Less(result.PCC123EngineStop, result.PCC123NoEngineStop);
+			TestPCCSections(modData, c, (3804, 0, 1), (4772, 1, 2), (6003, 2, 0));
+
+			c = "Group5Eng_CaseI.vdri";
+			result = CheckCycle(c, sumContainer);
+			Assert.AreEqual(214, result.NoADAS, 5);
+			Assert.AreEqual(result.EcoRollNoStop, result.NoADAS);
+			Assert.AreEqual(result.EcoRollEngineStop, result.EcoRollNoStop);
+			Assert.AreEqual(result.PCC12, result.NoADAS);
+			Assert.AreEqual(result.PCC123, result.PCC12);
+			Assert.AreEqual(result.PCC123NoEngineStop, result.PCC123);
+			Assert.AreEqual(result.PCC123EngineStop, result.PCC123NoEngineStop);
+			TestPCCSections(modData, c);
+
+			c = "Group5Eng_CaseJ.vdri";
+			result = CheckCycle(c, sumContainer);
+			Assert.AreEqual(303, result.NoADAS, 5);
+			Assert.AreEqual(result.EcoRollNoStop, result.NoADAS);
+			Assert.AreEqual(result.EcoRollEngineStop, result.EcoRollNoStop);
+			Assert.Less(result.PCC12, result.NoADAS);
+			Assert.Less(result.PCC123, result.PCC12);
+			Assert.Greater(result.PCC123NoEngineStop, result.PCC123);
+			Assert.Less(result.PCC123EngineStop, result.PCC123NoEngineStop);
+			TestPCCSections(modData, c, (3559, 0, 1), (5364, 1, 3), (5692, 3, 1), (6132, 1, 0));
+		}
+
+		private (ConvertedSI NoADAS, ConvertedSI EcoRollNoStop, ConvertedSI EcoRollEngineStop,
+			ConvertedSI PCC12, ConvertedSI PCC123, ConvertedSI PCC123NoEngineStop, ConvertedSI PCC123EngineStop)
+			CheckCycle(string s, SummaryDataContainer summaryDataContainer)
+		{
+
+			var sumResults = summaryDataContainer.Table.Select($@"[Cycle [-\]] = '{s}'", "Input File [-]");
+			Assert.AreEqual(7, sumResults.Length, $"{s}: Not enough result rows in sum file");
+			var values = sumResults.Select(row => row.Field<ConvertedSI>("FC-Final [g/km]")).ToArray();
+			var (EcoRollEngineStop, EcoRollNoStop, NoADAS, PCC12, PCC123, PCC123EngineStop, PCC123NoEngineStop) = values;
+
+			Assert.LessOrEqual(PCC12, NoADAS, $"{s}: Enabling ADAS should always reduce fuel consumption.");
+			Assert.LessOrEqual(PCC123, NoADAS, $"{s}: Enabling ADAS should always reduce fuel consumption.");
+
+			Assert.LessOrEqual(PCC123EngineStop, PCC123NoEngineStop, $"{s}: with engine stop should always consume less then without engine stop");
+			Assert.LessOrEqual(EcoRollEngineStop, EcoRollNoStop, $"{s}: with engine stop should always consume less then without engine stop");
+
+			Assert.LessOrEqual(PCC123NoEngineStop, EcoRollNoStop, $"{s}: PCC EcoRoll should always be lower as EcoRoll.");
+			Assert.LessOrEqual(PCC123EngineStop, EcoRollEngineStop, $"{s}: PCC EcoRoll should always be lower as EcoRoll.");
+
+			Assert.LessOrEqual(PCC123, PCC12, $"{s}: better pcc options should consume less");
+
+			return (NoADAS, EcoRollNoStop, EcoRollEngineStop, PCC12, PCC123, PCC123NoEngineStop, PCC123EngineStop);
+		}
+
+		private void TestPCCSections(ConcurrentDictionary<(string, string), ModalResults> modData, string c,
+			params (double Distance, int Before, int After)[] expectedSections)
+		{
+			var m = modData[(Group5PCC123, c.Slice(0, -5))];
+			var pccStates = m.SelectData(x => Convert.ToInt32(x["PCCState"]));
+			var distances = m.SelectData(x => x.Field<Meter>(ModalResultField.dist.GetName()).Value());
+			var sections = GetDistancesOfStateChanges(pccStates, distances);
+			if (expectedSections.Length == 0) {
+				Assert.IsFalse(sections.Any());
+			} else {
+				foreach (var (exp, actual) in expectedSections.Zip(sections)) {
+					Assert.AreEqual(exp.Before, actual.Before, $"Cycle {c}: Expected change from {exp.Before} --> {exp.After} at distance {exp.Distance}");
+					Assert.AreEqual(exp.After, actual.After, $"Cycle {c}: Expected change from {exp.Before} --> {exp.After} at distance {exp.Distance}");
+					Assert.AreEqual(exp.Distance, actual.Distance, 10, $"Cycle {c}: Expected change from {exp.Before} --> {exp.After} at distance {exp.Distance}");
+				}
+			}
+		}
+
+		IEnumerable<(T2 Distance, T1 Before, T1 After)> GetDistancesOfStateChanges<T1, T2>(IEnumerable<T1> states, IEnumerable<T2> locations)
+		{
+			using (var values = states.GetEnumerator()) {
+				using (var locs = locations.GetEnumerator()) {
+					locs.MoveNext();
+					values.MoveNext();
+					var value = values.Current;
+					while (values.MoveNext()) {
+						locs.MoveNext();
+						if (!value.Equals(values.Current)) {
+							yield return (locs.Current, value, values.Current);
+							value = values.Current;
+						}
+					}
+				}
+			}
+		}
+
+
+
 	}
 }
diff --git a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-Conventional/Group5PCCEng/AMT_12.vgbx b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-Conventional/Group5PCCEng/AMT_12.vgbx
index 216c531dec..4c30ebc554 100644
--- a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-Conventional/Group5PCCEng/AMT_12.vgbx
+++ b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-Conventional/Group5PCCEng/AMT_12.vgbx
@@ -1,7 +1,7 @@
-{
+{
   "Header": {
-    "CreatedBy": " ()",
-    "Date": "2016-10-13T08:52:52.1686119Z",
+    "CreatedBy": "",
+    "Date": "2021-08-13T16:05:14.5320631Z",
     "AppVersion": "3",
     "FileVersion": 6
   },
@@ -19,73 +19,85 @@
         "Ratio": 14.93,
         "LossMap": "Gear_1.vtlm",
         "ShiftPolygon": "",
-        "MaxTorque": ""
+        "MaxTorque": "",
+        "MaxSpeed": ""
       },
       {
         "Ratio": 11.64,
         "LossMap": "Gear_2.vtlm",
         "ShiftPolygon": "",
-        "MaxTorque": ""
+        "MaxTorque": "",
+        "MaxSpeed": ""
       },
       {
         "Ratio": 9.02,
         "LossMap": "Gear_3.vtlm",
         "ShiftPolygon": "",
-        "MaxTorque": ""
+        "MaxTorque": "",
+        "MaxSpeed": ""
       },
       {
         "Ratio": 7.04,
         "LossMap": "Gear_4.vtlm",
         "ShiftPolygon": "",
-        "MaxTorque": ""
+        "MaxTorque": "",
+        "MaxSpeed": ""
       },
       {
         "Ratio": 5.64,
         "LossMap": "Gear_5.vtlm",
         "ShiftPolygon": "",
-        "MaxTorque": ""
+        "MaxTorque": "",
+        "MaxSpeed": ""
       },
       {
         "Ratio": 4.4,
         "LossMap": "Gear_6.vtlm",
         "ShiftPolygon": "",
-        "MaxTorque": ""
+        "MaxTorque": "",
+        "MaxSpeed": ""
       },
       {
         "Ratio": 3.39,
         "LossMap": "Gear_7.vtlm",
         "ShiftPolygon": "",
-        "MaxTorque": ""
+        "MaxTorque": "",
+        "MaxSpeed": ""
       },
       {
         "Ratio": 2.65,
         "LossMap": "Gear_8.vtlm",
         "ShiftPolygon": "",
-        "MaxTorque": ""
+        "MaxTorque": "",
+        "MaxSpeed": ""
       },
       {
         "Ratio": 2.05,
         "LossMap": "Gear_9.vtlm",
         "ShiftPolygon": "",
-        "MaxTorque": ""
+        "MaxTorque": "",
+        "MaxSpeed": ""
       },
       {
         "Ratio": 1.6,
         "LossMap": "Gear_10.vtlm",
         "ShiftPolygon": "",
-        "MaxTorque": ""
+        "MaxTorque": "",
+        "MaxSpeed": ""
       },
       {
         "Ratio": 1.28,
         "LossMap": "Gear_11.vtlm",
         "ShiftPolygon": "",
-        "MaxTorque": ""
+        "MaxTorque": "",
+        "MaxSpeed": ""
       },
       {
         "Ratio": 1.0,
         "LossMap": "Gear_12.vtlm",
         "ShiftPolygon": "",
-        "MaxTorque": ""
+        "MaxTorque": "",
+        "MaxSpeed": ""
       }
     ],
     "TqReserve": 20.0,
@@ -97,8 +109,9 @@
     "TorqueConverter": {
       "Enabled": false
     },
-    "DownshiftAferUpshiftDelay": 10.0,
+    "DownshiftAfterUpshiftDelay": 6.0,
     "UpshiftAfterDownshiftDelay": 10.0,
-    "UpshiftMinAcceleration": 0.1
+    "UpshiftMinAcceleration": 0.1,
+    "PowershiftShiftTime": 0.8
   }
 }
\ No newline at end of file
diff --git a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-Conventional/Group5PCCEng/Class5_Tractor_NoADAS.vecto b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-Conventional/Group5PCCEng/Class5_Tractor_NoADAS.vecto
index d3c04df53d..e85737a8f3 100644
--- a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-Conventional/Group5PCCEng/Class5_Tractor_NoADAS.vecto
+++ b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-Conventional/Group5PCCEng/Class5_Tractor_NoADAS.vecto
@@ -1,7 +1,7 @@
 {
   "Header": {
     "CreatedBy": "",
-    "Date": "2021-08-11T15:31:10.9445325Z",
+    "Date": "2021-08-13T16:05:18.7442803Z",
     "AppVersion": "3",
     "FileVersion": 5
   },
diff --git a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-Conventional/Group5PCCEng/Engine_325kW_12.7l.veng b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-Conventional/Group5PCCEng/Engine_325kW_12.7l.veng
index 5e17fea53f..4f83244b76 100644
--- a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-Conventional/Group5PCCEng/Engine_325kW_12.7l.veng
+++ b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-Conventional/Group5PCCEng/Engine_325kW_12.7l.veng
@@ -1,9 +1,9 @@
 {
   "Header": {
-    "CreatedBy": " ()",
-    "Date": "2016-10-13T08:52:20.2515417Z",
+    "CreatedBy": "",
+    "Date": "2021-08-03T08:48:38.4435668Z",
     "AppVersion": "3",
-    "FileVersion": 3
+    "FileVersion": 5
   },
   "Body": {
     "SavedInDeclMode": false,
@@ -11,12 +11,25 @@
     "Displacement": "12740",
     "IdlingSpeed": 600.0,
     "Inertia": 5.1498,
+    "Fuels": [
+      {
+        "WHTC-Urban": 0.0,
+        "WHTC-Rural": 0.0,
+        "WHTC-Motorway": 0.0,
+        "WHTC-Engineering": 1.0,
+        "ColdHotBalancingFactor": 0.0,
+        "CFRegPer": 1.0,
+        "FuelMap": "325kW.vmap",
+        "FuelType": "DieselCI"
+      }
+    ],
+    "RatedPower": 0.0,
+    "RatedSpeed": 0.0,
+    "MaxTorque": 0.0,
     "FullLoadCurve": "325kW.vfld",
-    "FuelMap": "325kW.vmap",
-    "WHTC-Urban": 0.0,
-    "WHTC-Rural": 0.0,
-    "WHTC-Motorway": 0.0,
-    "WHTC-Engineering": 1.0,
-    "ColdHotBalancingFactor": 0.0
+    "WHRType": [
+      "None"
+    ],
+    "WHRCorrectionFactors": {}
   }
 }
\ No newline at end of file
diff --git a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-HEV/Group5PCCEng/AMT_12.vgbx b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-HEV/Group5PCCEng/AMT_12.vgbx
index eb443cc31d..a0eb32abb4 100644
--- a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-HEV/Group5PCCEng/AMT_12.vgbx
+++ b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-HEV/Group5PCCEng/AMT_12.vgbx
@@ -1,7 +1,7 @@
-{
+{
   "Header": {
     "CreatedBy": "",
-    "Date": "2020-08-21T09:25:38.1210499Z",
+    "Date": "2021-08-13T16:04:40.9512521Z",
     "AppVersion": "3",
     "FileVersion": 6
   },
diff --git a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-HEV/Group5PCCEng/Class5_Tractor_PCC12.vveh b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-HEV/Group5PCCEng/Class5_Tractor_PCC12.vveh
index 2166b4fb52..193f9b0549 100644
--- a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-HEV/Group5PCCEng/Class5_Tractor_PCC12.vveh
+++ b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-HEV/Group5PCCEng/Class5_Tractor_PCC12.vveh
@@ -1,7 +1,7 @@
 {
   "Header": {
     "CreatedBy": "",
-    "Date": "2021-08-03T09:13:22.6254913Z",
+    "Date": "2021-08-13T16:01:19.7658682Z",
     "AppVersion": "3",
     "FileVersion": 10
   },
diff --git a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-HEV/Group5PCCEng/Class5_Tractor_PCC123.vveh b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-HEV/Group5PCCEng/Class5_Tractor_PCC123.vveh
index 2379822d9c..19f7e26856 100644
--- a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-HEV/Group5PCCEng/Class5_Tractor_PCC123.vveh
+++ b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-HEV/Group5PCCEng/Class5_Tractor_PCC123.vveh
@@ -1,7 +1,7 @@
 {
   "Header": {
     "CreatedBy": "",
-    "Date": "2021-08-03T08:49:01.8366510Z",
+    "Date": "2021-08-13T16:01:28.5125553Z",
     "AppVersion": "3",
     "FileVersion": 10
   },
-- 
GitLab