Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit a4b02e2a authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

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
parent 8f37b841
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment