diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs index ef0db2c6302b7a0768b7c4440b73859e93fee52b..65c640bc2d648d562880e757b3963b2d980b8e76 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs @@ -66,5 +66,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { _ptoController.CommitSimulationStep(null); } + + public Second Duration + { + get + { + if (_ptoController != null) + return _ptoController.Duration; + else { + return 0.SI<Second>(); + } + } + } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs index 17d894ad92f8ac9aa2597eb88830c4b9d4d46a2a..c6799f61d9e8096087c964f3555f6a64ac68712f 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs @@ -1,3 +1,4 @@ +using System.Linq; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; @@ -14,9 +15,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl set { NextComponent = value; } } + public readonly Second Duration; + protected Second IdleStart; - public PTOCycleController(DrivingCycleData cycle) : base(null, cycle) {} + public PTOCycleController(DrivingCycleData cycle) : base(null, cycle) + { + Duration = Data.Entries.Last().Time - Data.Entries.First().Time; + } public IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, bool dryRun = false) @@ -55,7 +61,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (RightSample.Current == null) return null; - return RightSample.Current.Time; + return RightSample.Current.Time - LeftSample.Current.Time; } } } \ No newline at end of file