diff --git a/VectoCore/Models/Simulation/Impl/TimeRun.cs b/VectoCore/Models/Simulation/Impl/TimeRun.cs index 01cd44bbabd5826415debdb8dee60cc013ec15ef..e7ccfcad9155aa8df3137ef28fe42735caf5440a 100644 --- a/VectoCore/Models/Simulation/Impl/TimeRun.cs +++ b/VectoCore/Models/Simulation/Impl/TimeRun.cs @@ -35,7 +35,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl response.Switch(). Case<ResponseSuccess>(). Case<ResponseFailTimeInterval>(r => { - dt = r.SimulationInterval; + dt = r.DeltaT; }). Case<ResponseCycleFinished>(r => { FinishedWithoutErrors = true; diff --git a/VectoCore/Models/Simulation/Impl/VectoRun.cs b/VectoCore/Models/Simulation/Impl/VectoRun.cs index 33a149b988207fbefa68bcd74a10056d66a84d87..154e3a826515dc8a8d694824bce0d9f33331720c 100644 --- a/VectoCore/Models/Simulation/Impl/VectoRun.cs +++ b/VectoCore/Models/Simulation/Impl/VectoRun.cs @@ -103,14 +103,16 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl Container.RunStatus = Status.Aborted; 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, RunIdentifier); + AbsTime, Container.Distance, dt, Container.VehicleSpeed, TryCatch<VectoException>(() => Container.Gear), + vse.Message, RunIdentifier); } catch (VectoException ve) { Log.Error("SIMULATION RUN ABORTED! ========================"); Log.Error(ve); Container.RunStatus = Status.Aborted; 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, RunIdentifier); + AbsTime, Container.Distance, dt, Container.VehicleSpeed, TryCatch<VectoException>(() => Container.Gear), ve.Message, + RunIdentifier); } catch (Exception e) { Log.Error("SIMULATION RUN ABORTED! ========================"); Log.Error(e); diff --git a/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs b/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs index d18281dd9890c2eea04fb3081c6c8b6d992f28cc..d98a316856fa77a1be32d9d2b3d10575f91e3c40 100644 --- a/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs +++ b/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs @@ -84,12 +84,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl IResponse ISimulationOutPort.Request(Second absTime, Second dt) { // cycle finished (no more entries in cycle) - if (RightSample.Current == null) { + if (LeftSample.Current == null) { return new ResponseCycleFinished { Source = this }; } // interval exceeded - if ((absTime + dt).IsGreater(RightSample.Current.Time)) { + if (RightSample.Current != null && (absTime + dt).IsGreater(RightSample.Current.Time)) { return new ResponseFailTimeInterval { Source = this, DeltaT = (absTime + dt) - RightSample.Current.Time @@ -146,7 +146,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected override void DoCommitSimulationStep() { - if (AbsTime.IsGreater(RightSample.Current.Time)) { + if ((RightSample.Current == null) || AbsTime.IsGreaterOrEqual(RightSample.Current.Time)) { RightSample.MoveNext(); LeftSample.MoveNext(); }