diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/AuxiliaryDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/AuxiliaryDataAdapter.cs index b501b01430e9fe6115974a93a679c5bbb5cd5ec1..01a86deb2b9e9410f9794a35670775b5a40891f8 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/AuxiliaryDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/AuxiliaryDataAdapter.cs @@ -233,10 +233,10 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponen throw new VectoException("Should not be created for conventional vehicles"); case VectoSimulationJobType.BatteryElectricVehicle: case VectoSimulationJobType.SerialHybridVehicle: - aux.PowerDemandDataBusFunc = powerDemandFunc; + aux.PowerDemandElectricDataBusFunc = powerDemandFunc; break; case VectoSimulationJobType.ParallelHybridVehicle: - aux.PowerDemandDataBusFunc = parallelHybridPowerDemand; + aux.PowerDemandElectricDataBusFunc = parallelHybridPowerDemand; break; case VectoSimulationJobType.EngineOnlySimulation: case VectoSimulationJobType.IEPC_E: @@ -348,7 +348,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponen { var spElectric = new VectoRunData.AuxData { - DemandType = AuxiliaryDemandType.Constant, + DemandType = AuxiliaryDemandType.Dynamic, Technology = auxData.Technology.Where(tech => DeclarationData.SteeringPump.IsFullyElectric(tech)) .ToList(), IsFullyElectric = true, @@ -356,6 +356,14 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponen ID = Constants.Auxiliaries.IDs.SteeringPump_el, PowerDemandElectric = powerDemand.electricPumps * alternatorEfficiency, PowerDemandMech = powerDemand.electricPumps, + + PowerDemandElectricDataBusFunc = (db) => { + if (db.VehicleInfo.VehicleStopped) { + return 0.SI<Watt>(); + } else { + return powerDemand.electricPumps; + } + }, MissionType = mission, }; diff --git a/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs b/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs index 7a57e9e9b8af21bee60732686fc382b3ee23de11..3928f2ba0ff4aeebe5992029abe0a7264004bd0e 100644 --- a/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs +++ b/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs @@ -190,7 +190,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Data [JsonIgnore] public Func<DrivingCycleData.DrivingCycleEntry, Watt> PowerDemandMechCycleFunc; - [JsonIgnore] public Func<IDataBus, Watt> PowerDemandDataBusFunc; + [JsonIgnore] public Func<IDataBus, Watt> PowerDemandElectricDataBusFunc; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs b/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs index 6235dba0574c2bc0c17b1e4bb2301d228be7acad..1b308554adfd582f86f249cc9a6bb6ac667d7331 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs @@ -46,18 +46,26 @@ namespace TUGraz.VectoCore.Models.SimulationComponent var electricConsumersPower = _electricConsumers.Sum(aux => aux.PowerDemand(absTime, dt, dryRun)).DefaultIfNull(0); + var powerDemand = PreviousState.ConsumedEnergy / dt * efficiency + electricConsumersPower / Efficiency; + + + if (!dryRun) { CurrentState.ElectricAuxPower = electricConsumersPower; } - - if ((PreviousState.ConsumedEnergy * efficiency).IsBetween(chargeEnergy, dischargeEnergy)) { - return (PreviousState.ConsumedEnergy / dt * efficiency) + electricConsumersPower; + if (powerDemand.IsBetween(chargeEnergy, dischargeEnergy)) + { + return powerDemand; } + //if ((PreviousState.ConsumedEnergy * efficiency).IsBetween(chargeEnergy, dischargeEnergy)) { + // return (PreviousState.ConsumedEnergy / dt * efficiency) + electricConsumersPower / Efficiency; + //} + // write in mod-file for post-processing correction if (!dryRun) { - CurrentState.MissingEnergy = PreviousState.ConsumedEnergy + electricConsumersPower * dt; + CurrentState.MissingEnergy = powerDemand * dt; } return 0.SI<Watt>(); @@ -72,11 +80,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent protected override void DoWriteModalResults(Second time, Second simulationInterval, IModalDataContainer container) { if (CurrentState.MissingEnergy.IsEqual(0)) { + var consumedEnergy = + (PreviousState.ConsumedEnergy / simulationInterval) + CurrentState.ElectricAuxPower; container[ModalResultField.P_DCDC_In] = - PreviousState.ConsumedEnergy / simulationInterval / Efficiency; + consumedEnergy / Efficiency; container[ModalResultField.P_DCDC_Out] = - PreviousState.ConsumedEnergy / simulationInterval; + consumedEnergy; } else { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricAuxiliaries.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricAuxiliaries.cs index ad9ce93cf4b5b43fd8b803b34efea2ca1b702903..52b5d7285487afb7bdca9ac28d784237ee146835 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricAuxiliaries.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricAuxiliaries.cs @@ -73,7 +73,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (aux.DemandType == AuxiliaryDemandType.Constant) { powerDemand = aux.PowerDemandElectric; } else if(aux.DemandType == AuxiliaryDemandType.Dynamic) { - powerDemand = aux.PowerDemandDataBusFunc(DataBus); + powerDemand = aux.PowerDemandElectricDataBusFunc(DataBus); }