From 77853d197efdc99b1df0607f61f0150884806c64 Mon Sep 17 00:00:00 2001 From: Michael Krisper <michael.krisper@tugraz.at> Date: Tue, 30 Aug 2016 12:54:54 +0200 Subject: [PATCH] ICombustionEngineIdleController --> IIdleController --- .../Models/SimulationComponent/IClutch.cs | 2 +- .../SimulationComponent/ICombustionEngine.cs | 2 +- .../Models/SimulationComponent/IGearbox.cs | 5 +---- ...gineIdleController.cs => IIdleController.cs} | 2 +- .../SimulationComponent/Impl/ATGearbox.cs | 4 ++-- .../SimulationComponent/Impl/AbstractGearbox.cs | 1 - .../Models/SimulationComponent/Impl/Clutch.cs | 4 ++-- .../Impl/CombustionEngine.cs | 4 ++-- ...CycleController.cs => PTOCycleController.cs} | 17 +++++++++++++---- .../Impl/PowertrainDrivingCycle.cs | 5 ----- VectoCore/VectoCoreTest/Utils/MockGearbox.cs | 2 -- .../VectoCoreTest/Utils/MockIdleController.cs | 2 +- 12 files changed, 24 insertions(+), 26 deletions(-) rename VectoCore/VectoCore/Models/SimulationComponent/{ICombustionEngineIdleController.cs => IIdleController.cs} (96%) rename VectoCore/VectoCore/Models/SimulationComponent/Impl/{PTOEngineCycleController.cs => PTOCycleController.cs} (77%) diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IClutch.cs b/VectoCore/VectoCore/Models/SimulationComponent/IClutch.cs index 7b38571e55..f30e8929a6 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 d699cf9e9f..6c2a8e2085 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 565684dfa1..6ced4d1422 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 52083e3358..fd039729ed 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 f738992670..57ab3bbc96 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 35dbc628d4..c1428cb8c5 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 3af177aabb..7f3ff392d1 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 aa68b99fe6..c95c7c5d60 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 ef003b4f9b..2ab8e025a1 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 47d2a07dcd..60dd67a49f 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 a604172af5..edebdf3b3b 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 a592aa8d80..513cdf225f 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) { -- GitLab