From 87bd32e6609aed41f53bd66f3db36efa2d8571eb Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Tue, 27 Oct 2015 08:50:10 +0100
Subject: [PATCH] add property to indicate successful completion of a run

---
 VectoCore/Models/Simulation/IVectoRun.cs        | 2 ++
 VectoCore/Models/Simulation/Impl/DistanceRun.cs | 1 +
 VectoCore/Models/Simulation/Impl/VectoRun.cs    | 8 ++++++++
 3 files changed, 11 insertions(+)

diff --git a/VectoCore/Models/Simulation/IVectoRun.cs b/VectoCore/Models/Simulation/IVectoRun.cs
index f14714fdbf..eb359549ab 100644
--- a/VectoCore/Models/Simulation/IVectoRun.cs
+++ b/VectoCore/Models/Simulation/IVectoRun.cs
@@ -17,5 +17,7 @@ namespace TUGraz.VectoCore.Models.Simulation
 		/// </summary>
 		/// <returns></returns>
 		IVehicleContainer GetContainer();
+
+		bool FinishedWithoutErrors { get; }
 	}
 }
\ No newline at end of file
diff --git a/VectoCore/Models/Simulation/Impl/DistanceRun.cs b/VectoCore/Models/Simulation/Impl/DistanceRun.cs
index a4b7695ac4..73f33ef975 100644
--- a/VectoCore/Models/Simulation/Impl/DistanceRun.cs
+++ b/VectoCore/Models/Simulation/Impl/DistanceRun.cs
@@ -36,6 +36,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
 						ds = r.MaxDistance;
 					}).
 					Case<ResponseCycleFinished>(r => {
+						FinishedWithoutErrors = true;
 						Log.Info("========= Driving Cycle Finished");
 					}).
 					Default(r => {
diff --git a/VectoCore/Models/Simulation/Impl/VectoRun.cs b/VectoCore/Models/Simulation/Impl/VectoRun.cs
index 29e3d8bf3c..d5e36a81ae 100644
--- a/VectoCore/Models/Simulation/Impl/VectoRun.cs
+++ b/VectoCore/Models/Simulation/Impl/VectoRun.cs
@@ -23,6 +23,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
 		//protected IModalDataWriter DataWriter { get; set; }
 		protected IVehicleContainer Container { get; set; }
 
+		public bool FinishedWithoutErrors { get; protected set; }
+
 		protected VectoRun(IVehicleContainer container)
 		{
 			Container = container;
@@ -50,14 +52,20 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
 					}
 				} while (response is ResponseSuccess);
 			} catch (VectoSimulationException vse) {
+				Log.Error("SIMULATION RUN ABORTED! ========================");
+				Log.Error(vse);
 				Container.FinishSimulation();
 				throw new VectoSimulationException("{6} - absTime: {0}, distance: {1}, dt: {2}, v: {3}, Gear: {4} | {5}", vse,
 					AbsTime, Container.Distance, dt, Container.VehicleSpeed, Container.Gear, vse.Message, Name);
 			} catch (VectoException ve) {
+				Log.Error("SIMULATION RUN ABORTED! ========================");
+				Log.Error(ve);
 				Container.FinishSimulation();
 				throw new VectoSimulationException("{6} - absTime: {0}, distance: {1}, dt: {2}, v: {3}, Gear: {4} | {5}", ve,
 					AbsTime, Container.Distance, dt, Container.VehicleSpeed, Container.Gear, ve.Message, Name);
 			} catch (Exception e) {
+				Log.Error("SIMULATION RUN ABORTED! ========================");
+				Log.Error(e);
 				Container.FinishSimulation();
 				throw new VectoSimulationException("{6} - absTime: {0}, distance: {1}, dt: {2}, v: {3}, Gear: {4} | {5}", e, AbsTime,
 					Container.Distance, dt, Container.VehicleSpeed, Container.Gear, e.Message, Name);
-- 
GitLab