From a4b02e2a3194e8e0318d9287855680a75cf2867c Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Wed, 12 Aug 2020 09:12:06 +0200 Subject: [PATCH] ignore solutions with invalid engine speed if battery gets empty, only evaluate additional solution if available power from battery is lower than max EM power --- .../Models/SimulationComponent/Strategies/HybridStrategy.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs index 271fc41295..e3c3a3e82c 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs @@ -389,7 +389,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies List<HybridResultEntry> eval, Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, bool dryRun, uint currentGear) { - var best = eval.Where(x => !double.IsNaN(x.Score)).OrderBy(x => x.Score).FirstOrDefault(); + var best = eval.Where(x => !double.IsNaN(x.Score) && (x.IgnoreReason & HybridConfigurationIgnoreReason.EngineSpeedTooHigh) == 0).OrderBy(x => x.Score).FirstOrDefault(); if (best == null) { best = eval.OrderBy(x => Math.Abs((int)currentGear - x.Gear)).FirstOrDefault( x => !(!x.ICEOff && x.IgnoreReason.InvalidEngineSpeed() && !(x.IgnoreReason.BatteryDemandExceeded()))); @@ -663,7 +663,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies // if battery is getting empty try to set EM-torque to discharge battery to lower SoC boundary var batEnergyAvailable = (DataBus.BatteryInfo.StoredEnergy - BatteryDischargeEnergyThreshold) / dt; var emDrivePower = -(batEnergyAvailable - ModelData.ElectricAuxDemand); - if (maxEmTorque.IsSmaller(0)) { + if (maxEmTorque.IsSmaller(0) && (-emDrivePower).IsGreaterOrEqual(maxEmTorque * firstResponse.ElectricMotor.AngularVelocity)) { + // maxEmTorque < 0 ==> EM can still propell + // (-emDrivePower).IsGreaterOrEqual(maxEmTorque * firstResponse.ElectricMotor.AngularVelocity) ==> power available from battery for driving does not exceed max EM power (otherwise torque lookup may fail) var emDriveTorque = ModelData.ElectricMachinesData.Where(x => x.Item1 == emPos).First().Item2.EfficiencyMap .LookupTorque(emDrivePower, firstResponse.ElectricMotor.AngularVelocity, maxEmTorque); if (emDriveTorque != null) { -- GitLab