Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 49759140 authored by Michael KRISPER's avatar Michael KRISPER
Browse files

added starting time for time based cycles, added missing last line in mod file

parent 1eeab286
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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);
......
......@@ -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();
}
......
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