diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IClutch.cs b/VectoCore/VectoCore/Models/SimulationComponent/IClutch.cs index 7b38571e55eb7a9071b54282f76d050565e55855..f30e8929a6fb00c99edb8acec0a680e67c95854c 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IClutch.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IClutch.cs @@ -43,6 +43,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent public interface IClutch : IPowerTrainComponent { //ITnOutPort IdleControlPort { get; } - ICombustionEngineIdleController IdleController { get; set; } + IIdleController IdleController { get; set; } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/ICombustionEngine.cs b/VectoCore/VectoCore/Models/SimulationComponent/ICombustionEngine.cs index d699cf9e9fa0e73f145611b2fe1d354b8476a17b..6c2a8e20857d2d9354441e190fa8fcf2cd4a9a95 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/ICombustionEngine.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/ICombustionEngine.cs @@ -39,6 +39,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent /// </summary> public interface ICombustionEngine : ITnOutProvider, IAuxOutProvider, IEngineInfo { - ICombustionEngineIdleController IdleController { get; } + IIdleController IdleController { get; } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/IGearbox.cs index 565684dfa12ef691c25ff96014aeb6af25acf094..6ced4d14225e6a5853a9a1cf61cc940f84a490f3 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IGearbox.cs @@ -37,8 +37,5 @@ namespace TUGraz.VectoCore.Models.SimulationComponent /// <summary> /// Defines interfaces for a gearbox. /// </summary> - public interface IGearbox : IPowerTrainComponent, IAuxOutProvider, IGearboxInfo - { - PTOEngineCycleController PTOController { get; set; } - } + public interface IGearbox : IPowerTrainComponent, IAuxOutProvider, IGearboxInfo {} } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/ICombustionEngineIdleController.cs b/VectoCore/VectoCore/Models/SimulationComponent/IIdleController.cs similarity index 96% rename from VectoCore/VectoCore/Models/SimulationComponent/ICombustionEngineIdleController.cs rename to VectoCore/VectoCore/Models/SimulationComponent/IIdleController.cs index 52083e33588a5dfe081a27ac8aec30ab86301561..fd039729ed80fb09c0d78ce92664178aea33d173 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/ICombustionEngineIdleController.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IIdleController.cs @@ -33,7 +33,7 @@ using TUGraz.VectoCore.Models.Connector.Ports; namespace TUGraz.VectoCore.Models.SimulationComponent { - public interface ICombustionEngineIdleController : ITnOutPort + public interface IIdleController : ITnOutPort { ITnOutPort RequestPort { set; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs index f738992670925181d5f884a95ecffaa4ffbe40e2..57ab3bbc96f7da698256fafa4390918781f172d0 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs @@ -32,11 +32,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl TorqueConverter = new TorqueConverter(this, Strategy, container, gearboxModelData.TorqueConverterData); } - private ICombustionEngineIdleController _idleController; + private IIdleController _idleController; public bool TorqueConverterLocked { get; protected internal set; } - public ICombustionEngineIdleController IdleController + public IIdleController IdleController { get { return _idleController; } set diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs index 35dbc628d464816a3fbfbcde1c35eedcd19976e1..c1428cb8c5dc9195affba2e82713a6f502bea098 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs @@ -88,7 +88,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl #endregion public abstract bool ClutchClosed(Second absTime); - public PTOEngineCycleController PTOController { get; set; } } public class GearboxState : SimpleComponentState diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs index 3af177aabb8a955c1aad93a00002986feb9ebddb..7f3ff392d1f25320d426eb1e8094da6f09976f94 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs @@ -50,7 +50,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl private const double ClutchEff = 1; private ClutchState _clutchState = ClutchState.ClutchSlipping; - public ICombustionEngineIdleController IdleController + public IIdleController IdleController { get { return _idleController; } set @@ -61,7 +61,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } private readonly SI _clutchSpeedSlippingFactor; - private ICombustionEngineIdleController _idleController; + private IIdleController _idleController; protected Clutch(IVehicleContainer container) : base(container) {} diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs index aa68b99fe679bd638aa8b6e2f9acff0daa427523..c95c7c5d60072edc04f4c3d0e2103d6202125d21 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs @@ -128,7 +128,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl get { return ModelData.FullLoadCurve.N95hSpeed; } } - public ICombustionEngineIdleController IdleController + public IIdleController IdleController { get { return EngineIdleController ?? (EngineIdleController = new CombustionEngineIdleController(this)); } } @@ -481,7 +481,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl // ReSharper disable once InconsistentNaming } - protected class CombustionEngineIdleController : LoggingObject, ICombustionEngineIdleController + protected class CombustionEngineIdleController : LoggingObject, IIdleController { protected readonly double PeDropSlope = -0.75; protected readonly double PeDropOffset = 1.0; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOEngineCycleController.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs similarity index 77% rename from VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOEngineCycleController.cs rename to VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs index ef003b4f9bbbbc3261072bd4b4aae8df7f36cabb..2ab8e025a11b8d8ba18e9ce1e862471fe2dcb308 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOEngineCycleController.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs @@ -8,12 +8,16 @@ using TUGraz.VectoCore.Models.SimulationComponent.Data; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - public class PTOEngineCycleController : PowertrainDrivingCycle, ICombustionEngineIdleController + public class PTOCycleController : PowertrainDrivingCycle, IIdleController { - public ITnOutPort RequestPort { get; set; } + public ITnOutPort RequestPort + { + set { NextComponent = value; } + } + protected Second IdleStart; - public PTOEngineCycleController(IVehicleContainer container, DrivingCycleData cycle) + public PTOCycleController(IVehicleContainer container, DrivingCycleData cycle) : base(container, cycle) {} public IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, @@ -28,7 +32,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (IdleStart == null) { IdleStart = absTime; } - return base.Request(absTime, dt); + return base.Request(absTime - IdleStart, dt); } public IResponse Initialize(NewtonMeter outTorque, PerSecond outAngularVelocity) @@ -47,5 +51,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl IdleStart = null; } + + public Second GetNextCycleTime() + { + return IdleStart + RightSample.Current.Time; + } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs index 47d2a07dcd19bd4c7e0eda0ca6cc3d29506b9aa4..60dd67a49fb885c2654ed684b760e36154039097 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs @@ -77,11 +77,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl AbsTime = 0.SI<Second>(); } - protected PowertrainDrivingCycle(IVehicleContainer container) : base(container) - { - AbsTime = 0.SI<Second>(); - } - #region ISimulationOutPort public IResponse Request(Second absTime, Meter ds) diff --git a/VectoCore/VectoCoreTest/Utils/MockGearbox.cs b/VectoCore/VectoCoreTest/Utils/MockGearbox.cs index a604172af56eb9938fd672f92039e991261e91d8..edebdf3b3b5ced57d9fce7c981bb44c84d6bf025 100644 --- a/VectoCore/VectoCoreTest/Utils/MockGearbox.cs +++ b/VectoCore/VectoCoreTest/Utils/MockGearbox.cs @@ -122,7 +122,5 @@ namespace TUGraz.VectoCore.Tests.Utils { throw new NotImplementedException(); } - - public PTOEngineCycleController PTOController { get; set; } } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Utils/MockIdleController.cs b/VectoCore/VectoCoreTest/Utils/MockIdleController.cs index a592aa8d80f332233fb4f562cc57cc6bcfa38efe..513cdf225fe5be8984e716c77f9a2283759a8136 100644 --- a/VectoCore/VectoCoreTest/Utils/MockIdleController.cs +++ b/VectoCore/VectoCoreTest/Utils/MockIdleController.cs @@ -37,7 +37,7 @@ using TUGraz.VectoCore.Models.SimulationComponent; namespace TUGraz.VectoCore.Tests.Utils { - public class MockIdleController : ICombustionEngineIdleController + public class MockIdleController : IIdleController { public IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, bool dryRun = false) {