diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs index be1f1305a97abc5b48b7820936f8c2e349f808b0..7cb09134fbfb374b70dcaddb147e3cdc632fe96d 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs @@ -208,7 +208,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl // check if provided EM torque (drivetrain) is valid) if ((!avgDtSpeed.IsEqual(DataBus.HybridControllerInfo.ElectricMotorSpeed(Position) / ModelData.RatioADC) || !dt.IsEqual(DataBus.HybridControllerInfo.SimulationInterval))) { - return new ResponseInvalidOperatingPoint(this); + return new ResponseInvalidOperatingPoint(this) { + ElectricMotor = { + MaxDriveTorque = maxDriveTorqueDt, + MaxRecuperationTorque = maxRecuperationTorqueDt, + AngularVelocity = avgDtSpeed, // avgemspeed?? + AvgDrivetrainSpeed = avgDtSpeed, + PowerRequest = outTorque * avgDtSpeed, + DeRatingActive = DeRatingActive, + } + }; } throw new VectoException( "Invalid operating point provided by strategy! EM Torque: {0}, max Drive Torque: {1}, min Recup Torque: {2}", @@ -227,7 +236,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl MaxRecuperationTorque = maxRecuperationTorqueDt, AngularVelocity = avgDtSpeed, // avgemspeed?? AvgDrivetrainSpeed = avgDtSpeed, - PowerRequest = outTorque * avgDtSpeed + PowerRequest = outTorque * avgDtSpeed, + DeRatingActive = DeRatingActive } }; } @@ -288,7 +298,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl //} if (NextComponent != null && !dryRun && !DataBus.IsTestPowertrain && !emOff && !(electricSupplyResponse is ElectricSystemResponseSuccess)) { if ( !avgEmSpeed.IsEqual(DataBus.HybridControllerInfo.ElectricMotorSpeed(Position) / ModelData.RatioADC)) { - return new ResponseInvalidOperatingPoint(this); + return new ResponseInvalidOperatingPoint(this) { + ElectricMotor = { + MaxDriveTorque = maxDriveTorqueDt, + MaxRecuperationTorque = maxRecuperationTorqueDt, + AngularVelocity = avgDtSpeed, // avgemspeed?? + AvgDrivetrainSpeed = avgDtSpeed, + PowerRequest = outTorque * avgDtSpeed, + DeRatingActive = DeRatingActive, + } + }; } throw new VectoException( "Invalid operating point provided by strategy! EM Torque: {0}, req. electric Power: {1}, battery demand motor: {3}, max Power from Battery: {2}", diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs index b27574109a453b6237a21d7edf005e3ae861c308..5b55095322e3d1e5f5d80df5d5945e98e22eae1e 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs @@ -55,7 +55,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies TestPowertrain.Gearbox.Disengaged = !useNextGear.Engaged; TestPowertrain.Gearbox.DisengageGearbox = !useNextGear.Engaged; TestPowertrain.Gearbox._nextGear = Controller.ShiftStrategy.NextGear; - TestPowertrain.Container.VehiclePort.Initialize(DataBus.VehicleInfo.VehicleSpeed, DataBus.DrivingCycleInfo.RoadGradient ?? 0.SI<Radian>()); + //if (DataBus.GearboxInfo.GearboxType != GearboxType.APTN) { + TestPowertrain.Container.VehiclePort.Initialize(DataBus.VehicleInfo.VehicleSpeed, + DataBus.DrivingCycleInfo.RoadGradient ?? 0.SI<Radian>()); + //} + TestPowertrain.HybridController.ApplyStrategySettings(cfg); @@ -79,7 +83,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies } } - TestPowertrain.HybridController.Initialize(Controller.PreviousState.OutTorque, Controller.PreviousState.OutAngularVelocity); + //if (DataBus.GearboxInfo.GearboxType != GearboxType.APTN) { + TestPowertrain.HybridController.Initialize(Controller.PreviousState.OutTorque, + Controller.PreviousState.OutAngularVelocity); + //} if (!PreviousState.GearboxEngaged || (useNextGear.Engaged && useNextGear.Equals(DataBus.GearboxInfo.Gear)) || !nextGear.Engaged) { TestPowertrain.CombustionEngine.UpdateFrom(DataBus.EngineInfo); @@ -1536,7 +1543,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies DataBus.GearboxInfo.GearEngaged(absTime) && (eval.First().Response?.Gearbox.Gear.Engaged ?? true); if (DataBus.DriverInfo.DrivingAction == DrivingAction.Accelerate && emEngaged) { //var filtered = eval.Where(x => !x.IgnoreReason.InvalidEngineSpeed()).ToArray(); - var filtered = eval.Where(x => !x.IgnoreReason.EngineSpeedTooLow() && !x.IgnoreReason.EngineSpeedTooHigh()).ToArray(); + var batOK = eval.Where(x => !x.IgnoreReason.BatteryDemandExceeded()).ToArray(); + if (!batOK.Any()) { + batOK = eval.ToArray(); + } + var filtered = batOK.Where(x => !x.IgnoreReason.EngineSpeedTooLow() && !x.IgnoreReason.EngineSpeedTooHigh()).ToArray(); if (filtered.Length == 0) { filtered = eval.Where(x => !x.IgnoreReason.EngineSpeedTooLow() && !x.IgnoreReason.EngineSpeedTooHigh()).ToArray(); }