diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/PTODataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/PTODataAdapter.cs index 5e12fb5e2ce8c903c872ca1b934cc3d4789af163..56a663a2d347e9589399f268bf287014e2845a79 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/PTODataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/PTODataAdapter.cs @@ -37,7 +37,6 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponen return new PTOData { TransmissionPowerDemand = powerDemand, - //TransmissionPowerDemandElectrical = TransmissionType = pto.PTOTransmissionType, LossMap = PTOIdleLossMapReader.GetZeroLossMap(), }; @@ -53,7 +52,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponen { return new PTOData() { - TransmissionType = DeclarationData.PTO.DefaultPTOTechnology, //Consider vehicles with transmission ? + TransmissionType = DeclarationData.PTO.DefaultPTOTechnology, LossMap = PTOIdleLossMapReader.GetZeroLossMap(), PTOCycle = DrivingCycleDataReader.ReadFromStream(RessourceHelper.ReadStream(DeclarationData.PTO.DefaultE_PTOActivationCycle), diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs index 68e8dd780a20c9ffa71ccfbaffeda5e702e97c92..0d7c738aa88c9673cf1babcb135081bb697b6742 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs @@ -782,9 +782,9 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl if (data.PTO?.PTOCycle != null) { - cycle.IdleController = GetPEVIdleController(data.PTO, container); - - elAux.AddAuxiliary(new EPTO()); + var pevPTOController = GetPEVIdleController(data.PTO, container); + cycle.IdleController = pevPTOController; + elAux.AddAuxiliary(new EPTO(pevPTOController)); } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs index d82096ce3b3f1cf8915be005b0080f60d6805199..57f46260cfbe400e584d2e8e47ab448641dc7e21 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs @@ -481,17 +481,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public CycleData CycleData { get { - var cycleData = new CycleData + return new CycleData { AbsTime = CurrentState.AbsTime, AbsDistance = CurrentState.Distance, LeftSample = Left, RightSample = CycleIntervalIterator.RightSample, }; - IdleController?.UpdateCycleEntry(cycleData); - - - return cycleData; } } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/EPTO.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/EPTO.cs index ea7183e9690242097437c43a1a8eac474d2a02fb..72ec7f7ad421eaf14b72e47944ce4b6dc5f40ea8 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/EPTO.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/EPTO.cs @@ -8,17 +8,25 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { public class EPTO : IAuxDemand { + private readonly IPTOCycleController _ptoCycleController; + + public EPTO(IPTOCycleController cycleController) + { + _ptoCycleController = cycleController; + } + #region Implementation of IAuxDemand public Watt PowerDemand(IDataBus dataBus) { if (dataBus.DrivingCycleInfo.PTOActive) { - return dataBus.DrivingCycleInfo.CycleData.LeftSample.PTOElectricalPowerDemand ?? 0.SI<Watt>(); + return _ptoCycleController.CycleData.LeftSample.PTOElectricalPowerDemand ?? 0.SI<Watt>(); } return 0.SI<Watt>(); } + public string AuxID => Constants.Auxiliaries.IDs.PTOConsumer; #endregion diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs index 9ee61b1a52fe2f89ab6c604f0cc43e9514d43161..ed276ae4d0afcbe46c46f80d21f121b54be88e15 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs @@ -111,6 +111,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } } + public Second Duration { get { @@ -121,9 +122,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } } - public void UpdateCycleEntry(CycleData cycleData) + public CycleData CycleData { - //Do nothing + get => throw new NotImplementedException(); } } } \ 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 1a16915cb555d52b92870d6aae34c35e9d13b61f..a6eeec66dfa2950bc638cb0976bf7c946ce86a32 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs @@ -48,8 +48,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl void CommitSimulationStep(Second time, Second simulationInterval, IModalDataContainer container); Second GetNextCycleTime(); Second Duration { get; } - - void UpdateCycleEntry(CycleData entry); + CycleData CycleData { get; } } public class PTOCycleController : PowertrainDrivingCycle, IIdleController @@ -142,6 +141,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl AbsTime = -1.SI<Second>(); } + public CycleData CycleData + { + get => new CycleData() { + LeftSample = _ptoActive ? CycleIterator.LeftSample : new DrivingCycleData.DrivingCycleEntry(), + }; + } + public void CommitSimulationStep(Second time, Second simulationInterval, IModalDataContainer container) { @@ -166,16 +172,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl CycleIterator.Reset(); } - public void UpdateCycleEntry(CycleData cycleData) - { - if (_ptoActive) - { - cycleData.LeftSample.PTOElectricalPowerDemand = CycleIterator.LeftSample.PTOElectricalPowerDemand; - } - } - - - #region Implementation of IIdleControllerSwitcher public void ActivatePTO()