diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs index 6aee7c21a16c37671deae09f37177ea3c6620f3e..9bc9aa5d2c3ff7e6139d677b55e11fc05fafa1f7 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs @@ -51,6 +51,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl private IIdleController _idleController; protected bool RequestAfterGearshift; + private WattSecond _powershiftLossEnergy; + public bool TorqueConverterLocked { get { return CurrentState.TorqueConverterLocked; } @@ -94,6 +96,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl get { return _strategy.NextGear; } } + #region Overrides of AbstractGearbox<ATGearboxState> + + public override uint Gear { get { return _gear; } protected internal set { _gear = value; + //if (PreviousState.Gear == value) { + // RequestAfterGearshift = false; + //} + } } + + #endregion + public override bool ClutchClosed(Second absTime) { return absTime.IsGreater(DataBus.AbsTime) || @@ -241,13 +253,15 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl private void SetPowershiftLossEnergy(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity) { - if (RequestAfterGearshift) { + if (RequestAfterGearshift /*&& Gear != PreviousState.Gear*/) { LastShift = absTime; Gear = _strategy.Engage(absTime, dt, outTorque, outAngularVelocity); - CurrentState.PowershiftLossEnergy = ComputeShiftLosses(outTorque, outAngularVelocity); + _powershiftLossEnergy = ComputeShiftLosses(outTorque, outAngularVelocity); } else { if (PreviousState.PowershiftLossEnergy != null && PreviousState.PowershiftLossEnergy.IsGreater(0)) { - CurrentState.PowershiftLossEnergy = PreviousState.PowershiftLossEnergy; + _powershiftLossEnergy = PreviousState.PowershiftLossEnergy; + } else { + _powershiftLossEnergy = null; } } } @@ -278,15 +292,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl avgOutAngularVelocity : 0.SI<NewtonMeter>(); inTorque += inertiaTorqueLossOut / effectiveRatio; - - if (CurrentState.PowershiftLossEnergy != null) { + var powershiftLoss = 0.SI<NewtonMeter>(); + var aliquotEnergyLoss = 0.SI<WattSecond>(); + if (_powershiftLossEnergy != null) { var remainingShiftLossLime = ModelData.PowershiftShiftTime - (absTime - LastShift); if (remainingShiftLossLime.IsGreater(0)) { - var aliquotEnergyLoss = CurrentState.PowershiftLossEnergy * VectoMath.Min(1.0, dt / remainingShiftLossLime); - var avgEngineSpeed = (DataBus.EngineSpeed + outAngularVelocity * ModelData.Gears[Gear].Ratio) / 2; - CurrentState.PowershiftLoss = aliquotEnergyLoss / dt / avgEngineSpeed; - inTorque += CurrentState.PowershiftLoss; - CurrentState.PowershiftLossEnergy -= aliquotEnergyLoss; + aliquotEnergyLoss = _powershiftLossEnergy * VectoMath.Min(1.0, dt / remainingShiftLossLime); + var avgEngineSpeed = (DataBus.EngineSpeed + outAngularVelocity * effectiveRatio) / 2; + powershiftLoss = aliquotEnergyLoss / dt / avgEngineSpeed; + inTorque += powershiftLoss; + //inTorque += CurrentState.PowershiftLossEnergy; } } @@ -297,6 +312,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl CurrentState.SetState(inTorque, inAngularVelocity, outTorque, outAngularVelocity); CurrentState.Gear = Gear; CurrentState.TransmissionTorqueLoss = inTorque * effectiveRatio - outTorque; + CurrentState.PowershiftLoss = powershiftLoss; + CurrentState.PowershiftLossEnergy = _powershiftLossEnergy ?? 0.SI<WattSecond>() - aliquotEnergyLoss; TorqueConverter.Locked(CurrentState.InTorque, CurrentState.InAngularVelocity, CurrentState.InTorque, CurrentState.InAngularVelocity); } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs index af37562ee64318c5d5fc620f2447d05ce2195432..fff47730f30f6e5f913791adfac0e4864a1c5f00 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs @@ -347,17 +347,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (DataBus.VehicleSpeed < DataBus.CycleData.LeftSample.VehicleTargetSpeed - 10.KMPHtoMeterPerSecond() && DataBus.DriverAcceleration < 0.SI<MeterPerSquareSecond>()) { var tmpResponseCurr = (ResponseDryRun)_gearbox.Request(absTime, dt, outTorque, outAngularVelocity, true); if (_gearbox.Gear > 1 || _gearbox.Gear == 1 && _gearbox.TorqueConverterLocked) { - var tmpCurr = new NextGearState(); - var tmpDs = new NextGearState(); - tmpCurr.SetState(_nextGear); + var tmpCurr = _nextGear.Clone(); + var tmpGbxState = new NextGearState(absTime, _gearbox); + Downshift(absTime, gear); - tmpDs.SetState(_nextGear); - _gearbox.Gear = _nextGear.Gear; - _gearbox.TorqueConverterLocked = _nextGear.TorqueConverterLocked; + SetGear(_nextGear); var tmpResponseDs = (ResponseDryRun)_gearbox.Request(absTime, dt, outTorque, outAngularVelocity, true); _nextGear.SetState(tmpCurr); - _gearbox.Gear = _nextGear.Gear; - _gearbox.TorqueConverterLocked = _nextGear.TorqueConverterLocked; + SetGear(tmpGbxState); if (tmpResponseDs.DeltaFullLoad < tmpResponseCurr.DeltaFullLoad) { Downshift(absTime, gear); return true; @@ -369,6 +366,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return false; } + private void SetGear(NextGearState gbxState) + { + _gearbox.Gear = gbxState.Gear; + _gearbox.TorqueConverterLocked = gbxState.TorqueConverterLocked; + _gearbox.Disengaged = gbxState.Disengaged; + } + /// <summary> /// Tests if the operating point is below (left of) the down-shift curve. /// </summary> @@ -408,6 +412,21 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public uint Gear; public bool TorqueConverterLocked; + public NextGearState() { } + + private NextGearState(NextGearState nextGearState) + { + AbsTime = nextGearState.AbsTime; + Disengaged = nextGearState.Disengaged; + Gear = nextGearState.Gear; + TorqueConverterLocked = nextGearState.TorqueConverterLocked; + } + + public NextGearState(Second absTime, ATGearbox gearbox) + { + SetState(absTime, gearbox); + } + public void SetState(Second absTime, bool disengaged, uint gear, bool tcLocked) { AbsTime = absTime; @@ -423,6 +442,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl Gear = state.Gear; TorqueConverterLocked = state.TorqueConverterLocked; } + + public void SetState(Second absTime, ATGearbox gearbox) + { + AbsTime = absTime; + Disengaged = gearbox.Disengaged; + Gear = gearbox.Gear; + TorqueConverterLocked = gearbox.TorqueConverterLocked; + } + + public NextGearState Clone() + { + return new NextGearState(this); + } } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs index 1feacbaf805dd0b08821796f2e9e093c7d56e8ae..56463b1622cc7fd700d31371cea1105086c2b35c 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs @@ -52,6 +52,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl /// </summary> [Required, ValidateObject] internal readonly GearboxData ModelData; + protected uint _gear; + protected AbstractGearbox(IVehicleContainer container, VectoRunData runData) : base(container) { ModelData = runData.GearboxData; @@ -76,7 +78,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl /// <summary> /// The current gear. /// </summary> - public uint Gear { get; protected internal set; } + public virtual uint Gear + { + get { return _gear; } + protected internal set { _gear = value; } + } public abstract bool TCLocked { get; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs index 45905396c9e2e1dd27cf2161bc9253f3578a6006..320a6c98de08b789a5bf725ef9908250a784577f 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs @@ -164,10 +164,21 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var avgOutSpeedMin = (PreviousState.OutAngularVelocity + dryOperatingPointMin.OutAngularVelocity) / 2.0; var deltaMin = (outTorque - dryOperatingPointMin.OutTorque) * avgOutSpeedMin; + var inTorqueMin = + (PreviousState.InAngularVelocity * PreviousState.InTorque + + dryOperatingPointMin.InAngularVelocity * dryOperatingPointMin.InTorque) / + (PreviousState.InAngularVelocity + dryOperatingPointMin.InAngularVelocity); + var engRespMin = (ResponseDryRun) + NextComponent.Request(absTime, dt, inTorqueMin, dryOperatingPointMin.InAngularVelocity, true); + + //var tqMin = 2.0 * engineResponse.DeltaDragLoad / (operatingPoint.InAngularVelocity + DataBus.EngineSpeed); + //var operatingPointMin = ModelData.LookupOperatingPointOut( + // outAngularVelocity, operatingPoint.InAngularVelocity, tqMin); + return new ResponseDryRun { Source = this, DeltaFullLoad = 2 * deltaMax, - DeltaDragLoad = 2 * deltaMin, + DeltaDragLoad = 2*deltaMin, TorqueConverterOperatingPoint = dryOperatingPointMax }; }