diff --git a/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs b/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs index 544668e07dd67eda179ed02d5cefedcf79b4afdf..28a297e64c63cba34b8c491d309523403990788c 100644 --- a/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs +++ b/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs @@ -61,7 +61,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ? 0.SI<NewtonMeter>() : _gearData.LossMap.GetInTorque(inAngularVelocity, torque); - Loss = inTorque * inAngularVelocity - torque * angularVelocity; + var outPower = torque * angularVelocity; + var inPower = inTorque * inAngularVelocity; + Loss = inPower - outPower; var retVal = NextComponent.Request(absTime, dt, inTorque, inAngularVelocity, dryRun); diff --git a/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs b/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs index 8cd6767aa4c52e027ff3da5f779c471525f87ad5..406588131d20e35076c38bf7d76db1bde5624934 100644 --- a/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs +++ b/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs @@ -22,7 +22,6 @@ using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Exceptions; using TUGraz.VectoCore.Models.Connector.Ports; using TUGraz.VectoCore.Models.Connector.Ports.Impl; -using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.DataBus; @@ -316,29 +315,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl throw new VectoException("ComputeFullLoadPower cannot compute for simulation interval length 0."); } - //_currentState.StationaryFullLoadPower = _data.GetFullLoadCurve(gear).FullLoadStationaryPower(rpm); CurrentState.StationaryFullLoadTorque = Data.FullLoadCurve.FullLoadStationaryTorque(angularVelocity); CurrentState.StationaryFullLoadPower = CurrentState.StationaryFullLoadTorque * angularVelocity; var pt1 = Data.FullLoadCurve.PT1(angularVelocity).Value(); -// var dynFullPowerCalculated = (1 / (pt1 + 1)) * -// (_currentState.StationaryFullLoadPower + pt1 * _previousState.EnginePower); - var tStarPrev = pt1 * - Math.Log(1 / (1 - (PreviousState.EnginePower / CurrentState.StationaryFullLoadPower).Value()), Math.E) - .SI<Second>(); + var powerRatio = PreviousState.EnginePower / CurrentState.StationaryFullLoadPower; + var tStarPrev = pt1 * Math.Log(1 / (1 - powerRatio.Value())).SI<Second>(); var tStar = tStarPrev + PreviousState.dt; var dynFullPowerCalculated = CurrentState.StationaryFullLoadPower * (1 - Math.Exp((-tStar / pt1).Value())); - CurrentState.DynamicFullLoadPower = (dynFullPowerCalculated < CurrentState.StationaryFullLoadPower) - ? dynFullPowerCalculated - : CurrentState.StationaryFullLoadPower; - - // new check in vecto 3.x (according to Martin Rexeis) - if (CurrentState.DynamicFullLoadPower < StationaryIdleFullLoadPower) { - CurrentState.DynamicFullLoadPower = StationaryIdleFullLoadPower; - } + CurrentState.DynamicFullLoadPower = VectoMath.Limit(dynFullPowerCalculated, StationaryIdleFullLoadPower, + CurrentState.StationaryFullLoadPower); CurrentState.DynamicFullLoadTorque = CurrentState.DynamicFullLoadPower / angularVelocity; Log.Debug("FullLoad: torque: {0}, power: {1}", CurrentState.DynamicFullLoadTorque, CurrentState.DynamicFullLoadPower); @@ -358,9 +347,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public Watt EnginePower { get; set; } - /// <summary> - /// [rad/s] - /// </summary> public PerSecond EngineSpeed { get; set; } public Watt EnginePowerLoss { get; set; } diff --git a/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs b/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs index c339dcca799acbe48cc788928e51194dad417c78..c78e5d7699bb35bff698cd9c18923a06b2bb0f0b 100644 --- a/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs +++ b/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs @@ -184,9 +184,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl Case<ResponseSuccess>(). Case<ResponseOverload>(). Case<ResponseUnderload>(). - Default(r => { - throw new UnexpectedResponseException("Gearbox.Initialize", r); - }); + Default(r => { throw new UnexpectedResponseException("Gearbox.Initialize", r); }); var fullLoadGearbox = Data.Gears[gear].FullLoadCurve.FullLoadStationaryTorque(inAngularVelocity) * inAngularVelocity; var fullLoadEngine = DataBus.EngineStationaryFullPower(inAngularVelocity); @@ -322,7 +320,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ? outTorque / Data.Gears[Gear].Ratio : Data.Gears[Gear].LossMap.GetInTorque(inEngineSpeed, outTorque); - PowerLoss = inTorque * inEngineSpeed - outTorque * outAngularVelocity; + var inPower = inTorque * inEngineSpeed; + var outPower = outTorque * outAngularVelocity; + + + PowerLoss = inPower - outPower; if (!inEngineSpeed.IsEqual(0)) { PowerLossInertia = Formulas.InertiaPower(inEngineSpeed, PreviousInAngularSpeed, Data.Inertia, dt); @@ -339,7 +341,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ShiftTime = absTime + dt; Strategy.Disengage(absTime, dt, outTorque, outAngularVelocity); Log.Debug("EngineSpeed is below IdleSpeed, Gearbox disengage!"); - return new ResponseEngineSpeedTooLow() { Source = this, GearboxPowerRequest = outTorque * outAngularVelocity }; + return new ResponseEngineSpeedTooLow { + AbsTime = absTime, + Source = this, + GearboxPowerRequest = outTorque * outAngularVelocity + }; } var dryRunResponse = NextComponent.Request(absTime, dt, inTorque, inEngineSpeed, true); dryRunResponse.GearboxPowerRequest = outTorque * outAngularVelocity; diff --git a/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs b/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs index edc7272f11b63d15cbe234853468707095efb192..e1cc41366018900899087fbe967208b8e575bd16 100644 --- a/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs +++ b/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs @@ -92,6 +92,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl // interval exceeded if (RightSample.Current != null && (absTime + dt).IsGreater(RightSample.Current.Time)) { return new ResponseFailTimeInterval { + AbsTime = absTime, Source = this, DeltaT = (absTime + dt) - RightSample.Current.Time }; @@ -103,9 +104,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl // if response successfull update internal AbsTime for DoCommit AbsTime = absTime + dt; }) - .Default(r => { - throw new UnexpectedResponseException("PowertrainDrivingCycle received an unexpected response.", r); - }); + .Default( + r => { throw new UnexpectedResponseException("PowertrainDrivingCycle received an unexpected response.", r); }); return request; }