Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 87bd32e6 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

add property to indicate successful completion of a run

parent 91a53216
No related branches found
No related tags found
No related merge requests found
...@@ -17,5 +17,7 @@ namespace TUGraz.VectoCore.Models.Simulation ...@@ -17,5 +17,7 @@ namespace TUGraz.VectoCore.Models.Simulation
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
IVehicleContainer GetContainer(); IVehicleContainer GetContainer();
bool FinishedWithoutErrors { get; }
} }
} }
\ No newline at end of file
...@@ -36,6 +36,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl ...@@ -36,6 +36,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
ds = r.MaxDistance; ds = r.MaxDistance;
}). }).
Case<ResponseCycleFinished>(r => { Case<ResponseCycleFinished>(r => {
FinishedWithoutErrors = true;
Log.Info("========= Driving Cycle Finished"); Log.Info("========= Driving Cycle Finished");
}). }).
Default(r => { Default(r => {
......
...@@ -23,6 +23,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl ...@@ -23,6 +23,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
//protected IModalDataWriter DataWriter { get; set; } //protected IModalDataWriter DataWriter { get; set; }
protected IVehicleContainer Container { get; set; } protected IVehicleContainer Container { get; set; }
public bool FinishedWithoutErrors { get; protected set; }
protected VectoRun(IVehicleContainer container) protected VectoRun(IVehicleContainer container)
{ {
Container = container; Container = container;
...@@ -50,14 +52,20 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl ...@@ -50,14 +52,20 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
} }
} while (response is ResponseSuccess); } while (response is ResponseSuccess);
} catch (VectoSimulationException vse) { } catch (VectoSimulationException vse) {
Log.Error("SIMULATION RUN ABORTED! ========================");
Log.Error(vse);
Container.FinishSimulation(); Container.FinishSimulation();
throw new VectoSimulationException("{6} - absTime: {0}, distance: {1}, dt: {2}, v: {3}, Gear: {4} | {5}", vse, 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); AbsTime, Container.Distance, dt, Container.VehicleSpeed, Container.Gear, vse.Message, Name);
} catch (VectoException ve) { } catch (VectoException ve) {
Log.Error("SIMULATION RUN ABORTED! ========================");
Log.Error(ve);
Container.FinishSimulation(); Container.FinishSimulation();
throw new VectoSimulationException("{6} - absTime: {0}, distance: {1}, dt: {2}, v: {3}, Gear: {4} | {5}", ve, 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); AbsTime, Container.Distance, dt, Container.VehicleSpeed, Container.Gear, ve.Message, Name);
} catch (Exception e) { } catch (Exception e) {
Log.Error("SIMULATION RUN ABORTED! ========================");
Log.Error(e);
Container.FinishSimulation(); Container.FinishSimulation();
throw new VectoSimulationException("{6} - absTime: {0}, distance: {1}, dt: {2}, v: {3}, Gear: {4} | {5}", e, AbsTime, 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); Container.Distance, dt, Container.VehicleSpeed, Container.Gear, e.Message, Name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment