diff --git a/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs b/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs index 0541f0ecda211ef9db82cfec04b9d6491f368a85..926515746821b4cbb641ed9d67b6a58296d30b0b 100644 --- a/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs +++ b/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs @@ -69,7 +69,9 @@ namespace TUGraz.VectoCommon.InputData public interface IHybridStrategyParameters { - double EquivalenceFactor { get; } + double EquivalenceFactorDischarge { get; } + + double EquivalenceFactorCharge { get; } double MinSoC { get; } diff --git a/VectoCommon/VectoCommon/Models/HybridStrategyResponse.cs b/VectoCommon/VectoCommon/Models/HybridStrategyResponse.cs index 87eef60ba36a32e160abd71297a09ea1b3a94a7a..d1c887d17b554d48cd43b59f567fbbcaa38b3d6b 100644 --- a/VectoCommon/VectoCommon/Models/HybridStrategyResponse.cs +++ b/VectoCommon/VectoCommon/Models/HybridStrategyResponse.cs @@ -41,7 +41,7 @@ namespace TUGraz.VectoCommon.Models { public IResponse Response { get; set; } - public double Score { get { return (FuelCosts + EqualityFactor * (BatCosts + ICEStartPenalty1) * SoCPenalty + ICEStartPenalty2) / GearshiftPenalty; } } + public double Score { get { return (FuelCosts + EquivalenceFactor * (BatCosts + ICEStartPenalty1) * SoCPenalty + ICEStartPenalty2) / GearshiftPenalty; } } public double FuelCosts { get; set; } @@ -49,7 +49,7 @@ namespace TUGraz.VectoCommon.Models { public double SoCPenalty { get; set; } - public double EqualityFactor { get; set; } + public double EquivalenceFactor { get; set; } public double GearshiftPenalty { get; set; } diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONHybridStrategyParameters.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONHybridStrategyParameters.cs index 3474c05f98f78978fbbc166f692bc6d347a8a3d9..bc392525d0efffc165dcf2f87273f749eb0b922e 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONHybridStrategyParameters.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONHybridStrategyParameters.cs @@ -9,11 +9,19 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON public JSONHybridStrategyParameters(JObject json, string filename, bool tolerateMissing) : base(json, filename, tolerateMissing) { } - public double EquivalenceFactor + public double EquivalenceFactorDischarge { get { - return Body.GetEx<double>("EquivalenceFactor"); + return Body["EquivalenceFactor"] == null ? Body.GetEx<double>("EquivalenceFactorDischarge") : + Body.GetEx<double>("EquivalenceFactor"); + } + } + + public double EquivalenceFactorCharge { + get { + return Body["EquivalenceFactor"] == null ? Body.GetEx<double>("EquivalenceFactorCharge") : + Body.GetEx<double>("EquivalenceFactor"); } } diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs index de54aeceddd18826dcdb41445b3c58a7f25ae261..2c381e3af888a8403356327ce5a134af29e3b1a6 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs @@ -699,7 +699,8 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter IEngineeringInputDataProvider inputData) { var retVal = new HybridStrategyParameters() { - EquivalenceFactor = hybridStrategyParameters.EquivalenceFactor, + EquivalenceFactorDischarge = hybridStrategyParameters.EquivalenceFactorDischarge, + EquivalenceFactorCharge = hybridStrategyParameters.EquivalenceFactorCharge, MinSoC = hybridStrategyParameters.MinSoC, MaxSoC = hybridStrategyParameters.MaxSoC, TargetSoC = hybridStrategyParameters.TargetSoC, diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/HybridStrategyParameters.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/HybridStrategyParameters.cs index 7b87dc390749de4ddfcaedfb007446aa0ccd5c2f..5b55c23f29756dbe91359d024ceabed313fc9542 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/HybridStrategyParameters.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/HybridStrategyParameters.cs @@ -3,7 +3,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data { public class HybridStrategyParameters { - public double EquivalenceFactor { get; set; } + public double EquivalenceFactorDischarge { get; set; } + + public double EquivalenceFactorCharge { get; set; } public double MinSoC { get; set; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs index 90acb6fd96fcca5b69fbdbcfc1c7a9641f888d8a..23902397c7ad211cc486f96dc65ac00eabd9e782 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs @@ -76,6 +76,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { retVal.Engine.PowerRequest = outTorque * outAngularVelocity; retVal.Engine.DynamicFullLoadPower = 0.SI<Watt>(); retVal.Engine.DragPower = 0.SI<Watt>(); + retVal.Engine.DragTorque = 0.SI<NewtonMeter>(); retVal.Engine.EngineSpeed = 0.RPMtoRad(); retVal.Engine.AuxiliariesPowerDemand = 0.SI<Watt>(); return retVal; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs index 8df3954edd8503c556c488e3dcba0fd3286dd9ed..4fad2b56ed6e166c80fc2b21fde5340c03f90a94 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs @@ -524,9 +524,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies } } - DryRunSolution = new DryRunSolutionState(DataBus.DriverInfo.DrivingAction, best, eval); + DryRunSolution = new DryRunSolutionState(DataBus.DriverInfo.DrivingAction, best, eval); - if (retVal.ShiftRequired) { + if (retVal.ShiftRequired) { DryRunSolution = null; CurrentState.GearshiftTriggerTstmp = absTime; } @@ -1562,7 +1562,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies tmp.SoCPenalty += extraSoCPenalty; } - tmp.EqualityFactor = StrategyParameters.EquivalenceFactor; + tmp.EquivalenceFactor = resp.ElectricSystem.RESSPowerDemand.IsSmaller(0) + ? StrategyParameters.EquivalenceFactorDischarge + : StrategyParameters.EquivalenceFactorCharge; tmp.GearshiftPenalty = resp.Gearbox.Gear.Engaged && !resp.Gearbox.Gear.Equals(DataBus.GearboxInfo.Gear) ? ModelData.GearshiftParameters.RatingFactorCurrentGear : 1; @@ -1660,7 +1662,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies // $"{x.Response.Engine.TorqueOutDemand}, {x.Response.Engine.TotalTorqueDemand}, {x.Response.Engine.DynamicFullLoadTorque}"; // } // return - // $"{x.U:F2}: {x.Score:F2}; G{x.Gear}; ({x.FuelCosts:F2} + {x.EqualityFactor:F2} * ({x.BatCosts:F2} + {x.ICEStartPenalty1:F2}) * {x.SoCPenalty:F2} + {x.ICEStartPenalty2:F2}) / {x.GearshiftPenalty:F2} = {x.Score:F2} ({foo} ICE: {ice}); {x.IgnoreReason.HumanReadable()}"; + // $"{x.U:F2}: {x.Score:F2}; G{x.Gear}; ({x.FuelCosts:F2} + {x.EquivalenceFactorDischarge:F2} * ({x.BatCosts:F2} + {x.ICEStartPenalty1:F2}) * {x.SoCPenalty:F2} + {x.ICEStartPenalty2:F2}) / {x.GearshiftPenalty:F2} = {x.Score:F2} ({foo} ICE: {ice}); {x.IgnoreReason.HumanReadable()}"; // }) // ) // ); diff --git a/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs b/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs index 7a3eaa8668be4577b34aa09c5df69f97f6c7bcf4..b3c0c8b786de4c27edcbde9e9e9cfd2553c794e6 100644 --- a/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs +++ b/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs @@ -1108,7 +1108,8 @@ public class JSONFileWriter : IOutputFileWriter { var header = GetHeader(HybridStrategyParamsVersion); var body = new Dictionary<string, object>() { - {"EquivalenceFactor", hp.EquivalenceFactor}, + {"EquivalenceFactorDischarge", hp.EquivalenceFactorDischarge}, + {"EquivalenceFactorCharge", hp.EquivalenceFactorCharge}, {"MinSoC", hp.MinSoC * 100}, {"MaxSoC", hp.MaxSoC * 100}, {"TargetSoC", hp.TargetSoC * 100},